问题
[EDITED]
The project i'm working on is a 3 folder project in Java J2EE with servlets and Hibernate for the persistance. The structure is as follow: - Admin -> the main program with the beans and HTML/CSS - Jar -> with the jars, Hibernate tools and classes - War -> with the Servlets
Between them, I use Xstream to share the classes and important info.
I'm using Eclipse and Tomcat 7.
Hope that with this all of you get the global idea.
This what the Xstream debugger said:
Caused by: com.thoughtworks.xstream.converters.ConversionException: satdata.musicoterapia.hibernate.Terapeuta0 : satdata.musicoterapia.hibernate.Terapeuta0
---- Debugging information ----
message : satdata.musicoterapia.hibernate.Terapeuta0
cause-exception : com.thoughtworks.xstream.mapper.CannotResolveClassException
cause-message : satdata.musicoterapia.hibernate.Terapeuta0
class : satdata.musicoterapia.hibernate.Usuario
required-type : satdata.musicoterapia.hibernate.Usuario
converter-type : com.thoughtworks.xstream.converters.reflection.ReflectionConverter
path : /list/Usuario[2]/terapeuta
class[1] : java.util.ArrayList
converter-type[1] : com.thoughtworks.xstream.converters.collections.CollectionConverter
version : null
Links (I don't have enough reputiation for have more than 2 links):
Complete StackTrace: http://pastebin.com/6vXyD6hC XML: http://pastebin.com/YM9q3uvq Servlet: below, in the comment Where the problem occurs: below, in the comment Java classes: below, in the comment If something is missing, ask and I'll put it here. Thanks for all!!!
回答1:
In your servlet code you are are mentioning :
xstream.alias("Terapeuta", Terapeuta.class);
In XML file it is given as:
<terapeuta class="satdata.musicoterapia.hibernate.Terapeuta0" resolves-to="Terapeuta">
So in logs you are getting error as:
The exception in logs says:
com.thoughtworks.xstream.mapper.CannotResolveClassException: satdata.musicoterapia.hibernate.Terapeuta0
it seems your class namein MXL should be satdata.musicoterapia.hibernate.Terapeuta
satdata.musicoterapia.hibernate.Terapeuta0
来源:https://stackoverflow.com/questions/25546413/com-thoughtworks-xstream-converters-conversionexception