Tuesday 12 May 2009

7-How to Develop Container-Managed-Relationships

Some problems that I have met during this task follows together with their solutions:
…………………………………………………
Unable to deploy EJB: OrderARSEJB from CMPent.jar:

[EJB:011028]The DataSource with the JNDI name: myJDBCDataSource could not be loc
ated. Please ensure that the DataSource has been deployed successfully and that
the JNDI name in your EJB Deployment descriptor is correct.

You have to put the JNDI name in the place for Data-Source-Name in weblogic-rdbms-jar.xml
………………………………..
[java] JVM args ignored when same JVM is used.
[java] Starting Client . . .

[java] Looking up the order home via JNDI.

[java] javax.naming.NoInitialContextException: Need to specify class name i
n environment or system property, or as an applet parameter, or in an applicatio
n resource file: java.naming.factory.initial

I had forgotten to create the jndi.properties file.
…………………………………………
compile:
[javac] Compiling 10 source files to C:\CMRentity\build
[javac] Note: C:\CMRentity\src\cmrex\OrderEJB.java uses unchecked or unsafe
operations.
[javac] Note: Recompile with -Xlint:unchecked for details.
Solution is below:

<target name="compile" depends="copy-resources">
<javac srcdir="${sourcedir}"
destdir="${targetdir}"
classpathref="libraries"
source="1.5"
debug="on">
<compilerarg value="-Xlint"/>
</javac>
</target>
……………………………………………….
Unable to deploy EJB: OrderLineItemEJB from CMRent.jar:

[EJB:011019]While reading META-INF/weblogic-cmp-rdbms-jar.xml, the persistence l
ayer of the Entity EJB failed to deploy. The error was:
Error in descriptor line 38: Error parsing file at line: 38 column: 21. org.xm
l.sax.SAXParseException: Element type "field-name" must be declared..

I made a mistake in weblogic-rdbms-bean.xml
Solution is below:
<field-map>
<cmp-field>fee</cmp-field>
<dbms-column>fee</dbms-column>
</field-map>
</table-map>
</weblogic-rdbms-bean>
………………………………………….
Unable to deploy EJB: OrderLineItemEJB from CMRent.jar:

[EJB:011017]Error while reading 'META-INF/weblogic-cmp-rdbms-jar.xml'. The error
was:


There are 1 nested errors:

Query:
EJB Name: OrderEJB
Method Name: findByPrimaryKey
Parameter Types: (java.lang.String)


SELECT OBJECT(bean) FROM Order =>> AS <<= bean WHERE ( bean.orderId = 1 )


EJB QL Parser Error.

32: unexpected token: AS

Note: 'Order' is a Reserved Keyword.

Error in FROM clause.

Check that the Range Variable Declarations and the Collection Member Declaratio
ns are correct
and that no EJB QL keywords are being used as:

...
The keyword ORDER gets mixed with the EJB name, I changed all Order instances to OrderARS.