5 Replies Latest reply on Jul 3, 2003 4:20 AM by userid

    JBoss 3.2.1 CMP field for key not found

    userid Newbie

      Hello,
      cann anyone help me?

      I want to migrate an WebSphere App to JBoss. I deleted all WebSphere-specific files and replace them with the necessary JBoss files. Everything looks fine, but the EJB Container don't start with this Message:

      17:37:05,750 INFO [StatelessSessionInstancePool] Creating
      17:37:05,750 INFO [StatelessSessionInstancePool] Created
      17:37:05,750 INFO [StatelessSessionContainer] Created
      17:37:05,750 INFO [EjbModule] Created
      17:37:05,765 INFO [EjbModule] Starting
      17:37:05,765 INFO [EntityContainer] Starting
      17:37:06,218 ERROR [EntityContainer] Starting failed
      org.jboss.deployment.DeploymentException: CMP field for key not found: field name=userEB
      at org.jboss.ejb.plugins.cmp.jdbc.metadata.JDBCRelationshipRoleMetaData.loadKeyFields(JDBCRelationshipRoleMetaData.java:3
      at org.jboss.ejb.plugins.cmp.jdbc.metadata.JDBCRelationshipRoleMetaData.init(JDBCRelationshipRoleMetaData.java:157)
      at org.jboss.ejb.plugins.cmp.jdbc.metadata.JDBCRelationMetaData.(JDBCRelationMetaData.java:313)
      at org.jboss.ejb.plugins.cmp.jdbc.metadata.JDBCApplicationMetaData.(JDBCApplicationMetaData.java:404)
      at org.jboss.ejb.plugins.cmp.jdbc.metadata.JDBCXmlFileLoader.load(JDBCXmlFileLoader.java:75)
      at org.jboss.ejb.plugins.cmp.jdbc.JDBCStoreManager.loadJDBCEntityMetaData(JDBCStoreManager.java:737)
      at org.jboss.ejb.plugins.cmp.jdbc.JDBCStoreManager.initStoreManager(JDBCStoreManager.java:430)
      at org.jboss.ejb.plugins.cmp.jdbc.JDBCStoreManager.start(JDBCStoreManager.java:372)
      at org.jboss.ejb.plugins.CMPPersistenceManager.start(CMPPersistenceManager.java:170)
      at org.jboss.ejb.EntityContainer.startService(EntityContainer.java:339)
      at org.jboss.system.ServiceMBeanSupport.start(ServiceMBeanSupport.java:192)
      at sun.reflect.GeneratedMethodAccessor34.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:549)
      at org.jboss.system.ServiceController$ServiceProxy.invoke(ServiceController.java:966)
      at $Proxy11.start(Unknown Source)
      at org.jboss.system.ServiceController.start(ServiceController.java:392)
      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:549)
      at org.jboss.mx.util.MBeanProxyExt.invoke(MBeanProxyExt.java:177)
      at $Proxy23.start(Unknown Source)
      at org.jboss.ejb.EjbModule.startService(EjbModule.java:329)
      at org.jboss.system.ServiceMBeanSupport.start(ServiceMBeanSupport.java:192)
      at sun.reflect.GeneratedMethodAccessor34.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:549)
      at org.jboss.system.ServiceController$ServiceProxy.invoke(ServiceController.java:966)
      at $Proxy11.start(Unknown Source)
      at org.jboss.system.ServiceController.start(ServiceController.java:392)
      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:549)
      at org.jboss.mx.util.MBeanProxyExt.invoke(MBeanProxyExt.java:177)
      at $Proxy20.start(Unknown Source)
      at org.jboss.ejb.EJBDeployer.start(EJBDeployer.java:540)
      at org.jboss.deployment.MainDeployer.start(MainDeployer.java:832)
      at org.jboss.deployment.MainDeployer.start(MainDeployer.java:824)
      at org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:640)
      at org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:613)
      at sun.reflect.GeneratedMethodAccessor27.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:549)
      at org.jboss.mx.util.MBeanProxyExt.invoke(MBeanProxyExt.java:177)
      at $Proxy7.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.java:200)
      at org.jboss.deployment.scanner.AbstractDeploymentScanner.startService(AbstractDeploymentScanner.java:273)
      at org.jboss.system.ServiceMBeanSupport.start(ServiceMBeanSupport.java:192)
      at sun.reflect.GeneratedMethodAccessor7.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:549)
      at org.jboss.system.ServiceController$ServiceProxy.invoke(ServiceController.java:966)
      at $Proxy0.start(Unknown Source)
      at org.jboss.system.ServiceController.start(ServiceController.java:392)
      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:549)
      at org.jboss.mx.util.MBeanProxyExt.invoke(MBeanProxyExt.java:177)
      at $Proxy5.start(Unknown Source)
      at org.jboss.deployment.SARDeployer.start(SARDeployer.java:226)
      at org.jboss.deployment.MainDeployer.start(MainDeployer.java:832)
      at org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:640)
      at org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:613)
      at org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:597)
      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:324)
      at org.jboss.mx.capability.ReflectedMBeanDispatcher.invoke(ReflectedMBeanDispatcher.java:284)
      at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:549)
      at org.jboss.mx.util.MBeanProxyExt.invoke(MBeanProxyExt.java:177)
      at $Proxy6.deploy(Unknown Source)
      at org.jboss.system.server.ServerImpl.doStart(ServerImpl.java:365)
      at org.jboss.system.server.ServerImpl.start(ServerImpl.java:272)
      at org.jboss.Main.boot(Main.java:150)
      at org.jboss.Main$1.run(Main.java:388)
      at java.lang.Thread.run(Thread.java:536)
      17:37:06,250 WARN [ServiceController] Problem starting service jboss.j2ee:jndiName=ejb/usermgmt/SequenceEntityBean,service=EJB

      The field userEB is an CMR field. It's an collection of EntityBeans. Any suggestions?

        • 1. Re: JBoss 3.2.1 CMP field for key not found
          userid Newbie

          XML Files:

          • 2. Re: JBoss 3.2.1 CMP field for key not found
            Raja Master

            in ur jbosscmp-jdbc.xml, shouldnt the names of the "field-name" map to the key values in your usereb and usergroupeb tables? This is for the userjoinusergroup relation.

            As far as i can see, the names in ur jbosscmp-jdbc.xml dont match the key values of ur entities..

            -Raj

            • 3. Re: JBoss 3.2.1 CMP field for key not found
              userid Newbie

              @ raja05

              Thanks for your quick reply.
              But I don't fix the Problem anymore. The many to many relationship between user and usergroup is resolved by an resolution table "j2ee_user_usergroup_link". And there are the key fields usrid and usrgrpid.
              I think I have a problem with the CMR mapping, but I don't see my failure.

              • 4. Re: JBoss 3.2.1 CMP field for key not found
                userid Newbie

                To specify my problem, I pick out the deployment snippets, where I think the failure is.
                "UserEB" EntityBean has an CMP primary key field "usrId" and and CMR collection field "userGroupEB".
                "UserGroupEB" EntityBean has an CMP primary key field "grpId" and and CMR collection field "userEB".
                To resolve the many to many relationship there is an resolution table called "j2ee_user_usergroup_link" with the foreign keys "usrid" and "usrgrpid"
                In the following two xml files I want to map this case to JBoss, but it didn't work. And I can't see my failure.
                The ejb-jar.xml file work fine with WebSphere, so I suggest, that the failure is in my jboss-jdbc.xml file.

                ----------ejb-jar.xml --------------------
                <ejb-relation>

                <ejb-relation-name>User_UserGroup</ejb-relation-name>
                <ejb-relationship-role>
                <ejb-relationship-role-name>UserGroupHasManyUser</ejb-relationship-role-name>
                Many
                <relationship-role-source>
                <ejb-name>UserGroupEB</ejb-name>
                </relationship-role-source>
                <cmr-field>
                <cmr-field-name>userEB</cmr-field-name>
                <cmr-field-type>java.util.Collection</cmr-field-type>
                </cmr-field>
                </ejb-relationship-role>
                <ejb-relationship-role>
                <ejb-relationship-role-name>UserJoinManyUserGroup</ejb-relationship-role-name>
                Many
                <relationship-role-source>
                <ejb-name>UserEB</ejb-name>
                </relationship-role-source>
                <cmr-field>
                <cmr-field-name>userGroupEB</cmr-field-name>
                <cmr-field-type>java.util.Collection</cmr-field-type>
                </cmr-field>
                </ejb-relationship-role>
                </ejb-relation>
                ----------ejb-jar.xml --------------------

                ----------jbosscmp-jdbc.xml --------------
                <ejb-relation>
                <ejb-relation-name>User_UserGroup</ejb-relation-name>
                <relation-table-mapping>
                <table-name>j2ee_user_usergroup_link</table-name>
                </relation-table-mapping>
                <ejb-relationship-role>
                <ejb-relationship-role-name>UserJoinManyUserGroup</ejb-relationship-role-name>
                <key-fields>
                <key-field>
                <field-name>userGroupEB</field-name>
                <column-name>usrgrpid</column-name>
                </key-field>
                </key-fields>
                </ejb-relationship-role>
                <ejb-relationship-role>
                <ejb-relationship-role-name>UserGroupHasManyUser</ejb-relationship-role-name>
                <key-fields>
                <key-field>
                <field-name>userEB</field-name>
                <column-name>usrid</column-name>
                </key-field>
                </key-fields>
                </ejb-relationship-role>
                </ejb-relation>
                ----------jbosscmp-jdbc.xml --------------


                Thanks a lot!

                UserId

                • 5. Re: JBoss 3.2.1 CMP field for key not found
                  userid Newbie

                  I'm very glad. I solved the problem.
                  @raja05 at the 10th time I read your post, suddenly I saw my failure I confused "key values" with CMR fields.
                  So the failure was still in the jbosscmb-jdbc.xml file. For them, who are interested, I post the fixed file snipped:

                  <ejb-relation>
                  <ejb-relation-name>User_UserGroup</ejb-relation-name>
                  <relation-table-mapping>
                  <table-name>j2ee_user_usergroup_link</table-name>
                  </relation-table-mapping>
                  <ejb-relationship-role>
                  <ejb-relationship-role-name>UserJoinManyUserGroup</ejb-relationship-role-name>
                  <key-fields>
                  <key-field>
                  <field-name>usrId</field-name>
                  <column-name>usrid</column-name>
                  </key-field>
                  </key-fields>
                  </ejb-relationship-role>
                  <ejb-relationship-role>
                  <ejb-relationship-role-name>UserGroupHasManyUser</ejb-relationship-role-name>
                  <key-fields>
                  <key-field>
                  <field-name>grpId</field-name>
                  <column-name>usrgrpid</column-name>
                  </key-field>
                  </key-fields>
                  </ejb-relationship-role>
                  </ejb-relation>