• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Thread cannot find resource reference?

 
Ranch Hand
Posts: 61
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 61
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.

 
Greenhorn
Posts: 2
Eclipse IDE Java Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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 ]
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic