| Author |
Thread cannot find resource reference?
|
Todd Johnson
Ranch Hand
Joined: Sep 03, 2005
Posts: 61
|
|
I'm working on a project that consists of a "web" project that contains my struts presentation layer, and a utility "business" project that contains my business layer. I'm just using pojos (no EJBs). Both these projects are part of the same EAR file. My test server has a websphere datasource setup, and I have a resource reference named jdbc/tmDB defined in the web deployment descriptor for the "web" project. Anything in my web project can access the datasource. Anything in my business project can access the datasource as well. However if an object in my business project is run as a thread and I try to access the datasource I get the following logged on the console... [1/30/06 10:32:55:397 EST] 41dbc872 ConnectionFac I J2CA0122I: Resource reference jdbc/tmDB could not be located, so default values of the following are used: [Resource-ref settings] res-auth: 1 (APPLICATION) res-isolation-level: 0 (TRANSACTION_NONE) res-sharing-scope: true (SHAREABLE) res-resolution-control: 999 (undefined) [Other attributes] isCMP1_x: false (not CMP1.x) isJMS: false (not JMS) Oddly enough the database updates are still successful. Any idea why threads from the "business" project utility jar cannot find the resource? Thanks! Todd [ January 30, 2006: Message edited by: Todd Johnson ]
|
 |
Todd Johnson
Ranch Hand
Joined: Sep 03, 2005
Posts: 61
|
|
Well I guess I found my answer... According to http://www-304.ibm.com/jct09002c/isv/tech/faq/individual.jsp?oid=1:83616
Q: In WebSphere Application Server Version Version 5.0, is it possible to do a JNDI lookup in a thread spawned by a servlet? A: This is currently not supported. According to the Servlet 2.3 specification, servlet containers that are part of a J2EE-compliant implementation are not currently required to support lookups of JNDI registered objects when performed on threads created by the developer.
|
 |
Andrea Colleoni
Greenhorn
Joined: Mar 16, 2004
Posts: 2
|
|
Hi Todd, I'm facing the same problem (like many others as I see searching on Google)... Have you found an alternative approach to get resources referenced in the container from a thread spawned by a servlet? I thought about RMI access to an object which exports information about the environment obtained from the servlet container, (e.g. a DataSource), but I'm trying to avoid RMI because of extra compile work... Bye. Andrea Colleoni PlaneCom s.r.l. [ May 02, 2006: Message edited by: Andrea Colleoni ]
|
_______________
Andrea Colleoni
|
 |
 |
|
|
subject: Thread cannot find resource reference?
|
|
|