Win a copy of Practical SVG this week in the HTML/CSS/JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

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

 
chaohua wang
Ranch Hand
Posts: 62
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 100
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The EJB interfaces (home and remote) needs to be packaged on the client side

-Debu
 
chaohua wang
Ranch Hand
Posts: 62
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
No. No. No. No. Changed my mind. Wanna come down. To see this tiny ad:
the new thread boost feature: great for the advertiser and smooth for the coderanch user
https://coderanch.com/t/674455/Thread-Boost-feature
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!