File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes BEA/Weblogic and the fly likes Cant deploy the entity bean Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Products » BEA/Weblogic
Bookmark "Cant deploy the entity bean" Watch "Cant deploy the entity bean" New topic
Author

Cant deploy the entity bean

Pappu Kumar
Ranch Hand

Joined: Oct 01, 2002
Posts: 69
I am using Weblogic 6.0. And cant deploy a simple entity bean.
I am attaching the source for all my files.
Kindly tell me if there is anything wrong in the Java files or the XML files.
----
package com.titan.cabin;
import java.rmi.RemoteException;
public interface CabinRemote extends javax.ejb.EJBObject {
public String getName() throws RemoteException;
public void setName(String str) throws RemoteException;
public int getDeckLevel() throws RemoteException;
public void setDeckLevel(int level) throws RemoteException;
public int getShipId() throws RemoteException;
public void setShipId(int sp) throws RemoteException;
public int getBedCount() throws RemoteException;
public void setBedCount(int bc) throws RemoteException;
}
--------
package com.titan.cabin;
import java.rmi.RemoteException;
import javax.ejb.CreateException;
import javax.ejb.FinderException;
public interface CabinHomeRemote extends javax.ejb.EJBHome {
public CabinRemote create(Integer id)
throws CreateException, RemoteException;
public CabinRemote findByPrimaryKey(Integer pk)
throws FinderException, RemoteException;
}
-------
package com.titan.cabin;
import javax.ejb.EntityContext;
public class CabinBean implements javax.ejb.EntityBean {
public Integer id;
public String name;
public int deckLevel;
public int shipId;
public int bedCount;

public Integer ejbCreate(Integer id) {
this.id = id;
return null;
}
public void ejbPostCreate(Integer id) {
// Do nothing. Required.
}
public String getName() {
return name;
}
public void setName(String str) {
name = str;
}
public int getShipId() {
return shipId;
}
public void setShipId(int sp) {
shipId = sp;
}
public int getBedCount() {
return bedCount;
}
public void setBedCount(int bc) {
bedCount = bc;
}
public int getDeckLevel() {
return deckLevel;
}
public void setDeckLevel(int level ) {
deckLevel = level;
}
public void setEntityContext(EntityContext ctx) {
// Not implemented.
}
public void unsetEntityContext() {
// Not implemented.
}
public void ejbActivate() {
// Not implemented.
}
public void ejbPassivate() {
// Not implemented.
}
public void ejbLoad() {
// Not implemented.
}
public void ejbStore() {
// Not implemented.
}
public void ejbRemove() {
// Not implemented.
}
}
----------
<?xml version="1.0"?>
<!DOCTYPE weblogic-ejb-jar PUBLIC '-//BEA Systems, Inc.//DTD WebLogic 5.1.0 EJB//EN' 'http://www.bea.com/servers/wls510/dtd/weblogic-ejb-jar.dtd'>
<weblogic-ejb-jar>
<weblogic-enterprise-bean>
<ejb-name>CabinEJB</ejb-name>
<caching-descriptor>
<max-beans-in-cache>1000</max-beans-in-cache>
</caching-descriptor>
<persistence-descriptor>
<is-modified-method-name>isModified</is-modified-method-name>
<persistence-type>
<type-identifier>WebLogic_CMP_RDBMS</type-identifier>
<type-version>5.1.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>5.1.0</type-version>
</persistence-use>
</persistence-descriptor>
<jndi-name>CabinHomeRemote</jndi-name>
</weblogic-enterprise-bean>
</weblogic-ejb-jar>
------------
<?xml version="1.0"?>
<!DOCTYPE ejb-jar PUBLIC '-//Sun Microsystems, Inc.//DTD Enterprise JavaBeans 1.1//EN' 'http://java.sun.com/j2ee/dtds/ejb-jar_1_1.dtd'>
<ejb-jar>
<enterprise-beans>
<entity>
<ejb-name>CabinEJB</ejb-name>
<home>com.titan.cabin.CabinHomeRemote</home>
<remote>com.titan.cabin.CabinRemote</remote>
<ejb-class>com.titan.cabin.CabinBean</ejb-class>
<persistence-type>Container</persistence-type>
<prim-key-class>java.lang.Integer</prim-key-class>
<reentrant>False</reentrant>
<cmp-field><field-name>id</field-name></cmp-field>
<cmp-field><field-name>name</field-name></cmp-field>
<cmp-field><field-name>deckLevel</field-name></cmp-field>
<cmp-field><field-name>shipId</field-name></cmp-field>
<cmp-field><field-name>bedCount</field-name></cmp-field>
<primkey-field>id</primkey-field>
</entity>
</enterprise-beans>
<assembly-descriptor>
<container-transaction>
<method>
<ejb-name>CabinEJB</ejb-name>
<method-intf>Remote</method-intf>
<method-name>*</method-name>
</method>
<trans-attribute>Required</trans-attribute>
</container-transaction>
</assembly-descriptor>
</ejb-jar>
---------
<!DOCTYPE weblogic-rdbms-bean PUBLIC
'-//BEA Systems, Inc.//DTD WebLogic 5.1.0 EJB RDBMS Persistence//EN'
'http://www.bea.com/servers/wls510/dtd/weblogic-rdbms-persistence.dtd'>

<weblogic-rdbms-bean>
<ejb-name>CabinEJB</ejb-name>
<table-name>CABIN</table-name>
<field-map>
<cmp-field>id</cmp-field>
<dbms-column>ID</dbms-column>
</field-map>
<field-map>
<cmp-field>shipId</cmp-field>
<dbms-column>SHIP_ID</dbms-column>
</field-map>
<field-map>
<cmp-field>bedCount</cmp-field>
<dbms-column>BED_COUNT</dbms-column>
</field-map>
<field-map>
<cmp-field>name</cmp-field>
<dbms-column>NAME</dbms-column>
</field-map>
<field-map>
<cmp-field>deckLevel</cmp-field>
<dbms-column>DECK_LEVEL</dbms-column>
</field-map>
</weblogic-rdbms-bean>
-----------
Please Help
Simon Brown
sharp shooter, and author
Ranch Hand

Joined: May 10, 2000
Posts: 1913
    
    6
Hi there, is there any specific problem that you have, or any error messages you've seen? Moving this to the WebLogic forum since you're having problems with WLS 6...
Also, thanks for joining JavaRanch, but could you just take a quick look at the naming policy and edit your profile accordingly.
Thanks!
Simon
Bartender (moderator) of "J2EE and EJB" forum
Rahul Mahindrakar
Ranch Hand

Joined: Jul 28, 2000
Posts: 1851
PappuPager is not a valid name at all. Please re-register before your name gets blocked.
As simon stated if you can state the error message you are getting that will be helpful.
Pappu Kumar
Ranch Hand

Joined: Oct 01, 2002
Posts: 69
When i do ejbc this is what i get.
C:\project>java weblogic.ejbc cabin.jar Cabin1.jar
<Oct 1, 1998 9:08:05 PM EDT> <Error> <EJB> <EJB Deployment: CabinEJB has a class com.titan.cabin.CabinBean which is in the classpath. This class should only be located in the ejb-jar file.>
<Oct 1, 1998 9:08:05 PM EDT> <Error> <EJB> <EJB Deployment: CabinEJB has a class com.titan.cabin.CabinHomeRemote which is in the classpath. This class should only be located in the ejb-jar file.>
<Oct 1, 1998 9:08:05 PM EDT> <Error> <EJB> <EJB Deployment: CabinEJB has a class com.titan.cabin.CabinRemote which is in the classpath. This class should only be located in the ejb-jar file.>
Rahul Mahindrakar
Ranch Hand

Joined: Jul 28, 2000
Posts: 1851
What I would recommend is that you check up your classpath. It looks like you already have the bean in the server classpath and this is causing the problem you are encountering.
Check up you setenv.bat file or do a search "containing text" for your package structure com.titan.cabin in the c:\bea folder.
Dave Landers
Ranch Hand

Joined: Jul 24, 2002
Posts: 401
This message is usually just a warning, and should not cause a deployment failure.
It means exactly what it says - you are deploying an ejb jar but the same classes are also in CLASSPATH.
One reason this might be a problem is maybe the version in CLASSPATH is different and so the ejb would not work correctly.
But usually, the only effect is that you will not be able to redeploy ("hot deploy") the bean because weblogic will be unable to replace classes when they are "anchored" in the system classpath.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Cant deploy the entity bean