6 Replies Latest reply on Jul 17, 2003 2:53 PM by Ivan O. Parra

    redeploying ejb.jar is not working for SLSB

    Ivan O. Parra Novice

      I've tested these scenarious with JB3.2.1/Jetty binary release:

      1)Start up JBoss deploying various jars
      2)Using jetty to access session beans
      3)touching session.jars
      - redeployment is fine
      4)removing session.jars
      - undeployment works
      5)attempting something that uses session.jar
      - A) JNDI reference succeeds
      - B) get a "null object name" InstanceNotFoundException on the JMX layer.
      6)redeploy sessions.jar
      -A) JNDI/JMX works fine
      -B)java.lang.NullPointerException
      at org.jboss.ejb.StatelessSessionContainer$ContainerInterceptor.invoke(StatelessSessionContainer.java:613)

      I also try attempted these steps without step 5.(IE. I removed the jar, waited a few seconds, and replaced the jar). I still saw the same error as #6. It seems that redeployment only works if you remove/replace quickly. If you wait, then the EJB container becomes a waste.

      I am not using ears, just the deploy directory.

      Anyone have any ideas? Bug?

      -Ivan

        • 1. Re: redeploying ejb.jar is not working for SLSB
          Ivan O. Parra Novice

          Slight correction
          5)A) JNDI doesn't work. I was cacheing the JNDI Home. If I stop cacheing, then I get an exception during the lookup.

          But even when the cacheing is turned off, I still get the NullPointer Exception on the container.

          -Ivan

          • 2. Re: redeploying ejb.jar is not working for SLSB
            Adrian Brock Master

            Post the server log. That shows it is redeployed.

            Regards,
            Adrian

            • 3. Re: redeploying ejb.jar is not working for SLSB
              Ivan O. Parra Novice

              Thanks Adrian!

              So this is what I did.
              1)deploy our app and confirmed it worked for a particular JSP(that uses SB).
              2)removed session.jar
              3)tried the same JSP
              -got a JNDI Exception, as expected
              4)redeployed session.jar
              5)tried the same JSP, and got this:

              16:11:27,989 INFO [EJBDeployer] Deployed: file:/C:/cygwin/home/Ivan.Parra/cvs/mainbuild/jboss/server/default/deploy/session.jar
              16:11:28,180 INFO [MainDeployer] Deployed package: file:/C:/cygwin/home/Ivan.Parra/cvs/mainbuild/jboss/server/default/deploy/session.jar
              16:11:42,410 ERROR [LogInterceptor] RuntimeException:
              java.lang.NullPointerException
              at org.jboss.ejb.StatelessSessionContainer$ContainerInterceptor.invokeHome(StatelessSessionContainer.java:592)
              at org.jboss.resource.connectionmanager.CachedConnectionInterceptor.invokeHome(CachedConnectionInterceptor.java:206)
              at org.jboss.ejb.plugins.StatelessSessionInstanceInterceptor.invokeHome(StatelessSessionInstanceInterceptor.java:51)
              at org.jboss.ejb.plugins.AbstractTxInterceptor.invokeNext(AbstractTxInterceptor.java:88)
              at org.jboss.ejb.plugins.TxInterceptorCMT.runWithTransactions(TxInterceptorCMT.java:243)
              at org.jboss.ejb.plugins.TxInterceptorCMT.invokeHome(TxInterceptorCMT.java:74)
              at org.jboss.ejb.plugins.SecurityInterceptor.invokeHome(SecurityInterceptor.java:92)
              at org.jboss.ejb.plugins.LogInterceptor.invokeHome(LogInterceptor.java:120)
              at org.jboss.ejb.plugins.ProxyFactoryFinderInterceptor.invokeHome(ProxyFactoryFinderInterceptor.java:93)
              at org.jboss.ejb.StatelessSessionContainer.internalInvokeHome(StatelessSessionContainer.java:310)
              at org.jboss.ejb.Container.invoke(Container.java:694)
              at java.lang.reflect.Method.invoke(Native Method)
              at org.jboss.mx.capability.ReflectedMBeanDispatcher.invoke(ReflectedMBeanDispatcher.java:284)
              at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:549)
              at org.jboss.invocation.local.LocalInvoker.invoke(LocalInvoker.java:101)
              at org.jboss.invocation.InvokerInterceptor.invoke(InvokerInterceptor.java:83)
              at org.jboss.proxy.TransactionInterceptor.invoke(TransactionInterceptor.java:46)
              at org.jboss.proxy.SecurityInterceptor.invoke(SecurityInterceptor.java:45)
              at org.jboss.proxy.ejb.HomeInterceptor.invoke(HomeInterceptor.java:173)
              at org.jboss.proxy.ClientContainer.invoke(ClientContainer.java:85)
              at $Proxy480.create(Unknown Source)
              at java.lang.reflect.Method.invoke(Native Method)
              at com.activereasoning.controller.server.JBossAppServerLocator.createRemoteObject(JBossAppServerLocator.java:59)
              at com.activereasoning.controller.server.AppServerProxy.getPersonOperation(AppServerProxy.java:235)
              at com.activereasoning.controller.server.PeopleAppServerProxy.getAllPersons(PeopleAppServerProxy.java:230)
              at com.activereasoning.controller.actions.ListAllPersonsAction.execute(ListAllPersonsAction.java:53)
              at org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java:480)
              at org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:274)
              at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1420)
              at org.apache.struts.action.ActionServlet.doGet(ActionServlet.java:502)
              at javax.servlet.http.HttpServlet.service(HttpServlet.java:740)
              at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
              at org.mortbay.jetty.servlet.ServletHolder.handle(ServletHolder.java:360)
              at org.mortbay.jetty.servlet.WebApplicationHandler.dispatch(WebApplicationHandler.java:294)
              at org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:558)
              at org.mortbay.http.HttpContext.handle(HttpContext.java:1714)
              at org.mortbay.jetty.servlet.WebApplicationContext.handle(WebApplicationContext.java:507)
              at org.mortbay.http.HttpContext.handle(HttpContext.java:1664)
              at org.mortbay.http.HttpServer.service(HttpServer.java:863)
              at org.jboss.jetty.Jetty.service(Jetty.java:460)
              at org.mortbay.http.HttpConnection.service(HttpConnection.java:775)
              at org.mortbay.http.HttpConnection.handleNext(HttpConnection.java:939)
              at org.mortbay.http.HttpConnection.handle(HttpConnection.java:792)
              at org.mortbay.http.SocketListener.handleConnection(SocketListener.java:201)
              at org.mortbay.util.ThreadedServer.handle(ThreadedServer.java:289)
              at org.mortbay.util.ThreadPool$PoolThread.run(ThreadPool.java:455)
              16:11:42,420 ERROR [STDERR] java.lang.reflect.InvocationTargetException:
              16:11:42,420 ERROR [STDERR] java.rmi.ServerException: RuntimeException; nested exception is:
              java.lang.NullPointerException
              16:11:42,420 ERROR [STDERR] java.lang.NullPointerException
              16:11:42,420 ERROR [STDERR] at org.jboss.ejb.StatelessSessionContainer$ContainerInterceptor.invokeHome(StatelessSessionContainer.java:592)
              16:11:42,420 ERROR [STDERR] at org.jboss.resource.connectionmanager.CachedConnectionInterceptor.invokeHome(CachedConnectionInterceptor.java:206)
              16:11:42,420 ERROR [STDERR] at org.jboss.ejb.plugins.StatelessSessionInstanceInterceptor.invokeHome(StatelessSessionInstanceInterceptor.java:51)
              16:11:42,420 ERROR [STDERR] at org.jboss.ejb.plugins.AbstractTxInterceptor.invokeNext(AbstractTxInterceptor.java:88)
              16:11:42,420 ERROR [STDERR] at org.jboss.ejb.plugins.TxInterceptorCMT.runWithTransactions(TxInterceptorCMT.java:243)
              16:11:42,420 ERROR [STDERR] at org.jboss.ejb.plugins.TxInterceptorCMT.invokeHome(TxInterceptorCMT.java:74)
              16:11:42,420 ERROR [STDERR] at org.jboss.ejb.plugins.SecurityInterceptor.invokeHome(SecurityInterceptor.java:92)
              16:11:42,420 ERROR [STDERR] at org.jboss.ejb.plugins.LogInterceptor.invokeHome(LogInterceptor.java:120)
              16:11:42,420 ERROR [STDERR] at org.jboss.ejb.plugins.ProxyFactoryFinderInterceptor.invokeHome(ProxyFactoryFinderInterceptor.java:93)
              16:11:42,420 ERROR [STDERR] at org.jboss.ejb.StatelessSessionContainer.internalInvokeHome(StatelessSessionContainer.java:310)
              16:11:42,430 ERROR [STDERR] at org.jboss.ejb.Container.invoke(Container.java:694)
              16:11:42,430 ERROR [STDERR] at java.lang.reflect.Method.invoke(Native Method)
              16:11:42,430 ERROR [STDERR] at org.jboss.mx.capability.ReflectedMBeanDispatcher.invoke(ReflectedMBeanDispatcher.java:284)
              16:11:42,430 ERROR [STDERR] at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:549)
              16:11:42,440 ERROR [STDERR] at org.jboss.invocation.local.LocalInvoker.invoke(LocalInvoker.java:101)
              16:11:42,440 ERROR [STDERR] at org.jboss.invocation.InvokerInterceptor.invoke(InvokerInterceptor.java:83)
              16:11:42,440 ERROR [STDERR] at org.jboss.proxy.TransactionInterceptor.invoke(TransactionInterceptor.java:46)
              16:11:42,440 ERROR [STDERR] at org.jboss.proxy.SecurityInterceptor.invoke(SecurityInterceptor.java:45)
              16:11:42,450 ERROR [STDERR] at org.jboss.proxy.ejb.HomeInterceptor.invoke(HomeInterceptor.java:173)
              16:11:42,450 ERROR [STDERR] at org.jboss.proxy.ClientContainer.invoke(ClientContainer.java:85)
              16:11:42,450 ERROR [STDERR] at $Proxy480.create(Unknown Source)
              16:11:42,460 ERROR [STDERR] at java.lang.reflect.Method.invoke(Native Method)
              16:11:42,460 ERROR [STDERR] at com.activereasoning.controller.server.JBossAppServerLocator.createRemoteObject(JBossAppServerLocator.java:59)
              16:11:42,460 ERROR [STDERR] at com.activereasoning.controller.server.AppServerProxy.getPersonOperation(AppServerProxy.java:235)
              16:11:42,460 ERROR [STDERR] at com.activereasoning.controller.server.PeopleAppServerProxy.getAllPersons(PeopleAppServerProxy.java:230)
              16:11:42,460 ERROR [STDERR] at com.activereasoning.controller.actions.ListAllPersonsAction.execute(ListAllPersonsAction.java:53)
              16:11:42,470 ERROR [STDERR] at org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java:480)
              16:11:42,470 ERROR [STDERR] at org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:274)
              16:11:42,470 ERROR [STDERR] at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1420)
              16:11:42,470 ERROR [STDERR] at org.apache.struts.action.ActionServlet.doGet(ActionServlet.java:502)
              16:11:42,480 ERROR [STDERR] at javax.servlet.http.HttpServlet.service(HttpServlet.java:740)
              16:11:42,480 ERROR [STDERR] at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
              16:11:42,480 ERROR [STDERR] at org.mortbay.jetty.servlet.ServletHolder.handle(ServletHolder.java:360)
              16:11:42,490 ERROR [STDERR] at org.mortbay.jetty.servlet.WebApplicationHandler.dispatch(WebApplicationHandler.java:294)
              16:11:42,490 ERROR [STDERR] at org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:558)
              16:11:42,490 ERROR [STDERR] at org.mortbay.http.HttpContext.handle(HttpContext.java:1714)
              16:11:42,500 ERROR [STDERR] at org.mortbay.jetty.servlet.WebApplicationContext.handle(WebApplicationContext.java:507)
              16:11:42,500 ERROR [STDERR] at org.mortbay.http.HttpContext.handle(HttpContext.java:1664)
              16:11:42,500 ERROR [STDERR] at org.mortbay.http.HttpServer.service(HttpServer.java:863)
              16:11:42,500 ERROR [STDERR] at org.jboss.jetty.Jetty.service(Jetty.java:460)
              16:11:42,500 ERROR [STDERR] at org.mortbay.http.HttpConnection.service(HttpConnection.java:775)
              16:11:42,510 ERROR [STDERR] at org.mortbay.http.HttpConnection.handleNext(HttpConnection.java:939)
              16:11:42,510 ERROR [STDERR] at org.mortbay.http.HttpConnection.handle(HttpConnection.java:792)
              16:11:42,510 ERROR [STDERR] at org.mortbay.http.SocketListener.handleConnection(SocketListener.java:201)
              16:11:42,510 ERROR [STDERR] at org.mortbay.util.ThreadedServer.handle(ThreadedServer.java:289)
              16:11:42,510 ERROR [STDERR] at org.mortbay.util.ThreadPool$PoolThread.run(ThreadPool.java:455)
              16:11:42,510 ERROR [STDERR] java.lang.reflect.InvocationTargetException:
              16:11:42,520 ERROR [STDERR] java.rmi.ServerException: RuntimeException; nested exception is:
              java.lang.NullPointerException
              16:11:42,520 ERROR [STDERR] java.lang.NullPointerException
              16:11:42,520 ERROR [STDERR] at org.jboss.ejb.StatelessSessionContainer$ContainerInterceptor.invokeHome(StatelessSessionContainer.java:592)
              16:11:42,520 ERROR [STDERR] at org.jboss.resource.connectionmanager.CachedConnectionInterceptor.invokeHome(CachedConnectionInterceptor.java:206)
              16:11:42,520 ERROR [STDERR] at org.jboss.ejb.plugins.StatelessSessionInstanceInterceptor.invokeHome(StatelessSessionInstanceInterceptor.java:51)
              16:11:42,530 ERROR [STDERR] at org.jboss.ejb.plugins.AbstractTxInterceptor.invokeNext(AbstractTxInterceptor.java:88)
              16:11:42,530 ERROR [STDERR] at org.jboss.ejb.plugins.TxInterceptorCMT.runWithTransactions(TxInterceptorCMT.java:243)
              16:11:42,530 ERROR [STDERR] at org.jboss.ejb.plugins.TxInterceptorCMT.invokeHome(TxInterceptorCMT.java:74)
              16:11:42,530 ERROR [STDERR] at org.jboss.ejb.plugins.SecurityInterceptor.invokeHome(SecurityInterceptor.java:92)
              16:11:42,530 ERROR [STDERR] at org.jboss.ejb.plugins.LogInterceptor.invokeHome(LogInterceptor.java:120)
              16:11:42,530 ERROR [STDERR] at org.jboss.ejb.plugins.ProxyFactoryFinderInterceptor.invokeHome(ProxyFactoryFinderInterceptor.java:93)
              16:11:42,540 ERROR [STDERR] at org.jboss.ejb.StatelessSessionContainer.internalInvokeHome(StatelessSessionContainer.java:310)
              16:11:42,540 ERROR [STDERR] at org.jboss.ejb.Container.invoke(Container.java:694)
              16:11:42,540 ERROR [STDERR] at java.lang.reflect.Method.invoke(Native Method)
              16:11:42,540 ERROR [STDERR] at org.jboss.mx.capability.ReflectedMBeanDispatcher.invoke(ReflectedMBeanDispatcher.java:284)
              16:11:42,540 ERROR [STDERR] at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:549)
              16:11:42,550 ERROR [STDERR] at org.jboss.invocation.local.LocalInvoker.invoke(LocalInvoker.java:101)
              16:11:42,550 ERROR [STDERR] at org.jboss.invocation.InvokerInterceptor.invoke(InvokerInterceptor.java:83)
              16:11:42,550 ERROR [STDERR] at org.jboss.proxy.TransactionInterceptor.invoke(TransactionInterceptor.java:46)
              16:11:42,550 ERROR [STDERR] at org.jboss.proxy.SecurityInterceptor.invoke(SecurityInterceptor.java:45)
              16:11:42,550 ERROR [STDERR] at org.jboss.proxy.ejb.HomeInterceptor.invoke(HomeInterceptor.java:173)
              16:11:42,550 ERROR [STDERR] at org.jboss.proxy.ClientContainer.invoke(ClientContainer.java:85)
              16:11:42,560 ERROR [STDERR] at $Proxy480.create(Unknown Source)
              16:11:42,560 ERROR [STDERR] at java.lang.reflect.Method.invoke(Native Method)
              16:11:42,560 ERROR [STDERR] at com.activereasoning.controller.server.JBossAppServerLocator.createRemoteObject(JBossAppServerLocator.java:59)
              16:11:42,560 ERROR [STDERR] at com.activereasoning.controller.server.AppServerProxy.getPersonOperation(AppServerProxy.java:235)
              16:11:42,560 ERROR [STDERR] at com.activereasoning.controller.server.PeopleAppServerProxy.getAllPersons(PeopleAppServerProxy.java:230)
              16:11:42,570 ERROR [STDERR] at com.activereasoning.controller.actions.ListAllPersonsAction.execute(ListAllPersonsAction.java:53)
              16:11:42,570 ERROR [STDERR] at org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java:480)
              16:11:42,570 ERROR [STDERR] at org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:274)
              16:11:42,570 ERROR [STDERR] at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1420)
              16:11:42,570 ERROR [STDERR] at org.apache.struts.action.ActionServlet.doGet(ActionServlet.java:502)
              16:11:42,570 ERROR [STDERR] at javax.servlet.http.HttpServlet.service(HttpServlet.java:740)
              16:11:42,580 ERROR [STDERR] at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
              16:11:42,580 ERROR [STDERR] at org.mortbay.jetty.servlet.ServletHolder.handle(ServletHolder.java:360)
              16:11:42,580 ERROR [STDERR] at org.mortbay.jetty.servlet.WebApplicationHandler.dispatch(WebApplicationHandler.java:294)
              16:11:42,580 ERROR [STDERR] at org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:558)
              16:11:42,580 ERROR [STDERR] at org.mortbay.http.HttpContext.handle(HttpContext.java:1714)
              16:11:42,590 ERROR [STDERR] at org.mortbay.jetty.servlet.WebApplicationContext.handle(WebApplicationContext.java:507)
              16:11:42,590 ERROR [STDERR] at org.mortbay.http.HttpContext.handle(HttpContext.java:1664)
              16:11:42,590 ERROR [STDERR] at org.mortbay.http.HttpServer.service(HttpServer.java:863)
              16:11:42,590 ERROR [STDERR] at org.jboss.jetty.Jetty.service(Jetty.java:460)
              16:11:42,590 ERROR [STDERR] at org.mortbay.http.HttpConnection.service(HttpConnection.java:775)
              16:11:42,600 ERROR [STDERR] at org.mortbay.http.HttpConnection.handleNext(HttpConnection.java:939)
              16:11:42,600 ERROR [STDERR] at org.mortbay.http.HttpConnection.handle(HttpConnection.java:792)
              16:11:42,600 ERROR [STDERR] at org.mortbay.http.SocketListener.handleConnection(SocketListener.java:201)
              16:11:42,600 ERROR [STDERR] at org.mortbay.util.ThreadedServer.handle(ThreadedServer.java:289)
              16:11:42,600 ERROR [STDERR] at org.mortbay.util.ThreadPool$PoolThread.run(ThreadPool.java:455)

              If you need the entire server.log, let me know(sorta windy).
              Thanks Adrian!

              -Ivan

              • 4. Re: redeploying ejb.jar is not working for SLSB
                Ivan O. Parra Novice

                It seems that this line is returning null:

                Method m = (Method)homeMapping.get(mi.getMethod());

                I threw this into the debugger and noticed that their is a method in homeMapping that has the same Name, but different Clazzes. The equals for Method is:
                Method other = (Method)obj;
                if ((getDeclaringClass() == other.getDeclaringClass())
                && (getName().equals(other.getName()))) {


                Somehow, the Invocation is using a cached Method passed in from the Proxy. I notice that the Home Proxy did not change between deployments. I'm guessing that this is to allow for Home Cacheing.

                When this service startsup, it loads the interfaces from the classloader and reinitializes the homeMapping. Reloading the class makes all subsequent Method.equals be false because any previous proxies to this service have the old interface method. This renders the *mapping useless.


                Would this work? During the setup*Mapping, key from something that is not Class dependent; perhaps Wrapping the Method just to override the equals?

                -Ivan

                • 5. Re: redeploying ejb.jar is not working for SLSB
                  Adrian Brock Master

                  If you are redeploying the ejb (that contains the
                  interface class) you must also redeploy any independent
                  apps that use that class. In this case your jsp
                  is holding onto a reference to the old reference.

                  Alternatively, use the ByValueInvokerInterceptor
                  for your ejb that will do pass by value instead of
                  by reference.

                  Regards,
                  Adrian

                  • 6. Re: redeploying ejb.jar is not working for SLSB
                    Ivan O. Parra Novice

                    That did it. Thanks! If I have any other questions I'll post it.

                    -Ivan