Skip to Main Content

Java Development Tools

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Datasource

568364Apr 12 2007 — edited Jun 29 2009
I want to add a servlet to my ADF app. I already created it and adeded the servlet and servlet-mapping in web.xml

I wantto get a connection from my Data Source, i created it in the EMbebed OC4J Server preferences. Its the one my adf app uses and it works.

My code:

InitialContext ic = new InitialContext(); // JNDI initial context
DataSource ds = (DataSource) ic.lookup("jdbc/OracleDS"); // JNDI lookup

the name of the ds is jdbc/OracleDS

but i get the following error:

07/04/12 21:40:38 Hola
07/04/12 21:40:38 javax.naming.NamingException: Not in an application scope - start OC4J with the -userThreads switch if using user-created threads
07/04/12 21:40:38 javax.naming.NamingException: Not in an application scope - start OC4J with the -userThreads switch if using user-created threads
07/04/12 21:40:38 at com.evermind.server.PreemptiveApplicationContext.getContext(PreemptiveApplicationContext.java:30)
07/04/12 21:40:38 at com.evermind.naming.FilterContext.lookup(FilterContext.java:126)
07/04/12 21:40:38 at com.evermind.server.PreemptiveApplicationContext.lookup(PreemptiveApplicationContext.java:42)
07/04/12 21:40:38 at javax.naming.InitialContext.lookup(InitialContext.java:351)


how can i sort this?

thanks
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Jul 27 2009
Added on Apr 12 2007
7 comments
1,196 views