• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Seam: Misterious ClassCastExceptions during EJB use

 
Greenhorn
Posts: 27
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hey everyone!
I have a weird problem. I get ClassCastExceptions of the following kind while using EJB stateless session beans from my seam project:

Caused by javax.el.ELException with message: "java.lang.ClassCastException: com.tza.dto.RegisteredClientDTO cannot be cast to com.tza.dto.RegisteredClientDTO"

The history: I have an application, that used to be deployed as an ear file in my app server and served to a set of java clients. All worked fine. Now I wanted to add a web component to the application providing visualisation for some data retrieved from the sever ear. So at first I created a seam war file accessing stateless session beans on the server ear to retrieve the data. But that wouldn't work. I got said ClassCastExceptions.
I then packaged the old application and the new web app into one big ear file. The data was still accessed via SSBs and I have the same problem.

Somewhere I read that this can be caused by duplicate class files in the classpath, so i cleaned up the cp and now do not have any doubles left - same problem.

The example exception I get after trying to access objects from a List<RegisteredClientDTO> I retrieved via an EJB from the server app to my web app.

Any ideas what could cause this behaviour?

--Ole
 
Ranch Hand
Posts: 466
1
IntelliJ IDE Oracle Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Can you provide stack trace?
 
Ole Hornischer
Greenhorn
Posts: 27
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
The Stacktrace is:



And ClientLister is:

 
clojure forum advocate
Posts: 3479
Mac Objective C Clojure
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I noticed that you are using JNDI to locate a service object, why you aren't using Seam BI?
Are you sure that RegisteredClientDTO's version returned from bean.getRegisteredClients() is same of your Seam RegisteredClientDTO version?
I mean what if the two versions aren't compatible? some updated and recompile RegisteredClientDTO ?
I'm not saying this the problem, but I will dig it if I were you.
 
Ole Hornischer
Greenhorn
Posts: 27
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
That was my first idea as well, but I recompiled both applications again with current sources and made sure that there is only one occurence of the class file in the classpath of both applications (which are by now merged to one exploded ear).

I did not know about Seam BI, so I will look into that, I used JNDI because I knew how to. Is there some kind of incompatibility between Seam and JNDI?
 
Evil is afoot. But this tiny ad is just an ad:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic