Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Jboss doesn't deploy CMP entity bean because the bean is defined as abstract????

 
Vili Leonardo
Greenhorn
Posts: 18
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
When I deploy the following CMP entity bean, Jboss complains that it should not be declared as Abstract class. Can anyone show me what I did wrong? I thought the ejb spec says that the CMP entity bean must be defined as abstract??? Thanks
Here is the class definition:
public abstract class EntityUserBean implements EntityBean {

private EntityContext context;

public String getID(){
return this.getIdXX();
}

public abstract String getIdXX();
public abstract void setIdXX(String id);

public void setEntityContext(EntityContext ctx){
context = ctx;
}
public void unsetEntityContext(){ }
public void ejbLoad() {}
public void ejbStore() { }
public void ejbActivate(){}
public void ejbPassivate(){}
public void ejbRemove(){}

}
ejb-jar.xml:
<entity>
<ejb-name>User</ejb-name>
<local-home>com.ejb.EntityUserHome</local-home>
<local>com.ejb.EntityUser</local>
<ejb-class>com.ejb.EntityUserBean</ejb-class>
<abstract-schema-name>UserSchema</abstract-schema-name>
<persistence-type>Container</persistence-type>
<cmp-version>2.x</cmp-version>
<reentrant>False</reentrant>
<prim-key-class>java.lang.String</prim-key-class>
<cmp-field>
<field-name>idXX</field-name>
</cmp-field>
<primkey-field>idXX</primkey-field>
</entity>
standardjbosscmp-jdbc.xml:
<enterprise-beans>
<entity>
<ejb-name>User</ejb-name>
<table-name>Customerid</table-name>
<cmp-field>
<field-name>idXX</field-name>
<not-null/>
</cmp-field>
</entity>
</enterprise-beans>
 
Don Griffing
Ranch Hand
Posts: 33
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I noticed that you have:

It should be:

for your CMP entity beans.
 
Vili Leonardo
Greenhorn
Posts: 18
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
the <ejb-class> element should point to the fully qualified bean class. My bean is called EntityUserBean not EntityUserBeanCMP.
 
Vili Leonardo
Greenhorn
Posts: 18
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have found out what causes the error. The ejb-jar.xml dtd is default to ejb spec 1.1. After I change the dtd to 2.0 everything is fine.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic