Win a copy of The Way of the Web Tester: A Beginner's Guide to Automating Tests this week in the Testing forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Lookup a MySQL Datasource with a EntityBean EJB with jboss

antoine onnen
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hy all,
For a few days, i have problems to instance a datasource from my Entitybean
jboss release is 3.2.2 , MySQL 3.23.38
i use mysql-connector-java-3.0.9-stable-bin.jar for jdbc connectivity
Here is the source of my datasource mysql-ds.xml
The datasource is deployed in jboss cause i see the ligne as followed in the
administration console
a.. name=MySQLmydbDS,service=LocalTxCM
a.. name=MySQLmydbDS,service=ManagedConnectionFactory
a.. name=MySQLmydbDS,service=ManagedConnectionPool
My EJB deploy without problems when i put the jar in the deploy directory
Here is the part of the source of my EJB causing Exception
public void setEntityContext(EntityContext context) {
this.context = context;
try {
InitialContext ic = new InitialContext();
DataSource ds = (DataSource) ic.lookup("java:comp/env/jdbc/ClientDB");
/* ----> ERROR */
connexionBD = ds.getConnection();
catch (Exception e) {
throw new EJBException("Connexion � la base de donn�es impossible : "
+ e.getMessage());
Here my ejb-jar.xml
<description>Descripteur de d�ploiement pour l'EJB client</description>
<display-name>EJB Client</display-name>
<description>EJB Client ( BMP )</description>
And finally the jboss.xml

The error message when i execute my client :
java.rmi.ServerException : RemoteException occured in server Thread; nested
exception is :
java.rmi.ServerException: EJBException:; nested exception is :
javax.ejb.EJBException: Connexion � la base de donn�e impossible : Could not
dereference object

Thanks in advance if you've already seen this problem.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic