Register / Login
Win a copy of
Cross-Platform Desktop Applications: Using Node, Electron, and NW.js
this week in the
this forum made possible by our volunteer staff, including ...
Roel De Nijs
Stephan van Hulst
EJB and other Java EE Technologies
Getting javax. naming. NameNotFoundException from new Thread created by JSP page
posted 12 years ago
I am trying to implement the strategy to show the user a waiting page, which a complex SQL query is processed in the background in a separate
When I try to get an
and do a lookup, I get the following exception
javax.naming.NameNotFoundException: Name comp/env/jdbc not found in context "java:".
Here is the code which I am using to get a DataSource
Context ctx = new InitialContext(); DataSource ds = (DataSource) ctx.lookup(jndiName); Connection con = ds.getConnection();
Its the same code I use throughout my application and it works everywhere, except from the new thread. Here is the code from
<% session.removeAttribute("bbtb"); %> <jsp:useBean id="bbtb" class="DapisSVLBBTaskBean" scope="session"> <jsp:setProperty name="bbtb" property="reqNo" /> </jsp:useBean> <% bbtb.setRunning(true); new Thread(bbtb).start(); %> <jsp:forward page="waiting.jsp" />
I am using WebSpehre 5.0
Any ideas would be highly apcodeciated. I just can't seem to understand why would this happen only in new thread but works fine in rest of the places in my WebApplication.
It is sorta covered in the
JavaRanch Style Guide
Boost this thread!
How Tomcat Works: connection pooling in tomcat
Configuring MYSQL Datasource
Access context parameters from Bean.