-
1. Re: Please help with EJB3 ClassCastException.
peterj Jan 12, 2007 6:51 PM (in response to kingcu)I think you want to use a different JNDI name:
BeanLocal bl = (BeanLocal) jndiContext.lookup("myapp/BeanLocal/local");
and
Object ref = jndiContext.lookup("myapp/BeanRemote/remote"); -
2. Re: Please help with EJB3 ClassCastException.
peterj Jan 12, 2007 6:54 PM (in response to kingcu)Oops, glanced right over the annotations. (It's Friday afternoon, I must be tired.) Check with JNDIView to see what names you actually got.
-
3. Re: Please help with EJB3 ClassCastException.
kingcu Jan 12, 2007 8:28 PM (in response to kingcu)I can see the right jndi names in jmx-console. And in fact, I was using the default jndi names initially, but did not work; then I changed to custom jndi.
-
4. Re: Please help with EJB3 ClassCastException.
mmarcom Jan 13, 2007 2:12 PM (in response to kingcu)can you pls post her eyour exception?
i remember having same problem and i fixed it by changing a parameter in ejb3-deployable ....
regards
marco -
5. Re: Please help with EJB3 ClassCastException.
knuffelbert Jan 13, 2007 4:52 PM (in response to kingcu)I had the same problem when I started a couple days ago, maybe the solution is the same...
In my jboss.xml file, the specified jndi name was incorrect. -
6. Re: Please help with EJB3 ClassCastException.
kingcu Jan 13, 2007 10:40 PM (in response to kingcu)Here is the exception:
22:33:03,944 ERROR [[action]] Servlet.service() for servlet action threw exception java.lang.ClassCastException at com.sun.corba.se.impl.javax.rmi.PortableRemoteObject.narrow(PortableRemoteObject.java:229) at javax.rmi.PortableRemoteObject.narrow(PortableRemoteObject.java:137) at com.kfi.was.actions.SponsorAction.list(SponsorAction.java:51) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:585) at org.apache.struts.actions.DispatchAction.dispatchMethod(DispatchAction.java:266) at org.apache.struts.actions.DispatchAction.execute(DispatchAction.java:167) at org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java:413) at org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:225) at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1858) at org.apache.struts.action.ActionServlet.doGet(ActionServlet.java:446) at javax.servlet.http.HttpServlet.service(HttpServlet.java:697) at javax.servlet.http.HttpServlet.service(HttpServlet.java:810) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173) at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173) at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213) at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:178) at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:175) at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:74) at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126) at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105) at org.jboss.web.tomcat.tc5.jca.CachedConnectionValve.invoke(CachedConnectionValve.java:156) at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:107) at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148) at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:869) at org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:664) at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:527) at org.apache.tomcat.util.net.MasterSlaveWorkerThread.run(MasterSlaveWorkerThread.java:112) at java.lang.Thread.run(Thread.java:595) Caused by: java.lang.ClassCastException: $Proxy79 at com.sun.corba.se.impl.javax.rmi.PortableRemoteObject.narrow(PortableRemoteObject.java:212) ... 33 more
-
7. Re: Please help with EJB3 ClassCastException.
kingcu Jan 13, 2007 10:42 PM (in response to kingcu)As for jboss.xml, I don't have it in my ear; I think if I use annotation, I can avoid xml configuration.
Also, since JBoss 4.0.5 doesn't support J2EE 5 yet, my application ear is still J2EE 1.4; not sure if this will cause any problem.
Here is what my application.xml looks like:<?xml version="1.0" encoding="UTF-8"?> <application version="1.4" xmlns="http://java.sun.com/xml/ns/j2ee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/application_1_4.xsd"> <module> <ejb>ejb3beans.jar</ejb> </module> <module> <web> <web-uri>was.war</web-uri> <context-root>was</context-root> </web> </module> </application>