aspose file tools*
The moose likes EJB and other Java EE Technologies and the fly likes How to compile the EJB client codes at the remote JVM? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Java » EJB and other Java EE Technologies
Bookmark "How to compile the EJB client codes at the remote JVM?" Watch "How to compile the EJB client codes at the remote JVM?" New topic
Author

How to compile the EJB client codes at the remote JVM?

chaohua wang
Ranch Hand

Joined: Dec 22, 2002
Posts: 62
Hi, Folks,

I am new to EJB.
I read some simple examples about EJB.
I am confused how to compile codes on client site.
For example: the following is EJB client code.


import javax.naming.*;
import javax.rmi.PortableRemoteObject;
import examples.*;


public class SessionTest {

TestSessionBeanHome testSessionBean;

public void main() throws Exception{
//Look up home interface
try {
InitialContext ctx = new InitialContext();
Object objref = ctx.lookup("TestSessionBean");
testSessionBean = (TestSessionBeanHome)PortableRemoteObject.narrow(objref,

TestSessionBeanHome.class);
} catch (Exception NamingException) {
NamingException.printStackTrace();
}

}


in this code I need to compile with TestSessionBeanHome.java using javac. but this file is on remote site, different physical machine. How can I get TestSessionBeanHome.java file? It doesn't make sense I need to copy one from server site.

If it is in the same JVM (local), I know just do

import examples.TestSessionBeanHome;

Please help. Thank you very much.

Chaohua
Debu Panda
author
Ranch Hand

Joined: Jan 21, 2007
Posts: 100
The EJB interfaces (home and remote) needs to be packaged on the client side

-Debu


Author: EJB 3 In Action (http://manning.com/panda)
chaohua wang
Ranch Hand

Joined: Dec 22, 2002
Posts: 62
Hi, Debu,

Thank you very much for your response.
But Do I need to manually to copy Home and Remote object to client site?
there is anyway to generate client stub, which contains Home and Remote object?

I used Webservice. I know the client site of webservice can generate server site objects from published service using wscompile (a Compiler).

Chaohua
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: How to compile the EJB client codes at the remote JVM?
 
Similar Threads
session bean -classcast exception
portable remote object class conversion
jndi name in ejb3?
Doubt in bean lookup!
JNDI not creating for EJB Local interfaces example