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.
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.
Joined: Nov 14, 2008
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?