This week's book giveaway is in the Jobs Discussion forum.
We're giving away four copies of Java Interview Guide and have Anthony DePalma on-line!
See this thread for details.
The moose likes EJB and other Java EE Technologies and the fly likes Lookup problem Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Java Interview Guide this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Java » EJB and other Java EE Technologies
Bookmark "Lookup problem" Watch "Lookup problem" New topic

Lookup problem

Mohamed Mostafa

Joined: Mar 15, 2012
Posts: 11
I am trying to make an ejb which connects to a database using JNDI lookup
i am using Netbeans on Glassfish server (only if this info would help)

i have created a datasource on glassfish server for a sybase databse and the connection test went successfully

i have JNDI name: jdbc/test i have made reference and tried to use the look up method but always giving me error this is my code and below will print you the error


i am still new in this area i have searched alot for a solution with no help i guess if there any configuration need to be made or what please any one help
Ram Narayan.M
Ranch Hand

Joined: Jul 11, 2010
Posts: 247


"test" Stateless Session bean does not have Business Interface from which it implements.
Seeing the trace, you are calling the "test" class from main() method of main class...

Seems you have directly instantiated the "test" class and making a conventional method on object invocation...

Does not seem to be done in Application Server...

SCJP 6 [SCJP - Old is Gold]
Mohamed Mostafa

Joined: Mar 15, 2012
Posts: 11
test is the JNDI name .. whatever i have a dataSource that i need to use i can't know how to call it or why is this error happening
Mujahed Syed
Ranch Hand

Joined: May 18, 2010
Posts: 32


Execute asadmin list-jndi-entries command to see if your ejb entry is available.

List of available commands

I agree. Here's the link:
subject: Lookup problem
jQuery in Action, 3rd edition