geronimo-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Kest <soap_...@mail.ru>
Subject java.lang.ClassCastException while getting the home-interface!
Date Tue, 20 Nov 2007 14:10:29 GMT

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: http://www.nabble.com/java.lang.ClassCastException-while-getting-the-home-interface%21-tf4843726s134.html#a13857671
Sent from the Apache Geronimo - Users mailing list archive at Nabble.com.

Mime
View raw message