Hello all.

I am new at Tomee.
Tried to make some simple movements in our prototype dev.
I created a Resource which connect Tomee to Postgres
<Resource id="testjndi" type="javax.sql.DataSource"
classpath="/lib/postgresql-9.3-1102.jdbc41.jar">
    #  PostgreSQL example
    #
    #  This connector will not work until you download the driver at:
    #  http://jdbc.postgresql.org/download.html
    JdbcDriver   org.postgresql.Driver
    JdbcUrl  jdbc:postgresql://localhost:5432/testjndi
    UserName     postgres
    Password     xxxx
</Resource>

it seems to be deployed without errors
Now I am doing a simple context looking from the EJB 

initContext = new InitialContext();
        Context envContext  = (Context)initContext.lookup("java:/comp/env");
        envContext=envContext;
        DataSource ds = (DataSource)envContext.lookup("testjndi");

                
        Connection conn = ds.getConnection();

it gives me a next error

javax.naming.NameNotFoundException: Name "testjndi" not found.
Whada hell I am doing wrong, guys? :)



--
View this message in context: 
http://tomee-openejb.979440.n4.nabble.com/Cant-obtain-the-DataSource-via-Context-JNDI-tp4672626.html
Sent from the TomEE Dev mailing list archive at Nabble.com.

Reply via email to