Win a copy of Murach's Python Programming this week in the Jython/Python forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Class cast exception  RSS feed

 
Mehul Mistry
Ranch Hand
Posts: 44
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi,

I'm doing a small assignment,wehre in I've to insert a data to the database.
I've done the User interface in JSP using struts. And created a session Bean to talk to oracle database. The session Bean is
is deployed on Weblogic 9.0 and working fine.
For my user-interface the struts application is also deployed on the weblogic 9.0 by making a war file.

The entire flow.
The jsp form takes the data from the user. ActionForm gives the data to the bean in struts
which inturn gives it to the session bean to insert in the database.

But after deploying the war file and running it i'm getting following cast exception.

java.lang.ClassCastException: com.hospital.database.HOSPITAL_SESSION_BEAN_l2363p_HomeImpl_900_WLStub
at org.hospital.ui.bean.RegisterBean.insertRecord(RegisterBean.java:25)
at org.hospital.ui.actionclass.RegisterActionClass.execute(RegisterActionClass.java:30)
at org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java:419)
at org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:224)
at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1196)
at org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:432)
.........
.....
...


Can anyone pls tell me how to resolve this. The code scriplet where it gives exception in the
POJO bean is....( marked with ******)




Thanks...
 
Jaikiran Pai
Sheriff
Posts: 10447
227
IntelliJ IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Try this:



[ October 24, 2006: Message edited by: Jaikiran Pai ]
 
Mehul Mistry
Ranch Hand
Posts: 44
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi.. thanks for your help. But I'm still gettin this exception.Is there any other issue because of which i get this. The line is this only but in the exception.
 
Jaikiran Pai
Sheriff
Posts: 10447
227
IntelliJ IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
How is your application packaged? I mean is it an ear containing a war and jars? And are you sure your are looking up the right bean? The exception stacktrace is showing that the home being returned is something like HospitalHome and you are trying to cast it to DBOperationHome.
[ October 27, 2006: Message edited by: Jaikiran Pai ]
 
Mehul Mistry
Ranch Hand
Posts: 44
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
yes I'm looking up for the same bean. But My application is split into jar(session Bean) and war(struts app). I've deployed it seperately both on Weblogic 9.0.
 
Jaikiran Pai
Sheriff
Posts: 10447
227
IntelliJ IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Have you packaged the remote/home interfaces of your bean in both the war and the jar? It looks like a classloader issue. Looks like the home class is being loaded by classloader of the jar and being used by the classloader of the war(or vice versa). You might to isolate the two applications(the jar and the war). I am not aware as to how it is done in Weblogic.

Before moving on to that, is there any requirement of maintaing a separate jar and a war? Alternately, you could create an ear containing the jar(session bean and its interfaces) and a war (containing any web related entities).
 
Mehul Mistry
Ranch Hand
Posts: 44
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Got it... Thanks a lot for your help... I was able to solve my problem....
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!