If you add a reference to the datasource on context.xml it will be
available under comp/env too.

This was useful to me when I needed that one of my webapps to work on
Tomcat and TomEE.

2015-07-27 9:26 GMT-03:00 Arthur Portas <arthur.por...@itsector.pt>:

> Hi,
> try this JNDI string:
>
> java:openejb/
>
> 2015-07-27 13:10 GMT+01:00 using namespace <footpri...@bk.ru>:
>
> > I am using CXF interceptor to validate incoming web-service request. If
> > validation is not sunccessful I need to get a connection to database and
> > put
> > some data in it. I have the datasource configuration in context.xml which
> > works normally when I get connection within web-service implementation
> > class, but when I make the same attempt to obtain this datasource:
> >
> >             Context initContext = new InitialContext();
> >             Context envContext  =
> > (Context)initContext.lookup("java:/comp/env");
> >             DataSource ds = (DataSource)envContext.lookup("jdbc/oraDev");
> >             Connection conn = ds.getConnection();
> >
> > within cxf interceptor I am getting:
> >
> >     javax.naming.NameNotFoundException: Name [comp/env] is not bound in
> > this
> > Context. Unable to find [comp].
> >
> > I am trying to fix this now, please advice any suggestions.
> >
> >
> >
> > --
> > View this message in context:
> >
> http://tomee-openejb.979440.n4.nabble.com/Context-lookup-problems-tp4675609.html
> > Sent from the TomEE Users mailing list archive at Nabble.com.
> >
>

Reply via email to