• 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
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Problem in deploying Entity Bean

 
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
Ranch Hand
Posts: 75
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
Rana Aich
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 3
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic