tomee-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jean-Louis MONTEIRO <jean-louis.monte...@atosorigin.com>
Subject Re: Running Remote Java Client
Date Wed, 16 Dec 2009 07:45:18 GMT

Hi,

The remote URL depends on the mode used by OpenEJB
- standalone ejbd
- embedded tomcat http
- ....

You need to set the url according to your mode. As far as i can understand,
you are using OpenEJB embedded in Tomcat so you must use something like
"http://127.0.0.1:8080/openejb/ejb"

Obviously, you must adjust the host and the port according to your tomcat
configuration (connectors).
Have a look here for more information 
http://openejb.apache.org/3.0/clients.html
http://openejb.apache.org/3.0/clients.html 

Then, regarding your classpath issue, can you try something like
set CLASSPATH=.
set CLASSPATH=clientapp\javaee-api-5.0-1.jar;%CLASSPATH%
set CLASSPATH=clientapp\openejb-client-3.0.jar;%CLASSPATH%
"%JAVA_HOME%\bin\javac" clientuser\OrderClient.java
"%JAVA_HOME%\bin\java" clientuser.OrderClient

Just as a side note, in the first case, you reset the classpath before
launching the application which is bad cause you need openejb dependencies.

In the second case, you forgot to add your compile classes, so it doesn't
work.

Hope it helps.
Jean-Louis






SK Leung wrote:
> 
> 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-tp26795519p26807391.html
Sent from the OpenEJB User mailing list archive at Nabble.com.


Mime
View raw message