2 Replies Latest reply on Jan 15, 2003 6:40 PM by Hendrik van der Linde

    Home interface does not have a findByPrimaryKey method

    Horatiu Stanciu Newbie

      I deployed an Entity Bean on JBoss 3.0.3 but the following message appears:

      "
      16:49:50,226 INFO [MainDeployer] Starting deployment of package: file:/D:/Java/
      jboss-3.0.3/server/entity/deploy/examples.jar
      16:49:50,326 INFO [EjbModule] Creating
      16:49:50,346 INFO [EjbModule] Deploying Street
      16:49:50,406 INFO [EjbModule] Created
      16:49:50,406 INFO [EjbModule] Starting
      16:50:03,415 INFO [Street] Table 'STREET_TABLE' already exists
      16:50:03,425 WARN [ServiceController] Problem starting service jboss.j2ee:jndiN
      ame=Street,service=EJB
      org.jboss.deployment.DeploymentException: Home interface does not have a findByP
      rimaryKey method
      at org.jboss.ejb.plugins.cmp.jdbc.JDBCQueryManager.start(JDBCQueryManage
      r.java:99)
      at org.jboss.ejb.plugins.cmp.jdbc.JDBCStoreManager.startStoreManager(JDB
      CStoreManager.java:463)
      at org.jboss.ejb.plugins.cmp.jdbc.JDBCStoreManager.start(JDBCStoreManage
      r.java:369)
      at org.jboss.ejb.plugins.CMPPersistenceManager.start(CMPPersistenceManag
      er.java:198)
      at org.jboss.ejb.EntityContainer.start(EntityContainer.java:376)
      at org.jboss.ejb.Container.invoke(Container.java:756)
      at org.jboss.ejb.EntityContainer.invoke(EntityContainer.java:1058)
      at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:517)
      at org.jboss.system.ServiceController$ServiceProxy.invoke(ServiceControl
      ler.java:976)
      at $Proxy5.start(Unknown Source)
      at org.jboss.system.ServiceController.start(ServiceController.java:397)
      at sun.reflect.GeneratedMethodAccessor7.invoke(Unknown Source)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcces
      sorImpl.java:25)
      at java.lang.reflect.Method.invoke(Method.java:324)
      at org.jboss.mx.capability.ReflectedMBeanDispatcher.invoke(ReflectedMBea
      nDispatcher.java:284)
      at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:517)
      at org.jboss.util.jmx.MBeanProxy.invoke(MBeanProxy.java:174)
      at $Proxy25.start(Unknown Source)
      at org.jboss.ejb.EjbModule.startService(EjbModule.java:430)
      at org.jboss.system.ServiceMBeanSupport.start(ServiceMBeanSupport.java:1
      64)
      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.
      java:39)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcces
      sorImpl.java:25)
      at java.lang.reflect.Method.invoke(Method.java:324)
      at org.jboss.mx.capability.ReflectedMBeanDispatcher.invoke(ReflectedMBea
      nDispatcher.java:284)
      at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:517)
      at org.jboss.system.ServiceController$ServiceProxy.invoke(ServiceControl
      ler.java:976)
      at $Proxy5.start(Unknown Source)
      at org.jboss.system.ServiceController.start(ServiceController.java:397)
      at sun.reflect.GeneratedMethodAccessor7.invoke(Unknown Source)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcces
      sorImpl.java:25)
      at java.lang.reflect.Method.invoke(Method.java:324)
      at org.jboss.mx.capability.ReflectedMBeanDispatcher.invoke(ReflectedMBea
      nDispatcher.java:284)
      at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:517)
      at org.jboss.util.jmx.MBeanProxy.invoke(MBeanProxy.java:174)
      at $Proxy14.start(Unknown Source)
      at org.jboss.ejb.EJBDeployer.start(EJBDeployer.java:394)
      at org.jboss.deployment.MainDeployer.start(MainDeployer.java:802)
      at org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:616)
      at org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:580)
      at sun.reflect.GeneratedMethodAccessor19.invoke(Unknown Source)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcces
      sorImpl.java:25)
      at java.lang.reflect.Method.invoke(Method.java:324)
      at org.jboss.mx.capability.ReflectedMBeanDispatcher.invoke(ReflectedMBea
      nDispatcher.java:284)
      at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:517)
      at org.jboss.util.jmx.MBeanProxy.invoke(MBeanProxy.java:174)
      at $Proxy4.deploy(Unknown Source)
      at org.jboss.deployment.scanner.URLDeploymentScanner.deploy(URLDeploymen
      tScanner.java:427)
      at org.jboss.deployment.scanner.URLDeploymentScanner.scanDirectory(URLDe
      ploymentScanner.java:648)
      at org.jboss.deployment.scanner.URLDeploymentScanner.scan(URLDeploymentS
      canner.java:499)
      at org.jboss.deployment.scanner.AbstractDeploymentScanner.startService(A
      bstractDeploymentScanner.java:261)
      at org.jboss.system.ServiceMBeanSupport.start(ServiceMBeanSupport.java:1
      64)
      at sun.reflect.GeneratedMethodAccessor9.invoke(Unknown Source)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcces
      sorImpl.java:25)
      at java.lang.reflect.Method.invoke(Method.java:324)
      at org.jboss.mx.capability.ReflectedMBeanDispatcher.invoke(ReflectedMBea
      nDispatcher.java:284)
      at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:517)
      at org.jboss.system.ServiceController$ServiceProxy.invoke(ServiceControl
      ler.java:976)
      at $Proxy0.start(Unknown Source)
      at org.jboss.system.ServiceController.start(ServiceController.java:397)
      at sun.reflect.GeneratedMethodAccessor7.invoke(Unknown Source)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcces
      sorImpl.java:25)
      at java.lang.reflect.Method.invoke(Method.java:324)
      at org.jboss.mx.capability.ReflectedMBeanDispatcher.invoke(ReflectedMBea
      nDispatcher.java:284)
      at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:517)
      at org.jboss.util.jmx.MBeanProxy.invoke(MBeanProxy.java:174)
      at $Proxy3.start(Unknown Source)
      at org.jboss.deployment.SARDeployer.start(SARDeployer.java:249)
      at org.jboss.deployment.MainDeployer.start(MainDeployer.java:802)
      at org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:616)
      at org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:580)
      at org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:564)
      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.
      java:39)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcces
      sorImpl.java:25)
      at java.lang.reflect.Method.invoke(Method.java:324)
      at org.jboss.mx.capability.ReflectedMBeanDispatcher.invoke(ReflectedMBea
      nDispatcher.java:284)
      at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:517)
      at org.jboss.system.server.ServerImpl.doStart(ServerImpl.java:324)
      at org.jboss.system.server.ServerImpl.start(ServerImpl.java:221)
      at org.jboss.Main.boot(Main.java:148)
      at org.jboss.Main$1.run(Main.java:381)
      at java.lang.Thread.run(Thread.java:536)
      16:50:03,455 INFO [EjbModule] Started
      16:50:03,455 INFO [MainDeployer] Deployed package: file:/D:/Java/jboss-3.0.3/se
      rver/entity/deploy/examples.jar
      16:50:03,455 INFO [MainDeployer] Starting deployment of package: file:/D:/Java/
      jboss-3.0.3/server/entity/deploy/jbossweb-ejb.jar
      16:50:03,565 INFO [EjbModule] Creating
      16:50:03,585 INFO [EjbModule] Deploying CMPState
      16:50:03,625 INFO [EjbModule] Created
      16:50:03,625 INFO [EjbModule] Starting
      16:50:03,815 INFO [CMPState] Created table 'JETTY_HTTPSESSION_CMPSTATE' success
      fully.
      16:50:04,016 INFO [EjbModule] Started
      16:50:04,016 INFO [MainDeployer] Deployed package: file:/D:/Java/jboss-3.0.3/se
      rver/entity/deploy/jbossweb-ejb.jar
      16:50:04,016 INFO [MainDeployer] Starting deployment of package: file:/D:/Java/
      jboss-3.0.3/server/entity/deploy/jmx-ejb-adaptor.jar
      16:50:04,106 INFO [EjbModule] Creating
      16:50:04,126 INFO [EjbModule] Deploying jmx/ejb/Adaptor
      16:50:04,156 INFO [EjbModule] Created
      16:50:04,156 INFO [EjbModule] Starting
      16:50:04,216 INFO [EjbModule] Started
      16:50:04,216 INFO [MainDeployer] Deployed package: file:/D:/Java/jboss-3.0.3/se
      rver/entity/deploy/jmx-ejb-adaptor.jar
      16:50:04,216 INFO [MainDeployer] Starting deployment of package: file:/D:/Java/
      jboss-3.0.3/server/entity/deploy/jmx-console.war/
      16:50:04,346 INFO [jbossweb] Registered jboss.web:Jetty=0,JBossWebApplicationCo
      ntext=2,context=/jmx-console
      16:50:05,137 INFO [jbossweb] Started WebApplicationContext[/jmx-console,file:/D
      :/Java/jboss-3.0.3/server/entity/deploy/jmx-console.war/]
      16:50:05,157 INFO [jbossweb] successfully deployed file:/D:/Java/jboss-3.0.3/se
      rver/entity/deploy/jmx-console.war/ to /jmx-console
      16:50:05,157 INFO [MainDeployer] Deployed package: file:/D:/Java/jboss-3.0.3/se
      rver/entity/deploy/jmx-console.war/
      16:50:05,167 ERROR [URLDeploymentScanner] MBeanException: Exception in MBean ope
      ration 'checkIncompleteDeployments()'
      Cause: Incomplete Deployment listing:
      Packages waiting for a deployer:

      Incompletely deployed packages:

      MBeans waiting for classes:

      MBeans waiting for other MBeans:
      [ObjectName: jboss.j2ee:jndiName=Street,service=EJB
      state: FAILED
      I Depend On:
      Depends On Me: org.jboss.deployment.DeploymentException: Home interface does no
      t have a findByPrimaryKey method]
      16:50:05,167 INFO [URLDeploymentScanner] Started
      16:50:05,167 INFO [MainDeployer] Deployed package: file:/D:/Java/jboss-3.0.3/se
      rver/entity/conf/jboss-service.xml
      16:50:05,177 INFO [Server] JBoss (MX MicroKernel) [3.0.3 Date:200209301503] Sta
      rted in 0m:37s:994ms
      "

      THe method findByPrimaryKey exists in Home inteface
      If I type :

      javap -p -classpath %classpath% examples.StreetHome

      The result is:


      Compiled from StreetHome.java
      public interface examples.StreetHome extends javax.ejb.EJBHome
      /* ACC_SUPER bit NOT set */
      {
      public abstract examples.Street create(java.lang.String, java.lang.String) t
      hrows javax.ejb.CreateException, java.rmi.RemoteException;
      public abstract examples.Street findByPrimaryKey(java.lang.String) throws ja
      vax.ejb.FinderException, java.rmi.RemoteException;
      public abstract java.util.Collection findByName(java.lang.String) throws jav
      ax.ejb.FinderException, java.rmi.RemoteException;
      public abstract examples.Street findAllStreets() throws javax.ejb.FinderExce
      ption, java.rmi.RemoteException;
      }


      Do you have any idea where is the error?
      Thank you,
      H

        • 1. Re: Home interface does not have a findByPrimaryKey method
          Hendrik van der Linde Newbie

          I know it doesn't help, but I've g the same problem over here. The funny thing is that I successfully deployed my bean in the past, but made some changes (which I forgot). Maybe this is a JBoss caching problem of some sort?

          • 2. Re: Home interface does not have a findByPrimaryKey method
            Hendrik van der Linde Newbie

            I found the cause of the problem! The reason is not in the entity that seems the cause, but in another entity. That other entity, in my case Albumn was not completely finished (I did not specify all fields in ejb-jar.xml). After disabling this bean, the Artist bean deployed OK!
            This clearly is a bug, I hope someone can file a bug for it.

            See the stacktrace below if you're intested in the details:

            00:34:35,988 DEBUG [EntityContainer] End java:comp/env for EJB: Artist
            00:34:36,058 DEBUG [BaseLocalContainerInvoker] Bound EJBLocalHome of Artist to local/Artist
            00:34:36,183 DEBUG [ProxyFactory] Bound Artist to Artist
            00:34:36,184 DEBUG [Artist] Initializing CMP plugin for Artist
            00:34:36,211 DEBUG [Albumn] Create will not be allowed.
            00:34:36,212 DEBUG [Albumn] Remove SQL: DELETE FROM albumn WHERE id=?
            00:34:36,212 DEBUG [Albumn] Table not create as requested: albumn
            00:34:36,212 WARN [ServiceController] Problem starting service jboss.j2ee:jndiName=Artist,service=EJB
            org.jboss.deployment.DeploymentException: Home interface does not have a findByPrimaryKey method
            at org.jboss.ejb.plugins.cmp.jdbc.JDBCQueryManager.start(JDBCQueryManager.java:99)
            at org.jboss.ejb.plugins.cmp.jdbc.JDBCStoreManager.startStoreManager(JDBCStoreManager.java:463)
            at org.jboss.ejb.plugins.cmp.jdbc.JDBCStoreManager.start(JDBCStoreManager.java:369)
            at org.jboss.ejb.plugins.CMPPersistenceManager.start(CMPPersistenceManager.java:198)
            at org.jboss.ejb.EntityContainer.start(EntityContainer.java:376)
            at org.jboss.ejb.Container.invoke(Container.java:756)
            at org.jboss.ejb.EntityContainer.invoke(EntityContainer.java:1058)
            at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:517)
            at org.jboss.system.ServiceController$ServiceProxy.invoke(ServiceController.java:978)
            at $Proxy5.start(Unknown Source)
            at org.jboss.system.ServiceController.start(ServiceController.java:398)
            at java.lang.reflect.Method.invoke(Native Method)
            at org.jboss.mx.capability.ReflectedMBeanDispatcher.invoke(ReflectedMBeanDispatcher.java:284)