1 Reply Latest reply on Apr 17, 2012 9:54 AM by Stephen Coy

    failed to initialize after EJB server rebooted

    Aaron Lim Newbie

      hi guys,

       

      need some help on above mentioned problem.

       

      currently i have my EJB2 client application (deployed as WAR folder) deployed into JBOSS AS 5.1.GA.

       

      the EJB2 service is deployed on a WebLogic 7.x server, and to get the EJB stub, I need to get some kind of authentication ticket and put into InitialContext before I can perform a lookup.

       

      prop.put(InitialContext.PROVIDER_URL, "t3://x.x.x.x:<port>");

      prop.put(InitialContext.INITIAL_CONTEXT_FACTORY, "weblogic.jndi.WLInitialContextFactory");

      prop.put(Context.SECURITY_PRINCIPAL, getSecurityTicket());

      prop.put(Context.SECURITY_CREDENTIALS, "");

       

      this seems working fine, but whenever the WebLogic server is getting rebooted or the security ticket gets expired (1 hour or so due to inactivity), my application seems to have lost the connection and throwing the below exception:

       

      javax.naming.NamingException: Couldn't resolve initial reference: NameService [Root exception is org.omg.CORBA.NO_PERMISSION:   vmcid: 0x0  minor code: 0  completed: No]

          at weblogic.corba.j2ee.naming.Utils.wrapNamingException(Utils.java:83)

          at weblogic.corba.j2ee.naming.ORBHelper.getORBReference(ORBHelper.java:584)

          at weblogic.corba.j2ee.naming.InitialContextFactoryImpl.getInitialContext(InitialContextFactoryImpl.java:85)

          at weblogic.corba.j2ee.naming.InitialContextFactoryImpl.getInitialContext(InitialContextFactoryImpl.java:31)

          at weblogic.jndi.WLInitialContextFactory.getInitialContext(WLInitialContextFactory.java:46)

          at javax.naming.spi.NamingManager.getInitialContext(NamingManager.java:667)

          at javax.naming.InitialContext.getDefaultInitCtx(InitialContext.java:288)

          at javax.naming.InitialContext.init(InitialContext.java:223)

          at javax.naming.InitialContext.<init>(InitialContext.java:197)

          at com.atomicgun.service.TranslatorServicesImpl.getCompositeService(TranslatorServicesImpl.java:148)

          at com.atomicgun.service.TranslatorServicesImpl.getOutstandingBalance(TranslatorServicesImpl.java:258)

          at com.atomicgun.service.endpoint.CompositeServicesEndpoint.getOutstandingBalance(CompositeServicesEndpoint.java:57)

          at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

          at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)

          at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)

          at java.lang.reflect.Method.invoke(Method.java:597)

          at org.springframework.ws.server.endpoint.MethodEndpoint.invoke(MethodEndpoint.java:132)

          at org.springframework.ws.server.endpoint.adapter.MarshallingMethodEndpointAdapter.invokeInternal(MarshallingMethodEndpointAdapter.java:140)

          at org.springframework.ws.server.endpoint.adapter.AbstractMethodEndpointAdapter.invoke(AbstractMethodEndpointAdapter.java:53)

          at org.springframework.ws.server.MessageDispatcher.dispatch(MessageDispatcher.java:231)

          at org.springframework.ws.server.MessageDispatcher.receive(MessageDispatcher.java:172)

          at org.springframework.ws.transport.support.WebServiceMessageReceiverObjectSupport.handleConnection(WebServiceMessageReceiverObjectSupport.java:88)

          at org.springframework.ws.transport.http.WebServiceMessageReceiverHandlerAdapter.handle(WebServiceMessageReceiverHandlerAdapter.java:57)

          at org.springframework.ws.transport.http.MessageDispatcherServlet.doService(MessageDispatcherServlet.java:221)

          at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:669)

          at org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java:585)

          at javax.servlet.http.HttpServlet.service(HttpServlet.java:637)

          at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)

          at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)

          at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)

          at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)

          at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)

          at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)

          at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:235)

          at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)

          at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:190)

          at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:92)

          at org.jboss.web.tomcat.security.SecurityContextEstablishmentValve.process(SecurityContextEstablishmentValve.java:126)

          at org.jboss.web.tomcat.security.SecurityContextEstablishmentValve.invoke(SecurityContextEstablishmentValve.java:70)

          at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)

          at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)

          at org.jboss.web.tomcat.service.jca.CachedConnectionValve.invoke(CachedConnectionValve.java:158)

          at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)

          at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:330)

          at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:829)

          at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:598)

          at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)

          at java.lang.Thread.run(Thread.java:662)

      Caused by: org.omg.CORBA.NO_PERMISSION:   vmcid: 0x0  minor code: 0  completed: No

          at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)

          at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)

          at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)

          at java.lang.reflect.Constructor.newInstance(Constructor.java:513)

          at java.lang.Class.newInstance0(Class.java:355)

          at java.lang.Class.newInstance(Class.java:308)

          at com.sun.corba.se.impl.protocol.giopmsgheaders.MessageBase.getSystemException(MessageBase.java:897)

          at com.sun.corba.se.impl.protocol.giopmsgheaders.ReplyMessage_1_2.getSystemException(ReplyMessage_1_2.java:99)

          at com.sun.corba.se.impl.protocol.CorbaMessageMediatorImpl.getSystemExceptionReply(CorbaMessageMediatorImpl.java:572)

          at com.sun.corba.se.impl.protocol.CorbaClientRequestDispatcherImpl.processResponse(CorbaClientRequestDispatcherImpl.java:471)

          at com.sun.corba.se.impl.protocol.CorbaClientRequestDispatcherImpl.marshalingComplete(CorbaClientRequestDispatcherImpl.java:358)

          at com.sun.corba.se.impl.protocol.CorbaClientDelegateImpl.invoke(CorbaClientDelegateImpl.java:129)

          at com.sun.corba.se.impl.protocol.CorbaClientDelegateImpl.non_existent(CorbaClientDelegateImpl.java:232)

          at com.sun.corba.se.impl.protocol.CorbaClientDelegateImpl.non_existent(CorbaClientDelegateImpl.java:240)

          at com.sun.corba.se.impl.protocol.CorbaClientDelegateImpl.non_existent(CorbaClientDelegateImpl.java:240)

          at org.omg.CORBA.portable.ObjectImpl._non_existent(ObjectImpl.java:137)

          at weblogic.corba.j2ee.naming.ORBHelper.getORBReference(ORBHelper.java:564)

          ... 46 more


      the subsequent call will throw a slightly different exception:

      javax.naming.NamingException: Couldn't connect to the specified host [Root exception is org.omg.CORBA.NO_PERMISSION:   vmcid: 0x0  minor code: 0  completed: No]

          at weblogic.corba.j2ee.naming.Utils.wrapNamingException(Utils.java:83)

          at weblogic.corba.j2ee.naming.ORBHelper.getORBReferenceWithRetry(ORBHelper.java:656)

          at weblogic.corba.j2ee.naming.ORBHelper.getORBReference(ORBHelper.java:594)

          at weblogic.corba.j2ee.naming.InitialContextFactoryImpl.getInitialContext(InitialContextFactoryImpl.java:85)

          at weblogic.corba.j2ee.naming.InitialContextFactoryImpl.getInitialContext(InitialContextFactoryImpl.java:31)

          at weblogic.jndi.WLInitialContextFactory.getInitialContext(WLInitialContextFactory.java:46)

          at javax.naming.spi.NamingManager.getInitialContext(NamingManager.java:667)

          at javax.naming.InitialContext.getDefaultInitCtx(InitialContext.java:288)

          at javax.naming.InitialContext.init(InitialContext.java:223)

          at javax.naming.InitialContext.<init>(InitialContext.java:197)

          at com.atomicgun.service.TranslatorServicesImpl.getCompositeService(TranslatorServicesImpl.java:148)

          at com.atomicgun.service.TranslatorServicesImpl.getOutstandingBalance(TranslatorServicesImpl.java:258)

          at com.atomicgun.service.endpoint.CompositeServicesEndpoint.getOutstandingBalance(CompositeServicesEndpoint.java:57)

          at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

          at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)

          at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)

          at java.lang.reflect.Method.invoke(Method.java:597)

          at org.springframework.ws.server.endpoint.MethodEndpoint.invoke(MethodEndpoint.java:132)

          at org.springframework.ws.server.endpoint.adapter.MarshallingMethodEndpointAdapter.invokeInternal(MarshallingMethodEndpointAdapter.java:140)

          at org.springframework.ws.server.endpoint.adapter.AbstractMethodEndpointAdapter.invoke(AbstractMethodEndpointAdapter.java:53)

          at org.springframework.ws.server.MessageDispatcher.dispatch(MessageDispatcher.java:231)

          at org.springframework.ws.server.MessageDispatcher.receive(MessageDispatcher.java:172)

          at org.springframework.ws.transport.support.WebServiceMessageReceiverObjectSupport.handleConnection(WebServiceMessageReceiverObjectSupport.java:88)

          at org.springframework.ws.transport.http.WebServiceMessageReceiverHandlerAdapter.handle(WebServiceMessageReceiverHandlerAdapter.java:57)

          at org.springframework.ws.transport.http.MessageDispatcherServlet.doService(MessageDispatcherServlet.java:221)

          at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:669)

          at org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java:585)

          at javax.servlet.http.HttpServlet.service(HttpServlet.java:637)

          at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)

          at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)

          at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)

          at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)

          at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)

          at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)

          at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:235)

          at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)

          at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:190)

          at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:92)

          at org.jboss.web.tomcat.security.SecurityContextEstablishmentValve.process(SecurityContextEstablishmentValve.java:126)

          at org.jboss.web.tomcat.security.SecurityContextEstablishmentValve.invoke(SecurityContextEstablishmentValve.java:70)

          at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)

          at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)

          at org.jboss.web.tomcat.service.jca.CachedConnectionValve.invoke(CachedConnectionValve.java:158)

          at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)

          at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:330)

          at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:829)

          at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:598)

          at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)

          at java.lang.Thread.run(Thread.java:662)

      Caused by: org.omg.CORBA.NO_PERMISSION:   vmcid: 0x0  minor code: 0  completed: No

          at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)

          at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)

          at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)

          at java.lang.reflect.Constructor.newInstance(Constructor.java:513)

          at java.lang.Class.newInstance0(Class.java:355)

          at java.lang.Class.newInstance(Class.java:308)

          at com.sun.corba.se.impl.protocol.giopmsgheaders.MessageBase.getSystemException(MessageBase.java:897)

          at com.sun.corba.se.impl.protocol.giopmsgheaders.ReplyMessage_1_2.getSystemException(ReplyMessage_1_2.java:99)

          at com.sun.corba.se.impl.protocol.CorbaMessageMediatorImpl.getSystemExceptionReply(CorbaMessageMediatorImpl.java:572)

          at com.sun.corba.se.impl.protocol.CorbaClientRequestDispatcherImpl.processResponse(CorbaClientRequestDispatcherImpl.java:471)

          at com.sun.corba.se.impl.protocol.CorbaClientRequestDispatcherImpl.marshalingComplete(CorbaClientRequestDispatcherImpl.java:358)

          at com.sun.corba.se.impl.protocol.CorbaClientDelegateImpl.invoke(CorbaClientDelegateImpl.java:129)

          at com.sun.corba.se.impl.protocol.CorbaClientDelegateImpl.non_existent(CorbaClientDelegateImpl.java:232)

          at com.sun.corba.se.impl.protocol.CorbaClientDelegateImpl.non_existent(CorbaClientDelegateImpl.java:240)

          at org.omg.CORBA.portable.ObjectImpl._non_existent(ObjectImpl.java:137)

          at weblogic.corba.j2ee.naming.ORBHelper.getORBReferenceWithRetry(ORBHelper.java:633)

          ... 47 more

       

      the problem will go off if only i restart the JBoss instance but that's not a desired solution. does anyone have encountered such problem? i have no idea why it's trying to refer to NameService (in first error) since i have never have such reference in my code/configuration, and how come the subsequent calls throw a different exception. really clueless on this...

       

       

      Thanks in advance

        • 1. Re: failed to initialize after EJB server rebooted
          Stephen Coy Master

          When ever you're writing code that accesses a remote service, you must be prepared for it to fail. If you're caching the result of the first successful lookup then you need to blow it away and perform the complete JNDI lookup again. You probably need a fresh security ticket as well.

           

          I would setup a single shot retry mechanism (to cover reauthentication) and then throw an exception to the caller if you get other issues, such as the server being down, or someone unplugging your network cable in the server room (it happens).