Hello. I am having an issue with compiling my client code.
What I have done so far...
-Compiled my
java files.
-Created the jar from the class files
-Deployed the bean to the server and returned a client jar stub to my
code directory
I am creating a client program to interface with the bean and when I attempt to compile, I get:
C:\EJB\AdviceClient.java:21: cannot access AdviceHome
bad class file: .\AdviceHome.java
file does not contain class AdviceHome
Please remove or make sure it appears in the correct subdirectory of the classpath.
AdviceHome home = (AdviceHome) PortableRemoteObject.narrow(o, AdviceHome.class);
^
1 error
Tool completed with exit code 1
As you can see, I'm using textpad.
Here is my client code:
import javax.naming.*;
import java.rmi.*;
import javax.rmi.*;
import headfirst.*;
import javax.ejb.*;
public class AdviceClient
{
public static void main(
String[] args)
{
new AdviceClient().go();
}
public void go()
{
try
{
Context ic = new InitialContext();
Object o = ic.lookup("AdviceBean");
AdviceHome home = (AdviceHome) PortableRemoteObject.narrow(o, AdviceHome.class);
Advice advicebean = home.create();
System.out.println(advicebean.getAdvice() );
}
catch(Exception ex)
{
ex.printStackTrace();
}
}
}
I am using Head First
EJB as a reference. You can probably download the rest
of the code from
www.wickedlysmart.com if you like.
Let me know if you need anything else.
Thanks
Chris.