I have created a remote Java client to access the EJB which is Tomcat
6.0.14+OpenEJB 3.0.

The file structure is as below:
clientapp\clientuser\OrderClient.class
clientapp\openejb-client-3.0.jar
clientapp\javaee-api-5.0-1.jar
clientapp\runClient.bat

The Java client is with the following lines:
package clientuser;
import ...
public class OrderClient {
  public static void main(String[] args) {
    Properties prop = new Properties();
    prop.put("java.naming.factory.initial",
      "org.apache.openejb.client.RemoteInitialContextFactory");
    prop.put("java.naming.provider.url",
"http://127.0.0.1:8088/openejb/ejb";);
    InitialContext icOrderSB = new InitialContext(prop);
  }
}

If I have the batch file runClient.bat as
set
CLASSPATH=clientapp\javaee-api-5.0-1.jar;clientapp\openejb-client-3.0.jar
"E:\Program Files\Java\jdk1.6.0_16\bin\javac" clientuser\OrderClient.java
set CLASSPATH=
"E:\Program Files\Java\jdk1.6.0_16\bin\java" clientuser.OrderClient

I got the error message:
javax.naming.NoInitialContextException: Cannot instantiate class:
org.apache.openejb.client.RemoteInitialContextFactory [Root exception is
java.lang.ClassNotFoundException:
org.apache.openejb.client.RemoteInitialContextFactory]

If I have the batch file runClient.bat as
set
CLASSPATH=clientapp\javaee-api-5.0-1.jar;clientapp\openejb-client-3.0.jar
"E:\Program Files\Java\jdk1.6.0_16\bin\javac" clientuser\OrderClient.java
"E:\Program Files\Java\jdk1.6.0_16\bin\java" clientuser.OrderClient

I got the error message:
Exception in thread "main" java.lang.NoClassDefFoundError:
clientuser/OrderClient

What is going wrong? Please advise. Thanks.

SK
-- 
View this message in context: 
http://old.nabble.com/Running-Remote-Java-Client-tp26795519p26795519.html
Sent from the OpenEJB User mailing list archive at Nabble.com.

Reply via email to