You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomee.apache.org by nesrine <ne...@gmail.com> on 2013/10/10 22:21:31 UTC

Error EJB sample

hello,
i just beginig with ejb sample and i alwayes have this message :

javax.naming.NoInitialContextException: Need to specify class name in
environment or system property, or as an applet parameter, or in an
application resource file:  java.naming.factory.initial
 at javax.naming.spi.NamingManager.getInitialContext(NamingManager.java:662)
 at javax.naming.InitialContext.getDefaultInitCtx(InitialContext.java:307)
 at
javax.naming.InitialContext.getURLOrDefaultInitCtx(InitialContext.java:344)
 at javax.naming.InitialContext.lookup(InitialContext.java:411)
 at
org.superbiz.stateless.basic.CalculatorTest.lookupABean(CalculatorTest.java:27)
 at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
 at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
 at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
 at java.lang.reflect.Method.invoke(Method.java:601)
 at
org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:45)
 at
org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:15)
 at
org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:42)
 at
org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:27)
 at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:263)
 at
org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:68)
 at
org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:47)
 at org.junit.runners.ParentRunner$3.run(ParentRunner.java:231)
 at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:60)
 at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:229)
 at org.junit.runners.ParentRunner.access$000(ParentRunner.java:50)
 at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:222)
 at org.junit.runners.ParentRunner.run(ParentRunner.java:300)
 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



--
View this message in context: http://openejb.979440.n4.nabble.com/Error-EJB-sample-tp4665536.html
Sent from the OpenEJB Dev mailing list archive at Nabble.com.

Re: Error EJB sample

Posted by Jean-Louis MONTEIRO <je...@gmail.com>.
That is a JBoss annotation if I recall so not surprised it does not work.

JLouis


2013/10/18 nesrine <ne...@gmail.com>

> thinks  for replyin,
> imy problem was rsolve until i add
> @RemoteBinding(jndiBinding="bean1")
> to my EJb class , it'is the problem of naming
>
>
>
> --
> View this message in context:
> http://openejb.979440.n4.nabble.com/Error-EJB-sample-tp4665536p4665622.html
> Sent from the OpenEJB Dev mailing list archive at Nabble.com.
>



-- 
Jean-Louis

Re: Error EJB sample

Posted by nesrine <ne...@gmail.com>.
thinks  for replyin,
imy problem was rsolve until i add
@RemoteBinding(jndiBinding="bean1")
to my EJb class , it'is the problem of naming



--
View this message in context: http://openejb.979440.n4.nabble.com/Error-EJB-sample-tp4665536p4665622.html
Sent from the OpenEJB Dev mailing list archive at Nabble.com.

Re: Error EJB sample

Posted by Loïc Rodier <lo...@gmail.com>.
Many samples can  be  found on the Tomee web site
http://tomee.apache.org/examples-trunk/index.html
Le 12 oct. 2013 07:54, "nesrine" <ne...@gmail.com> a écrit :

> nO it's not obligation for me , i want to learnn EJB 3 ,
> if u can help me with a good tutorial let me now .
> thanks
>
>
>
> --
> View this message in context:
> http://openejb.979440.n4.nabble.com/Error-EJB-sample-tp4665536p4665546.html
> Sent from the OpenEJB Dev mailing list archive at Nabble.com.
>

Re: Error EJB sample

Posted by nesrine <ne...@gmail.com>.
nO it's not obligation for me , i want to learnn EJB 3 ,
if u can help me with a good tutorial let me now .
thanks



--
View this message in context: http://openejb.979440.n4.nabble.com/Error-EJB-sample-tp4665536p4665546.html
Sent from the OpenEJB Dev mailing list archive at Nabble.com.

Re: Error EJB sample

Posted by Romain Manni-Bucau <rm...@gmail.com>.
If you want to use JBoss, just use their forum ;)

*Romain Manni-Bucau*
*Twitter: @rmannibucau <https://twitter.com/rmannibucau>*
*Blog: **http://rmannibucau.wordpress.com/*<http://rmannibucau.wordpress.com/>
*LinkedIn: **http://fr.linkedin.com/in/rmannibucau*
*Github: https://github.com/rmannibucau*



2013/10/11 nesrine <ne...@gmail.com>

> Hello,
> I didn t find the priblem. Since i m new in ejb i can't understand ejb
> standalone ...
> So please can u help to begin . I m using jboss As7 .0  and trying tovrun
> one of  tbe simple example
>
>
>
>
> --
> View this message in context:
> http://openejb.979440.n4.nabble.com/Error-EJB-sample-tp4665536p4665544.html
> Sent from the OpenEJB Dev mailing list archive at Nabble.com.
>

Re: Error EJB sample

Posted by nesrine <ne...@gmail.com>.
Hello,
I didn t find the priblem. Since i m new in ejb i can't understand ejb
standalone ...
So please can u help to begin . I m using jboss As7 .0  and trying tovrun
one of  tbe simple example 




--
View this message in context: http://openejb.979440.n4.nabble.com/Error-EJB-sample-tp4665536p4665544.html
Sent from the OpenEJB Dev mailing list archive at Nabble.com.

Re: Error EJB sample

Posted by Romain Manni-Bucau <rm...@gmail.com>.
Ok, check http://tomee.apache.org/clients.html
Le 10 oct. 2013 23:47, "nesrine" <ne...@gmail.com> a écrit :

> I didn't undrestand my client bean  is like
> String jndiName = "java:global/Teste/SimpleBean";
>                 Context context ;
>                 Properties properties = new Properties();
>
>
> properties.put("java.naming.factory.initial","org.jnp.interfaces.NamingContextFactory"
>                 );
>
>
> properties.put("java.naming.factory.url.pkgs","org.jboss.naming:org.jnp.interfaces");
>
> properties.put("java.naming.provider.url","localhost:1099");
>
>                 try
>                 {
>                  context = new InitialContext(properties);
>                 System.out.println("Looking up JNDI Name " + jndiName);
>                 Object object = context.lookup(jndiName);
>                 System.out.println("Lookup returned " + object);
>
>                 SimpleRemote remote = (SimpleRemote) object;
>                 System.out.println(remote.getMessage());
>                 }
>                 catch(Exception e)
>
>                 {
>                 e.printStackTrace();
>                 }
>
>
>
>
>
>
>
> --
> View this message in context:
> http://openejb.979440.n4.nabble.com/Error-EJB-sample-tp4665536p4665539.html
> Sent from the OpenEJB Dev mailing list archive at Nabble.com.
>

Re: Error EJB sample

Posted by nesrine <ne...@gmail.com>.
I didn't undrestand my client bean  is like
String jndiName = "java:global/Teste/SimpleBean";
		Context context ;
		Properties properties = new Properties();
	
properties.put("java.naming.factory.initial","org.jnp.interfaces.NamingContextFactory"
		);
	
properties.put("java.naming.factory.url.pkgs","org.jboss.naming:org.jnp.interfaces");
		properties.put("java.naming.provider.url","localhost:1099");
		
		try
		{
		 context = new InitialContext(properties);
		System.out.println("Looking up JNDI Name " + jndiName);
		Object object = context.lookup(jndiName);
		System.out.println("Lookup returned " + object);

		SimpleRemote remote = (SimpleRemote) object;
		System.out.println(remote.getMessage());
		}
		catch(Exception e)
		
		{
		e.printStackTrace();
		}







--
View this message in context: http://openejb.979440.n4.nabble.com/Error-EJB-sample-tp4665536p4665539.html
Sent from the OpenEJB Dev mailing list archive at Nabble.com.

Re: Error EJB sample

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

In embedded mode set local initial context factory as context factory
through properties of initial context.
Le 10 oct. 2013 22:23, "nesrine" <ne...@gmail.com> a écrit :

>
> hello,
> i just beginig with ejb sample and i alwayes have this message :
>
> javax.naming.NoInitialContextException: Need to specify class name in
> environment or system property, or as an applet parameter, or in an
> application resource file:  java.naming.factory.initial
>  at
> javax.naming.spi.NamingManager.getInitialContext(NamingManager.java:662)
>  at javax.naming.InitialContext.getDefaultInitCtx(InitialContext.java:307)
>  at
> javax.naming.InitialContext.getURLOrDefaultInitCtx(InitialContext.java:344)
>  at javax.naming.InitialContext.lookup(InitialContext.java:411)
>  at
>
> org.superbiz.stateless.basic.CalculatorTest.lookupABean(CalculatorTest.java:27)
>  at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>  at
>
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
>  at
>
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
>  at java.lang.reflect.Method.invoke(Method.java:601)
>  at
>
> org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:45)
>  at
>
> org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:15)
>  at
>
> org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:42)
>  at
>
> org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:27)
>  at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:263)
>  at
>
> org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:68)
>  at
>
> org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:47)
>  at org.junit.runners.ParentRunner$3.run(ParentRunner.java:231)
>  at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:60)
>  at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:229)
>  at org.junit.runners.ParentRunner.access$000(ParentRunner.java:50)
>  at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:222)
>  at org.junit.runners.ParentRunner.run(ParentRunner.java:300)
>  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
>
>
>
> --
> View this message in context:
> http://openejb.979440.n4.nabble.com/Error-EJB-sample-tp4665536.html
> Sent from the OpenEJB Dev mailing list archive at Nabble.com.
>