This week's book giveaway is in the OO, Patterns, UML and Refactoring forum.
We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma on-line!
See this thread for details.
The moose likes EJB and other Java EE Technologies and the fly likes try to solve cmp exception over weblogic8.1 Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

JavaRanch » Java Forums » Java » EJB and other Java EE Technologies
Bookmark "try to solve cmp exception over weblogic8.1" Watch "try to solve cmp exception over weblogic8.1" New topic

try to solve cmp exception over weblogic8.1

Abhishek Srivastava

Joined: Sep 29, 2005
Posts: 6
Hi all

I have created an ejb.jar while making connectivity with Oracle 9i database on weblogic server8.1 with following files

1. Remote interface

public interface EjbRemote extends EJBObject
public String getId() throws RemoteException;
public String getName() throws RemoteException;
public String getPosition() throws RemoteException;
public int getSalary() throws RemoteException;

2. Home interace

public interface EjbHome1 extends EJBHome
public EjbRemote create(String id,String name,String position,int salary)throws CreateException,RemoteException;
public EjbRemote findByPrimaryKey(String id)throws RemoteException,FinderException;

3. Bean class

public abstract class EjbBean implements EntityBean
public abstract void setId(String id);
public abstract void setPosition(String position);
public abstract void setName(String name);
public abstract void setSalary(int salary);

public abstract String getId();
public abstract String getName();
public abstract String getPosition();
public abstract int getSalary();

public String ejbCreate(String id,String name,String position,int salary)throws CreateException
System.out.println("MY CMP");
return null;

public void ejbPostCreate(String id,String name,String position,int salary)throws CreateException{}

public void ejbActivate()throws RemoteException{}

public void ejbPassivate()throws RemoteException{}

public void ejbStore()throws RemoteException{}

public void ejbLoad()throws RemoteException{}

public void ejbRemove()throws RemoteException{}

EntityContext ctx;

public void setEntityContext(EntityContext ctx)

public void unsetEntityContext()

4. client programmer

public class CmpClient
public static void main(String s[])
Properties prop=new Properties();
Context context=new InitialContext(prop);
Object object=context.lookup("abhi");
EjbHome1 home=(EjbHome1)PortableRemoteObject.narrow(object,EjbHome1.class);
EjbRemote remote=home.findByPrimaryKey("a01");
System.out.println("My id is:"+remote.getId());
System.out.println("My name is:"+remote.getName());
System.out.println("My position is:"+remote.getPosition());
System.out.println("My salary is:"+remote.getSalary());
catch(Exception c)


5. Now i put 3 xml's inside META_INF

a) ejb-jar.xml




b) weblogic-cmp-rdbms-jar.xml













Then i made connection pools with poolname as mypool
datasource as mydatasource
jndi-name as myjndi

and after compressing into entity.jar ,i deployed .
But the weblogic server throws following exception as :


--------------- nested within: ------------------ - with nested exception:
[ Prepare failed. Task Id = 0
Module: entity Error: [EJB:011024]The XML parser encountered an error i
n your deployment descriptor. Please ensure that your deployment descriptor corr
esponds to the format in the DTD. The error was:
Error parsing file 'META-INF/weblogic-ejb-jar.xml' at line: 42 column: 30. The
content of element type "weblogic-enterprise-bean" must match "(ejb-name,(entit

at weblogic.drs.internal.SlaveCallbackHandler$1.execute(SlaveCallbackHan
at weblogic.kernel.ExecuteThread.execute(

Now plz tell me where i made it wrong.I given lt as you told but it throws exception .

Plz Try to solve it.


[ February 11, 2006: Message edited by: Mr. java srivastava ]

[ February 11, 2006: Message edited by: Mr. java srivastava ]
[ February 12, 2006: Message edited by: Mr. java srivastava ]
Marko Sibakov

Joined: Feb 09, 2006
Posts: 4
I looked your persistence definitons very quickly and it seems that you have wrong tag name in weblogic-ejb-jar.xml


shoud be


More info from

Please tell me if this solve your problem.

Marko Sibakov<br />Chief Architect<br />Reaktor Innovations Oy
I agree. Here's the link:
subject: try to solve cmp exception over weblogic8.1
It's not a secret anymore!