JBoss 6 EAP JaxWsProxyFactoryBean NoClassDefFoundError [英] JBoss 6 EAP JaxWsProxyFactoryBean NoClassDefFoundError

查看:121
本文介绍了JBoss 6 EAP JaxWsProxyFactoryBean NoClassDefFoundError的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在从JBoss 6.1.0 JBoss EAP 4.2.xa迁移应用程序.

我知道我已经做了很多更改,最重要的事情之一就是JBoss现在包括了大多数框架/最常用的库(模块),这很棒(战争文件较小).

现在,我有两个应用程序,都安装了Spring/CXF和Maven2.一个公开一个Web服务,第二个公开给第一个客户端.

问题出在客户端应用程序中,在运行时,当我尝试实例化代理Web服务时,出现以下错误:

------ java.lang.NoClassDefFoundError: org/apache/cxf/jaxws/JaxWsProxyFactoryBean 
at es....MyFactory.getService_WSC(MyFactory.java:59) 
...
at javax.servlet.http.HttpServlet.service(HttpServlet.java:847) 
...
at org.jboss.as.web.security.SecurityContextAssociationValve.invoke(SecurityContextAssociationValve.java:169)
...
at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:920) 
at java.lang.Thread.run(Thread.java:662) Caused by: java.lang.ClassNotFoundException: org.apache.cxf.jaxws.JaxWsProxyFactoryBean from [Module "deployment.myapp.war:main" from Service Module Loader] 
at org.jboss.modules.ModuleClassLoader.findClass(ModuleClassLoader.java:196) 
at org.jboss.modules.ConcurrentClassLoader.performLoadClassUnchecked(ConcurrentClassLoader.java:444) 
at org.jboss.modules.ConcurrentClassLoader.performLoadClassChecked(ConcurrentClassLoader.java:432) 
at org.jboss.modules.ConcurrentClassLoader.performLoadClassChecked(ConcurrentClassLoader.java:399) 
at org.jboss.modules.ConcurrentClassLoader.performLoadClass(ConcurrentClassLoader.java:374) 
at org.jboss.modules.ConcurrentClassLoader.loadClass(ConcurrentClassLoader.java:119) ... 21 more ------

在我的pom.xml中,具有以下内容(提供的CXF):

<properties>    
    <cxf.version>2.6.6</cxf.version>
    <cxf.scope>provided</cxf.scope>
</properties>

    <!-- CXF -->
    <dependency>
        <groupId>org.apache.cxf</groupId>
        <artifactId>cxf-rt-frontend-jaxws</artifactId>
        <version>${cxf.version}</version>
        <scope>${cxf.scope}</scope>
    </dependency>
    <dependency>
        <groupId>org.apache.cxf</groupId>
        <artifactId>cxf-rt-transports-http</artifactId>
        <version>${cxf.version}</version>
        <exclusions>
            <exclusion>
                <artifactId>commons-logging</artifactId>
                <groupId>commons-logging</groupId>
            </exclusion>
        </exclusions>
        <scope>${cxf.scope}</scope>
    </dependency>
    <dependency>
        <groupId>org.apache.cxf</groupId>
        <artifactId>cxf-rt-ws-security</artifactId>
        <version>${cxf.version}</version>
        <scope>${cxf.scope}</scope>
    </dependency>

可以包含CXF库,但是大概没有必要,并且JBoss EAP 6已经拥有它们了吗?,尽管如此,为什么我会在NoClassDefFoundError->之上得到错误,原因是:java.lang.ClassNotFoundException?

谢谢!

解决方案

最后我已经解决了.

首先,感谢willome的回复. 根据服务体系结构的性质(由Apache CXF实现),我倾向于使用CXF进行解决.

JBoss EAP 6嵌入了完整版本的CXF框架,其特殊性被划分"为模块,关键是准确地识别应用程序中包含的模块.

所有这一切的好处是,现在的战争非常轻松,您不能包括绝大多数框架/库...就我而言,我从30MB的战争变成了最后的5MB.

最后,我将文件添加到应用程序jboss-deployment-structure.xml中,其内容如下:

<?xml version="1.0" encoding="UTF-8"?>
<jboss-deployment-structure>
    <deployment>
        <dependencies>
            <module name="org.jboss.ws.cxf.jbossws-cxf-client" services="import" />
            <module name="org.apache.cxf.impl">
                <imports>
                    <include path="META-INF"/>
                    <include path="META-INF/cxf"/>
                </imports>
            </module>
            <!-- ... -->
        </dependencies>
    </deployment>
</jboss-deployment-structure>

然后我将pom.xm中的范围提供"用于CXF框架.

I'm migrating an application from JBoss 6.1.0 JBoss EAP 4.2.xa.

I know I have changed many things, one of the most important is that JBoss now includes most of the framework / most used libraries (modules), which is great (war files smaller).

Now, I have two applications, both mounted with Spring / CXF and Maven2. One exposes a web services and the second for the first client.

The problem is in the client application, at runtime, when I try to instantiate the proxy web service I get the following error:

------ java.lang.NoClassDefFoundError: org/apache/cxf/jaxws/JaxWsProxyFactoryBean 
at es....MyFactory.getService_WSC(MyFactory.java:59) 
...
at javax.servlet.http.HttpServlet.service(HttpServlet.java:847) 
...
at org.jboss.as.web.security.SecurityContextAssociationValve.invoke(SecurityContextAssociationValve.java:169)
...
at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:920) 
at java.lang.Thread.run(Thread.java:662) Caused by: java.lang.ClassNotFoundException: org.apache.cxf.jaxws.JaxWsProxyFactoryBean from [Module "deployment.myapp.war:main" from Service Module Loader] 
at org.jboss.modules.ModuleClassLoader.findClass(ModuleClassLoader.java:196) 
at org.jboss.modules.ConcurrentClassLoader.performLoadClassUnchecked(ConcurrentClassLoader.java:444) 
at org.jboss.modules.ConcurrentClassLoader.performLoadClassChecked(ConcurrentClassLoader.java:432) 
at org.jboss.modules.ConcurrentClassLoader.performLoadClassChecked(ConcurrentClassLoader.java:399) 
at org.jboss.modules.ConcurrentClassLoader.performLoadClass(ConcurrentClassLoader.java:374) 
at org.jboss.modules.ConcurrentClassLoader.loadClass(ConcurrentClassLoader.java:119) ... 21 more ------

In my pom.xml, I have the following (CXF as provided):

<properties>    
    <cxf.version>2.6.6</cxf.version>
    <cxf.scope>provided</cxf.scope>
</properties>

    <!-- CXF -->
    <dependency>
        <groupId>org.apache.cxf</groupId>
        <artifactId>cxf-rt-frontend-jaxws</artifactId>
        <version>${cxf.version}</version>
        <scope>${cxf.scope}</scope>
    </dependency>
    <dependency>
        <groupId>org.apache.cxf</groupId>
        <artifactId>cxf-rt-transports-http</artifactId>
        <version>${cxf.version}</version>
        <exclusions>
            <exclusion>
                <artifactId>commons-logging</artifactId>
                <groupId>commons-logging</groupId>
            </exclusion>
        </exclusions>
        <scope>${cxf.scope}</scope>
    </dependency>
    <dependency>
        <groupId>org.apache.cxf</groupId>
        <artifactId>cxf-rt-ws-security</artifactId>
        <version>${cxf.version}</version>
        <scope>${cxf.scope}</scope>
    </dependency>

Could include CXF libraries but presumably this is not necessary and that JBoss EAP 6 already has them?, Though, if this is so why do I get the error above NoClassDefFoundError -> Caused by: java.lang.ClassNotFoundException?

Thank you!

解决方案

Finally I've solved it.

First of all, thank willome response. By the nature of the services architecture (implemented with Apache CXF) I preferred to solve using CXF.

JBoss EAP 6 embed a full version of CXF framework, with the particularity that is "divided" into modules and the key has been to identify exactly the modules included in the application.

The good thing about all this is that the war now are very light, and you can NOT include the vast majority of frameworks / libraries ... in my case I went from one war of 30MB to final 5MB.

Then finally I added the file to the application jboss-deployment-structure.xml, with the following contents:

<?xml version="1.0" encoding="UTF-8"?>
<jboss-deployment-structure>
    <deployment>
        <dependencies>
            <module name="org.jboss.ws.cxf.jbossws-cxf-client" services="import" />
            <module name="org.apache.cxf.impl">
                <imports>
                    <include path="META-INF"/>
                    <include path="META-INF/cxf"/>
                </imports>
            </module>
            <!-- ... -->
        </dependencies>
    </deployment>
</jboss-deployment-structure>

And I kept the scope "provided" in my pom.xm for CXF framework.

这篇关于JBoss 6 EAP JaxWsProxyFactoryBean NoClassDefFoundError的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆