1. wrote a cmp entity bean(Product,ProductBean,ProductHome,ProductLocal,ProductLocalHome,productPK)..inside the package examples.
2. tried to deploy the bean with the following folder structure.
examples
Product.class
productBean.class
...
etc.
META-INF
ejb-jar.xml
weblogic-ejb-jar.xml.
created a jar..with the following command
jar cvf rgegcmp.jar examples META-INF
using weblogic.ejbc i tried to create stubs and skeletons and the following error occured.
<Oct 11, 2004 1:39:39 PM IST> <Warning> <EJB> <010054> <EJB Deployment: Product has a class examples.ProductBean which is in
the classpath. This class should only be located in the ejb-jar file.>
<Oct 11, 2004 1:39:39 PM IST> <Warning> <EJB> <010054> <EJB Deployment: Product has a class examples.ProductHome which is in
the classpath. This class should only be located in the ejb-jar file.>
<Oct 11, 2004 1:39:39 PM IST> <Warning> <EJB> <010054> <EJB Deployment: Product has a class examples.Product which is in the
classpath. This class should only be located in the ejb-jar file.>
<Oct 11, 2004 1:39:39 PM IST> <Warning> <EJB> <010054> <EJB Deployment: Product has a class examples.ProductLocalHome which i
s in the classpath. This class should only be located in the ejb-jar file.>
<Oct 11, 2004 1:39:39 PM IST> <Warning> <EJB> <010054> <EJB Deployment: Product has a class examples.ProductLocal which is in
the classpath. This class should only be located in the ejb-jar file.>
<Oct 11, 2004 1:39:39 PM IST> <Warning> <EJB> <010054> <EJB Deployment: Product has a class examples.ProductPK which is in th
e classpath. This class should only be located in the ejb-jar file.>
ERROR: Error from ejbc: null
java.lang.NullPointerException
at weblogic.ejb20.deployer.CompositeMBeanDescriptor.getPersistenceUseIdentifier(CompositeMBeanDescriptor.java:1484)
at weblogic.ejb20.deployer.CMPInfoImpl.<init>(CMPInfoImpl.java:104)
at weblogic.ejb20.deployer.EntityBeanInfoImpl.<init>(EntityBeanInfoImpl.java:135)
at weblogic.ejb20.deployer.BeanInfoImpl.createBeanInfoImpl(BeanInfoImpl.java:349)
at weblogic.ejb20.deployer.MBeanDeploymentInfoImpl.initializeBeanInfos(MBeanDeploymentInfoImpl.java:438)
at weblogic.ejb20.deployer.MBeanDeploymentInfoImpl.<init>(MBeanDeploymentInfoImpl.java:165)
at weblogic.ejb20.ejbc.EJBCompiler.setupEJB(EJBCompiler.java:151)
at weblogic.ejb20.ejbc.EJBCompiler.compileEJB(EJBCompiler.java:332)
at weblogic.ejbc20.runBody(ejbc20.java:479)
at weblogic.utils.compiler.Tool.run(Tool.java:126)
at weblogic.ejbc.main(ejbc.java:29)
--------------------------------------------------------
1. should i use weblogic-cmp-jar.xml...if so what is the need of this file? a sample weblogic-cmp-jar.xml file is also required.
2. what is the need for the primary key class --- why is it required.
-
Error in weblogic.ejbc while deploying the CMP entity bean. (2 messages)
- Posted by: somu rankan
- Posted on: October 11 2004 05:32 EDT
Threaded Messages (2)
- Error in weblogic.ejbc while deploying the CMP entity bean. by Kingshuk Bandyopadhyay on October 11 2004 06:19 EDT
- Re:problem persists!!!deploying CMP entity bean!!! by somu rankan on October 11 2004 07:11 EDT
-
Error in weblogic.ejbc while deploying the CMP entity bean.[ Go to top ]
- Posted by: Kingshuk Bandyopadhyay
- Posted on: October 11 2004 06:19 EDT
- in response to somu rankan
1. should i use weblogic-cmp-jar.xml
Yes.
> ...if so what is the need of this file?
It maps the abstract schema described in the ejb-jar.xml file into the concrete db schema. In other words - it tells the container the table in which your entity bean is mapped and how each CMP field maps to a column, and optionally the CMR mapping too.
> 2. what is the need for the primary key class --- why is it required.
Not sure really. It is mandatory in the deployment descriptor and according to the spec "The Bean provider must specify a primary key class in the deployment descriptor" (section 12.2.12 of ejb 2.0 spec). But the primary key class can also be obtained by looking at the findByPrimaryKey method of the local/remote interface. Since the findByPrimaryKey is mandatory why do I have to make another entry in the descriptor ?
Guess - Its there in the descriptor for the deployer's benefit. A deployer may do the mapping between what is in the ejb-jar.xml with what is in the database.
Any other better reason ?
About the error you are getting in ejbc -
If you open the weblogic server log file it may show you the exact exception that caused the ejbc failure. So far I have seen this error when -
1. ejbc ran out of memory (so increase the java heap size)
2. The entity bean had a pair of getDefault/setDefault CMP methods that mapped to CMP field 'default' which is a java keyword
there can be other reasons too I guess
Kingshuk Bandyopadhyay -
Re:problem persists!!!deploying CMP entity bean!!![ Go to top ]
- Posted by: somu rankan
- Posted on: October 11 2004 07:11 EDT
- in response to somu rankan
Tried to deploy the entity bean[CMP] with the following folder structure.
examples
Product.class
productBean.class
...
etc.
META-INF
ejb-jar.xml
weblogic-ejb-jar.xml.
weblogic-cmp-rdbms-jar.xml
created a jar..with the following command
1.jar cvf rgegcmp.jar examples META-INF
tried to create the stubs and skeletons using weblogic.ejbc command.
2. java weblogic.ejbc rgegcmp.jar rgegcmp1.jar
C:\btcomprj\BTCOMPRJ\classes>java weblogic.ejbc rgegcmp.jar rgegcmp1.jar
<Oct 11, 2004 4:29:29 PM IST> <Warning> <EJB> <010054> <EJB Deployment: Product has a class examples.ProductBean which is in
the classpath. This class should only be located in the ejb-jar file.>
<Oct 11, 2004 4:29:29 PM IST> <Warning> <EJB> <010054> <EJB Deployment: Product has a class examples.ProductHome which is in
the classpath. This class should only be located in the ejb-jar file.>
<Oct 11, 2004 4:29:29 PM IST> <Warning> <EJB> <010054> <EJB Deployment: Product has a class examples.Product which is in the
classpath. This class should only be located in the ejb-jar file.>
<Oct 11, 2004 4:29:29 PM IST> <Warning> <EJB> <010054> <EJB Deployment: Product has a class examples.ProductLocalHome which i
s in the classpath. This class should only be located in the ejb-jar file.>
<Oct 11, 2004 4:29:29 PM IST> <Warning> <EJB> <010054> <EJB Deployment: Product has a class examples.ProductLocal which is in
the classpath. This class should only be located in the ejb-jar file.>
<Oct 11, 2004 4:29:29 PM IST> <Warning> <EJB> <010054> <EJB Deployment: Product has a class examples.ProductPK which is in th
e classpath. This class should only be located in the ejb-jar file.>
ERROR: Error from ejbc: null
java.lang.NullPointerException
at weblogic.ejb20.deployer.CompositeMBeanDescriptor.getPersistenceUseIdentifier(CompositeMBeanDescriptor.java:1484)
at weblogic.ejb20.deployer.CMPInfoImpl.<init>(CMPInfoImpl.java:104)
at weblogic.ejb20.deployer.EntityBeanInfoImpl.<init>(EntityBeanInfoImpl.java:135)
at weblogic.ejb20.deployer.BeanInfoImpl.createBeanInfoImpl(BeanInfoImpl.java:349)
at weblogic.ejb20.deployer.MBeanDeploymentInfoImpl.initializeBeanInfos(MBeanDeploymentInfoImpl.java:438)
at weblogic.ejb20.deployer.MBeanDeploymentInfoImpl.<init>(MBeanDeploymentInfoImpl.java:165)
at weblogic.ejb20.ejbc.EJBCompiler.setupEJB(EJBCompiler.java:151)
at weblogic.ejb20.ejbc.EJBCompiler.compileEJB(EJBCompiler.java:332)
at weblogic.ejbc20.runBody(ejbc20.java:479)
at weblogic.utils.compiler.Tool.run(Tool.java:126)
at weblogic.ejbc.main(ejbc.java:29)
ERROR: ejbc found errors
----------------------------------------------------------------------
1. want to know why Null pointer exception is thrown by 'weblogic.ejbc'...
find the deployments descriptors which i have written for deployment.
weblogic-ejb-jar.xml
<?xml version="1.0"?>
<!DOCTYPE weblogic-ejb-jar PUBLIC
'-//BEA Systems, Inc.//DTD WebLogic 7.0.0 EJB//EN'
'http://www.bea.com/servers/wls700/dtd/weblogic-ejb-jar.dtd'>
<weblogic-ejb-jar>
<weblogic-enterprise-bean>
<ejb-name>Product</ejb-name>
<jndi-name>rgexample</jndi-name>
</weblogic-enterprise-bean>
</weblogic-ejb-jar>
--------------------------------------------
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>Product</ejb-name>
<home>examples.ProductHome</home>
<remote>examples.Product</remote>
<local-home>examples.ProductLocalHome</local-home>
<local>examples.ProductLocal</local>
<ejb-class>examples.ProductBean</ejb-class>
<persistence-type>Container</persistence-type>
<prim-key-class>examples.ProductPK</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>
<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(a) FROM ProductBean AS a WHERE 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(a) FROM ProductBean AS a WHERE 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(a) FROM ProductBean AS a WHERE 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(a) FROM ProductBean AS a WHERE 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(a) FROM ProductBean AS a WHERE basePrice < ?1]]>
</ejb-ql>
</query>
<query>
<query-method>
<method-name>findAllProducts</method-name>
<method-params>
</method-params>
</query-method>
<ejb-ql>
<![CDATA[SELECT OBJECT(a) FROM ProductBean AS a WHERE 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>
--------------------------------------------------------------------------------
weblogic-cmp-rdbms-jar.xml
<!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>
-------------------------------------------------------------------------------