在jboss EAP 6.3上部署一个war时,项目使用oracle coherence做为缓存,出现如下错误
Caused by: java.lang.NoClassDefFoundError: sun/rmi/server/MarshalOutputStream
at java.lang.ClassLoader.defineClass1(Native Method) [rt.jar:1.8.0_45]
at java.lang.ClassLoader.defineClass(ClassLoader.java:760) [rt.jar:1.8.0_45]
at org.jboss.modules.ModuleClassLoader.doDefineOrLoadClass(ModuleClassLoader.java:361) [jboss-modules.jar:1.3.3.Final-redhat-1]
at org.jboss.modules.ModuleClassLoader.defineClass(ModuleClassLoader.java:482) [jboss-modules.jar:1.3.3.Final-redhat-1]
... 61 more
Caused by: java.lang.ClassNotFoundException: sun.rmi.server.MarshalOutputStream from [Module "infosky:main" from local module loader @50cbc42f (finder: local module finder @75412c2f (roots: /opt/app/jboss-eap-6.3/modules,/opt/app/jboss-eap-6.3/modules/system/layers/base))]
at org.jboss.modules.ModuleClassLoader.findClass(ModuleClassLoader.java:213) [jboss-modules.jar:1.3.3.Final-redhat-1]
很幸运,很快找到了解决方法:
修改以下文件
/jboss-eap-6.3/modules/system/layers/base/sun/jdk/main/module.xml
找到path name=...位置,添加一行(红色部分)
<dependencies>
<system export="true">
<paths>
<path name="sun/rmi/server"/>
<path name="com/sun/script/javascript"/>
<path name="jdk/nashorn/api/scripting"/>
...