You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomee.apache.org by David Blevins <da...@visi.com> on 2010/01/12 18:08:45 UTC
Re: Running Remote Java Client
On Dec 16, 2009, at 3:47 PM, SK Leung wrote:
>
> Hi Jean-Louis,
> Thanks, it's classpath problem. I can solve this problem after
> including the
> current directory in the CLASSPATH. But I encounter another problem
> when
> invoking the method of the EJB from the Java client.
> public class OrderClient {
> public static void main(String[] args) {
> try {
> 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);
> Object objOrderSB = icOrderSB.lookup("java:OrderSBRemoteHome");
> OrderSBHome orderSBHome =
> (OrderSBHome)PortableRemoteObject.narrow(objOrderSB,
> OrderSBHome.class);
> OrderSB orderSB = orderSBHome.create();
> Collection cResults = orderSB.getAllAccounts();
> Iterator iterator = cResults.iterator();
> while (iterator.hasNext()) {
> Account account =
> (Account)PortableRemoteObject.narrow(iterator.next(), Account.class);
> System.out.println("Account: "+account.getOwnerName());
> }
> } catch (Exception e) {
> e.printStackTrace();
> } finally {
> }
> }
> }
>
> There is error when executing "account.getOwnerName()".
> java.rmi.RemoteException: Unknown Container Exception:
> java.rmi.RemoteException:
> Cannot open input stream to server: ; nested exception is:
> java.io.FileNotFoundException: http://127.0.0.1:8080/openejb/ejb
> ;
> nested
> exception is:
> java.io.FileNotFoundException: http://127.0.0.1:8080/openejb/
> ejb
> at
> org.apache.openejb.client.EJBObjectHandler._invoke(EJBObjectHandler.j
> ava:177)
> at
> org.apache.openejb.client.EJBInvocationHandler.invoke(EJBInvocationHa
> ndler.java:117)
> at
> org.apache.openejb.client.proxy.Jdk13InvocationHandler.invoke(Jdk13In
> vocationHandler.java:52)
> at $Proxy2.getOwnerName(Unknown Source)
> at clientuser.OrderClient.main(OrderClient.java:36)
>
> I have modified the port for tomcat to "8088" but the error message
> shown
> that it wants to access the "8080" port. Is there any configuration
> required
> for OpenEJB to use "8088" port? Or this can be overcome
> programatically.
> Please advise, much thanks.
>
Just checking in on threads that might have dropped over the holiday
break. Do you still need help with this?
-David