I have a class (no http) that listens for messages using JMS. What is the best way to implement this in a web app using the spring framework? If I run my listener as a standalone java application and then run my webapp everything is fine. I tried initializing the listener in a servlet during init but but it hangs my server. The last output from the log shows the c3p0 initilization and then it just hangs and the server never finishes starting up. The jms listener appears to be working , see bottom log excerpt, but I can not make any http requests to the server(tomcat). Thanks in advance.
Scott
init(ServletConfig config) throws ServletException {
super.init(config);
try{
ApplicationContext ctx =
WebApplicationContextUtils.getWebApplicationContex t(this.getServletContext());
if(ctx.containsBean("orderManager")){
log.debug("attempting to initialize Order Service Listener");
listener=new OrderManagerListener((OrderManager)ctx.getBean("or derManager"));
listener.run();
log.debug("Successfully initialized Order Service Listener");
}
else{
log.error("Error initializing Order Service Listener");
}
}
catch(ConfigurationException ce){
log.error("error initializing order service listener :"+ce);
}
Initializing c3p0 pool... com.mchange.v2.c3p0.PoolBackedDataSource@1142196 [ con
nectionPoolDataSource -> com.mchange.v2.c3p0.WrapperConnectionPoolDataSourc e@621
0fb [ acquireIncrement -> 3, autoCommitOnClose -> false, connectionTesterClassNa
me -> com.mchange.v2.c3p0.impl.DefaultConnectionTester, factoryClassLocation ->
null, forceIgnoreUnresolvedTransactions -> false, idleConnectionTestPeriod -> -1
, initialPoolSize -> 3, maxIdleTime -> 0, maxPoolSize -> 15, maxStatements -> 0,
minPoolSize -> 3, nestedDataSource -> com.mchange.v2.c3p0.DriverManagerDataSour
ce@a9255c [ description -> null, driverClass -> oracle.jdbc.OracleDriver, factor
yClassLocation -> null, jdbcUrl -> jdbc:oracle:thin:@//10.8.44.32:1521/GPSD, pro
perties -> {user=aaaL, password=aaa1} ] , propertyCycle -> 300, testConn
ectionOnCheckout -> false ] , factoryClassLocation -> null, numHelperThreads ->
3 ]
this is where the log hangs
27 Jul 2005 15:18:29,640 [DEBUG] AsyncWireDedicatedThread.debug - Thread-1[93920
51]: Arming async wire with trigger com.stc.jms.sockets.ProxyStcms$1@198e8b4
27 Jul 2005 15:18:29,640 [DEBUG] AsyncWireDedicatedThread.debug - Thread-1[93920
51]: Creating JMS AsyncWireDedicatedThread S0C0W1
27 Jul 2005 15:18:29,640 [DEBUG] AsyncWireDedicatedThread.debug - JMS AsyncWireD
edicatedThread S0C0W1[4918203]: JMS AsyncWireDedicatedThread Thread started
27 Jul 2005 15:18:29,640 [DEBUG] AsyncWireDedicatedThread.debug - JMS AsyncWireD
edicatedThread S0C0W1[4918203]: Async wire waiting for bytes to come in


Reply With Quote