[英]Java XStream cannot find class in Maven directory
我使用的是XStream,当我运行名为Webserver目录的模块的应用程序时:org / westbank / webserver
但是,如果我在其他某些模块中使用它,则可以很好地解析而不会出现错误..我很困惑。 即使我创建了一个新模块并尝试使用它,也会收到错误消息,但是如果我向其中添加TestService并从该路径加载它,则其他大多数模块都可以工作。
我的XML:
<XML>
<service class = "org.westbank.webserver.authentication.TestService">
<name>Test</name>
<identifier>14</identifier>
<vital>true</vital>
</service>
</XML>
错误:
Exception in thread "main"
com.thoughtworks.xstream.converters.ConversionException:
---- Debugging information ----
cause-exception : com.thoughtworks.xstream.mapper.CannotResolveClassException
cause-message : org.westbank.webserver.authentication.TestService
class : org.westbank.configuration.XMLConfiguration
required-type : org.westbank.configuration.XMLConfiguration
converter-type : com.thoughtworks.xstream.converters.reflection.ReflectionConverter
path : /XML/service
line number : 2
version : 1.4.9
-------------------------------
Caused by: com.thoughtworks.xstream.mapper.CannotResolveClassException: org.westbank.webserver.authentication.TestService
使用XStream库时,需要从尝试调用其他模块的类的模块中将Maven模块添加为依赖项。
IE浏览器:
我使用配置模块从Web服务器模块调用TestService,我需要确保配置模块已将Web服务器模块添加为依赖项。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.