-
15. EJB 3.1 Global JNDI names
jaikiran Jan 13, 2011 6:17 AM (in response to luis.planella)It should be working. JBoss AS6 binds to both EJB3.1 spec names as well as JBoss specific names. The log messages just print the JBoss specific JNDI names. Can you post the entire exception stacktrace and the exact code which shows the issue?
-
16. Re: EJB 3.1 Global JNDI names
luis.planella Jan 13, 2011 6:29 AM (in response to jaikiran)Sure. Here it is:
The main class which looks up the remote interface
public class RemoteTest { public static void main(String[] args) throws Exception { InitialContext context = new InitialContext(); String jndiName = "java:global/cyclos4/UserSessionService!" + UserSessionService.class.getName(); UserSessionService sessionService = (UserSessionService) context.lookup(jndiName); System.out.println(sessionService.getAuthenticatedUser()); } }
The stack trace
Exception in thread "main" javax.naming.NameNotFoundException: global not bound at org.jnp.server.NamingServer.getBinding(NamingServer.java:771) at org.jnp.server.NamingServer.getBinding(NamingServer.java:779) at org.jnp.server.NamingServer.getObject(NamingServer.java:785) at org.jnp.server.NamingServer.lookup(NamingServer.java:396) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:597) at sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:305) at sun.rmi.transport.Transport$1.run(Transport.java:159) at java.security.AccessController.doPrivileged(Native Method) at sun.rmi.transport.Transport.serviceCall(Transport.java:155) at sun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.java:535) at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run0(TCPTransport.java:790) at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport.java:649) at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908) at java.lang.Thread.run(Thread.java:662) at sun.rmi.transport.StreamRemoteCall.exceptionReceivedFromServer(StreamRemoteCall.java:255) at sun.rmi.transport.StreamRemoteCall.executeCall(StreamRemoteCall.java:233) at sun.rmi.server.UnicastRef.invoke(UnicastRef.java:142) at org.jnp.server.NamingServer_Stub.lookup(Unknown Source) at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:728) at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:688) at javax.naming.InitialContext.lookup(InitialContext.java:392) at org.cyclos.RemoteTest.main(RemoteTest.java:11)
The jndi.properties file
#jboss JNDI properties java.naming.factory.initial=org.jnp.interfaces.NamingContextFactory java.naming.provider.url=jnp://localhost:1099 java.naming.factory.url.pkgs=org.jnp.interfaces ### The TimedSocketFactory connection timeout in milliseconds (0 == blocking) jnp.timeout=0 ### The TimedSocketFactory read timeout in milliseconds (0 == blocking) jnp.sotimeout=0
-
17. Re: EJB 3.1 Global JNDI names
suikast42 Jan 13, 2011 6:54 AM (in response to luis.planella)I get exactly the same Exception.
-
18. EJB 3.1 Global JNDI names
jaikiran Jan 13, 2011 6:59 AM (in response to luis.planella)Looks like you are doing the lookup from the remote standalone application. There's a known issue with that http://lists.jboss.org/pipermail/jboss-development/2010-November/016685.html
-
19. Re: EJB 3.1 Global JNDI names
suikast42 Jan 13, 2011 7:03 AM (in response to jaikiran)I'm doing the lookup from a JUnit Testcase which is started by Arquillian. Either as IN_CONTAINER or AS_CLIENT is the same.
-
20. Re: EJB 3.1 Global JNDI names
suikast42 Jan 13, 2011 7:23 AM (in response to suikast42)I post the important part of my Arquillian TestCase.
The deployment and the injection works wonderfull. But the lookup still fails. I start the thestcase with the jbossas-remote-6 profile
@Deployment
public static JavaArchive createTestArchive() {
JavaArchive arch = ShrinkWrap.create( JavaArchive.class, "test.jar" )
.addPackages( true,UserBean.class.getPackage()) // All EJB's
.addPackages( true, Customer.class.getPackage()) // All Entities
.addPackages( true,UserInContainerTestCase.class.getPackage()) // all Test Classes
// .addClasses( UserInContainerTestCase.class, UserBeanRemote.class, UserBean.class, User.class, DBObject.class, UserIssueRole.class)
// .addClasses( UserInContainerTestCase.class, UserBeanRemote.class)
.addManifestResource(EmptyAsset.INSTANCE, ArchivePaths.create("beans.xml"));
return arch;
}
@After
public void beforeTest(){
try {
InitialContext pJndiContext = new InitialContext();
NamingEnumeration<NameClassPair> nEn = pJndiContext.list( "java:global" );
sLog.debug( "LIST" );
while (nEn.hasMoreElements()) {
sLog.debug( nEn.next() );
}
} catch (Exception e1) {
sLog.error( "ERROR",e1 );
}
}
@EJB
private UserBeanRemote ub;
@Test
public void testTest(){
Assert.assertNotNull( ub );
sLog.info( "OK" );
}
-
21. Re: EJB 3.1 Global JNDI names
jaikiran Jan 13, 2011 7:43 AM (in response to suikast42)For the Arquillian related question, can you please create a new thread with the details, in the Arquillian forum? We can discuss it there, with other users/developers who are more familiar with it.
-
22. Re: EJB 3.1 Global JNDI names
suikast42 Jan 13, 2011 8:54 AM (in response to jaikiran)Thanks for fast reply,
sure I can post the same question in Arquillian forum. But I mean this question i well placed here. Beacause the same issue occurs if i try to lookup from outside the JBoss's VM. I'm right ?
-
23. Re: EJB 3.1 Global JNDI names
jaikiran Jan 13, 2011 9:05 AM (in response to suikast42)Sueleyman Vurucu wrote:
Yes, outside JVM is a known issue. I thought you were also having problem when the Arquillian test was running IN_CONTAINER (i.e. same JVM). So I thought it might have to do something more specific to Arquillian.
-
24. Re: EJB 3.1 Global JNDI names
suikast42 Jan 13, 2011 9:52 AM (in response to jaikiran)Ok. You're right. I'll post this thread in Arquillian forum.
-
25. EJB 3.1 Global JNDI names
luis.planella Jan 14, 2011 9:19 AM (in response to jaikiran)This is quite a critical bug, isn't it?
The standard jndi naming is an important feature in EJB 3.1, and not supporting renders JBoss 6 standards incompatible.
Should I report an issue or this is already being fixed?
-
26. EJB 3.1 Global JNDI names
jaikiran Jan 15, 2011 9:28 AM (in response to luis.planella)Please create one here https://issues.jboss.org/browse/EJBTHREE
-
27. EJB 3.1 Global JNDI names
luis.planella Jan 17, 2011 5:45 AM (in response to jaikiran)Done: https://issues.jboss.org/browse/EJBTHREE-2233
Sorry for the delay. I was off all the weekend.
-
28. EJB 3.1 Global JNDI names
mpiraccini Mar 24, 2011 1:06 PM (in response to luis.planella)Please fix that, for me it's a critical issue .
-
29. EJB 3.1 Global JNDI names
mcatalin23 Apr 14, 2011 5:25 AM (in response to mpiraccini)Is any workaround for this issue? EJBTHREE-2233