Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Eclipse, Sub WebApp 9, EJB3.0, MySQL combo...

 
Kevin P Smith
Ranch Hand
Posts: 362
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Wondering if anyone could help me with deploying my EJB3.0 JAR file for connecting to MySQL?

I found this example on the 'Net (http://www.webagesolutions.com/knowledgebase/javakb/jkb006/index.html)
Which seems pretty good for showing me the basics of creating my Entity Bean, Session Bean etc.

I followed the instructions, the only difference (that I can see) is that I am using MySQL.

The classes all compile and the JAR is built, and the JAR files now deploys but I get the following error in my LOG file:



Looks like it's to do with the EJB not being able to connect to my MySQL DB.
Here is the Persistence XML



Additional Info (for testing it merely set/get the firstname and an auto-generated ID:

Entity Bean


Interface Bean (Remote)


Session Bean (Stateless)


My InitialContext on the 'Client'

[code]
props.setProperty("java.naming.factory.initial", "com.sun.enterprise.naming.SerialInitContextFactory");
props.setProperty("java.naming.factory.url.pkgs", "com.sun.enterprise.naming");
props.setProperty("java.naming.factory.state", "com.sun.corba.ee.impl.presentation.rmi.JNDIStateFactoryImpl");
props.setProperty("org.omg.CORBA.ORBInitialHost", "localhost");
props.setProperty("org.omg.CORBA.ORBInitialPort", "3700");
/code]

Thank you in advance for any help! :-D

[ August 13, 2008: Message edited by: Keith Seller ]
[ August 13, 2008: Message edited by: Keith Seller ]
 
Jaikiran Pai
Marshal
Pie
Posts: 10447
227
IntelliJ IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
javax.naming.NameNotFoundException: Test_DB not found


Have you deployed your datasource to point to the MySQL database. Here's what that article mentions:

The unit will use a data source with JNDI name jdbc/__default. This data source is automatically defined when Glassfish is installed. In real life, you will probably use a database such as MySQL, Oracle or DB2. In that case, you must first define a data source using the Glassfish administration console.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic