You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomee.apache.org by anas4120 <an...@yahoo.fr> on 2012/02/21 16:08:34 UTC

NullPointerException when JNDI lookup for remote bean

I deploy a stateless bean on apache-tomee-1.0.0-beta-2-plus.
But when I try to get the remote interface a NullPointerException is
throwed.
I do not have this problem with previous version of OpenEJB (version 3.14 on
tomcat 6.0.29)

Test client:
...
Properties p = new Properties();
p.put("java.naming.factory.initial",
"org.apache.openejb.client.RemoteInitialContextFactory");
p.put("java.naming.provider.url", "http://localhost:8080/openejb/ejb");
InitialContext ctx = new InitialContext(p);
MyBean myBean = (MyBean) ctx.lookup("MyBeanRemote");
...

Exception at ctx.lookup(..):
java.lang.NullPointerException
    at
org.apache.openejb.client.JNDIContext.createBusinessObject(JNDIContext.java:188)
    at org.apache.openejb.client.JNDIContext.lookup(JNDIContext.java:232)
    at javax.naming.InitialContext.lookup(InitialContext.java:392)
    at com.test.MyTestCase.setUp(MyTestCase.java:99)
    at junit.framework.TestCase.runBare(TestCase.java:132)
    at junit.framework.TestResult$1.protect(TestResult.java:110)
    at junit.framework.TestResult.runProtected(TestResult.java:128)
    at junit.framework.TestResult.run(TestResult.java:113)
    at junit.framework.TestCase.run(TestCase.java:124)
    at junit.framework.TestSuite.runTest(TestSuite.java:243)
    at junit.framework.TestSuite.run(TestSuite.java:238)
    at
org.junit.internal.runners.JUnit38ClassRunner.run(JUnit38ClassRunner.java:83)
    at
org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:50)
    at
org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
    at
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:467)
    at
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:683)
    at
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:390)
    at
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:197)

Any idea ?

--
View this message in context: http://openejb.979440.n4.nabble.com/NullPointerException-when-JNDI-lookup-for-remote-bean-tp4407278p4407278.html
Sent from the OpenEJB User mailing list archive at Nabble.com.

Re: NullPointerException when JNDI lookup for remote bean

Posted by superhans <su...@ludete.de>.
I've found the problem! An old version of the openejb-client was defined as
dependency in the client application. With 4.0.0 it works like a charm.



--
View this message in context: http://openejb.979440.n4.nabble.com/NullPointerException-when-JNDI-lookup-for-remote-bean-tp4407278p4660016.html
Sent from the OpenEJB User mailing list archive at Nabble.com.

Re: NullPointerException when JNDI lookup for remote bean

Posted by superhans <su...@ludete.de>.
forgot to upload an example for the client, here it is:
http://uploaded.net/file/5egsdxhe



--
View this message in context: http://openejb.979440.n4.nabble.com/NullPointerException-when-JNDI-lookup-for-remote-bean-tp4407278p4660015.html
Sent from the OpenEJB User mailing list archive at Nabble.com.

Re: NullPointerException when JNDI lookup for remote bean

Posted by superhans <su...@ludete.de>.
Hi,

can you tell me how to enable the ejbd:// support?

I made you a simplified example: http://uploaded.net/file/9nh2j6a6
The archive contains a readme.txt describing the files.

I'm exited what do you will see :D



--
View this message in context: http://openejb.979440.n4.nabble.com/NullPointerException-when-JNDI-lookup-for-remote-bean-tp4407278p4660014.html
Sent from the OpenEJB User mailing list archive at Nabble.com.

Re: NullPointerException when JNDI lookup for remote bean

Posted by Romain Manni-Bucau <rm...@gmail.com>.
Well in tomee ejb isnot active by default but your issue is relative to the
jndi name you use IMO

Which one is it?
Can you reproduce the issue in a sharable project?
Le 2 janv. 2013 01:28, "superhans" <su...@ludete.de> a écrit :

> Have someone had the same problem? I'm using tomee 1.5.1 and I can't look
> up
> a remote bean either:
>
> java.lang.NullPointerException
>         at
>
> org.apache.openejb.client.JNDIContext.createBusinessObject(JNDIContext.java:188)
>         at
> org.apache.openejb.client.JNDIContext.lookup(JNDIContext.java:232)
>         at javax.naming.InitialContext.lookup(InitialContext.java:411)
>         at [...]
>
> That's the configuration of my ContextFactory:
> Properties props = new Properties();
> props.put(Context.INITIAL_CONTEXT_FACTORY,
> "org.apache.openejb.client.RemoteInitialContextFactory");
> props.put(Context.PROVIDER_URL, "http://"+server+"/tomee/ejb");
>
> I've tried before to use ejbd protocol ("ejbd://127.0.0.1:8080") but this
> have not worked ...
>
> Can someone help me?
>
> Best regards
> Superhans
>
>
>
> --
> View this message in context:
> http://openejb.979440.n4.nabble.com/NullPointerException-when-JNDI-lookup-for-remote-bean-tp4407278p4660005.html
> Sent from the OpenEJB User mailing list archive at Nabble.com.
>

Re: NullPointerException when JNDI lookup for remote bean

Posted by superhans <su...@ludete.de>.
Have someone had the same problem? I'm using tomee 1.5.1 and I can't look up
a remote bean either:

java.lang.NullPointerException
	at
org.apache.openejb.client.JNDIContext.createBusinessObject(JNDIContext.java:188)
	at org.apache.openejb.client.JNDIContext.lookup(JNDIContext.java:232)
	at javax.naming.InitialContext.lookup(InitialContext.java:411)
	at [...]

That's the configuration of my ContextFactory:
Properties props = new Properties();
props.put(Context.INITIAL_CONTEXT_FACTORY,
"org.apache.openejb.client.RemoteInitialContextFactory");
props.put(Context.PROVIDER_URL, "http://"+server+"/tomee/ejb");

I've tried before to use ejbd protocol ("ejbd://127.0.0.1:8080") but this
have not worked ...

Can someone help me?

Best regards
Superhans



--
View this message in context: http://openejb.979440.n4.nabble.com/NullPointerException-when-JNDI-lookup-for-remote-bean-tp4407278p4660005.html
Sent from the OpenEJB User mailing list archive at Nabble.com.

Re: NullPointerException when JNDI lookup for remote bean

Posted by Romain Manni-Bucau <rm...@gmail.com>.
Hi,

are you sure your bean is deployed with this name?

- Romain


2012/2/21 anas4120 <an...@yahoo.fr>

> I deploy a stateless bean on apache-tomee-1.0.0-beta-2-plus.
> But when I try to get the remote interface a NullPointerException is
> throwed.
> I do not have this problem with previous version of OpenEJB (version 3.14
> on
> tomcat 6.0.29)
>
> Test client:
> ...
> Properties p = new Properties();
> p.put("java.naming.factory.initial",
> "org.apache.openejb.client.RemoteInitialContextFactory");
> p.put("java.naming.provider.url", "http://localhost:8080/openejb/ejb");
> InitialContext ctx = new InitialContext(p);
> MyBean myBean = (MyBean) ctx.lookup("MyBeanRemote");
> ...
>
> Exception at ctx.lookup(..):
> java.lang.NullPointerException
>    at
>
> org.apache.openejb.client.JNDIContext.createBusinessObject(JNDIContext.java:188)
>    at org.apache.openejb.client.JNDIContext.lookup(JNDIContext.java:232)
>    at javax.naming.InitialContext.lookup(InitialContext.java:392)
>    at com.test.MyTestCase.setUp(MyTestCase.java:99)
>    at junit.framework.TestCase.runBare(TestCase.java:132)
>    at junit.framework.TestResult$1.protect(TestResult.java:110)
>    at junit.framework.TestResult.runProtected(TestResult.java:128)
>    at junit.framework.TestResult.run(TestResult.java:113)
>    at junit.framework.TestCase.run(TestCase.java:124)
>    at junit.framework.TestSuite.runTest(TestSuite.java:243)
>    at junit.framework.TestSuite.run(TestSuite.java:238)
>    at
>
> org.junit.internal.runners.JUnit38ClassRunner.run(JUnit38ClassRunner.java:83)
>    at
>
> org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:50)
>    at
>
> org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
>    at
>
> org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:467)
>    at
>
> org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:683)
>    at
>
> org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:390)
>    at
>
> org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:197)
>
> Any idea ?
>
> --
> View this message in context:
> http://openejb.979440.n4.nabble.com/NullPointerException-when-JNDI-lookup-for-remote-bean-tp4407278p4407278.html
> Sent from the OpenEJB User mailing list archive at Nabble.com.
>