6 Replies Latest reply on Jan 30, 2006 3:31 PM by schulz-markus

    JBoss cannot find

    urddd

      I've got a strange problem and may be someone can help me if he/she has faced the problem before.

      I've got the following deployment exception:

      16:22:18,453 INFO [EntityContainer] Started jboss.j2ee:jndiName=anEJBNameWhatever,service=EJB
      16:22:21,187 ERROR [EntityContainer] Starting failed
      org.jboss.deployment.DeploymentException: Home interface does not have a findByPrimaryKey method

      The entity bean is fine and it has a findByPrimaryKey method the its Home class. What's strange is that the error happends ONLY to the last EJB defined in the jbosscmp-jdbc.xml. It doesn't matter which entity it is, the error happens to the last entity defined in jbosscmp-jdbc.xml

      What could be causing this error? Any ideas?


      here is the full exception:

      16:22:21,187 ERROR [EntityContainer] Starting failed
      org.jboss.deployment.DeploymentException: Home interface does not have a findByPrimaryKey method
      at org.jboss.ejb.plugins.cmp.jdbc.JDBCQueryManager.start(JDBCQueryManager.java:102)
      at org.jboss.ejb.plugins.cmp.jdbc.JDBCStoreManager.startStoreManager(JDBCStoreManager.java:451)
      at org.jboss.ejb.plugins.cmp.jdbc.JDBCStoreManager.start(JDBCStoreManager.java:351)
      at org.jboss.ejb.plugins.CMPPersistenceManager.start(CMPPersistenceManager.java:152)
      at org.jboss.ejb.EntityContainer.startService(EntityContainer.java:343)
      at org.jboss.system.ServiceMBeanSupport.start(ServiceMBeanSupport.java:192)
      at sun.reflect.GeneratedMethodAccessor5.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:546)
      at org.jboss.system.ServiceController$ServiceProxy.invoke(ServiceController.java:976)
      at $Proxy14.start(Unknown Source)
      at org.jboss.system.ServiceController.start(ServiceController.java:394)
      at sun.reflect.GeneratedMethodAccessor6.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:546)
      at org.jboss.mx.util.MBeanProxyExt.invoke(MBeanProxyExt.java:177)
      at $Proxy36.start(Unknown Source)
      at org.jboss.ejb.EjbModule.startService(EjbModule.java:331)
      at org.jboss.system.ServiceMBeanSupport.start(ServiceMBeanSupport.java:192)
      at sun.reflect.GeneratedMethodAccessor5.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:546)
      at org.jboss.system.ServiceController$ServiceProxy.invoke(ServiceController.java:976)
      at $Proxy14.start(Unknown Source)
      at org.jboss.system.ServiceController.start(ServiceController.java:394)
      at sun.reflect.GeneratedMethodAccessor6.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:546)
      at org.jboss.mx.util.MBeanProxyExt.invoke(MBeanProxyExt.java:177)
      at $Proxy12.start(Unknown Source)
      at org.jboss.ejb.EJBDeployer.start(EJBDeployer.java:544)
      at org.jboss.deployment.MainDeployer.start(MainDeployer.java:832)
      at org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:642)
      at org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:605)
      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:546)
      at org.jboss.mx.util.MBeanProxyExt.invoke(MBeanProxyExt.java:177)
      at $Proxy6.deploy(Unknown Source)
      at org.jboss.deployment.scanner.URLDeploymentScanner.deploy(URLDeploymentScanner.java:302)
      at org.jboss.deployment.scanner.URLDeploymentScanner.scan(URLDeploymentScanner.java:476)
      at org.jboss.deployment.scanner.AbstractDeploymentScanner$ScannerThread.doScan(AbstractDeploymentScanner.ja
      va:201)
      at org.jboss.deployment.scanner.AbstractDeploymentScanner$ScannerThread.loop(AbstractDeploymentScanner.java
      :212)
      at org.jboss.deployment.scanner.AbstractDeploymentScanner$ScannerThread.run(AbstractDeploymentScanner.java:
      191)


        • 1. Update
          urddd

          I my previous post I made a mistake.

          The entity (let call it entity A) that is failling is not the last only defined in jbosscmp-jdbc.xml but it still fails.

          Interestingly enough if I add another entity (entity B) in the last position, the entity B fail and not A.

          I have already used entity A in production so I'm sure there is no errors in entity A. Entity B is new.

          • 2. Re: JBoss cannot find
            urddd

            I've traced the problem to one entity.

            Right now I'm deploying with only 2 entities A and B.

            A is deployed before B.

            JBoss indicates that there is an error deploying B but this is not true. The error occurs while deploying A.

            I know this because if I deploy entity A only I got the error. If I deploy entity B only I got no errors.

            • 3. Re: JBoss cannot find
              urddd

              I finally found the problem.

              The problem was as the DeploymentException told me in the findByPrimaryKey method of one Entity. (the parameter was a String when it should have been an Integer).

              However JBoss was misleading me by idicating that the problem occured not in the entity that had the problem but the last entity deployed.


              To make it clear, if some entities where deployed in the following order:

              Entity A
              Entity B <-- the error was caused by this one
              Entity C
              Entity D
              Entity E <-- JBoss tells you that the problem is here


              JBoss don't tell that there is an error while deploying B but at the end of the deployment throws a DeploymentException accusing entity E which has done no wrong.

              • 4. Re: JBoss cannot find
                schulz-markus

                Yes, that's right. JBoss don't start the whole Bean at once. Every Bean is 'marked to start' and if the last Bean is about to start, every nessary information, like infos about references to other Beans, is available. At this point JBoss feeds the Beans with that information and starts them.

                If now one of the Beans can't be started (e.g. due to missing findByPrimaryKey method) the DeploymentException is thrown.

                The problem is, that the Exception is caught in a class, that is not aware of the 'marked to start' state and assumes that all already started beans are really started. So by receiving the DeploymentException while starting the last Beans, it assumes that this Bean has failed.

                I have a patch ready, that intercepts the Exception in that part, that is aware of the 'marked to start' state. There I collect messages about the failing Beans and their exception messages. After attempting all bean startups, the collection is examined to find out, if at least one exception has occured. If so, a new DeploymentException is thrown, which provides a detailed message list of failing Beans.

                If there is someone of the jboss people reading this - I like to make the patch available, but I'm not sure, if I should attach it to the bug report (Bug: JBAS-1505 - http://jira.jboss.com/jira/browse/JBAS-1505).

                • 5. Re: JBoss cannot find
                  dimitris

                  Yes, it seems this is the right bug report. If you can offer a minimal testcase that shows the problem, that would be even better :)

                  • 6. Re: JBoss cannot find
                    schulz-markus

                    Hi,
                    I have attached the sources of a testcase to the bug report.