Could not load primary key class: Integer
rjay1976 Dec 16, 2002 2:30 AMHi All,
I am trying to deploy a CMP bean with the create method returning Intereg in the bean, I am getting the error "Could not load primary key class: Integer".
I have pasted the code below, please let me know where I am going wrong.
EJB CLass:
package com.nds.mpgame;
/**
*@author R Jayendran
*@version 1.0
*created: 30-Oct-2002
*/
import javax.ejb.EntityBean;
import javax.ejb.EntityContext;
import javax.ejb.RemoveException;
import javax.ejb.CreateException;
/**
* This is a Game bean.
*
* @ejb:bean name="GameEJB"
* type="CMP"
* primkey-field="game_Id"
* @ejb:finder signature="Collection findAll()"
* unchecked="true"
* @ejb:interface remote-class="com.nds.mpgame.GameLocal"
* @ejb:pk class="java.lang.Integer"
*
* @jboss:table-name game
* @jboss:data-source-name OracleDS
* @jboss:persistence
*/
//@EJB:local
public abstract class GameEJB implements EntityBean
{
private EntityContext context;
public abstract int getGame_Id();
public abstract void setGame_Id(int gameId);
public abstract String getGame_Name();
public abstract void setGame_Name(String gameName);
public abstract int getCategory_Id();
public abstract void setCategory_Id(int categoryId);
//@EJB:local
public Integer ejbCreate(int gameId, String gameName, int categoryId) throws CreateException
{
System.out.println("=========ejbCreate Game=========");
setGame_Id(gameId);
setGame_Name(gameName);
setCategory_Id(categoryId);
return new Integer(gameId);
}
public void ejbPostCreate(int gameId, String gameName, int categoryId) throws CreateException
{
System.out.println("=========ejbPostCreate=========");
}
public void ejbActivate()
{
System.out.println("=========ejbActivate=========");
}
public void ejbPassivate()
{
System.out.println("=========ejbPassivate=========");
}
public void ejbLoad()
{
System.out.println("=========ejbLoad=========");
}
public void ejbStore()
{
System.out.println("=========ejbStore=========");
}
public void ejbRemove() throws RemoveException
{
System.out.println("=========ejbRemove=========");
}
public void setEntityContext(EntityContext ctx)
{
System.out.println("=========setEntityContext=========");
this.context=ctx;
}
public void unsetEntityContext()
{
System.out.println("=========unsetEntityContext=========");
this.context=null;
}
}
----------------------------------------------------------
XML File: (ejb-jar.xml)
<display-name>GameEJB</display-name>
<ejb-name>GameEJB</ejb-name>
<local-home>com.nds.mpgame.GameLocalHome</local-home>
com.nds.mpgame.GameLocal
<ejb-class>com.nds.mpgame.GameEJB</ejb-class>
<persistence-type>Container</persistence-type>
<prim-key-class>Integer</prim-key-class>
False
<cmp-version>2.x</cmp-version>
<cmp-field><field-name>game_Id</field-name></cmp-field>
<cmp-field><field-name>game_Name</field-name></cmp- field>
<cmp-field><field-name>category_Id</field-name></cmp-field>
<primkey-field>game_Id</primkey-field>
----------------------------------------------------------
Exception Message:
12:38:05,597 INFO [MainDeployer] Starting deployment of package: file:/E:/jboss
-3.0.2/server/default/deploy/Game.jar
12:38:05,706 INFO [EJBDeployer]
Bean : GameEJB
Method : public Integer ejbCreate(int, String, int) throws CreateException
Section: 10.6.4
Warning: The return type of an ejbCreate(...) method must be the entity bean's p
rimary key type.
12:38:05,722 INFO [EJBDeployer]
Bean : GameControllerEJB
Method : public abstract String getGame_Name()
Section: 7.10.7
Warning: All the exceptions defined in the throws clause of the matching method
of the session bean class must be defined in the throws clause of the method of
the remote interface.
12:38:05,722 INFO [EJBDeployer]
Bean : GameControllerEJB
Method : public abstract void setGame_Name(String)
Section: 7.10.7
Warning: All the exceptions defined in the throws clause of the matching method
of the session bean class must be defined in the throws clause of the method of
the remote interface.
12:38:05,722 INFO [EJBDeployer]
Bean : GameControllerEJB
Method : public abstract int getCategory_Id()
Section: 7.10.7
Warning: All the exceptions defined in the throws clause of the matching method
of the session bean class must be defined in the throws clause of the method of
the remote interface.
12:38:05,722 INFO [EJBDeployer]
Bean : GameControllerEJB
Method : public abstract void setCategory_Id(int)
Section: 7.10.7
Warning: All the exceptions defined in the throws clause of the matching method
of the session bean class must be defined in the throws clause of the method of
the remote interface.
12:38:05,722 INFO [EjbModule] Creating
12:38:05,753 INFO [EjbModule] Deploying GameEJB
12:38:05,769 INFO [EjbModule] Deploying GameControllerEJB
12:38:05,816 INFO [EjbModule] Created
12:38:05,816 INFO [EjbModule] Starting
12:38:05,909 WARN [ServiceController] Problem starting service jboss.j2ee:servi
ce=EJB,jndiName=GameLocal
org.jboss.deployment.DeploymentException: could not load primary key class: Integer
at org.jboss.ejb.plugins.cmp.jdbc.metadata.JDBCEntityMetaData.(JDBCEntityMetaData.java:218)
at org.jboss.ejb.plugins.cmp.jdbc.metadata.JDBCApplicationMetaData.(JDBCApplicationMetaData.java:117)
at org.jboss.ejb.plugins.cmp.jdbc.metadata.JDBCXmlFileLoader.load(JDBCXmlFileLoader.java:52)
at org.jboss.ejb.plugins.cmp.jdbc.JDBCStoreManager.loadJDBCEntityMetaData(JDBCStoreManager.java:677)
at org.jboss.ejb.plugins.cmp.jdbc.JDBCStoreManager.initStoreManager(JDBCStoreManager.java:389)
at org.jboss.ejb.plugins.cmp.jdbc.JDBCStoreManager.start(JDBCStoreManager.java:339)
at org.jboss.ejb.plugins.CMPPersistenceManager.start(CMPPersistenceManager.java:198)
at org.jboss.ejb.EntityContainer.startEntityContainer.java:376)
at org.jboss.ejb.Container.invokeContainer.java:764)
at org.jboss.ejb.EntityContainer.invoke(EntityContainer.java:1055)
at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:517)
at org.jboss.system.ServiceController$ServiceProxy.invoke(ServiceController.java:967)
at $Proxy5.start(Unknown Source)
at org.jboss.system.ServiceController.start(ServiceController.java:396)
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:517)
at org.jboss.util.jmx.MBeanProxy.invoke(MBeanProxy.java:174)
at $Proxy106.start(Unknown Source)
at org.jboss.ejb.EjbModule.startService(EjbModule.java:430)
at org.jboss.system.ServiceMBeanSupport.start(ServiceMBeanSupport.java:164)
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:517)
at org.jboss.system.ServiceController$ServiceProxy.invoke(ServiceController.java:967)
at $Proxy5.start(Unknown Source)
at org.jboss.system.ServiceController.start(ServiceController.java:396)
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:517)
at org.jboss.util.jmx.MBeanProxy.invoke(MBeanProxy.java:174)
at $Proxy10.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.GeneratedMethodAccessor9.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:517)
at org.jboss.util.jmx.MBeanProxy.invoke(MBeanProxy.java:174)
at $Proxy4.deploy(Unknown Source)
at org.jboss.deployment.scanner.URLDeploymentScanner.deploy(URLDeploymentScanner.java:427)
at org.jboss.deployment.scanner.URLDeploymentScanner.scanDirectory(URLDeploymentScanner.java:648)
at org.jboss.deployment.scanner.URLDeploymentScanner.scan(URLDeploymentScanner.java:499)
at org.jboss.deployment.scanner.AbstractDeploymentScanner$ScannerThread.doScan(AbstractDeploymentScanner.java:212)
at org.jboss.deployment.scanner.AbstractDeploymentScanner$ScannerThread.loop(AbstractDeploymentScanner.java:225)
at org.jboss.deployment.scanner.AbstractDeploymentScanner$ScannerThread.run(AbstractDeploymentScanner.java:202)
12:38:05,909 INFO [EjbModule] Started
12:38:05,909 INFO [MainDeployer] Deployed package: file:/E:/jboss-3.0.2/server/default/deploy/Game.jar
12:38:05,925 ERROR [URLDeploymentScanner] MBeanException: Exception in MBean operation '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:service=EJB,jndiName=GameLocal
state: FAILED
I Depend On: Depends On Me: org.jboss.deployment.DeploymentException: could not load primary key class: Integer]
Thanks
Jayen