Hi,
David has put a sample out here that does pretty much what you want to do -
http://people.apache.org/~dblevins/tmp/examples/SimpleApp/src/test/java/org/apache/openejb/examples/counter/EchoImplTest.java
You might want to modify your code a bit and try again. I was able to
run the EchoImplTest on g 2.0.1.
Lin
wanyna wrote:
I deploy ejb jar in geronimo2.0.1, this is a ejb2 test
http://www.nabble.com/file/p12813817/simple-ejb2-1.0.jar simple-ejb2-1.0.jar
, and this is a ejb3 test
http://www.nabble.com/file/p12813817/simple-ejb3-1.0.jar simple-ejb3-1.0.jar
.
Both of them deploy no error.
My client is a standalone application. Test code:
public class ClientTest {
public static EchoRemote getEchoService(String url,
String contextFactory) throws Exception {
Context context = getInitialContext(contextFactory, url);
Object obj = context.lookup("Echo");
return (EchoRemote) obj;
}
public static CounterRemote getCounterService(String url,
String contextFactory) throws Exception {
Context context = getInitialContext(contextFactory, url);
Object obj = context.lookup("SuperCounterBusinessRemote");
return (CounterRemote) obj;
}
private static Context getInitialContext(String initContextFactory,
String url) throws Exception {
Properties properties = new Properties();
properties.put(Context.INITIAL_CONTEXT_FACTORY,
initContextFactory);
properties.put(Context.PROVIDER_URL, url);
return new InitialContext(properties);
}
public static void main(String[] args) throws Exception{
String url = "ejbd://localhost:4201";
String factory =
"org.openejb.client.RemoteInitialContextFactory";
EchoRemote echo = getEchoService(url, factory);
assert("cba".equals(echo.echo("abc")));
// CounterRemote counter = getCounterService(url, factory);
// assert(counter.reset()==0);
// assert(counter.increment()==1);
// assert(counter.increment()==2);
// assert(counter.reset()==0);
}
}
exception:
Exception in thread "main" javax.naming.NameNotFoundException: /Echo does
not exist in the system. Check that the app was successfully deployed.
at org.apache.openejb.client.JNDIContext.lookup(JNDIContext.java:237)
at javax.naming.InitialContext.lookup(InitialContext.java:351)
at test.ClientTest.getEchoService(ClientTest.java:17)
at test.ClientTest.main(ClientTest.java:40)
What's the right jndi name?
I see some other messages talk about ejb jndi, but still can't resolve my
problem.
I deploy ejb2 test in geronimo 1.x, client lookup no problem.