wood burning stoves*
The moose likes EJB Certification (SCBCD/OCPJBCD) and the fly likes @Resource and JNDI name Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Certification » EJB Certification (SCBCD/OCPJBCD)
Bookmark "@Resource and JNDI name" Watch "@Resource and JNDI name" New topic

@Resource and JNDI name

Khaled Mahmoud
Ranch Hand

Joined: Jul 15, 2006
Posts: 361

As read from the SCBCD Study 3.0 :

For example, a field named myDatabase in the class MySessionBean in the package com.acme.example would correspond to the JNDI name java:comp/env/com.acme.example.MySessionBean/myDatabase

As I understood that from excerpt above is that the runtime will perform a look up in the following name : java:comp/env/com.acme.example.MySessionBean/myDatabase.

When i went to the Glassfish administration tool and tried to create a new resource with the JNDI name : java:comp/env/com.acme.example.MySessionBean/myDatabase

I got the following error :
ADMVAL1047: Value 'java:comp/env/com.acme.example.MySessionBean/myDatabase' is not valid for attribute 'jndi-name' of jdbc resource. The value can not contain the following characters: ^'':, ADMVAL1070: Create of jdbc resource is rejected.

SCJP, SCJD,SCWCD,SCDJWS,SCEA 5 MCP-C#, MCP-ASP.NET - http://www.khaledinho.com/
Life is the biggest school
I agree. Here's the link: http://aspose.com/file-tools
subject: @Resource and JNDI name
Similar Threads
Passed SCBCD5 with 90%
PDF of http://java.boot.by /scbcd5-guide
Question about the JNDI naming rules
Passed SCBCD5
Creating Datasource