dcsimg
ClasscastException for localhome interface.
1 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   Nayyer_Kamran
Posted On:   Sunday, September 16, 2001 11:52 PM

I am trying to implement EJB2.0 in which I made both home interfaces and both remote interfaces i.e. (local and remote). when I lookup the remote interfaces this bean works fine but when from session bean I go for local interfaces, lookup is successful but the the narrowing the local home throws ClassCastException I used the syntax as Object obj = context.lookup("localEJB"); => LocalHome homeobj = (LocalHome) PortableRemoteObject.narrow(obj,LocalHome.class); This line throws the ClassCastException. I am using weblogic6.1. I will be thankful for any solution. Nayyer    More>>

I am trying to implement EJB2.0 in which I made both home interfaces and both remote interfaces i.e. (local and remote). when I lookup the remote interfaces this bean works fine but when from session bean I go for local interfaces, lookup is successful but the the narrowing the local home throws ClassCastException I used the syntax as


Object obj = context.lookup("localEJB");

=> LocalHome homeobj = (LocalHome) PortableRemoteObject.narrow(obj,LocalHome.class);


This line throws the ClassCastException.


I am using weblogic6.1.


I will be thankful for any solution.


Nayyer

   <<Less

ClasscastException : Solution to your problem...

Posted By:   SANDEEP_THOOL  
Posted On:   Sunday, December 16, 2001 11:55 PM

Actually what is happening here is that
the CLIENT code is not able to find
the HOME class. So, effectively speaking
there is no class to NARROW. And that
is why the ClassCastException. This is a JDK / JNDI problem, not Weblogic's...


Solution
--------
When you 'run' your CLIENT code, instead
of simply using.....

C:>java AccountClient

Try using the following command.....

C:>java -cp AccountClientApp.jar AccountClient

Where AccountClientApp.jar is the name
of the Client JAR file which was
returned while deploying your EJB.

What is being done here is that the
Application Client Proxy Jar file is
being provided in the CLASSPATH while
running the client application.

Let me know, if the above works....
About | Sitemap | Contact