ejb@glassfish.java.net

Re: Naming Exception

From: Cheng Fang <cheng.fang_at_oracle.com>
Date: Thu, 10 Feb 2011 14:19:18 -0500

Can you attach a test app, preferably with source code?

Thanks,
-cheng

On 2/10/11 9:41 AM, Jose Alvarez de Lara wrote:
> Hi,
> I am trying an Application Client Project on Eclipse Helios SR1. The
> app contains a mdb-bean.jar in its classpath that is
> a mdb publish/subscribe and an ejb with a remote interface.
> This is my code in the client,
> private void test() {
> try {
> PublisherBeanRemote publisher = (PublisherBeanRemote) new
> InitialContext().lookup("java:global/mdb-bean/PublisherBean");
> publisher.publishNews("TR", "ET#Hola TR...");
> publisher.publishNews("ET", "TR#Hola ET...");
> } catch (NamingException e) {
> // TODO Auto-generated catch block
> e.printStackTrace();
> }
> }
> being PublisherBean the implementation of the ejb.
> And this is what I get when I run the app,
> java.lang.NullPointerException
> at
> com.sun.enterprise.naming.impl.SerialContext.getRemoteProvider(SerialContext.java:297)
> at
> com.sun.enterprise.naming.impl.SerialContext.getProvider(SerialContext.java:271)
> at
> com.sun.enterprise.naming.impl.SerialContext.lookup(SerialContext.java:430)
> at javax.naming.InitialContext.lookup(InitialContext.java:392)
> at client.Main.test(Main.java:25)
> at client.Main.main(Main.java:13)
> javax.naming.NamingException: Lookup failed for
> 'java:global/mdb-bean/PublisherBean' 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 client.Main.test(Main.java:25)
> at client.Main.main(Main.java:13)
> Caused by: javax.naming.NamingException: Unable to acquire
> SerialContextProvider for SerialContext [Root exception is
> java.lang.NullPointerException]
> at
> com.sun.enterprise.naming.impl.SerialContext.getProvider(SerialContext.java:276)
> at
> com.sun.enterprise.naming.impl.SerialContext.lookup(SerialContext.java:430)
> ... 3 more
> Caused by: java.lang.NullPointerException
> at
> com.sun.enterprise.naming.impl.SerialContext.getRemoteProvider(SerialContext.java:297)
> at
> com.sun.enterprise.naming.impl.SerialContext.getProvider(SerialContext.java:271)
> ... 4 more
> The only reason I guess is causing this exception is that the
> mdb-bean.jar is not in the classpath.
> How can I be sure about it?
> Thanks in advance,
> Jose