This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes EJB and other Java EE Technologies and the fly likes CMP Bean deployment problem Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » EJB and other Java EE Technologies
Bookmark "CMP Bean deployment problem" Watch "CMP Bean deployment problem" New topic
Author

CMP Bean deployment problem

Michael Daines
Greenhorn

Joined: Oct 29, 2002
Posts: 4
First, here's my environment: MS WindowsXP - Home, JDK 1.4.1_03, J2EE 1.3.1. I'm using the reference implementation for my work here.
I am trying to deploy several CMP beans. To date, I've only been able to deploy one stateless session bean, to give you an idea of my experience (yes, this is for a class). This problem happens to me even with the downloaded examples from the O'Reilly Enterprise JavaBeans book, following their example.
When I try to verify the beans, the last step before deployment, I get the following results from the verifier:
Test Name : tests.ejb.entity.TransactionDemarcationHomeInterface
Result : FAILED
Details :
For [CabinEJB]
Error: Transaction attributes must be specified for the methods defined in the home interface [com.daines.titan.cabin.CabinHome]. Method [create] has no transaction attribute defined within this bean [CabinEJB].
?!?!?!?
Now, my interpretation of this is that I've not implemented a create() method. In my xxxHome interface, I have the create() method, and in xxxBean I have a corresponding ejbCreate() method with the same parameters.
I can post my code if necessary, but I have the sinking feeling that this is some sort of environment or set-up issue, and not a problem with the code. If anyone can give me some insight into what the problem is and how to solve it, it would be much appreciated.
Thanx,
msd
Chris Mathews
Ranch Hand

Joined: Jul 18, 2001
Posts: 2712
This looks like a deployment descriptor issue. Post your ejb-jar.xml if you would like more detailed feedback...
Michael Daines
Greenhorn

Joined: Oct 29, 2002
Posts: 4
Sorry if this is a bit long, but I wasn't sure what to exclude.
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE ejb-jar PUBLIC '-//Sun Microsystems, Inc.//DTD Enterprise JavaBeans 2.0//EN' 'http://java.sun.com/dtd/ejb-jar_2_0.dtd'>
<ejb-jar>
<display-name>CabinEJB</display-name>
<enterprise-beans>
<entity>
<display-name>CabinEJB</display-name>
<ejb-name>CabinEJB</ejb-name>
<home>com.daines.titan.cabin.CabinHome</home>
<remote>com.daines.titan.cabin.Cabin</remote>
<ejb-class>com.daines.titan.cabin.CabinBean</ejb-class>
<persistence-type>Container</persistence-type>
<prim-key-class>java.lang.Integer</prim-key-class>
<reentrant>False</reentrant>
<cmp-version>2.x</cmp-version>
<abstract-schema-name>Cabin</abstract-schema-name>
<cmp-field>
<description>no description</description>
<field-name>bedCount</field-name>
</cmp-field>
<cmp-field>
<description>no description</description>
<field-name>shipID</field-name>
</cmp-field>
<cmp-field>
<description>no description</description>
<field-name>cabinName</field-name>
</cmp-field>
<cmp-field>
<description>no description</description>
<field-name>deckLevel</field-name>
</cmp-field>
<cmp-field>
<description>no description</description>
<field-name>cabinID</field-name>
</cmp-field>
<primkey-field>cabinID</primkey-field>
<security-identity>
<description></description>
<use-caller-identity></use-caller-identity>
</security-identity>
</entity>
</enterprise-beans>
<assembly-descriptor>
<method-permission>
<unchecked />
<method>
<ejb-name>CabinEJB</ejb-name>
<method-intf>Remote</method-intf>
<method-name>setBedCount</method-name>
<method-params>
<method-param>int</method-param>
</method-params>
</method>
<method>
<ejb-name>CabinEJB</ejb-name>
<method-intf>Remote</method-intf>
<method-name>getShipID</method-name>
<method-params />
</method>
<method>
<ejb-name>CabinEJB</ejb-name>
<method-intf>Home</method-intf>
<method-name>findByPrimaryKey</method-name>
<method-params>
<method-param>java.lang.Integer</method-param>
</method-params>
</method>
<method>
<ejb-name>CabinEJB</ejb-name>
<method-intf>Remote</method-intf>
<method-name>getHandle</method-name>
<method-params />
</method>
<method>
<ejb-name>CabinEJB</ejb-name>
<method-intf>Remote</method-intf>
<method-name>setShipID</method-name>
<method-params>
<method-param>int</method-param>
</method-params>
</method>
<method>
<ejb-name>CabinEJB</ejb-name>
<method-intf>Remote</method-intf>
<method-name>getPrimaryKey</method-name>
<method-params />
</method>
<method>
<ejb-name>CabinEJB</ejb-name>
<method-intf>Home</method-intf>
<method-name>getEJBMetaData</method-name>
<method-params />
</method>
<method>
<ejb-name>CabinEJB</ejb-name>
<method-intf>Remote</method-intf>
<method-name>remove</method-name>
<method-params />
</method>
<method>
<ejb-name>CabinEJB</ejb-name>
<method-intf>Remote</method-intf>
<method-name>setDeckLevel</method-name>
<method-params>
<method-param>int</method-param>
</method-params>
</method>
<method>
<ejb-name>CabinEJB</ejb-name>
<method-intf>Home</method-intf>
<method-name>remove</method-name>
<method-params>
<method-param>javax.ejb.Handle</method-param>
</method-params>
</method>
<method>
<ejb-name>CabinEJB</ejb-name>
<method-intf>Home</method-intf>
<method-name>getHomeHandle</method-name>
<method-params />
</method>
<method>
<ejb-name>CabinEJB</ejb-name>
<method-intf>Remote</method-intf>
<method-name>setCabinID</method-name>
<method-params>
<method-param>java.lang.Integer</method-param>
</method-params>
</method>
<method>
<ejb-name>CabinEJB</ejb-name>
<method-intf>Remote</method-intf>
<method-name>setCabinName</method-name>
<method-params>
<method-param>java.lang.String</method-param>
</method-params>
</method>
<method>
<ejb-name>CabinEJB</ejb-name>
<method-intf>Remote</method-intf>
<method-name>isIdentical</method-name>
<method-params>
<method-param>javax.ejb.EJBObject</method-param>
</method-params>
</method>
<method>
<ejb-name>CabinEJB</ejb-name>
<method-intf>Home</method-intf>
<method-name>create</method-name>
<method-params>
<method-param>java.lang.Integer</method-param>
</method-params>
</method>
<method>
<ejb-name>CabinEJB</ejb-name>
<method-intf>Home</method-intf>
<method-name>remove</method-name>
<method-params>
<method-param>java.lang.Object</method-param>
</method-params>
</method>
<method>
<ejb-name>CabinEJB</ejb-name>
<method-intf>Remote</method-intf>
<method-name>getDeckLevel</method-name>
<method-params />
</method>
<method>
<ejb-name>CabinEJB</ejb-name>
<method-intf>Remote</method-intf>
<method-name>getBedCount</method-name>
<method-params />
</method>
<method>
<ejb-name>CabinEJB</ejb-name>
<method-intf>Remote</method-intf>
<method-name>getCabinName</method-name>
<method-params />
</method>
<method>
<ejb-name>CabinEJB</ejb-name>
<method-intf>Remote</method-intf>
<method-name>getCabinID</method-name>
<method-params />
</method>
<method>
<ejb-name>CabinEJB</ejb-name>
<method-intf>Remote</method-intf>
<method-name>getEJBHome</method-name>
<method-params />
</method>
</method-permission>
<container-transaction>
<method>
<ejb-name>CabinEJB</ejb-name>
<method-intf>Remote</method-intf>
<method-name>setShipID</method-name>
<method-params>
<method-param>int</method-param>
</method-params>
</method>
<trans-attribute>Required</trans-attribute>
</container-transaction>
<container-transaction>
<method>
<ejb-name>CabinEJB</ejb-name>
<method-intf>Remote</method-intf>
<method-name>setDeckLevel</method-name>
<method-params>
<method-param>int</method-param>
</method-params>
</method>
<trans-attribute>Required</trans-attribute>
</container-transaction>
<container-transaction>
<method>
<ejb-name>CabinEJB</ejb-name>
<method-intf>Remote</method-intf>
<method-name>getCabinID</method-name>
<method-params />
</method>
<trans-attribute>Required</trans-attribute>
</container-transaction>
<container-transaction>
<method>
<ejb-name>CabinEJB</ejb-name>
<method-intf>Remote</method-intf>
<method-name>setCabinID</method-name>
<method-params>
<method-param>java.lang.Integer</method-param>
</method-params>
</method>
<trans-attribute>Required</trans-attribute>
</container-transaction>
<container-transaction>
<method>
<ejb-name>CabinEJB</ejb-name>
<method-intf>Remote</method-intf>
<method-name>getDeckLevel</method-name>
<method-params />
</method>
<trans-attribute>Required</trans-attribute>
</container-transaction>
<container-transaction>
<method>
<ejb-name>CabinEJB</ejb-name>
<method-intf>Remote</method-intf>
<method-name>getCabinName</method-name>
<method-params />
</method>
<trans-attribute>Required</trans-attribute>
</container-transaction>
<container-transaction>
<method>
<ejb-name>CabinEJB</ejb-name>
<method-intf>Remote</method-intf>
<method-name>getShipID</method-name>
<method-params />
</method>
<trans-attribute>Required</trans-attribute>
</container-transaction>
<container-transaction>
<method>
<ejb-name>CabinEJB</ejb-name>
<method-intf>Remote</method-intf>
<method-name>remove</method-name>
<method-params />
</method>
<trans-attribute>Required</trans-attribute>
</container-transaction>
<container-transaction>
<method>
<ejb-name>CabinEJB</ejb-name>
<method-intf>Remote</method-intf>
<method-name>setCabinName</method-name>
<method-params>
<method-param>java.lang.String</method-param>
</method-params>
</method>
<trans-attribute>Required</trans-attribute>
</container-transaction>
<container-transaction>
<method>
<ejb-name>CabinEJB</ejb-name>
<method-intf>Remote</method-intf>
<method-name>setBedCount</method-name>
<method-params>
<method-param>int</method-param>
</method-params>
</method>
<trans-attribute>Required</trans-attribute>
</container-transaction>
<container-transaction>
<method>
<ejb-name>CabinEJB</ejb-name>
<method-intf>Remote</method-intf>
<method-name>getBedCount</method-name>
<method-params />
</method>
<trans-attribute>Required</trans-attribute>
</container-transaction>
</assembly-descriptor>
</ejb-jar>
Karthik Guru
Ranch Hand

Joined: Mar 06, 2001
Posts: 1209


Details :
For [CabinEJB]
Error: Transaction attributes must be specified for the methods defined in the home interface [com.daines.titan.cabin.CabinHome]. Method [create] has no transaction attribute defined within this bean [CabinEJB].
?!?!?!?

[QB]
Now, my interpretation of this is that I've not implemented a create() method. In my xxxHome interface, I have the create() method, and in xxxBean I have a corresponding ejbCreate() method with the same parameters.


No i dont think the error means that. Infact the error means exactly what it reports.



Details :
For [CabinEJB]
Error: Transaction attributes must be specified for the methods defined in the home interface [com.daines.titan.cabin.CabinHome]. Method [create] has no transaction attribute defined within this bean [CabinEJB].


For a CMP entity bean, you must define a transaction attribute for
1. Methods in the remote interface ( i mean all the business methods like setDeckLevel() etc)
2. create() and find<METHOD> in the home interface
that you w'd have defined.
3. remove() in EJBHome and EJBObject.
Let me not talk about new ejbHome methods now.
From your descriptor it is clear that you have defined the attributes for case 1) ie all business methods in the remote interface.
But 2) & 3) are still left!
Why dont use the wildcard "*" to specify a transaction attribute for all the methods.
You can then override the attribute for some specific methods if you chose to.
You can just have :
<container-transaction>
<method>
<ejb-name>CabinEJB</ejb-name>
<method-name>*</method-name>
</method>
<trans-attribute>Required</transaction-attribute>
</container-transaction>

This associates a transaction attribute of "required" with all the methods.
In case you want to specify a different transaction attribute for any of the methods , you can override it later ( the way you have done it in the descriptor). ie you can have
<container-transaction>
<method>
<ejb-name>CabinEJB</ejb-name>
<method-name>getCabinName</method-name>
</method>
<trans-attribute>NotSupported</transaction-attribute>
</container-transaction>
which means that getCabinName does not support or execute in a transaction ( even if the calling code has some transaction associated with it).
while others run under "Required" attribute.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: CMP Bean deployment problem
 
Similar Threads
My SCEA Part 1Study Notes
Exam Details
My Study Notes
Generating CMP Entity Beans
impossible to solve FinderException