I think that you are not having the FirstHome class in your client's
classpath. Try running the client with something like
java <ClientClassName> -cp=<path_to_FirstHome.class>
--Viet
On Nov 20, 2007 9:10 AM, Kest <[EMAIL PROTECTED]> wrote:
> Hi, everybody. I'm new to J2EE™-applications development. At this moment
> I'm trying to get started with Enterprise JavaBeans™. I've made, packed into
> JAR-file, and successfully deployed on Geronimo 2.0 a very simple EJB™
> called first.jar. It just takes two integer numbers, adds them, and then
> prints the result to the console. I'd like to make it work along with my
> application client (standalone, not servlet or Java Server Page; I run it
> from a command line). After I had deployed my JavaBean™, I looked through
> Geronimo log-file and found this string:
>
> 11:50:14,968 INFO [OpenEJB] Auto-deploying ejb First:
> EjbDeployment(deployment-id=first/First, container-id=null)
>
>
> I assumed that I should specify the name for my EJB™ as "first/First". That
> is why I put those pieces of code in my application client: ...
> Properties properties = new Properties();
> properties.put(Context.INITIAL_CONTEXT_FACTORY,
> "org.apache.openejb.client.RemoteInitialContextFactory");
> properties.put(Context.PROVIDER_URL, "rmi://localhost:4201");
> try{
> System.out.println("Starting Client...");
> InitialContext initialContext = new InitialContext(properties);
> if(initialContext != null) System.out.println("Got context!");
> Object objRef = initialContext.lookup("first/First");
> System.out.println("Got home EJB-object reference!");
> FirstHome firstHome = (FirstHome)PortableRemoteObject.narrow(objRef,
> FirstHome.class);
> First first = firstHome.create();
> System.out.println("2 + 5 = " + first.add(2, 5));
> }
> ...
>
>
> When I try to "narrow" the object reference and to get my EJB's
> home-interface, I receive this error message: java.lang.ClassCastException.
> Could anyone tell me what I'm doing wrong? Thanks a lot. Looking forward to
> hearing from you.
> ________________________________
> View this message in context: java.lang.ClassCastException while getting
> the home-interface!
> Sent from the Apache Geronimo - Users mailing list archive at Nabble.com.
>