5 Replies Latest reply on Nov 7, 2002 5:03 PM by 807581

    Null pointer exception when running servlet in S1AS7

    807581
      I have deployed a WAR file on S1AS7 using Apache SOAP 2.3.1 and Xerces 1.4.0. When the client sends a SOAP request to the server, S1AS7 returns a 500 Internal Error with the following trace:

      java.lang.NullPointerException
      at org.apache.catalina.session.StandardSession.setId(StandardSession.java:363)
      at org.apache.catalina.session.ManagerBase.createSession(ManagerBase.java:563)
      at org.apache.catalina.session.StandardManager.createSession(StandardManager.java:335)
      at org.apache.catalina.connector.HttpRequestBase.doGetSession(HttpRequestBase.java:1239)
      at org.apache.catalina.connector.HttpRequestBase.access$000(HttpRequestBase.java:112)
      at org.apache.catalina.connector.HttpRequestBase$PrivilegedGetSession.run(HttpRequestBase.java:127)
      at java.security.AccessController.doPrivileged(Native Method)
      at org.apache.catalina.connector.HttpRequestBase.getSession(HttpRequestBase.java:1193)
      at org.apache.catalina.connector.HttpRequestFacade.getSession(HttpRequestFacade.java:214)
      at org.apache.catalina.connector.HttpRequestFacade.getSession(HttpRequestFacade.java:224)
      at COM.inovie.services.integration.applicationRegistry.server.ApplicationRegistryServlet.doPost(Unknown Source)
      at javax.servlet.http.HttpServlet.service(HttpServlet.java:760)
      at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
      at org.apache.catalina.core.StandardWrapperValve.invokeServletService(StandardWrapperValve.java:720)
      at org.apache.catalina.core.StandardWrapperValve.access$000(StandardWrapperValve.java:118)
      at org.apache.catalina.core.StandardWrapperValve$1.run(StandardWrapperValve.java:278)
      at java.security.AccessController.doPrivileged(Native Method)
      at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:274)
      at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:505)
      at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:212)
      at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:505)
      at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:203)
      at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:505)
      at com.iplanet.ias.web.connector.nsapi.NSAPIProcessor.process(NSAPIProcessor.java:157)
      at com.iplanet.ias.web.WebContainer.service(WebContainer.java:598)

      This same servlet runs fine on S1WS6. Is this a problem with my servlet or with S1AS7? Has anyone experienced a similar problem?

      Thanks for your help.
      --
      David
        • 1. Re: Null pointer exception when running servlet in S1AS7
          807581
          May be your requested uri does not exist, or may be the requested object is not loaded (initialised) by the application server, then put the class in the appserver classpath. Is Apache SOAP deployed properly? If Apache SOAP is working properly, give few more details like what this application does, how the DeploymentDescriptor.xml looks like, etc.
          May be it helps find the problem.
          • 2. Re: Null pointer exception when running servlet in S1AS7
            807581
            Application Background
            ----------------------
            The ApplicationRegistry is a simple web service that manages & persists
            URL contact information for HTTP communication between applications in a
            suite.

            The ApplicationRegistryServlet class extends
            org.apache.soap.http.RPCRouterServlet in order to process extra servlet
            parameters and add some logging. Instead of using Apache SOAP as an
            external service, the ApplicationRegistry encapsulates this
            functionality. The ApplicationRegistry.war file includes soap.jar,
            activation.jar, mail.jar, & xerces.jar.

            The servlet appears to deploy as expected. When I type in the following URL:
            http://host:port/ApplicationRegistry/
            I get back the expected SOAP RPC Router message "Sorry, I don't speak via
            HTTP GET - you have to use HTTP POST to talk to me."

            Due to problems we experienced getting WebLogic to read our
            DeploymentDescriptor.xml file, we are instead programmatically
            registering our deployment descriptor info in the init method of the
            ApplicationRegistryServlet. The code looks like this:

            private static final String[] methodNames = {
            "registerApplication",
            "unregisterApplication",
            "lookupAllApplications",
            "lookupApplicationByGUID",
            "lookupApplicationsByName"
            };
            private static final String URN = "urn:TCApplicationRegistry";
            private static final String FAULT_LISTENER =
            "COM.inovie.services.integration.applicationRegistry.server.FaultListener";
            private static final String PROVIDER_CLASS =
            "COM.inovie.services.integration.applicationRegistry.server.ApplicationRegistryImpl";

            ServletContext context = getServletContext();
            try {
            svcMgr = new ServiceManager(context, null);
            String[] faultListeners = new String[1];
            faultListeners[0] = FAULT_LISTENER;

            DeploymentDescriptor svcdd = new DeploymentDescriptor();
            svcdd.setID(URN);
            svcdd.setMethods (methodNames);
            svcdd.setScope (DeploymentDescriptor.SCOPE_APPLICATION);
            svcdd.setProviderType (DeploymentDescriptor.PROVIDER_JAVA);
            svcdd.setProviderClass (PROVIDER_CLASS);
            svcdd.setIsStatic (false);
            svcdd.setFaultListener(faultListeners);
            TypeMapping[] typeMappingsWorkplace = {
            new TypeMapping(Constants.NS_URI_SOAP_ENC,
            new QName(URN, "ContactInfo"),
            "COM.inovie.services.integration.applicationRegistry.xml.ContactInfo",
            "org.apache.soap.encoding.soapenc.BeanSerializer",
            "org.apache.soap.encoding.soapenc.BeanSerializer"),
            new TypeMapping(Constants.NS_URI_SOAP_ENC,
            new QName(URN, "ChooserInfo"),
            "COM.inovie.services.integration.objectChooser.xml.ChooserInfo",
            "org.apache.soap.encoding.soapenc.BeanSerializer",
            "org.apache.soap.encoding.soapenc.BeanSerializer"),
            // The following mapping was added to support .NET clients,
            // which do not identify the data type for the chooserInfoArray
            // when it is passed from the client in a "registerApplication"
            // call.
            new TypeMapping(Constants.NS_URI_SOAP_ENC,
            new QName("", "chooserInfoArray"),
            null,
            null,
            "org.apache.soap.encoding.soapenc.ArraySerializer"),
            };
            svcdd.setMappings(typeMappingsWorkplace);
            svcMgr.deploy(svcdd);

            // Set the configuration manager to restrict access to the SOAP configuration.
            ApplicationRegistryConfigMgr configManager = new ApplicationRegistryConfigMgr();
            configManager.setContext(context);
            } catch (Exception ex) {
            context.log(CLASS + ", init", ex);
            }

            However, even if I comment out this code I still get the same error, so
            this does not appear to be the cause of the problem.

            Test Update
            -----------

            Normally I should be able to run the Apache SOAP ServiceManagerClient
            with the list parameter to determine whether the descriptor was
            successfully deployed. However, even this scenario gives me the same
            error, so clearly the SOAP server is not able to work properly.

            NOTE: I have removed the call to getSession in the
            ApplicationRegistryServlet since it was unused, so the traceback now
            shows the error being triggered in the RPCRouterServlet doPost method.
            Otherwise it is the same trace:

            java.lang.NullPointerException
            at org.apache.catalina.session.StandardSession.setId(StandardSession.java:363)
            at org.apache.catalina.session.ManagerBase.createSession(ManagerBase.java:563)
            at org.apache.catalina.session.StandardManager.createSession(StandardManager.java:335)
            at org.apache.catalina.connector.HttpRequestBase.doGetSession(HttpRequestBase.java:1239)
            at org.apache.catalina.connector.HttpRequestBase.access$000(HttpRequestBase.java:112)
            at org.apache.catalina.connector.HttpRequestBase$PrivilegedGetSession.run(HttpRequestBase.java:127)
            at java.security.AccessController.doPrivileged(Native Method)
            at org.apache.catalina.connector.HttpRequestBase.getSession(HttpRequestBase.java:1193)
            at org.apache.catalina.connector.HttpRequestFacade.getSession(HttpRequestFacade.java:214)
            at org.apache.catalina.connector.HttpRequestFacade.getSession(HttpRequestFacade.java:224)
            at org.apache.soap.server.http.RPCRouterServlet.doPost(RPCRouterServlet.java:276)
            at COM.inovie.services.integration.applicationRegistry.server.ApplicationRegistryServlet.doPost(Unknown Source)
            at javax.servlet.http.HttpServlet.service(HttpServlet.java:760)
            at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
            at org.apache.catalina.core.StandardWrapperValve.invokeServletService(StandardWrapperValve.java:720)
            at org.apache.catalina.core.StandardWrapperValve.access$000(StandardWrapperValve.java:118)
            at org.apache.catalina.core.StandardWrapperValve$1.run(StandardWrapperValve.java:278)
            at java.security.AccessController.doPrivileged(Native Method)
            at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:274)
            at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:505)
            at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:212)
            at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:505)
            at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:203)
            at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:505)
            at com.iplanet.ias.web.connector.nsapi.NSAPIProcessor.process(NSAPIProcessor.java:157)
            at com.iplanet.ias.web.WebContainer.service(WebContainer.java:598)

            2nd NOTE: I can deploy soap.war from the Apache SOAP 2.3.1 distribution
            successfully in the same S1AS7 environment without a problem and the
            ServiceManagerClient list command runs successfully.

            Does anyone see a reason why the ApplicationRegistry deployment should
            not also run in S1AS7?

            Thanks,
            David Reeg
            • 3. Re: Null pointer exception when running servlet in S1AS7
              807581
              Hi David,

              Which bits of S1AS7 are you running - beta or final/fcs ?

              Thanks,
              Arvind
              • 4. Re: Null pointer exception when running servlet in S1AS7
                807581
                Arvind,

                We are using the final release distribution of S1AS7.

                Thanks,
                David
                • 5. Null pointer exception when running servlet in S1AS7
                  807581
                  Just out of curiousity, I created a barebones ApplicationRegistryServlet that extends RPCRouterServlet just to see if this would work. It gives the same exception when I run the ServiceManagerClient with the list parameter, whereas the RPCRouterServlet works when deployed from soap.war. Below is my barebones servlet:

                  public class ApplicationRegistryServlet extends RPCRouterServlet {

                  public void init() throws ServletException {
                  // Allow RPCRouterServlet to do its initialization.
                  super.init();
                  }

                  public void doPost (HttpServletRequest req, HttpServletResponse res)
                  throws ServletException, IOException {
                  // Pass request on to Apache SOAP.
                  super.doPost(req, res);
                  }
                  }

                  At this point I'm beyond the ApplicationRegistry code and working with just Apache SOAP. I don't see why the SOAP servlet works in S1AS7 when deployed in soap.war and not when deployed from my war file.

                  Thanks again for your help!
                  David Reeg