讨论区 » AAS-V10企业版 »
部署应用提示:类冲突异常ClassNotFoundException
异常信息:
Caused by: java.lang.NoClassDefFoundError: javax/cache/spi/CachingProvider
at java.base/java.lang.ClassLoader.defineClass1(Native Method)
at java.base/java.lang.ClassLoader.defineClass(ClassLoader.java:1016)
at org.apache.felix.framework.BundleWiringImpl$BundleClassLoader.defineClass(BundleWiringImpl.java:2410)
at org.apache.felix.framework.BundleWiringImpl$BundleClassLoader.findClass(BundleWiringImpl.java:2194)
at org.apache.felix.framework.BundleWiringImpl.findClassOrResourceByDelegation(BundleWiringImpl.java:1607)
at org.apache.felix.framework.BundleWiringImpl.access$200(BundleWiringImpl.java:80)
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1800)
... 185 common frames omitted
Caused by: java.lang.ClassNotFoundException: javax.cache.spi.CachingProvider not found by com.apusic.external.hazelcast [249]
at org.apache.felix.framework.BundleWiringImpl.findClassOrResourceByDelegation(BundleWiringImpl.java:1639)
at org.apache.felix.framework.BundleWiringImpl.access$200(BundleWiringImpl.java:80)
at org.apache.felix.framework.BundleWiringImpl$BundleClassLoader.loadClass(BundleWiringImpl.java:2053)
at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:521)
... 248 common frames omitted
处理方案:
可以看到是中间件的hazelcast类和应用冲突了,需要优先加载应用的类,两种处理方案:
1.在应用的WEB-INF目录添加apusic-web.xml
<?xml version="1.0" encoding="UTF-8"?>
<aas-web-app error-url="">
<class-loader delegate="false">
<property name="ignoreParentsFiles" value="true"></property>
<property name="ignoreClassPrefix" value="com.hazelcast"></property>
<property name="ignoreResources" value="META-INF/services/javax.cache.spi.CachingProvider;com.hazelcast"></property>
</class-loader>
</aas-web-app>
2.添加jvm参数-Dcom.sun.enterprise.overrideablejavaxpackages=指定冲突类包名
这里:-Dcom.sun.enterprise.overrideablejavaxpackages=javax.cache
apusic-web.xml (384 Bytes) apusic-web.xml |