my dog learned polymorphism*
The moose likes EJB and other Java EE Technologies and the fly likes Java SE6 client for EJB - Error in lookup Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » EJB and other Java EE Technologies
Bookmark "Java SE6 client for EJB - Error in lookup" Watch "Java SE6 client for EJB - Error in lookup" New topic
Author

Java SE6 client for EJB - Error in lookup

Nancy Antony
Ranch Hand

Joined: Sep 06, 2007
Posts: 145

I create a Remote Stateless session Bean with the following simple code


And Class Implementation is :


And I wrote a Java SE Client as follows:



I added HelloBean Project in library and gf-client.jar from glassfish modules. When I run this I get :

Nov 9, 2011 8:02:58 AM com.sun.enterprise.transaction.JavaEETransactionManagerSimplified initDelegates
INFO: Using com.sun.enterprise.transaction.jts.JavaEETransactionManagerJTSDelegate as the delegate

and it keeps running infinitely

Can anyone help?

Piotr Nowicki
Ranch Hand

Joined: Jul 13, 2010
Posts: 610

You should rather lookup:

or

Despite that - what Application Server are you using?


OCP Java SE 6 Programmer, OCM Java SE 6 Developer, OCE Java EE 6 JSPSD, OCE Java EE 6 EJBD, OCE Java EE 6 JPAD, Spring 3.0 Core Professional.
Nancy Antony
Ranch Hand

Joined: Sep 06, 2007
Posts: 145

I tried the suggestions, but it didn't work.

I got this stack trace : I'm using Glassfish 3.1

Nov 9, 2011 8:00:08 PM com.sun.enterprise.transaction.JavaEETransactionManagerSimplified initDelegates
INFO: Using com.sun.enterprise.transaction.jts.JavaEETransactionManagerJTSDelegate as the delegate
javax.naming.NamingException: Lookup failed for 'java:global/HelloBean/SayHello!hello.SayHelloRemote' in SerialContext ,orb'sInitialHost=localhost,orb'sInitialPort=3700 [Root exception is javax.naming.NameNotFoundException: HelloBean]
at com.sun.enterprise.naming.impl.SerialContext.lookup(SerialContext.java:442)
at javax.naming.InitialContext.lookup(InitialContext.java:392)
at allworld.TestBeanSaysHello.main(TestBeanSaysHello.java:21)
Caused by: javax.naming.NameNotFoundException: HelloBean
at com.sun.enterprise.naming.impl.TransientContext.resolveContext(TransientContext.java:252)
at com.sun.enterprise.naming.impl.TransientContext.lookup(TransientContext.java:171)
at com.sun.enterprise.naming.impl.TransientContext.lookup(TransientContext.java:172)
at com.sun.enterprise.naming.impl.SerialContextProviderImpl.lookup(SerialContextProviderImpl.java:58)
at com.sun.enterprise.naming.impl.RemoteSerialContextProviderImpl.lookup(RemoteSerialContextProviderImpl.java:89)
at sun.reflect.GeneratedMethodAccessor69.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at com.sun.corba.ee.impl.presentation.rmi.ReflectiveTie.dispatchToMethod(ReflectiveTie.java:146)
at com.sun.corba.ee.impl.presentation.rmi.ReflectiveTie._invoke(ReflectiveTie.java:176)
at com.sun.corba.ee.impl.protocol.CorbaServerRequestDispatcherImpl.dispatchToServant(CorbaServerRequestDispatcherImpl.java:682)
at com.sun.corba.ee.impl.protocol.CorbaServerRequestDispatcherImpl.dispatch(CorbaServerRequestDispatcherImpl.java:216)
at com.sun.corba.ee.impl.protocol.CorbaMessageMediatorImpl.handleRequestRequest(CorbaMessageMediatorImpl.java:1841)
at com.sun.corba.ee.impl.protocol.CorbaMessageMediatorImpl.handleRequest(CorbaMessageMediatorImpl.java:1695)
at com.sun.corba.ee.impl.protocol.CorbaMessageMediatorImpl.handleInput(CorbaMessageMediatorImpl.java:1078)
at com.sun.corba.ee.impl.protocol.giopmsgheaders.RequestMessage_1_2.callback(RequestMessage_1_2.java:221)
at com.sun.corba.ee.impl.protocol.CorbaMessageMediatorImpl.handleRequest(CorbaMessageMediatorImpl.java:797)
at com.sun.corba.ee.impl.protocol.CorbaMessageMediatorImpl.dispatch(CorbaMessageMediatorImpl.java:561)
at com.sun.corba.ee.impl.protocol.CorbaMessageMediatorImpl.doWork(CorbaMessageMediatorImpl.java:2558)
at com.sun.corba.ee.impl.orbutil.threadpool.ThreadPoolImpl$WorkerThread.performWork(ThreadPoolImpl.java:492)
at com.sun.corba.ee.impl.orbutil.threadpool.ThreadPoolImpl$WorkerThread.run(ThreadPoolImpl.java:528)

Any help ?
Piotr Nowicki
Ranch Hand

Joined: Jul 13, 2010
Posts: 610

Do you have any ejb-jar.xml attached to your app?
Does Glassfish reports (i.e. in logs) what JNDI names does it give to your EJBs?

EDIT: is this a fresh Glassfish or some modified version (already configured)?
James Boswell
Bartender

Joined: Nov 09, 2011
Posts: 1012
    
    5

Hi Nancy

Can I ask why you are using "java:global/HelloBean/SayHelloRemote" to look up your bean? I cannot see a reference to anything by the name of HelloBean.

Assuming you have not configured the JNDI name of the bean separately, I think your lookup name should simply be "SayHello/remote".
Piotr Nowicki
Ranch Hand

Joined: Jul 13, 2010
Posts: 610

The HelloBean is the application/module name.
James Boswell
Bartender

Joined: Nov 09, 2011
Posts: 1012
    
    5

Nancy

It might be worth looking here.

I wasn't aware but it looks like the JNDI name depends on how your application is packaged and deployed on GF.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Java SE6 client for EJB - Error in lookup
 
Similar Threads
Hello world example using EJB 3
Simple EJB3 session beans not deploying in JBOSS6
problem with stateless session bean
Problem while running a client
JavaBean as parameter of a WebService operation