• Post Reply Bookmark Topic Watch Topic
  • New Topic

Class Caste Exception from client  RSS feed

Saptarshi Chakraborty
Posts: 23
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi all ,
I am new to ejb 2 entity bean. I am creating a simple application with entity bean and JBoss 4.0.2.As i want want my application to grow further i am maintaining few design patterns like service locator and delegate. I have made two .jar files and one .war file .In one .jar i have all the ejb classes(D_SEjb.jar) and in another(L_simple.jar) service locator and delegate classes. I am putting first .jar along with the .war in deploy folder and the later in lib folder of JBoss.My ejb gets deployed easily and creates the necessary table but when the create method is called from the client to save the data in the database it gives a Class cast exception in the service locator in the PortableRemoteObject.narrow(objref, className) part.
My sevice locator method looks like this:

and in delegate it casted to the Home interface l like this :

My entity bean is:

After running XDoclet my home interface and ejb-jar.xml looks like this

home interface :

part of my ejb-jar.xml looks like this:

and the stack trace is

2009-10-04 11:48:24,119 INFO [STDOUT] at com.sun.corba.se.impl.javax.rmi.PortableRemoteObject.narrow(PortableRemoteObject.java:229)
2009-10-04 11:48:24,119 INFO [STDOUT] at javax.rmi.PortableRemoteObject.narrow(PortableRemoteObject.java:137)
2009-10-04 11:48:24,159 INFO [STDOUT] at com.ejbSimple.serviceLocator.AppServiceLocator.getHome(AppServiceLocator.java:86)
2009-10-04 11:48:24,159 INFO [STDOUT] at com.ejbSimple.delegate.Simpledelegate.<init>(Simpledelegate.java:20)
2009-10-04 11:48:24,159 INFO [STDOUT] at com.ejbSimple.action.simpleAction.execute(simpleAction.java:26)
2009-10-04 11:48:24,159 INFO [STDOUT] at org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java:421)
2009-10-04 11:48:24,159 INFO [STDOUT] at org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:226)
2009-10-04 11:48:24,159 INFO [STDOUT] at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1158)
2009-10-04 11:48:24,209 INFO [STDOUT] at org.apache.struts.action.ActionServlet.doGet(ActionServlet.java:397)
2009-10-04 11:48:24,219 INFO [STDOUT] at javax.servlet.http.HttpServlet.service(HttpServlet.java:697)
2009-10-04 11:48:24,219 INFO [STDOUT] at javax.servlet.http.HttpServlet.service(HttpServlet.java:810)
2009-10-04 11:48:24,229 INFO [STDOUT] at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
2009-10-04 11:48:24,229 INFO [STDOUT] at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
2009-10-04 11:48:24,229 INFO [STDOUT] at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:81)
2009-10-04 11:48:24,229 INFO [STDOUT] at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
2009-10-04 11:48:24,229 INFO [STDOUT] at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
2009-10-04 11:48:24,229 INFO [STDOUT] at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213)
2009-10-04 11:48:24,289 INFO [STDOUT] at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:178)
2009-10-04 11:48:24,299 INFO [STDOUT] at org.jboss.web.tomcat.security.CustomPrincipalValve.invoke(CustomPrincipalValve.java:39)
2009-10-04 11:48:24,299 INFO [STDOUT] at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:153)
2009-10-04 11:48:24,299 INFO [STDOUT] at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:59)
2009-10-04 11:48:24,299 INFO [STDOUT] at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126)
2009-10-04 11:48:24,299 INFO [STDOUT] at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105)
2009-10-04 11:48:24,319 INFO [STDOUT] at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:107)
2009-10-04 11:48:24,319 INFO [STDOUT] at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148)
2009-10-04 11:48:24,319 INFO [STDOUT] at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:856)
2009-10-04 11:48:24,319 INFO [STDOUT] at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(Http11Protocol.java:744)
2009-10-04 11:48:24,319 INFO [STDOUT] at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:527)
2009-10-04 11:48:24,329 INFO [STDOUT] at org.apache.tomcat.util.net.MasterSlaveWorkerThread.run(MasterSlaveWorkerThread.java:112)
2009-10-04 11:48:24,329 INFO [STDOUT] at java.lang.Thread.run(Thread.java:619)
2009-10-04 11:48:24,329 INFO [STDOUT] Caused by: java.lang.ClassCastException: $Proxy53 cannot be cast to org.omg.CORBA.Object
2009-10-04 11:48:24,329 INFO [STDOUT] at com.sun.corba.se.impl.javax.rmi.PortableRemoteObject.narrow(PortableRemoteObject.java:212)
2009-10-04 11:48:24,329 INFO [STDOUT] ... 29 more

I tried by putting L_simple.jar in the deploy but that didn't solve the problem.
Can any body help to figure out where the problem is and what mistake I made.
pankaj vijay
Ranch Hand
Posts: 75
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If you are learning EJB then better to go for EJB3.0. I don't know the solution because you are talking about EJB2.0
Presently i think every company working with EJB3.0. So there is no point to spend time on EJB2
Yes there is need of EJB2 if you are using EJB2 & EJB3 both in your project.

Don't get me started about those stupid light bulbs.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!