3 Replies Latest reply on Jan 3, 2008 8:23 AM by hopkinst

    JBoss Hanging on start up during Web Service ServletContext

    hopkinst

      On my JBoss 4.2.2 Server I have two web services.

      If I first start my JBoss server without either web service then deploy web service A. Then deploy web service B. The following runs (as intended).

      Web Service B has a ContextInitialized piece that runs when it is deployed. Inside of Web Service B (which has already ingested via wsimport Web Service A prior to packaging as a WAR and deployment on the same server) an instance of web service A is created via service and port. Then a function in web service A is called, passed an object, and properly returns data (in this case a boolean).

      Everything there runs as it is supposed to. The issue is that if I shut the server down and bring it back online with both of the Web Services (A and B) on the server the server will hang when it tries to create the instance of Web Service A inside the Servlet ContextInitialized section.

      During start up web service A deploys properly and I can see its endpoints created. Then web service B deploys and after one println that tells me it is starting it tries to create the service and port for web service A and the server just hangs.

      Does anyone have any idea what I've forgotten to do, or what the reason is that this will fail when the server is started and the web services are already deployed?

        • 1. Re: JBoss Hanging on start up during Web Service ServletCont
          asoldano

           

          "hopkinst" wrote:

          Web Service B has a ContextInitialized piece that runs when it is deployed. Inside of Web Service B (which has already ingested via wsimport Web Service A prior to packaging as a WAR and deployment on the same server) an instance of web service A is created via service and port.

          Could you please post here the source code where you do this so that we can better undestand what might be wrong?


          • 2. Re: JBoss Hanging on start up during Web Service ServletCont
            hopkinst

            Here is the web.xml that contains the listener.

            <?xml version="1.0" encoding="UTF-8"?>
            <web-app version="2.4" xmlns="http://java.sun.com/xml/ns/j2ee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd">
             <display-name>SSDIWeb</display-name>
            
             <listener>
             <listener-class>com.ctc.ssdi.SSDIWebInitialization</listener-class>
             </listener>
            
             <servlet>
             <servlet-name>ASIA</servlet-name>
             <servlet-class>com.ctc.ssdi.asia.ASIA</servlet-class>
             <load-on-startup>1</load-on-startup>
             </servlet>
             <servlet>
             <servlet-name>COMEXIA</servlet-name>
             <servlet-class>com.ctc.ssdi.comexia.COMEXIA</servlet-class>
             <load-on-startup>1</load-on-startup>
             </servlet>
             <servlet>
             <servlet-name>DESSIA</servlet-name>
             <servlet-class>com.ctc.ssdi.dessia.DESSIA</servlet-class>
             <load-on-startup>1</load-on-startup>
             </servlet>
             <servlet-mapping>
             <servlet-name>ASIA</servlet-name>
             <url-pattern>/ASIA</url-pattern>
             </servlet-mapping>
             <servlet-mapping>
             <servlet-name>COMEXIA</servlet-name>
             <url-pattern>/COMEXIA</url-pattern>
             </servlet-mapping>
             <servlet-mapping>
             <servlet-name>DESSIA</servlet-name>
             <url-pattern>/DESSIA</url-pattern>
             </servlet-mapping>
             <session-config>
             <session-timeout>30</session-timeout>
             </session-config>
            </web-app>


            This is the contex tinitialized code that is called from the listener.
            package com.ctc.ssdi;
            
            import javax.servlet.ServletContext;
            import javax.servlet.ServletContextEvent;
            import javax.servlet.ServletContextListener;
            
            import com.ctc.ssdi.asia.ASIA;
            
            /**
             * This is the SSDIWebInitialization that will be called when the WAR is deployed.
             */
            public final class SSDIWebInitialization
            implements ServletContextListener
            {
             public void contextInitialized (ServletContextEvent servletContextEvent)
             {
             ServletContext servletContext = servletContextEvent.getServletContext ();
             try
             {
             System.out.println("Inside of the contextInitialized in ContextListener.");
             ASIA asia = new ASIA();
             asia.RegisterService();
             }
             catch (Exception e)
             {
             servletContext.log ("Couldn't create addressesDB attribute: " + e.getMessage ());
             }
            
             //TODO: Create a waiting state to generate some sample data 1 and 5 minutes after it starts.
             //This may need to be a thread.
             }
            
             public void contextDestroyed (ServletContextEvent servletContextEvent)
             {
             System.out.println("Destroying the context.");
             }
            }


            Here is the registerAgent code that is called in the context initialized section.
            public void RegisterService() {
             System.out.println("Beginning the registration of the ASIA Web Service.");
            
             try{
             System.out.println("In the try block before the connection to the SSDR Registry Web Service.");
            
             com.ctc.ssdi.ssdr.generated.SsdrRegistryService service = new com.ctc.ssdi.ssdr.generated.SsdrRegistryService();
             com.ctc.ssdi.ssdr.generated.SsdrRegistry port = service.getSsdrRegistryPort();
            
             System.out.println("Connected to the SsdrRegistry. Now creating the agentASIA Agent");
            
             // Creating a new instance of the Agent Class for the ASIA Web Service
             Agent agentASIA = new Agent();
             agentASIA.setName("ASIA");
             agentASIA.setCommunity("Fake Plane Alpha");
             agentASIA.setFunction("ELINT");
             agentASIA.setHost("http://127.0.0.1:8080/ssdi-web/ASIA?wsdl");
             agentASIA.setIpAddress("127.0.0.1");
             agentASIA.setLowFreq((float)0);
             agentASIA.setHighFreq((float)1000);
             // Note you need to space before and after the first and last words or the letters are cut off (not sure why)
             agentASIA.setProvidedServices("subscribe,generalSearch");
             System.out.println("[...agentASIA created]");
            
             // Running the subscribe function
             java.lang.Boolean result = port.registerAgent(agentASIA);
             System.out.println("The results of the agent registration are:" + result);
             } catch (Exception ex){
             ex.printStackTrace();
             }
             }


            • 3. Re: JBoss Hanging on start up during Web Service ServletCont
              hopkinst

              Anyone have any ideas?