[英]Weblogic 12c - Mapstruct - 1.0.0.Final - ClassNotFoundException: Cannot find implementation
I've been using mapstruct for a while now, but have found this problem while trying to deploy one of my webservices: 我已经使用了一段时间的mapstruct,但是在尝试部署我的一个Web服务时发现了这个问题:
Target state: deploy failed on Server my_server
java.lang.ClassNotFoundException: Cannot find implementation for bar.foo.mapper.MyMapper
at weblogic.deploy.api.tools.deployer.Jsr88Operation.report(Jsr88Operation.java:547)
at weblogic.deploy.api.tools.deployer.Deployer.perform(Deployer.java:140)
at weblogic.deploy.api.tools.deployer.Deployer.runBody(Deployer.java:88)
at weblogic.utils.compiler.Tool.run(Tool.java:158)
at weblogic.utils.compiler.Tool.run(Tool.java:115)
at weblogic.Deployer.run(Deployer.java:74)
... 15 more
When I check the WAR being deployed, in the same bar.foo.mapper folder there's MyMapper.class and MyMapperImpl.class, as in other services that work correctly. 当我检查正在部署的WAR时,与其他正常工作的服务一样,在同一bar.foo.mapper文件夹中有MyMapper.class和MyMapperImpl.class。
In the POM, I've followed the setup as stated in the official doc . 在POM中,我遵循了官方文档中所述的设置。
I've already read @gunnar's answer here , but in my case the implementation is beside the interface in the WAR. 我已经在这里阅读了@gunnar的答案,但就我而言,实现是在WAR中的接口旁边。
Any ideas? 有任何想法吗?
Thanks! 谢谢!
UPDATE : I just tried with version 1.1.0.Beta1 with the same results 更新 :我只是尝试与1.1.0.Beta1版本具有相同的结果
UPDATE-2 : This is the log of the exception thrown: UPDATE-2 :这是引发异常的日志:
Caused By: java.lang.ClassNotFoundException: Cannot find implementation for bar.foo.mapper.MyMapper
at org.mapstruct.factory.Mappers.getMapper(Mappers.java:94)
While debugging, the exception is thrown here: 调试时,将在此处引发异常:
T mapper = (T) classLoader.loadClass( clazz.getName() + IMPLEMENTATION_SUFFIX ).newInstance();
...because classLoader.loadClass doesn't find bar.foo.mapper.MyMapperImpl, even though the class is beside the interface. ...因为classLoader.loadClass找不到bar.foo.mapper.MyMapperImpl,即使该类在接口旁边。
Could you try and create a copy of the Mappers
class, and use clazz.getClassLoader()
as the loader for the impl class? 你可以尝试创建的副本Mappers
类,并使用clazz.getClassLoader()
作为加载器实现类? This should do the trick. 这应该可以解决问题。 Can you let me know whether that works? 您能告诉我是否可行吗? If so, we'll change it in the next release. 如果是这样,我们将在下一个版本中对其进行更改。 Thanks! 谢谢!
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.