Deployment of CMP Entity bean

Dear all,

I am just trying to get my first CMP entitiy bean going, but I have problems with the deployment. I am using the Sun appliaction server and set up the bean using the wizard. However, when I try to deploy the bean, I get the following error:

"No cmp field defined for CMP EJB SupplierBean".

I have a hunch that the reason might be that I haven't managed to replace the existing deployment descriptor ejb-jar.xml with my own one, because the existing one can't be deleted.

Any ideas?

Cheers,

N.

[551 byte] By [NetWundia] at [2007-10-2 6:02:47]
# 1
Post your deployment descriptor.
aniseeda at 2007-7-16 13:03:12 > top of Java-index,Java Essentials,New To Java...
# 2

Here it is:

<?xml version="1.0"?>

<!DOCTYPE ejb-jar PUBLIC "-

//Sun Microsystems, Inc.

//DTD Enterprise

JavaBeans 1.1//EN"

"http://java.sun.com/j2ee/dtds/ejb-jar_1_1.dtd">

<ejb-jar>

<enterprise-beans>

<entity>

<description>

This bean represents a supplier

</description>

<ejb-name>SupplierBean</ejb-name>

<home>SupplierHome</home>

<remote>Supplier</remote>

<ejb-class>SupplierBean</ejb-class>

<persistence-type>Container</persistence-type>

<prim-key-class>Integer</prim-key-class>

<reentrant>False</reentrant>

<cmp-field><field-name>myAddress</field-name></cmp-field>

<cmp-field><field-name>myName</field-name></cmp-field>

<cmp-field><field-name>myMail</field-name></cmp-field>

<cmp-field><field-name>meActive</field-name></cmp-field>

</entity>

</enterprise-beans>

<assembly-descriptor>

<security-role>

<description>

This role represents everyone who is allowed full access

to the Supplier bean.

</description>

<role-name>everyone</role-name>

</security-role>

<method-permission>

<role-name>everyone</role-name>

<method>

<ejb-name>SupplierBean</ejb-name>

<method-name>*</method-name>

</method>

</method-permission>

<container-transaction>

<description>

All methods require a transaction

</description>

<method>

<ejb-name>SupplierBean</ejb-name>

<method-name>*</method-name>

</method>

<trans-attribute>Required</trans-attribute>

</container-transaction>

</assembly-descriptor>

</ejb-jar>

NetWundia at 2007-7-16 13:03:12 > top of Java-index,Java Essentials,New To Java...
# 3
><prim-key-class>Integer</prim-key-class>You would need a <primkey-field> to be defined too, since you are using a single-field key.I'm not sure if this is the cause for the exception.
aniseeda at 2007-7-16 13:03:12 > top of Java-index,Java Essentials,New To Java...
# 4
OK, I see. So, once I have made the change, how to get the deployment descriptor back into the entity bean?Cheers, N.
NetWundia at 2007-7-16 13:03:12 > top of Java-index,Java Essentials,New To Java...
# 5
> OK, I see. So, once I have made the change, how to> get the deployment descriptor back into the entity> bean?The simplest way is to repackage the jar and replace it with the existing one.
aniseeda at 2007-7-16 13:03:12 > top of Java-index,Java Essentials,New To Java...
# 6

I am probably missing something really obvious here, but I am stuck. Using the deployment tool, I don't seem to have any possibility overwriting the existing ejb-jar file. I was also thinking, that the problem could be related to the fact that I haven't specified the CMP resource, yet, because I am not sure about the JNDI name of my MySQL installation. Could this be the problem?

Cheers,

N.

NetWundia at 2007-7-16 13:03:12 > top of Java-index,Java Essentials,New To Java...
# 7

Just a little update here: I opened the jar file now as a zip file and manually replaced hte existing ejb-jar.xml with my own. This seems to have worked - at least I get a different error message, from which I conclude that I have some progrees (if that's what you wanna call it). The new error message is a classNotFound exception. However, I have no idea what class the deployment tool is looking for. Here is the complete message and the log file exerpt. Sorry about the long message, but perhaps some can make something of this. Any help is greatly appreciated!

Best regards,

N. :

deployment started : 0%

Deploying application in domain failed; Error while running ejbc -- Fatal Error from EJB Compiler -- Caught javax.ejb.EJBException while processing CMP beans for application [myJar2]; module [E:\java\AppServer\domains\domain1\applications\j2ee-modules\myJar2]: nested exception is: javax.ejb.EJBException: nested exception is: java.lang.ClassNotFoundException: int. See log for details.

; requested operation cannot be completed

!!! Operation Failed !!!

!!! With The Following Failure Messages !!!

Deploying application in domain failed; Error while running ejbc -- Fatal Error from EJB Compiler -- Caught javax.ejb.EJBException while processing CMP beans for application [myJar2]; module [E:\java\AppServer\domains\domain1\applications\j2ee-modules\myJar2]: nested exception is: javax.ejb.EJBException: nested exception is: java.lang.ClassNotFoundException: int. See log for details.

; requested operation cannot be completed

Error while running ejbc -- Fatal Error from EJB Compiler -- Caught javax.ejb.EJBException while processing CMP beans for application [myJar2]; module [E:\java\AppServer\domains\domain1\applications\j2ee-modules\myJar2]: nested exception is: javax.ejb.EJBException: nested exception is: java.lang.ClassNotFoundException: int. See log for details.

[#|2005-11-26T00:02:20.070+0000|SEVERE|sun-appserver-pe8.1_02|javax.enterprise.system.tools.deployment|_ThreadID=13;|Exception occured in J2EEC Phase

com.sun.enterprise.deployment.backend.IASDeploymentException: Error while running ejbc -- Fatal Error from EJB Compiler -- Caught javax.ejb.EJBException while processing CMP beans for application [myJar2]; module [E:\java\AppServer\domains\domain1\applications\j2ee-modules\myJar2]: nested exception is: javax.ejb.EJBException: nested exception is: java.lang.ClassNotFoundException: int. See log for details.

at com.sun.ejb.codegen.CmpCompiler.compile(CmpCompiler.java:269)

at com.sun.ejb.codegen.IASEJBC.doCompile(IASEJBC.java:615)

at com.sun.ejb.codegen.IASEJBC.ejbc(IASEJBC.java:563)

at com.sun.enterprise.deployment.backend.EJBCompiler.preDeployModule(EJBCompiler.java:427)

at com.sun.enterprise.deployment.backend.EJBCompiler.compile(EJBCompiler.java:213)

at com.sun.enterprise.deployment.backend.ModuleDeployer.runEJBC(ModuleDeployer.java:967)

at com.sun.enterprise.deployment.backend.EjbModuleDeployer.deploy(EjbModuleDeployer.java:176)

at com.sun.enterprise.deployment.backend.ModuleDeployer.doRequestFinish(ModuleDeployer.java:140)

at com.sun.enterprise.deployment.phasing.J2EECPhase.runPhase(J2EECPhase.java:146)

at com.sun.enterprise.deployment.phasing.DeploymentPhase.executePhase(DeploymentPhase.java:71)

at com.sun.enterprise.deployment.phasing.PEDeploymentService.executePhases(PEDeploymentService.java:633)

at com.sun.enterprise.deployment.phasing.PEDeploymentService.deploy(PEDeploymentService.java:188)

at com.sun.enterprise.deployment.phasing.PEDeploymentService.deploy(PEDeploymentService.java:520)

at com.sun.enterprise.management.deploy.DeployThread.deploy(DeployThread.java:143)

at com.sun.enterprise.management.deploy.DeployThread.run(DeployThread.java:172)

NetWundia at 2007-7-16 13:03:12 > top of Java-index,Java Essentials,New To Java...
# 8

I managed to solve this problem now. It seems the underlying cause was an incompatiblity between the J2ee stuff I was usgin and the actual Java compiler. I was 1.5 for compiling the code and it didn't work. Then someone gave me a hint and I tried to compile with 1.4.2 and the deployment worked like a charme.

Cheers,

N.

NetWundia at 2007-7-16 13:03:12 > top of Java-index,Java Essentials,New To Java...