2

我很难使用 Apache CXF 2.x 实现 REST Web 服务。我对使用配备 CXF 2.4.6 的 JBoss AS 7.1.1 Final 有严格的要求。我已经安装了 JBossWS 4.1.1:Apache CXF 集成堆栈,它将 CXF 版本升级到 2.6.4。我正在使用 Eclipse Kepler SR1,我必须在其中安装“JBossAS 工具”,以便将 JBoss AS 7.1.1 设置为我的项目运行时。以下是我正在使用的不同类以及我的 web.xml:

Web.xml

<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://java.sun.com/xml/ns/javaee" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd" id="WebApp_ID" version="3.0">
  <display-name>CXF</display-name>

    <servlet>
        <servlet-name>RESTServlet</servlet-name>
        <servlet-class>org.apache.cxf.jaxrs.servlet.CXFNonSpringJaxrsServlet</servlet-class>
        <init-param>
            <param-name>jaxrs.serviceClasses</param-name>
            <param-value>
                webservice.StudentServiceImpl
            </param-value>
        </init-param>
        <load-on-startup>1</load-on-startup>
    </servlet>
    <servlet-mapping>
        <servlet-name>StudentServiceImpl</servlet-name>
        <url-pattern>/*</url-pattern>
    </servlet-mapping>
    <session-config>
        <session-timeout>60</session-timeout>
    </session-config>
</web-app>

学生.java

package pojo;

import javax.xml.bind.annotation.XmlRootElement;

@XmlRootElement(name = "student")
public class Student {

    private String name;
    private String lName;

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getlName() {
        return lName;
    }

    public void setlName(String lName) {
        this.lName = lName;
    }

}

学生服务

package webservice;

import pojo.Student;

public interface StudentService {

public Student getStudent(String firstName,String lastName);
}

StudentServiceImpl.java

package webservice;

import javax.ws.rs.POST;
import javax.ws.rs.Path;
import javax.ws.rs.PathParam;
import javax.ws.rs.Produces;
import javax.ws.rs.core.MediaType;

import pojo.Student;

@Path("StudentService")
@Produces(MediaType.APPLICATION_JSON)

public class StudentServiceImpl implements StudentService{

    @POST
    @Path("/student/{firstName}/{lastName}")
    public Student getStudent(@PathParam("firstName") String firstName,@PathParam("lastName") String lastName) {

     Student student = new Student();
     student.setName(firstName);
     student.setlName(lastName);

     return student;

    }

}

我想要实现的是拥有一个 REST Web 服务,它返回一个复杂对象(在本例中为学生)作为 JSON 字符串。请记住,我在 Eclipse 中使用 CXFServlet 而不是 Spring 配置了 CXF 端点。另一个注意事项是我使用 Apache CXF 2.7.6 作为我的 CXF 运行时,因为我找不到下载 CXF 2.6.4 的有效链接。我的上下文根被称为“CXF”,但是当我浏览到 URL 时http://localhost:8080/CXF/,我收到错误 HTTP 错误 404。我做错了什么?

更新: 我刚刚注意到,在部署时,会引发以下异常:

17:51:26,489 WARN  [org.jboss.modules] (MSC service thread 1-1) Failed to define class org.apache.cxf.wsn.jms.JmsPublisher in Module "deployment.CXF.war:main" from Service Module Loader: java.lang.LinkageError: Failed to link org/apache/cxf/wsn/jms/JmsPublisher (Module "deployment.CXF.war:main" from Service Module Loader)
    at org.jboss.modules.ModuleClassLoader.defineClass(ModuleClassLoader.java:396)
    at org.jboss.modules.ModuleClassLoader.loadClassLocal(ModuleClassLoader.java:243)
    at org.jboss.modules.ModuleClassLoader$1.loadClassLocal(ModuleClassLoader.java:73)
    at org.jboss.modules.Module.loadModuleClass(Module.java:517)
    at org.jboss.modules.ModuleClassLoader.findClass(ModuleClassLoader.java:182)
    at org.jboss.modules.ConcurrentClassLoader.performLoadClassUnchecked(ConcurrentClassLoader.java:468)
    at org.jboss.modules.ConcurrentClassLoader.performLoadClassChecked(ConcurrentClassLoader.java:456)
    at org.jboss.modules.ConcurrentClassLoader.performLoadClassChecked(ConcurrentClassLoader.java:423)
    at org.jboss.modules.ConcurrentClassLoader.performLoadClass(ConcurrentClassLoader.java:398)
    at org.jboss.modules.ConcurrentClassLoader.loadClass(ConcurrentClassLoader.java:120)
    at java.lang.ClassLoader.defineClass1(Native Method) [rt.jar:1.6.0_45]
    at java.lang.ClassLoader.defineClassCond(ClassLoader.java:631) [rt.jar:1.6.0_45]
    at java.lang.ClassLoader.defineClass(ClassLoader.java:615) [rt.jar:1.6.0_45]
    at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:141) [rt.jar:1.6.0_45]
    at org.jboss.modules.ModuleClassLoader.doDefineOrLoadClass(ModuleClassLoader.java:327)
    at org.jboss.modules.ModuleClassLoader.defineClass(ModuleClassLoader.java:391)
    at org.jboss.modules.ModuleClassLoader.loadClassLocal(ModuleClassLoader.java:243)
    at org.jboss.modules.ModuleClassLoader$1.loadClassLocal(ModuleClassLoader.java:73)
    at org.jboss.modules.Module.loadModuleClass(Module.java:517)
    at org.jboss.modules.ModuleClassLoader.findClass(ModuleClassLoader.java:182)
    at org.jboss.modules.ConcurrentClassLoader.performLoadClassUnchecked(ConcurrentClassLoader.java:468)
    at org.jboss.modules.ConcurrentClassLoader.performLoadClassChecked(ConcurrentClassLoader.java:456)
    at org.jboss.modules.ConcurrentClassLoader.performLoadClassChecked(ConcurrentClassLoader.java:423)
    at org.jboss.modules.ConcurrentClassLoader.performLoadClass(ConcurrentClassLoader.java:398)
    at org.jboss.modules.ConcurrentClassLoader.loadClass(ConcurrentClassLoader.java:120)
    at java.lang.Class.forName0(Native Method) [rt.jar:1.6.0_45]
    at java.lang.Class.forName(Class.java:249) [rt.jar:1.6.0_45]
    at org.jboss.as.server.deployment.reflect.DeploymentClassIndex.classIndex(DeploymentClassIndex.java:54)
    at org.jboss.as.ee.component.deployers.InterceptorAnnotationProcessor.processComponentConfig(InterceptorAnnotationProcessor.java:63) [jboss-as-ee-7.1.1.Final.jar:7.1.1.Final]
    at org.jboss.as.ee.component.deployers.InterceptorAnnotationProcessor.deploy(InterceptorAnnotationProcessor.java:55) [jboss-as-ee-7.1.1.Final.jar:7.1.1.Final]
    at org.jboss.as.server.deployment.DeploymentUnitPhaseService.start(DeploymentUnitPhaseService.java:113)
    at org.jboss.msc.service.ServiceControllerImpl$StartTask.startService(ServiceControllerImpl.java:1811)
    at org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1746)
    at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:895) [rt.jar:1.6.0_45]
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:918) [rt.jar:1.6.0_45]
    at java.lang.Thread.run(Thread.java:662) [rt.jar:1.6.0_45]
Caused by: java.lang.NoClassDefFoundError: org/apache/activemq/advisory/ConsumerListener
    at java.lang.ClassLoader.defineClass1(Native Method) [rt.jar:1.6.0_45]
    at java.lang.ClassLoader.defineClassCond(ClassLoader.java:631) [rt.jar:1.6.0_45]
    at java.lang.ClassLoader.defineClass(ClassLoader.java:615) [rt.jar:1.6.0_45]
    at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:141) [rt.jar:1.6.0_45]
    at org.jboss.modules.ModuleClassLoader.doDefineOrLoadClass(ModuleClassLoader.java:327)
    at org.jboss.modules.ModuleClassLoader.defineClass(ModuleClassLoader.java:391)
    ... 35 more
Caused by: java.lang.ClassNotFoundException: org.apache.activemq.advisory.ConsumerListener from [Module "deployment.CXF.war:main" from Service Module Loader]
    at org.jboss.modules.ModuleClassLoader.findClass(ModuleClassLoader.java:190)
    at org.jboss.modules.ConcurrentClassLoader.performLoadClassUnchecked(ConcurrentClassLoader.java:468)
    at org.jboss.modules.ConcurrentClassLoader.performLoadClassChecked(ConcurrentClassLoader.java:456)
    at org.jboss.modules.ConcurrentClassLoader.performLoadClassChecked(ConcurrentClassLoader.java:423)
    at org.jboss.modules.ConcurrentClassLoader.performLoadClassChecked(ConcurrentClassLoader.java:423)
    at org.jboss.modules.ConcurrentClassLoader.performLoadClass(ConcurrentClassLoader.java:398)
    at org.jboss.modules.ConcurrentClassLoader.loadClass(ConcurrentClassLoader.java:120)
    ... 41 more

17:51:26,563 WARN  [org.jboss.modules] (MSC service thread 1-1) Failed to define class org.apache.cxf.wsn.services.JaxwsPublisher in Module "deployment.CXF.war:main" from Service Module Loader: java.lang.LinkageError: Failed to link org/apache/cxf/wsn/services/JaxwsPublisher (Module "deployment.CXF.war:main" from Service Module Loader)
    at org.jboss.modules.ModuleClassLoader.defineClass(ModuleClassLoader.java:396)
    at org.jboss.modules.ModuleClassLoader.loadClassLocal(ModuleClassLoader.java:243)
    at org.jboss.modules.ModuleClassLoader$1.loadClassLocal(ModuleClassLoader.java:73)
    at org.jboss.modules.Module.loadModuleClass(Module.java:517)
    at org.jboss.modules.ModuleClassLoader.findClass(ModuleClassLoader.java:182)
    at org.jboss.modules.ConcurrentClassLoader.performLoadClassUnchecked(ConcurrentClassLoader.java:468)
    at org.jboss.modules.ConcurrentClassLoader.performLoadClassChecked(ConcurrentClassLoader.java:456)
    at org.jboss.modules.ConcurrentClassLoader.performLoadClassChecked(ConcurrentClassLoader.java:423)
    at org.jboss.modules.ConcurrentClassLoader.performLoadClass(ConcurrentClassLoader.java:398)
    at org.jboss.modules.ConcurrentClassLoader.loadClass(ConcurrentClassLoader.java:120)
    at java.lang.Class.forName0(Native Method) [rt.jar:1.6.0_45]
    at java.lang.Class.forName(Class.java:249) [rt.jar:1.6.0_45]
    at org.jboss.as.server.deployment.reflect.DeploymentClassIndex.classIndex(DeploymentClassIndex.java:54)
    at org.jboss.as.ee.component.deployers.InterceptorAnnotationProcessor.processComponentConfig(InterceptorAnnotationProcessor.java:63) [jboss-as-ee-7.1.1.Final.jar:7.1.1.Final]
    at org.jboss.as.ee.component.deployers.InterceptorAnnotationProcessor.deploy(InterceptorAnnotationProcessor.java:55) [jboss-as-ee-7.1.1.Final.jar:7.1.1.Final]
    at org.jboss.as.server.deployment.DeploymentUnitPhaseService.start(DeploymentUnitPhaseService.java:113)
    at org.jboss.msc.service.ServiceControllerImpl$StartTask.startService(ServiceControllerImpl.java:1811)
    at org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1746)
    at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:895) [rt.jar:1.6.0_45]
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:918) [rt.jar:1.6.0_45]
    at java.lang.Thread.run(Thread.java:662) [rt.jar:1.6.0_45]
Caused by: java.lang.NoClassDefFoundError: org/apache/cxf/wsn/jms/JmsPublisher
    at java.lang.ClassLoader.defineClass1(Native Method) [rt.jar:1.6.0_45]
    at java.lang.ClassLoader.defineClassCond(ClassLoader.java:631) [rt.jar:1.6.0_45]
    at java.lang.ClassLoader.defineClass(ClassLoader.java:615) [rt.jar:1.6.0_45]
    at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:141) [rt.jar:1.6.0_45]
    at org.jboss.modules.ModuleClassLoader.doDefineOrLoadClass(ModuleClassLoader.java:327)
    at org.jboss.modules.ModuleClassLoader.defineClass(ModuleClassLoader.java:391)
    ... 20 more
Caused by: java.lang.ClassNotFoundException: org.apache.cxf.wsn.jms.JmsPublisher from [Module "deployment.CXF.war:main" from Service Module Loader]
    at org.jboss.modules.ModuleClassLoader.findClass(ModuleClassLoader.java:190)
    at org.jboss.modules.ConcurrentClassLoader.performLoadClassUnchecked(ConcurrentClassLoader.java:468)
    at org.jboss.modules.ConcurrentClassLoader.performLoadClassChecked(ConcurrentClassLoader.java:456)
    at org.jboss.modules.ConcurrentClassLoader.performLoadClassChecked(ConcurrentClassLoader.java:423)
    at org.jboss.modules.ConcurrentClassLoader.performLoadClass(ConcurrentClassLoader.java:398)
    at org.jboss.modules.ConcurrentClassLoader.loadClass(ConcurrentClassLoader.java:120)
    ... 26 more

17:51:26,690 WARN  [org.jboss.modules] (MSC service thread 1-1) Failed to define class org.apache.cxf.wsn.jms.JmsPublisher in Module "deployment.CXF.war:main" from Service Module Loader: java.lang.LinkageError: Failed to link org/apache/cxf/wsn/jms/JmsPublisher (Module "deployment.CXF.war:main" from Service Module Loader)
    at org.jboss.modules.ModuleClassLoader.defineClass(ModuleClassLoader.java:396) [jboss-modules.jar:1.1.1.GA]
    at org.jboss.modules.ModuleClassLoader.loadClassLocal(ModuleClassLoader.java:243) [jboss-modules.jar:1.1.1.GA]
    at org.jboss.modules.ModuleClassLoader$1.loadClassLocal(ModuleClassLoader.java:73) [jboss-modules.jar:1.1.1.GA]
    at org.jboss.modules.Module.loadModuleClass(Module.java:517) [jboss-modules.jar:1.1.1.GA]
    at org.jboss.modules.ModuleClassLoader.findClass(ModuleClassLoader.java:182) [jboss-modules.jar:1.1.1.GA]
    at org.jboss.modules.ConcurrentClassLoader.performLoadClassUnchecked(ConcurrentClassLoader.java:468) [jboss-modules.jar:1.1.1.GA]
    at org.jboss.modules.ConcurrentClassLoader.performLoadClassChecked(ConcurrentClassLoader.java:456) [jboss-modules.jar:1.1.1.GA]
    at org.jboss.modules.ConcurrentClassLoader.performLoadClassChecked(ConcurrentClassLoader.java:423) [jboss-modules.jar:1.1.1.GA]
    at org.jboss.modules.ConcurrentClassLoader.performLoadClass(ConcurrentClassLoader.java:398) [jboss-modules.jar:1.1.1.GA]
    at org.jboss.modules.ConcurrentClassLoader.loadClass(ConcurrentClassLoader.java:120) [jboss-modules.jar:1.1.1.GA]
    at java.lang.Class.getDeclaredFields0(Native Method) [rt.jar:1.6.0_45]
    at java.lang.Class.privateGetDeclaredFields(Class.java:2300) [rt.jar:1.6.0_45]
    at java.lang.Class.getDeclaredFields(Class.java:1745) [rt.jar:1.6.0_45]
    at org.jboss.as.server.deployment.reflect.ClassReflectionIndex.<init>(ClassReflectionIndex.java:57) [jboss-as-server-7.1.1.Final.jar:7.1.1.Final]
    at org.jboss.as.server.deployment.reflect.DeploymentReflectionIndex.getClassIndex(DeploymentReflectionIndex.java:66) [jboss-as-server-7.1.1.Final.jar:7.1.1.Final]
    at org.jboss.as.ee.metadata.MethodAnnotationAggregator.runtimeAnnotationInformation(MethodAnnotationAggregator.java:58)
    at org.jboss.as.ee.component.deployers.InterceptorAnnotationProcessor.handleAnnotations(InterceptorAnnotationProcessor.java:85)
    at org.jboss.as.ee.component.deployers.InterceptorAnnotationProcessor.processComponentConfig(InterceptorAnnotationProcessor.java:70)
    at org.jboss.as.ee.component.deployers.InterceptorAnnotationProcessor.deploy(InterceptorAnnotationProcessor.java:55)
    at org.jboss.as.server.deployment.DeploymentUnitPhaseService.start(DeploymentUnitPhaseService.java:113) [jboss-as-server-7.1.1.Final.jar:7.1.1.Final]
    at org.jboss.msc.service.ServiceControllerImpl$StartTask.startService(ServiceControllerImpl.java:1811) [jboss-msc-1.0.2.GA.jar:1.0.2.GA]
    at org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1746) [jboss-msc-1.0.2.GA.jar:1.0.2.GA]
    at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:895) [rt.jar:1.6.0_45]
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:918) [rt.jar:1.6.0_45]
    at java.lang.Thread.run(Thread.java:662) [rt.jar:1.6.0_45]
Caused by: java.lang.NoClassDefFoundError: org/apache/activemq/advisory/ConsumerListener
    at java.lang.ClassLoader.defineClass1(Native Method) [rt.jar:1.6.0_45]
    at java.lang.ClassLoader.defineClassCond(ClassLoader.java:631) [rt.jar:1.6.0_45]
    at java.lang.ClassLoader.defineClass(ClassLoader.java:615) [rt.jar:1.6.0_45]
    at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:141) [rt.jar:1.6.0_45]
    at org.jboss.modules.ModuleClassLoader.doDefineOrLoadClass(ModuleClassLoader.java:327) [jboss-modules.jar:1.1.1.GA]
    at org.jboss.modules.ModuleClassLoader.defineClass(ModuleClassLoader.java:391) [jboss-modules.jar:1.1.1.GA]
    ... 24 more
Caused by: java.lang.ClassNotFoundException: org.apache.activemq.advisory.ConsumerListener from [Module "deployment.CXF.war:main" from Service Module Loader]
    at org.jboss.modules.ModuleClassLoader.findClass(ModuleClassLoader.java:190) [jboss-modules.jar:1.1.1.GA]
    at org.jboss.modules.ConcurrentClassLoader.performLoadClassUnchecked(ConcurrentClassLoader.java:468) [jboss-modules.jar:1.1.1.GA]
    at org.jboss.modules.ConcurrentClassLoader.performLoadClassChecked(ConcurrentClassLoader.java:456) [jboss-modules.jar:1.1.1.GA]
    at org.jboss.modules.ConcurrentClassLoader.performLoadClassChecked(ConcurrentClassLoader.java:423) [jboss-modules.jar:1.1.1.GA]
    at org.jboss.modules.ConcurrentClassLoader.performLoadClassChecked(ConcurrentClassLoader.java:423) [jboss-modules.jar:1.1.1.GA]
    at org.jboss.modules.ConcurrentClassLoader.performLoadClass(ConcurrentClassLoader.java:398) [jboss-modules.jar:1.1.1.GA]
    at org.jboss.modules.ConcurrentClassLoader.loadClass(ConcurrentClassLoader.java:120) [jboss-modules.jar:1.1.1.GA]
    ... 30 more

17:51:26,757 ERROR [org.jboss.msc.service.fail] (MSC service thread 1-1) MSC00001: Failed to start service jboss.deployment.unit."CXF.war".POST_MODULE: org.jboss.msc.service.StartException in service jboss.deployment.unit."CXF.war".POST_MODULE: Failed to process phase POST_MODULE of deployment "CXF.war"
    at org.jboss.as.server.deployment.DeploymentUnitPhaseService.start(DeploymentUnitPhaseService.java:119) [jboss-as-server-7.1.1.Final.jar:7.1.1.Final]
    at org.jboss.msc.service.ServiceControllerImpl$StartTask.startService(ServiceControllerImpl.java:1811) [jboss-msc-1.0.2.GA.jar:1.0.2.GA]
    at org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1746) [jboss-msc-1.0.2.GA.jar:1.0.2.GA]
    at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:895) [rt.jar:1.6.0_45]
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:918) [rt.jar:1.6.0_45]
    at java.lang.Thread.run(Thread.java:662) [rt.jar:1.6.0_45]
Caused by: java.lang.RuntimeException: Error getting reflective information for class org.apache.cxf.wsn.services.JaxwsNotificationBroker with ClassLoader ModuleClassLoader for Module "deployment.CXF.war:main" from Service Module Loader
    at org.jboss.as.server.deployment.reflect.DeploymentReflectionIndex.getClassIndex(DeploymentReflectionIndex.java:70) [jboss-as-server-7.1.1.Final.jar:7.1.1.Final]
    at org.jboss.as.ee.metadata.MethodAnnotationAggregator.runtimeAnnotationInformation(MethodAnnotationAggregator.java:58)
    at org.jboss.as.ee.component.deployers.InterceptorAnnotationProcessor.handleAnnotations(InterceptorAnnotationProcessor.java:85)
    at org.jboss.as.ee.component.deployers.InterceptorAnnotationProcessor.processComponentConfig(InterceptorAnnotationProcessor.java:70)
    at org.jboss.as.ee.component.deployers.InterceptorAnnotationProcessor.deploy(InterceptorAnnotationProcessor.java:55)
    at org.jboss.as.server.deployment.DeploymentUnitPhaseService.start(DeploymentUnitPhaseService.java:113) [jboss-as-server-7.1.1.Final.jar:7.1.1.Final]
    ... 5 more
Caused by: java.lang.NoClassDefFoundError: org/apache/cxf/wsn/jms/JmsPublisher
    at java.lang.Class.getDeclaredFields0(Native Method) [rt.jar:1.6.0_45]
    at java.lang.Class.privateGetDeclaredFields(Class.java:2300) [rt.jar:1.6.0_45]
    at java.lang.Class.getDeclaredFields(Class.java:1745) [rt.jar:1.6.0_45]
    at org.jboss.as.server.deployment.reflect.ClassReflectionIndex.<init>(ClassReflectionIndex.java:57) [jboss-as-server-7.1.1.Final.jar:7.1.1.Final]
    at org.jboss.as.server.deployment.reflect.DeploymentReflectionIndex.getClassIndex(DeploymentReflectionIndex.java:66) [jboss-as-server-7.1.1.Final.jar:7.1.1.Final]
    ... 10 more
Caused by: java.lang.ClassNotFoundException: org.apache.cxf.wsn.jms.JmsPublisher from [Module "deployment.CXF.war:main" from Service Module Loader]
    at org.jboss.modules.ModuleClassLoader.findClass(ModuleClassLoader.java:190)
    at org.jboss.modules.ConcurrentClassLoader.performLoadClassUnchecked(ConcurrentClassLoader.java:468)
    at org.jboss.modules.ConcurrentClassLoader.performLoadClassChecked(ConcurrentClassLoader.java:456)
    at org.jboss.modules.ConcurrentClassLoader.performLoadClassChecked(ConcurrentClassLoader.java:423)
    at org.jboss.modules.ConcurrentClassLoader.performLoadClass(ConcurrentClassLoader.java:398)
    at org.jboss.modules.ConcurrentClassLoader.loadClass(ConcurrentClassLoader.java:120)
    ... 15 more

17:51:26,811 INFO  [org.jboss.as.server] (DeploymentScanner-threads - 2) JBAS015870: Deploy of deployment "CXF.war" was rolled back with failure message {"JBAS014671: Failed services" => {"jboss.deployment.unit.\"CXF.war\".POST_MODULE" => "org.jboss.msc.service.StartException in service jboss.deployment.unit.\"CXF.war\".POST_MODULE: Failed to process phase POST_MODULE of deployment \"CXF.war\""}}
17:51:27,096 INFO  [org.jboss.as.server.deployment] (MSC service thread 1-10) JBAS015877: Stopped deployment CXF.war in 285ms
17:51:27,100 INFO  [org.jboss.as.controller] (DeploymentScanner-threads - 2) JBAS014774: Service status report
JBAS014777:   Services which failed to start:      service jboss.deployment.unit."CXF.war".POST_MODULE: org.jboss.msc.service.StartException in service jboss.deployment.unit."CXF.war".POST_MODULE: Failed to process phase POST_MODULE of deployment "CXF.war"

17:51:27,107 ERROR [org.jboss.as.server.deployment.scanner] (DeploymentScanner-threads - 1) {"JBAS014653: Composite operation failed and was rolled back. Steps that failed:" => {"Operation step-2" => {"JBAS014671: Failed services" => {"jboss.deployment.unit.\"CXF.war\".POST_MODULE" => "org.jboss.msc.service.StartException in service jboss.deployment.unit.\"CXF.war\".POST_MODULE: Failed to process phase POST_MODULE of deployment \"CXF.war\""}}}}
4

3 回答 3

4

我们在尝试在 JBoss AS 7.1.1 Final + jbossws-cxf-4.0.2.GA 上运行 Web 服务时遇到了类似的问题。我们解决问题的方法是通过 Eclipse 上的构建路径配置将 Jboss 模块中的 CXF jar 添加为变量。这样,您将能够完成 @mike4263 建议的“编译依赖项”。这是一个很好的教程:http: //www.wikihow.com/Add-JARs-to-Project-Build-Paths-in-Eclipse-%28Java%29

于 2013-12-02T19:16:08.663 回答
1

您需要从您的包中删除其他版本的 CXF。容器版本和捆绑版本之间似乎存在一些阻抗不匹配。您的应用程序应该依赖于使用 JBoss 部署的版本。这是一个相当常见的错误,这意味着您没有利用预配置的版本,并且可能会遇到其他集成/支持问题

您可以将依赖项配置为“编译依赖项”,并确保它没有捆绑到输出 WAR 文件中。

于 2013-10-06T14:42:33.313 回答
0

我有同样的问题。我解决如下。

  1. 删除standalone.xml中的以下标签(在jboos上)

    <subsystem xmlns="urn:jboss:domain:webservices:1.2">
        <modify-wsdl-address>true</modify-wsdl-address>
        <wsdl-host>${jboss.bind.address:127.0.0.1}</wsdl-host>
        <endpoint-config name="Standard-Endpoint-Config"/>
        <endpoint-config name="Recording-Endpoint-Config">
            <pre-handler-chain name="recording-handlers" protocol-bindings="##SOAP11_HTTP ##SOAP11_HTTP_MTOM ##SOAP12_HTTP ##SOAP12_HTTP_MTOM">
                <handler name="RecordingHandler" class="org.jboss.ws.common.invocation.RecordingServerHandler"/>
            </pre-handler-chain>
        </endpoint-config>
    </subsystem>
    

2.如果不想删除它们。在您的项目中找到 Lib“cxf-services-wsn-core-2.7.1.jar”。

这个解决方案对我有用。

于 2016-10-06T11:26:47.783 回答