1 2 Previous Next 15 Replies Latest reply on Dec 1, 2003 1:03 PM by jkan

    Broken hot deployment; ClassCastException problems

    wchao

      JBoss 3.0 beta (2002-02-21) seems to be buggy when it comes to hot deployment and redeployment of EARs. Specifically, I frequently get ClassCastException issues from servlet code that is doing a lookup and PortableRemoteObject.narrow on the resulting object reference. Restarting the server solves the problem, but having to restart every time I make a change isn't much better than alternative app servers, and it's a very slow way to develop.

      Is this a known issue with JBoss 3.0 beta?

        • 1. Re: Broken hot deployment; ClassCastException problems
          wchao

          As a point of clarification, the ClassCastException with PortableRemoteObject.narrow happens even when I don't change the EJB classes or interfaces. It happens even when I merely change servlets or JSPs that access the EJBs.

          • 2. Re: Broken hot deployment; ClassCastException problems

            Yes, this was a known bug. You could try CVS to
            get the latest version.

            Regards,
            Adrian

            • 3. Re: Broken hot deployment; ClassCastException problems
              basil

              I still observe the problem with ClassCastException in JBoss 3.0.0 RC1

              The problem specifically happens in the following case:
              - Deploy an .ear file to the server, run tests that use EJB session / entity beans in the .ear
              - Redeploy the .ear (with or without any changes)
              - Rerun the tests. The ClassCastException happens in PortableRemoteObject.narrow when trying to obtain an EJB session home from the server (i.e. from within the execution of a different EJB session bean).

              • 4. Re: Broken hot deployment; ClassCastException problems

                Hi,

                This problem was reported as fixed yesterday.
                The fix should also make jndi processing faster inside
                the same VM.

                Regards,
                Adrian

                • 5. Re: Broken hot deployment; ClassCastException problems
                  wchao

                  Adrian, did you try out narrow in the latest CVS of JBoss 3.0.0? I couldn't get the latest (2002-04-24) CVS working with my database, so my application doesn't deploy.

                  • 6. Re: Broken hot deployment; ClassCastException problems
                    wchao

                    Strange. I am using the 2002-04-24 HEAD snapshot of JBoss 3.1.0 alpha, and the ClassCastException doesn't occur when I redeploy a regular packed EAR. It only happens when I redeploy an unpacked EAR (by changing files and touching the deployment descriptor). Seems like something's been fixed in JBoss, but not yet with the code that handles unpacked deployments.

                    Better than having to restart the whole server, but still agonizingly slow for development.

                    Anybody else have the ClassCastException problem with unpacked EAR files?

                    • 7. Re: Broken hot deployment; ClassCastException problems

                      I tried with 3.0 last night.
                      The narrow works. But I didn't try with unpacked.

                      Regards,
                      Adrian

                      • 8. Re: Broken hot deployment; ClassCastException problems
                        lobo

                        I have the same Problem with JBoss 3.0.0 stable from jboss.org.
                        I get a ClassCastException after these steps:
                        1) Start Server and deploy *.ear -> everything is fine
                        2) Start a TestClient -> works
                        3) Hot redeploy my *.ear-File -> seems to work too
                        4) Using the same TestClient.
                        Then I get this:

                        javax.ejb.EJBException: nested exception is: java.lang.ClassCastException: $Proxy93
                        at org.jboss.ejb.StatelessSessionContainer$ContainerInterceptor.invoke(StatelessSessionContainer.java:675)
                        at org.jboss.resource.connectionmanager.CachedConnectionInterceptor.invoke(CachedConnectionInterceptor.java:186)
                        at org.jboss.ejb.plugins.StatelessSessionInstanceInterceptor.invoke(StatelessSessionInstanceInterceptor.java:77)
                        at org.jboss.ejb.plugins.AbstractTxInterceptor.invokeNext(AbstractTxInterceptor.java:96)
                        ... 19 more


                        Any solutions for this?

                        • 9. Re: Broken hot deployment; ClassCastException problems
                          nnorbi

                          Hello,

                          I have a servlet (TrackerServlet), which makes an EJB remote call from it's init method. Also the lookup and narrow logic is inside of this method. When I deploy my ear at the first time after restarting my JBoss 3.0.0 (final version with Tomcat) everything works fine. But when I undeploy it and make a redeploy, I got the following exception:

                          java.lang.ClassCastException
                          at com.sun.corba.se.internal.javax.rmi.PortableRemoteObject.narrow(PortableRemoteObject.java:293)
                          at javax.rmi.PortableRemoteObject.narrow(PortableRemoteObject.java:134)
                          at com.jaron.tracker.client.Settings.getTrackerController(Unknown Source)
                          at com.jaron.tracker.client.TrackerServlet.init(Unknown Source)
                          at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:916)
                          at org.apache.catalina.core.StandardWrapper.load(StandardWrapper.java:808)
                          at org.apache.catalina.core.StandardContext.loadOnStartup(StandardContext.java:3266)
                          at org.apache.catalina.core.StandardContext.start(StandardContext.java:3395)
                          at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:785)
                          at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:454)
                          at org.jboss.web.catalina.EmbeddedCatalinaServiceSX.createWebContext(EmbeddedCatalinaServiceSX.java:321)
                          at org.jboss.web.catalina.EmbeddedCatalinaServiceSX.performDeploy(EmbeddedCatalinaServiceSX.java:238)
                          at org.jboss.web.AbstractWebContainer.start(AbstractWebContainer.java:300)
                          at org.jboss.deployment.MainDeployer.start(MainDeployer.java:678)
                          at org.jboss.deployment.MainDeployer.start(MainDeployer.java:671)
                          at org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:513)
                          at org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:481)
                          at sun.reflect.GeneratedMethodAccessor16.invoke(Unknown Source)
                          at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
                          at java.lang.reflect.Method.invoke(Method.java:324)
                          at org.jboss.mx.capability.ReflectedMBeanDispatcher.invoke(ReflectedMBeanDispatcher.java:284)
                          at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:491)
                          at org.jboss.util.jmx.MBeanProxy.invoke(MBeanProxy.java:174)
                          at $Proxy4.deploy(Unknown Source)
                          at org.jboss.deployment.scanner.URLDeploymentScanner.deploy(URLDeploymentScanner.java:405)
                          at org.jboss.deployment.scanner.URLDeploymentScanner.scanDirectory(URLDeploymentScanner.java:586)
                          at org.jboss.deployment.scanner.URLDeploymentScanner.scan(URLDeploymentScanner.java:465)
                          at org.jboss.deployment.scanner.AbstractDeploymentScanner$ScannerThread.loop(AbstractDeploymentScanner.java:202)
                          at org.jboss.deployment.scanner.AbstractDeploymentScanner$ScannerThread.run(AbstractDeploymentScanner.java:191)

                          The EJB itself is deployed on a different machine with the same configuration. On that machine the redeploy works.

                          Can somebody help me?

                          Thanks,
                          Norbert Nagy

                          • 10. Re: Broken hot deployment; ClassCastException problems
                            rdoust

                            I don't even get the ClassCastException after I redeploy an ear. I get "hit any key to continue" (Ant batch file terminates). I look in the server.log and there's no indication at all of any kind of problem. It just quits. Very abruptly. This is on JBoss_3_1_0_1 using the Jetty servlet engine.

                            • 11. Re: Broken hot deployment; ClassCastException problems
                              nickduong

                              I had the some problem in running JBoss 3.0.0 and JBoss 3.0.1RC1 in WinXP.

                              However, when I moved to Linux this problem does not happen.

                              Does anyone knows this error is only in WinXP?

                              • 12. Re: Broken hot deployment; ClassCastException problems
                                skizz

                                I just tested this on the 3.0.0 release, on WinXP/JDK1.4.1 and RH Linux 7.3/JDK1.4.0 and it happens on both :-( I am using cactus to do my unit testing, and it is the cactus servlet that sees the problem.

                                The problem is in JNDI, here is my analysis (I amm testing an EJB called User):

                                1. On first deployment, lookup of local/User (UserLocalHome interface) returns User:$Proxy34. This is the same object listed in the management view as bound to local/User, and all the tests work fine.

                                2. Do a hot redeploy

                                3. Lookup local/User from the servlet returns User:$Proxy34 as before, while in the management view local/User is bound to proxy: $Proxy43. The tests fail with a ClassCastException.

                                • 13. Re: Broken hot deployment; ClassCastException problems
                                  stevewink

                                  I think I had a similar problem with a JCA resource I wrote and a test program which I installed as a service. The fix for mine was to add the resource as a dependancy in the test service's xml file eg.

                                  <?xml version="1.0" encoding="UTF-8"?>



                                  jboss.jca:service=LocalTxCM,name=samplejcaDS



                                  Hope this helps.

                                  • 14. Re: Broken hot deployment; ClassCastException problems

                                    I have tried jboss-3.0.0 with jetty, jboss-3.0.0_tomcat-4.0.3, and jboss-3.0.1_tomcat-4.0.4. I have the same problem as described above everywhere.

                                    I think this thread and http://www.jboss.org/modules/bb/index.html?module=bb&op=viewtopic&t=forums/ describes the same problem. And it seems to be some caching of proxy in JBoss, so that after hot deployment it is impossible to narrow proxies that have already been looked up to home-interfaces? It is only a problem from a servlet or other running in the same JVM as JBoss

                                    If I have understood correctly this is a bug, and a bug that it is fairly difficult to live with. Any work-arounds? Any hopes for a fix shortly?

                                    1 2 Previous Next