Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / JavaBeans / October 2004

Tip: Looking for answers? Try searching our database.

CMP Entity Beans openejb MySql problem

Thread view: 
wanadoo - 17 Oct 2004 09:38 GMT
Hello all of you,

I have a problem:

I want to develop an CMP  Entity bean into OpenEjb. The database i'm using
is MySql.
After done ( from the steps given on openejb.org and changing postgreSQL to
mysql ):
- packaging (jar tool);
- deployment (deploy tool );
- creating the table structure
- changing the openejb.conf together with cmp.mysql_global_database.xml,
cmp.mysql_local_database.xml and mysql.cmp_or_mapping.xml
i want to start openejb as a remote server:

> start openejb start

But openejb fails to run!!! Everything went well in the past but now it's
going wrong in some sort of way :(

The openejb.log file responses:

DEBUG:  Instantiating assembler class
org.openejb.alt.assembler.classic.Assembler
FATAL:  OpenEJB has encountered a fatal error and cannot be started:
Assembler failed to build the container system.
org.openejb.SystemException: Can not set prim-key-field on deployment Stock:
id
at
org.openejb.alt.assembler.classic.AssemblerTool.assembleDeploymentInfo(Assem
blerTool.java:354)
at
org.openejb.alt.assembler.classic.AssemblerTool.assembleContainer(AssemblerT
ool.java:202)
at
org.openejb.alt.assembler.classic.AssemblerTool.assembleContainers(Assembler
Tool.java:171)
at
org.openejb.alt.assembler.classic.Assembler.buildContainerSystem(Assembler.j
ava:254)
at org.openejb.alt.assembler.classic.Assembler.build(Assembler.java:179)
at org.openejb.OpenEJB.init(OpenEJB.java:239)
at org.openejb.server.EjbDaemon.init(EjbDaemon.java:137)
at org.openejb.server.EjbDaemon.main(EjbDaemon.java:1116)
at org.openejb.server.Main.main(Main.java:61)
Root cause:
java.lang.NoSuchFieldException: id
at java.lang.Class.getField(Class.java:911)
at org.openejb.core.DeploymentInfo.setPrimKeyField(DeploymentInfo.java:991)
at
org.openejb.alt.assembler.classic.AssemblerTool.assembleDeploymentInfo(Assem
blerTool.java:352)
at
org.openejb.alt.assembler.classic.AssemblerTool.assembleContainer(AssemblerT
ool.java:202)
at
org.openejb.alt.assembler.classic.AssemblerTool.assembleContainers(Assembler
Tool.java:171)
at
org.openejb.alt.assembler.classic.Assembler.buildContainerSystem(Assembler.j
ava:254)
at org.openejb.alt.assembler.classic.Assembler.build(Assembler.java:179)
at org.openejb.OpenEJB.init(OpenEJB.java:239)
at org.openejb.server.EjbDaemon.init(EjbDaemon.java:137)
at org.openejb.server.EjbDaemon.main(EjbDaemon.java:1116)
at org.openejb.server.Main.main(Main.java:61)

My table structure:

CREATE TABLE stocks(
id integer auto_increment primary key,
tickerSymbol varchar(10) not null,
name varchar(33) not null,
price decimal( 10, 2 ) not null );

In my ejb-jar file:
   .....
  <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>
     ...
  <primkey-field>id</primkey-field>
   ......

In my mysql.cmp_or_mapping.xml:

   ..........
 <class name="stock.StockBean" identity="id" key-generator="IDENTITY">
  <map-to table="stocks"/>
  <field name="id" type="integer" direct="true">
        <sql name="id" type="integer"/>
 </field>
   ........

i DON'T KNOW WHAT TO DO ANYMORE!!!!!!

I will be gratefull for any response,

Willem

bisschop37(at)lycos.nl
bill - 22 Oct 2004 14:02 GMT
Hi,

You have to declare the id field in you're Bean class PUBLIC instead of PRIVATE!!!

Gr,

Bill

> Hello all of you,
>
[quoted text clipped - 100 lines]
>
> bisschop37(at)lycos.nl


Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.