com.thoughtworks.xstream.converters.ConversionException [英] com.thoughtworks.xstream.converters.ConversionException

查看:305
本文介绍了com.thoughtworks.xstream.converters.ConversionException的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



我正在开发的项目是Java J2EE中的3个文件夹项目,其中包含servlets和Hibernate以提供持久性。结构如下: - 管理 - >与豆和HTML / CSS的主程序 - Jar - >与罐子,Hibernate工具和类 - 战争 - >与Servlets



在它们之间,我使用Xstream来共享类和重要信息。



我使用Eclipse和Tomcat 7。

希望通过这一切都可以得到全球性的想法。



这是Xstream调试器所说的:

 原因:com.thoughtworks.xstream.converters.ConversionException:satdata.musicoterapia.hibernate.Terapeuta0:satdata.musicoterapia.hibernate.Terapeuta0 
--- - 调试信息----
消息:satdata.musicoterapia.hibernate.Terapeuta0
原因异常:com.thoughtworks.xstream.mapper.CannotResolveClassException
原因消息: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

链接(我没有足够的推测,有超过2个链接):

完整的StackTrace: http://pastebin.com/6vXyD6hC
XML: http://pastebin.com/YM9q3uvq
Servlet:在下面的注释中
发生问题的地方:下面的注释
Java类:below,在注释
中如果缺少某些东西,请询问我将它放在这里。感谢所有!!!

解决方案

在您的servlet代码中,您提到了:

  xstream.alias(Terapeuta,Terapeuta.class); 

在XML文件中,它给出为:

 < terapeuta class =satdata.musicoterapia.hibernate.Terapeuta0resolves-to =Terapeuta> 

因此,在日志中您收到错误信息:

日志中的例外说:


com.thoughtworks.xstream.mapper.CannotResolveClassException:
satdata.musicoterapia.hibernate .Terativea0


好像你在MXL中的类名应该是 satdata.musicoterapia.hibernate.Terapeuta $ b $ pre $ satdata.musicoterapia.hibernate.Terapeuta0


[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!!!

解决方案

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

这篇关于com.thoughtworks.xstream.converters.ConversionException的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆