This week's book giveaway is in the Performance forum.
We're giving away four copies of The Java Performance Companion and have Charlie Hunt, Monica Beckwith, Poonam Parhar, & Bengt Rutisson on-line!
See this thread for details.
Win a copy of The Java Performance Companion this week in the Performance forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Deploying Entity Bean

 
Uma Lade
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Guys,

Im on the way of learning EJB and trying to deploy Entity beans. The app server is Weblogic 8.1.0.

Im getting the following error msg when Im trying to deploy the bean.

"Exception:weblogic.management.ApplicationException: Prepare failed. Task Id = 0 Module: CMPEntity Error: [EJB:011024]The XML parser encountered an error in your deployment descriptor. Please ensure that your deployment descriptor corresponds to the format in the DTD. The error was: Error parsing file 'META-INF/weblogic-ejb-jar.xml' at line: 12 column: 28. Element type "persistence-type" must be declared..

[Deployer:149033]preparing application CMPEntity on myserver
[Deployer:149033]failed application CMPEntity on myserver
[Deployer:149034]An exception occurred for task [Deployer:149026]Deploy application CMPEntity on myserver.: Exception:weblogic.management.ApplicationException: Prepare failed. Task Id = 0 Module: CMPEntity Error: [EJB:011024]The XML parser encountered an error in your deployment descriptor. Please ensure that your deployment descriptor corresponds to the format in the DTD. The error was: Error parsing file 'META-INF/weblogic-ejb-jar.xml' at line: 12 column: 28. Element type "persistence-type" must be declared.. ."

But my weblogic-ejb-jar.xml has the element <persistence-type>. The contents of my weblogic-ejb-jar.xml are given below.

<?xml version="1.0"?>
<!DOCTYPE weblogic-ejb-jar PUBLIC "-//BEA Systems, Inc.//DTD WebLogic 8.1.0 EJB//EN" "http://www.bea.com/servers/wls810/dtd/weblogic-ejb-jar.dtd">

<weblogic-ejb-jar>
<weblogic-enterprise-bean>
<ejb-name>EntityCMP</ejb-name>
<entity-descriptor>
<entity-cache>
<max-beans-in-cache>1000</max-beans-in-cache>
</entity-cache>
<persistence>
<persistence-type>
<type-identifier>WebLogic_CMP_RDBMS</type-identifier>
<type-version>7.0</type-version>
<type-storage>META-INF/weblogic-cmp-rdbms-jar.xml</type-storage>
</persistence-type>
<persistence-use>
<type-identifier>WebLogic_CMP_RDBMS</type-identifier>
<type-version>7.0</type-version>
</persistence-use>
</persistence>
</entity-descriptor>
<enable-call-by-reference>True</enable-call-by-reference>
<jndi-name>EntityCMPHome</jndi-name>
</weblogic-enterprise-bean>
</weblogic-ejb-jar>


Could anyone pls help me resolving this.
Thanks in advance.

Uma
 
johnone wilsonone
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
There are more appropiate forums that might be able to answer your question better.

But seems like your deployment consttructor is ill formed...
 
Dan Drillich
Ranch Hand
Posts: 1183
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Uma,

I just installed Weblogic 8.1.0 on my laptop and it comes with several nice working EJB examples.
The container managed example has the following weblogic-ejb-jar.xml file:



As you can see, the example uses the <persistence-use> element and not the <persistence-type> one.

If you look at the http://www.bea.com/servers/wls810/dtd/weblogic-ejb-jar.dtd file, you'll notice that only persistence-use exists there.

Regards,
Dan
 
Dan Drillich
Ranch Hand
Posts: 1183
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Uma,

It seems that BEA deviates here from Sun dtds.

If you look at the http://java.sun.com/dtd/ejb-jar_2_0.dtd file, you'll only see the persistence-type element.

Same is true about the deployment descriptor example at the bottom of this page http://java.sun.com/developer/onlineTraining/EJBIntro/EJBIntro.html.

Regards,
Dan
 
Dan Drillich
Ranch Hand
Posts: 1183
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
This excellent tutorial by Sun http://java.sun.com/developer/onlineTraining/EJBIntro/EJBIntro.html says:

This is a good example of a fairly simple CMP entity bean. Notice that there is no database access logic in the bean. This is because the EJB vendor provides tools for mapping the fields in the CustomerBean to the database.


Since the mapping is, by definition, a vendor specific implementation, no wonder that BEA has its own XML structure to define the persistence.

Regards,
Dan
 
Ajith Kallambella
Sheriff
Posts: 5782
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You might find more help on this issue in our BEA/Weblogic forum. I'm sliding this topic over there...
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic