wood burning stoves*
The moose likes EJB and other Java EE Technologies and the fly likes A Simple CMP Bean deployment problem in Bea WebLogic 8.0 Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of OCM Java EE 6 Enterprise Architect Exam Guide this week in the OCMJEA forum!
JavaRanch » Java Forums » Java » EJB and other Java EE Technologies
Bookmark "A Simple CMP Bean deployment problem in Bea WebLogic 8.0" Watch "A Simple CMP Bean deployment problem in Bea WebLogic 8.0" New topic
Author

A Simple CMP Bean deployment problem in Bea WebLogic 8.0

Caesar Dutta
Ranch Hand

Joined: Sep 18, 2004
Posts: 30
Hi everybody:

I have followed the example AccountBean that comes with Bea Weblogic.

In the file "weblogic-cmp-rdbms-jar.xml" I have used the
JNDI name for Data Source for the tag "data-source-name.

For reference I giving below the xml files:-

ejb-jar.xml
------------
<?xml version="1.0"?>

<!DOCTYPE ejb-jar PUBLIC
"-//Sun Microsystems, Inc.//DTD Enterprise JavaBeans 2.0//EN"
"http://java.sun.com/dtd/ejb-jar_2_0.dtd">

<ejb-jar>
<enterprise-beans>
<entity>
<ejb-name>containerManaged</ejb-name>
<home>examples.ejb20.basic.containerManaged.AccountHome</home>
<remote>examples.ejb20.basic.containerManaged.Account</remote>
<ejb-class>examples.ejb20.basic.containerManaged.AccountBean</ejb-class>
<persistence-type>Container</persistence-type>
<prim-key-class>java.lang.String</prim-key-class>
<reentrant>False</reentrant>
<cmp-version>2.x</cmp-version>
<abstract-schema-name>AccountBean</abstract-schema-name>
<cmp-field>
<field-name>accountId</field-name>
</cmp-field>
<cmp-field>
<field-name>balance</field-name>
</cmp-field>
<cmp-field>
<field-name>accountType</field-name>
</cmp-field>
<primkey-field>accountId</primkey-field>
<query>
<query-method>
<method-name>findBigAccounts</method-name>
<method-params>
<method-param>double</method-param>
</method-params>
</query-method>
<ejb-ql>
<![CDATA[SELECT OBJECT(a) FROM AccountBean AS a WHERE a.balance > ?1]]>
</ejb-ql>
</query>
<query>
<query-method>
<method-name>findAccount</method-name>
<method-params>
<method-param>double</method-param>
</method-params>
</query-method>
<ejb-ql>
<![CDATA[SELECT OBJECT(a) FROM AccountBean AS a WHERE a.balance = ?1]]>
</ejb-ql>
</query>
<query>
<query-method>
<method-name>findNullAccounts</method-name>
<method-params>
</method-params>
</query-method>
<ejb-ql>
<![CDATA[SELECT OBJECT(a) FROM AccountBean AS a WHERE a.accountType IS NULL]]>
</ejb-ql>
</query>
</entity>
</enterprise-beans>

<assembly-descriptor>
<container-transaction>
<method>
<ejb-name>containerManaged</ejb-name>
<method-name>*</method-name>
</method>
<trans-attribute>Required</trans-attribute>
</container-transaction>
</assembly-descriptor>
</ejb-jar>

weblogic-ejb-jar.xml
-----------------------
<?xml version="1.0"?>

<!DOCTYPE weblogic-ejb-jar PUBLIC
"-//BEA Systems, Inc.//DTD WebLogic 8.1.0 EJB//EN"
"http://www.bea.com/servers/wls810/dtd/weblogic-ejb-jar.dtd" >


<weblogic-ejb-jar>
<weblogic-enterprise-bean>
<ejb-name>containerManaged</ejb-name>

<entity-descriptor>
<persistence>
<persistence-use>
<type-identifier>WebLogic_CMP_RDBMS</type-identifier>
<type-version>6.0</type-version>
<type-storage>META-INF/weblogic-cmp-rdbms-jar.xml</type-storage>
</persistence-use>
</persistence>

</entity-descriptor>

<jndi-name>ejb20-containerManaged-AccountHome</jndi-name>

</weblogic-enterprise-bean>

</weblogic-ejb-jar>

and weblogic-cmp-rdbms-jar.xml
--------------------------

<?xml version="1.0"?>

<!DOCTYPE weblogic-rdbms-jar PUBLIC
'-//BEA Systems, Inc.//DTD WebLogic 8.1.0 EJB RDBMS Persistence//EN'
'http://www.bea.com/servers/wls810/dtd/weblogic-rdbms20-persistence-810.dtd'>

<weblogic-rdbms-jar>
<weblogic-rdbms-bean>
<ejb-name>containerManaged</ejb-name>
<!- This is the datasource JNDI name -->
<data-source-name>Oracle9iPool</data-source-name>
<table-map>
<table-name>ejbAccounts</table-name>
<field-map>
<cmp-field>accountId</cmp-field>
<dbms-column>id</dbms-column>
</field-map>
<field-map>
<cmp-field>balance</cmp-field>
<dbms-column>bal</dbms-column>
</field-map>
<field-map>
<cmp-field>accountType</cmp-field>
<dbms-column>acctype</dbms-column>
</field-map>
</table-map>
</weblogic-rdbms-bean>
<create-default-dbms-tables>DropAndCreateAlways</create-default-dbms-tables>
</weblogic-rdbms-jar>

All the files are at /META-INF

When I am deploying the EAR file its giving a stack dump such as
"
Exception:weblogic.management.ApplicationException: activate failed for SimpleCMP.jar Module: SimpleCMP.jar Error: Exception activating module: EJBModule(SimpleCMP.jar,status=PREPARED) Unable to deploy EJB: containerManaged from SimpleCMP.jar: XA error: XAER_RMERR : A resource manager error has occured in the transaction branch start() failed on resource 'Oracle9iPool': XAER_RMERR : A resource manager error has occured in the transaction branch oracle.jdbc.xa.OracleXAException at oracle.jdbc.xa.OracleXAResource.checkError(OracleXAResource.java:1159) at oracle.jdbc.xa.client.OracleXAResource.start(OracleXAResource.java:311) at weblogic.jdbc.wrapper.VendorXAResource.start(VendorXAResource.java:50) at weblogic.jdbc.jta.DataSource.start(DataSource.java:604) at weblogic.transaction.internal.XAServerResourceInfo.start(XAServerResourceInfo.java:1069) at weblogic.transaction.internal.XAServerResourceInfo.xaStart(XAServerResourceInfo.java:1001) at weblogic.transaction.internal.XAServerResourceInfo.enlist(XAServerResourceInfo.java:203) at weblogic.transaction.internal.ServerTransactionImpl.enlistResource(ServerTransactionImpl.java:419) at weblogic.jdbc.jta.DataSource.enlist(DataSource.java:1230) at weblogic.jdbc.jta.DataSource.refreshXAConnAndEnlist(DataSource.java:1193) at weblogic.jdbc.jta.DataSource.getConnection(DataSource.java:371) at weblogic.jdbc.jta.DataSource.connect(DataSource.java:329) at weblogic.jdbc.common.internal.RmiDataSource.getConnection(RmiDataSource.java:298) at weblogic.ejb20.cmp.rdbms.RDBMSPersistenceManager.getConnection(RDBMSPersistenceManager.java:1841) at weblogic.ejb20.cmp.rdbms.RDBMSPersistenceManager.verifyDatabaseType(RDBMSPersistenceManager.java:2025) at weblogic.ejb20.cmp.rdbms.RDBMSPersistenceManager.setup(RDBMSPersistenceManager.java:195) at weblogic.ejb20.manager.BaseEntityManager.setupPM(BaseEntityManager.java:217) at weblogic.ejb20.manager.BaseEntityManager.setup(BaseEntityManager.java:184) at weblogic.ejb20.manager.DBManager.setup(DBManager.java:164) at weblogic.ejb20.deployer.ClientDrivenBeanInfoImpl.activate(ClientDrivenBeanInfoImpl.java:1004) at weblogic.ejb20.deployer.EJBDeployer.activate(EJBDeployer.java:1322) at weblogic.ejb20.deployer.EJBModule.activate(EJBModule.java:610) at weblogic.j2ee.J2EEApplicationContainer.activateModule(J2EEApplicationContainer.java:3012) at weblogic.j2ee.J2EEApplicationContainer.activate(J2EEApplicationContainer.java:2076) at weblogic.j2ee.J2EEApplicationContainer.activate(J2EEApplicationContainer.java:2057) at weblogic.management.deploy.slave.SlaveDeployer$ComponentActivateTask.activateContainer(SlaveDeployer.java:2624) at weblogic.management.deploy.slave.SlaveDeployer$ActivateTask.doCommit(SlaveDeployer.java:2547) at weblogic.management.deploy.slave.SlaveDeployer$Task.commit(SlaveDeployer.java:2349) at weblogic.management.deploy.slave.SlaveDeployer$Task.checkAutoCommit(SlaveDeployer.java:2431) at weblogic.management.deploy.slave.SlaveDeployer$Task.prepare(SlaveDeployer.java:2343) at weblogic.management.deploy.slave.SlaveDeployer$ActivateTask.prepare(SlaveDeployer.java:2511) at weblogic.management.deploy.slave.SlaveDeployer.processPrepareTask(SlaveDeployer.java:833) at weblogic.management.deploy.slave.SlaveDeployer.prepareDelta(SlaveDeployer.java:542) at weblogic.management.deploy.slave.SlaveDeployer.prepareUpdate(SlaveDeployer.java:500) at weblogic.drs.internal.SlaveCallbackHandler$1.execute(SlaveCallbackHandler.java:25) at weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:197) at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:170)

"

Kindly note that I have some Stateful/Stateless EJBs using these JDBC
services and the connection pool is tested too.

Any help would be greatly appreciated or if somebone can provide a step
by step simple example for CMP (not CMR now) I would be grateful.

Thanks in advance.

Caesar
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: A Simple CMP Bean deployment problem in Bea WebLogic 8.0