This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
The moose likes EJB and other Java EE Technologies and the fly likes Problem in deploying Entity Bean Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » EJB and other Java EE Technologies
Bookmark "Problem in deploying Entity Bean" Watch "Problem in deploying Entity Bean" New topic
Author

Problem in deploying Entity Bean

Rana Aich
Greenhorn

Joined: Oct 08, 2003
Posts: 3
Hi All,
I'm newbie in EJB and JBOSS. I'm working on jboss-3.2.2RC4. I'm having a very basic problem in deploying Entity Bean using CMP2.0.
My JBOSS gives the following warning, and then fails to deploy the *.ear file:
---------------------------------------------------------------------------
12:17:18,619 INFO [EARDeployer] Init J2EE application: file:/D:/JBOSS3.2/jboss-3.2.2RC4/server/default/deploy/po.ear
12:17:19,440 WARN [verifier] EJB spec violation:
Bean : EmployeeBean
Section: 10.6.2
Warning: The entity bean's class must implement, directly or indirectly, the javax.ejb.EntityBean interface.
12:17:19,451 WARN [verifier] EJB spec violation:
Bean : EmployeeBean
Section: 10.6.2
Warning: The entity bean class must define a public constructor that takes no arguments.
12:17:19,461 ERROR [MainDeployer] could not create deployment: file:/D:/JBOSS3.2/jboss-3.2.2RC4/server/default/tmp/deploy/tmp4055po.ear-contents/po.jar
org.jboss.deployment.DeploymentException: Verification of Enterprise Beans failed, see above for error messages.
at org.jboss.ejb.EJBDeployer.create(EJBDeployer.java:490)
at org.jboss.deployment.MainDeployer.create(MainDeployer.java:776)
----------------------------------------------------------------------
I'm unable to find any clue on the web.
Thanks in advance for the prompt help.
Sri Basavanahally
Ranch Hand

Joined: Oct 07, 2003
Posts: 75
Hi !
Make sure your Entity bean implementation class implements the EntityBean interface - your first warning
Make sure you have matched each create method in the home interface with one ejbCreate() and one ejbPostCreate() method in the implmentation class. The args have to match as well.
Try these two first
-Sri


UP THE IRONS !
Rana Aich
Greenhorn

Joined: Oct 08, 2003
Posts: 3
Thanks for reply. I have compared my EmployeeBean.java with the Oriely Workbook Titan example and looked okay.
Well, here is the EmployeeBean.java for your perusal:
-----------------------------------------------------
package com.nri.po.ejb;
import javax.ejb.EntityBean;
import javax.ejb.EntityContext;
import javax.ejb.CreateException;
/**
* CMP bean for Employee record
*/
public abstract class EmployeeBean implements EntityBean {
/*
* Unlike in 1.0 and 1.1, there is no need to define the context or CMP fields as attributes in 2.x
*
* However, we need to define the Accessor/Mutator methods for CMP fields -
* a) These methods must be abstract, as the implementation will be provided by Container provider
* b) Unlike the local interface, here we MUST have the setter methods also for the read-only fields.
*/
public abstract String getFirstname();
public abstract void setFirstname(String s);
public abstract String getLastname();
public abstract void setLastname(String s);
public abstract String getIdentifier();
public abstract void setIdentifier(String s);
public abstract String getPassword();
public abstract void setPassword(String s);

//Lifecycle Methods for EJB Container
/**
* Associate this bean instance with a particular context.
* Once done, we can quiery the Context for environment info via properties.
* @param EntityContext
*/
public void setEntityContext(EntityContext ctx) {}
/**
* Disassociate this bean instance with a particular context.
*/
public void unsetEntityContext() {}
/**
* Called after activating this instance.
* Placeholder - should acquire needed resource here.
*/
public void ejbActivate() {}
/**
* Called before passivating this instance.
* Placeholder - should release any acquired resources here.
*/
public void ejbPassivate() {}
/**
* Save values to DB.
* Placeholder - should do any needed pre-processing here.
*/
public void ejbStore() {}
/**
* Load values from DB.
* Placeholder - should do any needed post-processing here.
*/
public void ejbLoad() {}
/**
* To create a new record.
* We just take in the firstname, lastname, identifier and password.
* @param String firstname
* @param String lastname
* @param String identifier
* @param String password
* @return String - must return 'null' primary key class
* @throws CreateException
*/
public String ejbCreate(String firstname, String lastname, String identifier, String password)
throws CreateException {
setFirstname(firstname);
setLastname(lastname);
setIdentifier(identifier);
setPassword(password);
return null;
}
/**
* To associate the newly created record with its own EJBObject.
* Placeholder - should do any needed post-processing here.
* @param String firstname
* @param String lastname
* @param String identifier
* @param String password
* @throws CreateException
*/
public void ejbPostCreate(String firstname, String lastname, String identifier, String password)
throws CreateException {
}
/**
* To delete record from DB.
*/
public void ejbRemove() {}
}
Rana Aich
Greenhorn

Joined: Oct 08, 2003
Posts: 3
Hi All,
Please ignore this problem statement. Infact I have solved it just now. It was nothing but a problem of wrong entry in ejb-jar.xml .
Thanks.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Problem in deploying Entity Bean
 
Similar Threads
Problem Deploying in jboss3.2
JNDI name not found error!!
EJB deployment problems.
Deploying entity beans with Local Interfaces
HowTo: Advice Bean deployed on JBoss