tomee-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ManojS <>
Subject OpenEJB - Datasource lookup problem
Date Sun, 06 Jan 2008 09:51:28 GMT


I was playing with openejb and a test ejb application in my machine. My
intention was to identify how much openejb is useful for me as an ejb
container, so that I can recommend to use at my workplace. While I was
trying to integrate openejb along with the application I cannot able to
lookup the datasource connection defined in the openejb.conf file. If I
explain in detail, my openejb.conf has the following connection

<Connector id="MyDatasource" type="Datasource">
    JdbcDriver   org.gjt.mysql.Driver
    JdbcUrl      jdbc:mysql://localhost:3306/test_db
    UserName     root
    Password     12345
    jtamanaged   true

I am using the "Default Stateless Container" with ctype="STATELESS". And my
ejb code (my ejbs are stateless session beans) for datasource lookup is as

public Connection getConnection () throws Exception {
	Context ctx = new InitialContext();
	Datasource ds = (Datasource) ctx.lookup( "MyDatasource" );
	return (ds!=null?ds.getConnection():null);

This code is throwing a javax.naming.NameNotFoundException. I tried with
various other JNDI names like "java:comp/MyDatasource",
"java:openejb/MyDatasource" etc. But the same result.

The openejb version I am using is 1.0, because the EJB version I was using
is 2.0.

Can anyone help me to figure out what is the JNDI name to use for connector
lookup ?

Thanks in advance.


View this message in context:
Sent from the OpenEJB User mailing list archive at

View raw message