Hello all,
I am having trouble accessing a session bean from a remote client. The jndi lookup gives the following exception:
javax.naming.NamingException: Lookup failed for 'java:global/AsyncEjbEAR/AsyncEjb/AsyncBean!de.example.asyncejb.AsyncBeanRemote' in SerialContext [Root exception is javax.naming.NamingException: Unable to acquire SerialContextProvider for SerialContext [Root exception is java.lang.NullPointerException]]
at com.sun.enterprise.naming.impl.SerialContext.lookup(SerialContext.java:442)
at javax.naming.InitialContext.lookup(InitialContext.java:392)
at Main.<init>(Main.java:46)
at Main.main(Main.java:9)
Here is the bean (with no methods yet):
package de.example.asyncejb;
import javax.ejb.Remote;
import javax.ejb.Stateless;
/**
* Session Bean implementation class AsyncBean
*/
@Remote
@Stateless()
public class AsyncBean implements AsyncBeanRemote {
/**
* Default constructor.
*/
public AsyncBean() {
// TODO Auto-generated constructor stub
}
}
And thats the client:
public Main() {
try
{
InitialContext ic = new InitialContext();
// Object obj = ic.lookup("java:global/AsyncEjbEAR/AsyncEjb/AsyncBean");
// Object obj = ic.lookup("de.example.asyncejb.AsyncBeanRemote#de.example.asyncejb.AsyncBeanRemote");
Object obj = ic.lookup("java:global/AsyncEjbEAR/AsyncEjb/AsyncBean!de.example.asyncejb.AsyncBeanRemote");
} catch (NamingException e)
{
e.printStackTrace();
throw new RuntimeException(e);
}
}
In the jndi lookp I tried the jndi names that have been printed to the console right after the deployment:
// [#|2010-05-05T15:15:20.701+0200|INFO|glassfishv3.0|javax.enterprise.system.container.ejb.com.sun.ejb.containers|_ThreadID=19;_ThreadName=http-thread-pool-4848-(1);|Portable JNDI names for EJB AsyncBean : [java:global/AsyncEjbEAR/AsyncEjb/AsyncBean!de.example.asyncejb.AsyncBeanRemote, java:global/AsyncEjbEAR/AsyncEjb/AsyncBean]|#]
// [#|2010-05-05T15:15:20.701+0200|INFO|glassfishv3.0|javax.enterprise.system.container.ejb.com.sun.ejb.containers|_ThreadID=19;_ThreadName=http-thread-pool-4848-(1);|Glassfish-specific (Non-portable) JNDI names for EJB AsyncBean : [de.example.asyncejb.AsyncBeanRemote#de.example.asyncejb.AsyncBeanRemote, de.example.asyncejb.AsyncBeanRemote]|#]
Option 1: java:global/AsyncEjbEAR/AsyncEjb/AsyncBean!de.example.asyncejb.AsyncBeanRemote
Option2: java:global/AsyncEjbEAR/AsyncEjb/AsyncBean
Option3: de.example.asyncejb.AsyncBeanRemote#de.example.asyncejb.AsyncBeanRemote
Option4: de.example.asyncejb.AsyncBeanRemote
However, none of them works. What am I missing?
Thanks
Kris
[Message sent by forum member 'brezn8']
http://forums.java.net/jive/thread.jspa?messageID=412747