users@glassfish.java.net

Can't access remote EJBs (GF3.1)

From: <forums_at_java.net>
Date: Thu, 10 Mar 2011 07:28:48 -0600 (CST)

My project worked perfectly with GlassFish 3.0.1, 
but with remote GlassFish 3.1 I can't lookup remote EJB-s.
If the GlassFish 3.1 is local, then I can lookup EJB-s.

The minimal Eclipse 3.6.2 workspace is available:
www.dopti.hu/~bboros/workspace_lookup_remote_ejb.zip [1]

Architecture:

  * Debian  server (192.168.0.202) with GlassFish 3.1
  * Ubuntu client
  * Eclipse 3.6.2 with the latest Oracle GlassFish plugin

There is one stateless session bean: SayHello.java

 

 

package hu.bb; import javax.ejb.Stateless; package hu.bb; import
javax.ejb.Stateless; /** * Session Bean implementation class SayHello */
@Stateless public class SayHello implements SayHelloRemote { /** * Default
constructor. */ public SayHello() { } public String sayHello(String name) {
return "Hello " + name; } }
 

Remote interface:

package hu.bb; import javax.ejb.Remote; @Remote public interface
SayHelloRemote { public String sayHello(String name); }
 

The application client:

import javax.naming.InitialContext; import javax.swing.JOptionPane; public
class Main { public static void main(String[] args) { Main app = new Main();
try { app.execute(); } catch (Exception e) { e.printStackTrace();
JOptionPane.showMessageDialog(null, "Error: " + e.getClass().getName() + " "
+ e.getMessage()); } } private void execute() throws Exception {
InitialContext ic = new InitialContext(); System.out.println("InitialContext
created"); hu.bb.SayHelloRemote sh = null; try { String strBean =
"java:global/SayHello/SayHello_ejb/SayHello!hu.bb.SayHelloRemote"; //String
strBean = "java:global/SayHello/SayHello_ejb/SayHello"; //String strBean =
"hu.bb.SayHello"; System.out.println("lookup : " + strBean); sh =
(hu.bb.SayHelloRemote)ic.lookup(strBean); } catch (Exception e) { throw new
Exception("EJB lookup failure ", e); } // calling EJB String strResult =
sh.sayHello("Mr. Smith"); System.out.println(strResult);
JOptionPane.showMessageDialog(null, strResult); } }
 

The gf-client.jar is on the classpath.

If the GlassFish is on the same machine, the program runs correctly.
But if the GlassFish is on the remote 192.168.0.202 machine,
the InitialContext.lookup() does not return:

Thread.sleep(long) line: not available [native method]
TcpTimeoutsImpl$1.sleepTime() line: 158
CorbaContactInfoListIteratorImpl.next() line: 232
CorbaContactInfoListIteratorImpl.next() line: 69
CorbaClientDelegateImpl.request(Object, String, boolean) line: 213
CorbaClientDelegateImpl.is_a(Object, String) line: 393
CORBAObjectImpl(ObjectImpl)._is_a(String) line: 112
NamingContextHelper.narrow(Object) line: 69
SerialContext$ProviderCacheKey.getNameService() line: 1241
SerialContext.getRemoteProvider() line: 411 SerialContext.getProvider() line:
347 SerialContext.lookup(String, int) line: 504 SerialContext.lookup(String)
line: 455 InitialContext.lookup(String) line: 392 Main.execute() line: 28
Main.main(String[]) line: 11
The VM arguments:

-Dorg.com.CORBA.ORBInitialHost=192.168.0.202
Please help, I don't know what is wront.
Thank you

 

 

 

 

 

 

 


[1] http://www.dopti.hu/~bboros/workspace_lookup_remote_ejb.zip

--
[Message sent by forum member 'oszhatife']
View Post: http://forums.java.net/node/779793