[jboss-user] [JBossWS] - Re: JBoss Hanging on start up during Web Service ServletCont

hopkinst do-not-reply at jboss.com
Wed Dec 19 14:08:51 EST 2007


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();
  |     	}
  |     }

View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4114363#4114363

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4114363



More information about the jboss-user mailing list