• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • Liutauras Vilda
  • Jeanne Boyarsky
  • paul wheaton
Sheriffs:
  • Ron McLeod
  • Devaka Cooray
  • Henry Wong
Saloon Keepers:
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Tim Moores
  • Mikalai Zaikin
Bartenders:
  • Frits Walraven

CMP Bean deployment problem

 
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
Ranch Hand
Posts: 2713
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
This looks like a deployment descriptor issue. Post your ejb-jar.xml if you would like more detailed feedback...
 
Michael Daines
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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>
 
Ranch Hand
Posts: 1209
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator



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.

 
The fastest and most reliable components of any system are those that are not there. Tiny ad:
Gift giving made easy with the permaculture playing cards
https://coderanch.com/t/777758/Gift-giving-easy-permaculture-playing
reply
    Bookmark Topic Watch Topic
  • New Topic