Hi,
I'm trying to connect a standalone java client application to an EJB in Apache Geronimo, but with no success so far.
It's a starting project so I can learn something about EJB and remote invocation, and ... well, I'll put some info and hope someone can put some light on the matter.
My Geronimo has the following ports, which are displayed on console, when starting up:
Listening on Ports:
0 0.0.0.0 Derby Connector
80 0.0.0.0 Tomcat Connector HTTP BIO HTTP
1099 0.0.0.0 RMI Naming
1150 127.0.0.1 CORBA Naming Service
2001 127.0.0.1 OpenEJB ORB Adapter
4201 0.0.0.0 OpenEJB Daemon
6882 127.0.0.1 OpenEJB ORB Adapter
8009 0.0.0.0 Tomcat Connector AJP AJP
8443 0.0.0.0 Tomcat Connector HTTPS BIO HTTPS
9999 0.0.0.0 JMX Remoting Connector
61613 0.0.0.0 ActiveMQ Transport Connector
61616 0.0.0.0 ActiveMQ Transport Connector
I'm working with Apache Geronimo 2.1.2, in a windows system, installed locally.
My EJB3 has the following definition:
@Stateful(name="test-bean", mappedName="test-bean-map")
public class TestBean implements TestLocal, TestRemote {
public String hello(String user) {
return "Hello " + user + ", welcome to this EJB!";
}
public List getList(String user) {
...
}
}
And the interfaces, which are part of the EJB client JAR:
@Remote
public interface TestRemote {
public String hello(String user);
}
@Local
public interface TestLocal {
public List getList(String user);
}
The EAR has the EJB and a WAR module that successfully injects TestLocal and uses it.
Now I've started a Java project from scratch, and inside a runnable class main method I do something like:
String hostName = "localhost";
String port = "1150";
Properties props = new Properties();
props.setProperty("java.naming.factory.initial", "org.openejb.client.RemoteInitialContextFactory");
props.setProperty("java.naming.provider.url", hostName+":"+port);
// props.setProperty("java.naming.security.principal", "username");
// props.setProperty("java.naming.security.credentials", "passwd");
Context ic = null;
try {
ic = new InitialContext(props);
// java:comp/env/
// @Stateful(name="test-bean", mappedName="test-bean-map")
TestRemote testBean = (TestRemote) PortableRemoteObject.narrow(
ic.lookup("test-bean"),
TestRemote.class
);
String result = testBean.hello( "peter" );
log( result );
} catch(Throwable ex) {
ex.printStackTrace();
} finally {
if( ic!=null ) {
ic.close();
}
}
The result:
java.lang.RuntimeException: Invalid response from server: -1
at org.apache.openejb.client.JNDIContext.lookup(JNDIContext.java:277)
at javax.naming.InitialContext.lookup(InitialContext.java:392)
I've tried using ports 1099 and 1150, with the same result. What port should I use? The one defined for CORBA Naming Service?
So what am I missing here?
In apache geronimo, where am I suppose to check the jndi name configured? I can't seem to find it ... although it works on the webapp that goes with the EJB (on the same EAR).
Thanks
-
EJB remote invokation with Apache Geronimo (1 messages)
- Posted by: bat mobile
- Posted on: May 21 2010 11:47 EDT
Threaded Messages (1)
- double post, admin lock if possible, thanks by bat mobile on May 21 2010 11:51 EDT
-
double post, admin lock if possible, thanks[ Go to top ]
- Posted by: bat mobile
- Posted on: May 21 2010 11:51 EDT
- in response to bat mobile
double post, sorry
please reply to: https://www.theserverside.com/discussions/thread.tss?thread_id=60216
thank you