Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Error in Deploying CMP Bean!!!

1 view
Skip to first unread message

somu rajan

unread,
Oct 14, 2004, 2:57:49 AM10/14/04
to
i'm writing a CMP Bean. i wrote the Bean , home and remote interfaces. i'm using weblogic 7.0 as my application server.

1. what is the default data base for the weblogic 7.0.
2. should v create any table while deploying the CMP bean in a database. i think there is no need because the container will take care of it.
3. what is the need of <Data-source-name> in the deployment descriptor file weblogic-cmp-ejb-jar.xml. this is a mandatory field. can i give a random name here? if not, how 2 create a data source name.

please refer my deployment descriptor file.s

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

<weblogic-rdbms-jar>
<weblogic-rdbms-bean>
<ejb-name>Product</ejb-name>
<data-source-name>examples-dataSource-demoPool</data-source-name>
<table-map>
<table-name>TORDER</table-name>
<field-map>
<cmp-field>productID</cmp-field>
<dbms-column>PRODUCTID</dbms-column>
</field-map>
<field-map>
<cmp-field>name</cmp-field>
<dbms-column>NAME</dbms-column>
</field-map>
<field-map>
<cmp-field>description</cmp-field>
<dbms-column>DESCRIPTION</dbms-column>
</field-map>
<field-map>
<cmp-field>basePrice</cmp-field>
<dbms-column>BASEPRICE</dbms-column>
</field-map>
</table-map>
</weblogic-rdbms-bean>
<create-default-dbms-tables>True</create-default-dbms-tables>
</weblogic-rdbms-jar>

--------------------------
<?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>Product</ejb-name>
<home>examples.ProductHome</home>
<remote>examples.Product</remote>
<ejb-class>examples.ProductBean</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>ProductBean</abstract-schema-name>
<cmp-field>
<field-name>productID</field-name>
</cmp-field>
<cmp-field>
<field-name>name</field-name>
</cmp-field>
<cmp-field>
<field-name>description</field-name>
</cmp-field>
<cmp-field>
<field-name>basePrice</field-name>
</cmp-field>
<primkey-field>productID</primkey-field>
<query>
<query-method>
<method-name>findByName</method-name>
<method-params>
<method-param>java.lang.String</method-param>
</method-params>
</query-method>
<ejb-ql>
<![CDATA[SELECT OBJECT(p) FROM ProductBean AS p WHERE p.name = ?1]]>
</ejb-ql>
</query>
<query>
<query-method>
<method-name>findByDescription</method-name>
<method-params>
<method-param>java.lang.String</method-param>
</method-params>
</query-method>
<ejb-ql>
<![CDATA[SELECT OBJECT(p) FROM ProductBean AS p WHERE p.description = ?1]]>
</ejb-ql>
</query>
<query>
<query-method>
<method-name>findByBasePrice</method-name>
<method-params>
<method-param>double</method-param>
</method-params>
</query-method>
<ejb-ql>
<![CDATA[SELECT OBJECT(p) FROM ProductBean AS p WHERE p.basePrice = ?1]]>
</ejb-ql>
</query>
<query>
<query-method>
<method-name>findExpensiveProducts</method-name>
<method-params>
<method-param>double</method-param>
</method-params>
</query-method>
<ejb-ql>
<![CDATA[SELECT OBJECT(p) FROM ProductBean AS p WHERE p.basePrice > ?1]]>
</ejb-ql>
</query>
<query>
<query-method>
<method-name>findCheapProducts</method-name>
<method-params>
<method-param>double</method-param>
</method-params>
</query-method>
<ejb-ql>
<![CDATA[SELECT OBJECT(p) FROM ProductBean AS p WHERE p.basePrice < ?1]]>
</ejb-ql>
</query>
<query>
<query-method>
<method-name>findAllProducts</method-name>
<method-params>
</method-params>
</query-method>
<ejb-ql>
<![CDATA[SELECT OBJECT(p) FROM ProductBean AS p WHERE p.productID IS NOT NULL]]>
</ejb-ql>
</query>
</entity>
</enterprise-beans>
<assembly-descriptor>
<container-transaction>
<method>
<ejb-name>Product</ejb-name>
<method-intf>Remote</method-intf>
<method-name>*</method-name>
</method>
<trans-attribute>Required</trans-attribute>
</container-transaction>
</assembly-descriptor>
</ejb-jar>

----------------------------

<?xml version="1.0"?>

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

<weblogic-ejb-jar>

<weblogic-enterprise-bean>

<ejb-name>Product</ejb-name>

<entity-descriptor>

<entity-cache>

<max-beans-in-cache>1000</max-beans-in-cache>

</entity-cache>

<persistence>

<persistence-type>

<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-type>

<persistence-use>

<type-identifier>WebLogic_CMP_RDBMS</type-identifier>

<type-version>6.0</type-version>

</persistence-use>

</persistence>

</entity-descriptor>

<jndi-name>RemoteProductHome</jndi-name>

</weblogic-enterprise-bean>

</weblogic-ejb-jar>


-------------------------------------------------------------


4. when i tried to deploy the following error occurs.. how to fix the errror.

weblogic.management.ApplicationException: activate failed forrgcmp1
{
Module Name: rgcmp1, Error: Exception activating module: EJBModule(rgcmp1,status=PREPARED)


Unable to deploy EJB: Product from rgcmp1.jar:

The DataSource with the JNDI name: examples-dataSource-demoPool could not be located. Please ensure that the DataSource has been deployed successfully and that the JNDI name in your EJB Deployment descriptor is correct.


TargetException:

Unable to deploy EJB: Product from rgcmp1.jar:

The DataSource with the JNDI name: examples-dataSource-demoPool could not be located. Please ensure that the DataSource has been deployed successfully and that the JNDI name in your EJB Deployment descriptor is correct.


}
at weblogic.j2ee.J2EEApplicationContainer.activate(J2EEApplicationContainer.java:1097)
at weblogic.j2ee.J2EEApplicationContainer.activate(J2EEApplicationContainer.java:1078)
at weblogic.management.deploy.slave.SlaveDeployer.processPrepareTask(SlaveDeployer.java:1144)
at weblogic.management.deploy.slave.SlaveDeployer.prepareUpdate(SlaveDeployer.java:764)
at weblogic.drs.internal.SlaveCallbackHandler$1.execute(SlaveCallbackHandler.java:24)
at weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:234)
at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:210)

ram

unread,
Oct 14, 2004, 11:25:06 AM10/14/04
to
1.The default data base is pointbase.
2. You need a datasource defined in the bean descriptor if you are using container managed persistence.
3. To create the datasource, start the server and use the admin console to create the connection pool and the datasource.
4. you can create tables in the database or turn on the auto create table feature in the rdbms file
<create-default-dbms-tables>True</create-default-dbms-tables>

vasanthi ramesh

0 new messages