java.lang.noclassdeffounderror:链接失败在JBoss7.1启动时

j8ag8udp  于 2021-07-08  发布在  Java
关注(0)|答案(1)|浏览(338)

我正在尝试将我的应用程序从JBoss6.4迁移到7.1。
在启动服务器时,我得到以下警告:

2020-11-16 10:05:46,751 WARN  [org.jboss.modules] (Weld Thread Pool -- 1) Failed to define class com.randomcompany.oracle.spatial.adminws.exception.FaultLoggerListener in Module "deployment.data-stream-ear.ear.data-s
stream-ws.war" from Service Module Loader: java.lang.NoClassDefFoundError: Failed to link com/randomcompany/oracle/spatial/adminws/exception/FaultLoggerListener (Module "deployment.data-stream-ear.ear.data-stream-ws.war" from Service Module Loader): org/apache/cxf/logging/FaultListener
        at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
        at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
        at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
        at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
        at org.jboss.modules.ModuleClassLoader.defineClass(ModuleClassLoader.java:446)
        at org.jboss.modules.ModuleClassLoader.loadClassLocal(ModuleClassLoader.java:274)
        at org.jboss.modules.ModuleClassLoader$1.loadClassLocal(ModuleClassLoader.java:77)
        at org.jboss.modules.Module.loadModuleClass(Module.java:713)
        at org.jboss.modules.ModuleClassLoader.findClass(ModuleClassLoader.java:190)
        at org.jboss.modules.ConcurrentClassLoader.performLoadClassUnchecked(ConcurrentClassLoader.java:412)
        at org.jboss.modules.ConcurrentClassLoader.performLoadClass(ConcurrentClassLoader.java:400)
        at org.jboss.modules.ConcurrentClassLoader.loadClass(ConcurrentClassLoader.java:116)
        at org.jboss.as.weld.WeldModuleResourceLoader.classForName(WeldModuleResourceLoader.java:68)
        at org.jboss.weld.bootstrap.AnnotatedTypeLoader.loadClass(AnnotatedTypeLoader.java:65)
        at org.jboss.weld.bootstrap.AnnotatedTypeLoader.loadAnnotatedType(AnnotatedTypeLoader.java:60)
        at org.jboss.weld.bootstrap.FastAnnotatedTypeLoader.loadAnnotatedType(FastAnnotatedTypeLoader.java:104)
        at org.jboss.weld.bootstrap.BeanDeployer.addClass(BeanDeployer.java:94)
        at org.jboss.weld.bootstrap.ConcurrentBeanDeployer$1.doWork(ConcurrentBeanDeployer.java:61)
        at org.jboss.weld.bootstrap.ConcurrentBeanDeployer$1.doWork(ConcurrentBeanDeployer.java:58)
        at org.jboss.weld.executor.IterativeWorkerTaskFactory$1.call(IterativeWorkerTaskFactory.java:62)
        at org.jboss.weld.executor.IterativeWorkerTaskFactory$1.call(IterativeWorkerTaskFactory.java:55)
        at java.util.concurrent.FutureTask.run(FutureTask.java:266)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
        at java.lang.Thread.run(Thread.java:745)
        at org.jboss.threads.JBossThread.run(JBossThread.java:320)

这是我的 jboss-deployment-structure.xml :

<jboss-deployment-structure>
    <ear-subdeployments-isolated>true</ear-subdeployments-isolated>
    <deployment>
        <dependencies>
            <module name="org.apache.ws.security" />
            <module name="javax.transaction.api" />
            <module name="org.apache.cxf" services="import">
            </module>
        </dependencies>
    </deployment>
    <sub-deployment name="data-stream-ejb.jar">
    </sub-deployment>
    <sub-deployment name="data-stream-ws.war">
        <dependencies>
            <module name="deployment.data-stream-ear.ear.data-stream-ejb.jar" />
        </dependencies>
    </sub-deployment>
    <sub-deployment name="data-stream-gui.war">
    </sub-deployment>
</jboss-deployment-structure>

类包含在 data-stream-ws.war :

package com.randomcompany.oracle.spatial.adminws.exception;

import javax.naming.InitialContext;
import javax.naming.NamingException;

import org.apache.cxf.logging.FaultListener;
import org.apache.cxf.message.Message;

public class FaultLoggerListener implements FaultListener {
    private FaultLoggerInterface faultLogger;
    private String faultLoggerName;

        @Override
    public boolean faultOccurred(Exception exception, String description, Message message) {
        return getFautLogger().logException(exception, description);
    }

    private FaultLoggerInterface getFautLogger() {
        if (this.faultLogger == null) {
            try {
                InitialContext context = new InitialContext();
                this.faultLogger = ((FaultLoggerInterface) context.lookup(this.faultLoggerName));
            } catch (NamingException e) {
                throw new RuntimeException(e);
            }
        }
        return this.faultLogger;
    }

    public void setFaultLoggerName(String faultLoggerName) throws NamingException {
        this.faultLoggerName = faultLoggerName;
    }
}

我试着把 ear-subdeployments-isolated 假象,但没有成功。

ylamdve6

ylamdve61#

我已经找到了一个解决方案彻底检查我的旧6.4 standalone.xml ; 我已将cxf添加到 urn:jboss:domain:ee:4.0 子系统作为一个全局模块(并将整个子系统的默认配置替换为从旧的子系统1.2->4.0的不同版本中获得的配置):

<global-modules>
    <module name="org.apache.cxf" slot="main"/>
</global-modules>
<spec-descriptor-property-replacement>true</spec-descriptor-property-replacement>
<jboss-descriptor-property-replacement>true</jboss-descriptor-property-replacement>
<annotation-property-replacement>true</annotation-property-replacement>

应用层没有其他变化,现在部署完成,没有问题。

相关问题