Skip to Main Content

Java EE (Java Enterprise Edition) General Discussion

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

servlet.service() for servlet threw exception java.lang.NullPointerExceptio

791392Dec 15 2008 — edited Dec 15 2008
Hi
I am running JBoss 5GA on Windows Vista and JDK 6. I am getting the following error when I run to run the application: The GWTServlet is simply a plain servlet. I am sending in a parameter to the servlet from a jsp.
Any help in resolving the issue is appreciated. Many thanks in advance.
type Exception report

message

description The server encountered an internal error () that prevented it from fulfilling this request.

exception
java.lang.NullPointerException
com.dexcenter.util.JmsProducer.sendMessage(JmsProducer.java:31)
com.dexcenter.jms.GWTProxyServlet.doPost(GWTProxyServlet.java:42)
com.dexcenter.jms.GWTProxyServlet.doGet(GWTProxyServlet.java:32)
javax.servlet.http.HttpServlet.service(HttpServlet.java:690)
javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)

note The full stack trace of the root cause is available in the JBoss Web/2.1.1.GA logs.
---

This is my code:
public class GWTProxyServlet extends HttpServlet {

    private static final String QUEUE_CONNECTION_FACTORY = "ConnectionFactory";
    private static final String DEX_SESSION_QUEUE = "queue/TransmitPreProcessQ";


    public void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        doPost(request, response);
    }

    public void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        System.out.println("in doPost of GWTProxyServlet..");
        String sessionIDHeader = request.getParameter("sessionIDHeader");
        System.out.println("Session ID from index.jsp: "+sessionIDHeader);
        ProcessDTO processDTOPayLoad = new ProcessDTO();
        processDTOPayLoad.setSessionID(sessionIDHeader);
        JmsProducer.takeInSessionId(sessionIDHeader);
        JmsProducer.sendMessage(processDTOPayLoad,QUEUE_CONNECTION_FACTORY, DEX_SESSION_QUEUE);
        
        request.setAttribute("started",true);
        RequestDispatcher dispatcher =  getServletContext().getRequestDispatcher("/index.jsp");
        dispatcher.forward(request, response);
    }
}
index.jsp
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<html>
  <head>
    <title>DexCenter Application</title>
  </head>
  <body>
    <h1>Start the DexCenter Process....</h1>
    <form name="appForm" action="GWTProxyServlet">
    	Your name: <input type="text" name="sessionIDHeader" size="40"><br/>
    	<br/><br/>
    	<input type="submit" value="Post a Message on the Transmit-PreProcess Queue"/>
    </form>
    <br/>
    <c:if test="${started}">
    	The message was sent to the Transmit-PreProcess Queue. Look at the console where you started JBoss. <br/>
    	You should see "Posting Message on the Transmit-PreProcess Queue.." and then a "Completed Posting Message on Transmit-PreProcess Queue" when it's finished.<br/>
    	You could even submit this form several times...<br/> 
    </c:if>
  </body>
</html>
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Jan 12 2009
Added on Dec 15 2008
2 comments
1,034 views