Difference between server restart and application restart
Hi,
I have deployed an ear application on geronimo server and am facing a strange issue. After starting the server, i deploy the ear and it works perfectly. Its a messaging application with oracle queues integrated with JMS broker using Gbeans and listener classes.
When the server is restarted, the application gets deployed but it is not able to establish connection with the oracle queue which it could do so when the application was deployed for the first time.
The error that i get is -
java.lang.NullPointerException: You have accessed the java:comp jndi context on a thread that has not initialized it
Strangely, when i restart the application from admin console, everything works!
I want to know what is the difference in container's behaviour when server is restarted and when an application is restarted. It will be great if you find a flaw in code written or in case you anticipate one, please do let me know.
Expecting a prompt response...
Following is the piece of code which fails when the server is started again -
i_recvrQueueConn = oracle.jms.AQjmsQueueConnectionFactory.createQueueConnection( i_dbConnection );
i_recvrQueueConn.start();
i_recvrQueueSession = i_recvrQueueConn.createSession(false, Session.AUTO_ACKNOWLEDGE);
In the createSession statement, i get the following error -
java.lang.NullPointerException: You have accessed the java:comp jndi context on a thread that has not initialized it
at org.apache.geronimo.gjndi.JavaCompContextGBean.getContext(JavaCompContextGBean.java:34)
at org.apache.xbean.naming.context.ContextFlyweight.lookup(ContextFlyweight.java:47)
at org.apache.xbean.naming.context.ContextFederation.getFederatedBinding(ContextFederation.java:69)
at org.apache.xbean.naming.context.AbstractFederatedContext.getBinding(AbstractFederatedContext.java:63)
at org.apache.xbean.naming.context.AbstractContext.lookup(AbstractContext.java:139)
at org.apache.xbean.naming.context.AbstractContext.lookup(AbstractContext.java:625)
at org.apache.xbean.naming.context.AbstractContext.lookup(AbstractContext.java:162)
at org.apache.xbean.naming.context.AbstractContext.lookup(AbstractContext.java:611)
at javax.naming.InitialContext.lookup(InitialContext.java:392)
at oracle.jms.EmulatedXAHandler.<init>(EmulatedXAHandler.java:69)
at oracle.jms.AQjmsSession.<init>(AQjmsSession.java:378)
at oracle.jms.AQjmsConnection.createSession(AQjmsConnection.java:1132)
at ltc.vise.hl7.gbean.OracleAQListener.<init>(OracleAQListener.java:101)
at ltc.vise.hl7.gbean.OracleAQProxy.doStart(OracleAQProxy.java:103)
at org.apache.geronimo.gbean.runtime.GBeanInstance.createInstance(GBeanInstance.java:998)
at org.apache.geronimo.gbean.runtime.GBeanInstanceState.attemptFullStart(GBeanInstanceState.java:268)
at org.apache.geronimo.gbean.runtime.GBeanInstanceState.start(GBeanInstanceState.java:102)
at org.apache.geronimo.gbean.runtime.GBeanInstanceState.startRecursive(GBeanInstanceState.java:124)
at org.apache.geronimo.gbean.runtime.GBeanInstance.startRecursive(GBeanInstance.java:555)
at org.apache.geronimo.kernel.basic.BasicKernel.startRecursiveGBean(BasicKernel.java:379)
at org.apache.geronimo.kernel.config.ConfigurationUtil.startConfigurationGBeans(ConfigurationUtil.java:456)
at org.apache.geronimo.kernel.config.KernelConfigurationManager.start(KernelConfigurationManager.java:188)
at org.apache.geronimo.kernel.config.SimpleConfigurationManager.startConfiguration(SimpleConfigurationManager.java:563)
at sun.reflect.GeneratedMethodAccessor21.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.apache.geronimo.gbean.runtime.ReflectionMethodInvoker.invoke(ReflectionMethodInvoker.java:34)
at org.apache.geronimo.gbean.runtime.GBeanOperation.invoke(GBeanOperation.java:124)
at org.apache.geronimo.gbean.runtime.GBeanInstance.invoke(GBeanInstance.java:832)
at org.apache.geronimo.gbean.runtime.RawInvoker.invoke(RawInvoker.java:57)
at org.apache.geronimo.kernel.basic.RawOperationInvoker.invoke(RawOperationInvoker.java:35)
at org.apache.geronimo.kernel.basic.ProxyMethodInterceptor.intercept(ProxyMethodInterceptor.java:96)
at org.apache.geronimo.gbean.GBeanLifecycle$$EnhancerByCGLIB$$36339902.startConfiguration(<generated>)
at org.apache.geronimo.system.main.EmbeddedDaemon.doStartup(EmbeddedDaemon.java:162)
at org.apache.geronimo.system.main.EmbeddedDaemon.execute(EmbeddedDaemon.java:79)
at org.apache.geronimo.kernel.util.MainConfigurationBootstrapper.main(MainConfigurationBootstrapper.java:45)
at org.apache.geronimo.cli.AbstractCLI.executeMain(AbstractCLI.java:67)
at org.apache.geronimo.cli.daemon.DaemonCLI.main(DaemonCLI.java:30)
Thanks,
Chander