• 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

Question about the JNDI naming rules

 
Ranch Hand
Posts: 361
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,

According to the EJB Study guide by MZ, when the @Resource annotation is used, it is relative to the java:comp/env naming context.

For example :
@Resource(name="db") DataSource;

The container will search in the JNDI registry for the name : java:comp/env/db

When I tried to create such a resource with the name : java:comp/env/db, I received an error that says the JNDI name I provided is not a valid JNDI name.

This happend on Glassfish application server that ships with Netbeans 6.0

Why does this happen ???




 
Ranch Hand
Posts: 183
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Khaled Mahmoud,

I've just test the same thing in my OC4J.

The steps were:
- Deploy the application in OC4J
- Create the DataSource in OC4J Console with:

- Restart the application

And it worked.
I think that, in my console OC4J, the JNDI locations are relative to java:comp/env.

Hope it helps,

Beno�t
 
Khaled Mahmoud
Ranch Hand
Posts: 361
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,
Does anybody know why the name start with java:comp is not accepted in the Glassfish application server.
 
Tomorrow is the first day of the new metric calendar. Comfort me tiny ad:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic