Hi

try openejb:Resource/testjndi or java:openejb/Resource/testjndi. To
get it in comp/env you need some linking in web.xml but this is
generally useless if you don't have jndi constraints.
Romain Manni-Bucau
Twitter: @rmannibucau
Blog: http://rmannibucau.wordpress.com/
LinkedIn: http://fr.linkedin.com/in/rmannibucau
Github: https://github.com/rmannibucau



2014-10-26 18:03 GMT+01:00 sapozal <[email protected]>:
> 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