-
1. Re: ClassCastException from PortableRemoteObject.narrow in J
jaikiran Sep 8, 2005 8:58 AM (in response to eferreyra)I guess, you have the ejb classes in your .war. Remove these classes from the war and try running
-
2. Re: ClassCastException from PortableRemoteObject.narrow in J
eferreyra Sep 8, 2005 10:19 AM (in response to eferreyra)YES, that do it.
I uncheck "/Tutorial/FiboEJB-client.jar -> WEB-INF/lib" in the FiboWeb.war packing conf. and works !
Now, can i get some explanation of why that is wrong (i guess the tutorial is for a local AppServer, not a remote, but in more detail...) and why the narrow method fails ?
Thanks jaikiran! -
3. Re: ClassCastException from PortableRemoteObject.narrow in J
jaikiran Sep 8, 2005 11:19 AM (in response to eferreyra)Similar problem was faced by many others, and following is an extract from one of the replies by darranl:
When the bean classes are packaged in the jar and the war then,
the problem is when they are packaged twice is that they get loaded by two different classloaders which makes them look as if they are different. -
4. Re: ClassCastException from PortableRemoteObject.narrow in J
gnokit Sep 8, 2005 11:40 PM (in response to eferreyra)"jaikiran" wrote:
Similar problem was faced by many others, and following is an extract from one of the replies by darranl:When the bean classes are packaged in the jar and the war then,
the problem is when they are packaged twice is that they get loaded by two different classloaders which makes them look as if they are different.
I dont understand.
I also got this problem but still not solve yet
the war archive should contains
WEB-INF/classes/ contains the ComputeServlet.class only
WEB-INF/lib/FiboEJB-Client.jar contains the Component and Home interface classes of FiboBean
right?
The FiboEJB.jar contains the Component,Home and the Bean classes of FiboBean
right? -
5. Re: ClassCastException from PortableRemoteObject.narrow in J
jaikiran Sep 9, 2005 3:15 AM (in response to eferreyra)Please post the exception that you are seeing, and also the relevant code
-
6. Re: ClassCastException from PortableRemoteObject.narrow in J
darranl Sep 9, 2005 4:57 AM (in response to eferreyra)"gnokit" wrote:
I dont understand.
I also got this problem but still not solve yet
the war archive should contains
WEB-INF/classes/ contains the ComputeServlet.class only
WEB-INF/lib/FiboEJB-Client.jar contains the Component and Home interface classes of FiboBean
right?
The FiboEJB.jar contains the Component,Home and the Bean classes of FiboBean
right?
Wrong, you need to make sure the the jar 'FiboEJB-Client.jar' is NOT packaged within the war. -
7. Re: ClassCastException from PortableRemoteObject.narrow in J
gnokit Sep 9, 2005 7:13 AM (in response to eferreyra)"darranl" wrote:
"gnokit" wrote:
I dont understand.
I also got this problem but still not solve yet
the war archive should contains
WEB-INF/classes/ contains the ComputeServlet.class only
WEB-INF/lib/FiboEJB-Client.jar contains the Component and Home interface classes of FiboBean
right?
The FiboEJB.jar contains the Component,Home and the Bean classes of FiboBean
right?
Wrong, you need to make sure the the jar 'FiboEJB-Client.jar' is NOT packaged within the war.
I remove Home and Component interfaces classes
so the WEB-INF/classes only contains the servlet classes
It works....
Does the Web Container and EJB Container share the same classpath?
i'm using JBoss 4.0.2 -
8. Re: ClassCastException from PortableRemoteObject.narrow in J
zgwmike Sep 25, 2005 2:45 AM (in response to eferreyra)I don't think the web container and the ejb container share the same classpath.
-
9. Re: ClassCastException from PortableRemoteObject.narrow in J
ashok.kadam Sep 8, 2008 7:45 AM (in response to eferreyra)Hi ,
I am getting the same problem.
I checked all replies mentioned below.
My .war file does not contain any of the EJB classes.
Please suggest.
Envirnoments:
Jboss - 5.0.0.CR1
Java version - 1.5.0_13
EJB - 2
Regards,
-Ashok -
10. Re: ClassCastException from PortableRemoteObject.narrow in J
acefrehley Jan 7, 2009 11:51 AM (in response to eferreyra)I experienced the same problem, but I didn't have any jars deployed in the wrong place. My problem was that I wasn't casting to the EXACT interface name that I had annotated with @Remote. My interface was extending from an interface that was annotated with @Remote. It was only when I:
1.) Cast to the exact interface that contains the actual @Remote annotation
2.) Specified the JNDI lookup name suffixed with /remote
Did it finally work for me... Here is the syntax that worked in my case:OrderManager orderManagerEjb = (OrderManager) jndiContext.lookup("OrderManagerBean/remote");
Where OrderManager has the @Remote annotation.
Hope this helps somebody.