【问题标题】:There is an issue when running Jersey2 REST Client on WildFly 8.1在 WildFly 8.1 上运行 Jersey2 REST 客户端时出现问题
【发布时间】:2014-10-28 14:56:24
【问题描述】:

我正在尝试将编写在 Jersey 2.13 上的 REST 客户端嵌入到 WildFly 8.1 应用程序服务器。我知道 WF8 有自己的 REST 客户端(RestEasy)实现。而且WF8似乎不会让泽西岛活着。它拦截 Jersey 并用自己的类替换。

这是我的异常日志:

java.lang.LinkageError: org/glassfish/jersey/media/multipart/internal/FormDataParamValueFactoryProvider
org.glassfish.jersey.media.multipart.internal.FormDataParameterInjectionFeature.configure(FormDataParameterInjectionFeature.java:77)
org.jboss.resteasy.spi.ResteasyProviderFactory.registerProvider(ResteasyProviderFactory.java:1673)
org.jboss.resteasy.spi.ResteasyProviderFactory.registerProvider(ResteasyProviderFactory.java:1310)
org.jboss.resteasy.spi.ResteasyProviderFactory.registerProvider(ResteasyProviderFactory.java:1232)
org.jboss.resteasy.spi.ResteasyProviderFactory.register(ResteasyProviderFactory.java:2364)
org.jboss.resteasy.spi.ResteasyProviderFactory.register(ResteasyProviderFactory.java:97)
org.jboss.resteasy.util.FeatureContextDelegate.register(FeatureContextDelegate.java:37)
org.jboss.resteasy.util.FeatureContextDelegate.register(FeatureContextDelegate.java:12)
org.glassfish.jersey.media.multipart.MultiPartFeature.configure(MultiPartFeature.java:64)
org.jboss.resteasy.spi.ResteasyProviderFactory.registerProvider(ResteasyProviderFactory.java:1673)
org.jboss.resteasy.spi.ResteasyProviderFactory.registerProvider(ResteasyProviderFactory.java:1310)
org.jboss.resteasy.spi.ResteasyProviderFactory.registerProvider(ResteasyProviderFactory.java:1232)
org.jboss.resteasy.spi.ResteasyProviderFactory.register(ResteasyProviderFactory.java:2364)
org.jboss.resteasy.client.jaxrs.internal.ClientConfiguration.register(ClientConfiguration.java:168)
org.jboss.resteasy.client.jaxrs.internal.ClientWebTarget.register(ClientWebTarget.java:351)
org.jboss.resteasy.client.jaxrs.internal.ClientWebTarget.register(ClientWebTarget.java:23)
com.jaspersoft.jasperserver.jaxrs.client.core.JerseyRequest.<init>(JerseyRequest.java:104)
com.jaspersoft.jasperserver.jaxrs.client.core.JerseyRequest.buildRequest(JerseyRequest.java:62)
com.jaspersoft.jasperserver.jaxrs.client.core.JerseyRequest.buildRequest(JerseyRequest.java:55)
com.jaspersoft.jasperserver.jaxrs.client.apiadapters.serverInfo.ServerInfoService.buildServerInfoRequest(ServerInfoService.java:44)
com.jaspersoft.jasperserver.jaxrs.client.apiadapters.serverInfo.ServerInfoService.edition(ServerInfoService.java:51)
il.alex.jboss.example.MainServlet.doGet(MainServlet.java:26)
javax.servlet.http.HttpServlet.service(HttpServlet.java:687)
javax.servlet.http.HttpServlet.service(HttpServlet.java:790)
io.undertow.servlet.handlers.ServletHandler.handleRequest(ServletHandler.java:85)
io.undertow.servlet.handlers.security.ServletSecurityRoleHandler.handleRequest(ServletSecurityRoleHandler.java:61)
io.undertow.servlet.handlers.ServletDispatchingHandler.handleRequest(ServletDispatchingHandler.java:36)
org.wildfly.extension.undertow.security.SecurityContextAssociationHandler.handleRequest(SecurityContextAssociationHandler.java:78)
io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:25)
io.undertow.servlet.handlers.security.SSLInformationAssociationHandler.handleRequest(SSLInformationAssociationHandler.java:113)
io.undertow.servlet.handlers.security.ServletAuthenticationCallHandler.handleRequest(ServletAuthenticationCallHandler.java:56)
io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:25)
io.undertow.security.handlers.AbstractConfidentialityHandler.handleRequest(AbstractConfidentialityHandler.java:45)
io.undertow.servlet.handlers.security.ServletConfidentialityConstraintHandler.handleRequest(ServletConfidentialityConstraintHandler.java:61)
io.undertow.security.handlers.AuthenticationMechanismsHandler.handleRequest(AuthenticationMechanismsHandler.java:58)
io.undertow.servlet.handlers.security.CachedAuthenticatedSessionHandler.handleRequest(CachedAuthenticatedSessionHandler.java:70)
io.undertow.security.handlers.SecurityInitialHandler.handleRequest(SecurityInitialHandler.java:76)
io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:25)
org.wildfly.extension.undertow.security.jacc.JACCContextIdHandler.handleRequest(JACCContextIdHandler.java:61)
io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:25)
io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:25)
io.undertow.servlet.handlers.ServletInitialHandler.handleFirstRequest(ServletInitialHandler.java:240)
io.undertow.servlet.handlers.ServletInitialHandler.dispatchRequest(ServletInitialHandler.java:227)
io.undertow.servlet.handlers.ServletInitialHandler.access$000(ServletInitialHandler.java:73)
io.undertow.servlet.handlers.ServletInitialHandler$1.handleRequest(ServletInitialHandler.java:146)
io.undertow.server.Connectors.executeRootHandler(Connectors.java:177)
io.undertow.server.HttpServerExchange$1.run(HttpServerExchange.java:727)
java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
java.lang.Thread.run(Thread.java:745)

有没有办法解决这个问题?

更新

修改jboss-deployment-structure文件后:

<?xml version="1.0" encoding="UTF-8"?>
<jboss-deployment-structure>
    <deployment>
        <exclude-subsystems>
            <subsystem name="resteasy" xmlns="urn:jboss:domain:jaxrs:1.0"/>
        </exclude-subsystems>
    </deployment>
</jboss-deployment-structure>

我明白了

2014-10-28 05:20:14,308] Artifact jboss-another-example:war exploded: Artifact is being deployed, please wait...
[0m17:20:14,570 INFO  [org.jboss.as.server.deployment] (MSC service thread 1-5) JBAS015876: Starting deployment of "jboss_another_example_war_exploded.war" (runtime-name: "jboss_another_example_war_exploded.war")
[0m[31m17:20:15,571 ERROR [org.jboss.msc.service.fail] (MSC service thread 1-2) MSC000001: Failed to start service jboss.deployment.unit."jboss_another_example_war_exploded.war".STRUCTURE: org.jboss.msc.service.StartException in service jboss.deployment.unit."jboss_another_example_war_exploded.war".STRUCTURE: JBAS018733: Failed to process phase STRUCTURE of deployment "jboss_another_example_war_exploded.war"
    at org.jboss.as.server.deployment.DeploymentUnitPhaseService.start(DeploymentUnitPhaseService.java:166) [wildfly-server-8.1.0.Final.jar:8.1.0.Final]
    at org.jboss.msc.service.ServiceControllerImpl$StartTask.startService(ServiceControllerImpl.java:1948) [jboss-msc-1.2.2.Final.jar:1.2.2.Final]
    at org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1881) [jboss-msc-1.2.2.Final.jar:1.2.2.Final]
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) [rt.jar:1.8.0_40-ea]
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) [rt.jar:1.8.0_40-ea]
    at java.lang.Thread.run(Thread.java:745) [rt.jar:1.8.0_40-ea]
Caused by: org.jboss.as.server.deployment.DeploymentUnitProcessingException: JBAS018748: Error loading jboss-deployment-structure.xml from /Users/alex/IdeaProjects/jboss-another-example/out/artifacts/jboss_another_example_war_exploded.war/WEB-INF/jboss-deployment-structure.xml
    at org.jboss.as.server.deployment.module.descriptor.DeploymentStructureDescriptorParser.parse(DeploymentStructureDescriptorParser.java:322) [wildfly-server-8.1.0.Final.jar:8.1.0.Final]
    at org.jboss.as.server.deployment.module.descriptor.DeploymentStructureDescriptorParser.parse(DeploymentStructureDescriptorParser.java:294) [wildfly-server-8.1.0.Final.jar:8.1.0.Final]
    at org.jboss.as.server.deployment.module.descriptor.DeploymentStructureDescriptorParser.deploy(DeploymentStructureDescriptorParser.java:158) [wildfly-server-8.1.0.Final.jar:8.1.0.Final]
    at org.jboss.as.server.deployment.DeploymentUnitPhaseService.start(DeploymentUnitPhaseService.java:159) [wildfly-server-8.1.0.Final.jar:8.1.0.Final]
    ... 5 more
Caused by: javax.xml.stream.XMLStreamException: ParseError at [row,col]:[5,13]
Message: JBAS018754: Unexpected content of type 'element start', name is '{urn:jboss:domain:jaxrs:1.0}subsystem', text is: 'null'
    at org.jboss.as.server.deployment.module.descriptor.JBossDeploymentStructureParser12.unexpectedContent(JBossDeploymentStructureParser12.java:1194) [wildfly-server-8.1.0.Final.jar:8.1.0.Final]
    at org.jboss.as.server.deployment.module.descriptor.JBossDeploymentStructureParser12.parseExcludeSubsystem(JBossDeploymentStructureParser12.java:1100) [wildfly-server-8.1.0.Final.jar:8.1.0.Final]
    at org.jboss.as.server.deployment.module.descriptor.JBossDeploymentStructureParser12.parseModuleStructureSpec(JBossDeploymentStructureParser12.java:366) [wildfly-server-8.1.0.Final.jar:8.1.0.Final]
    at org.jboss.as.server.deployment.module.descriptor.JBossDeploymentStructureParser12.parseDeployment(JBossDeploymentStructureParser12.java:267) [wildfly-server-8.1.0.Final.jar:8.1.0.Final]
    at org.jboss.as.server.deployment.module.descriptor.JBossDeploymentStructureParser12.readElement(JBossDeploymentStructureParser12.java:244) [wildfly-server-8.1.0.Final.jar:8.1.0.Final]
    at org.jboss.as.server.deployment.module.descriptor.JBossDeploymentStructureParser12.readElement(JBossDeploymentStructureParser12.java:69) [wildfly-server-8.1.0.Final.jar:8.1.0.Final]
    at org.jboss.staxmapper.XMLMapperImpl.processNested(XMLMapperImpl.java:110)
    at org.jboss.staxmapper.XMLMapperImpl.parseDocument(XMLMapperImpl.java:69)
    at org.jboss.as.server.deployment.module.descriptor.DeploymentStructureDescriptorParser.parse(DeploymentStructureDescriptorParser.java:316) [wildfly-server-8.1.0.Final.jar:8.1.0.Final]
    ... 8 more

[0m[31m17:20:15,578 ERROR [org.jboss.as.controller.management-operation] (management-handler-thread - 2) JBAS014613: Operation ("deploy") failed - address: ([("deployment" => "jboss_another_example_war_exploded.war")]) - failure description: {"JBAS014671: Failed services" => {"jboss.deployment.unit.\"jboss_another_example_war_exploded.war\".STRUCTURE" => "org.jboss.msc.service.StartException in service jboss.deployment.unit.\"jboss_another_example_war_exploded.war\".STRUCTURE: JBAS018733: Failed to process phase STRUCTURE of deployment \"jboss_another_example_war_exploded.war\"
    Caused by: org.jboss.as.server.deployment.DeploymentUnitProcessingException: JBAS018748: Error loading jboss-deployment-structure.xml from /Users/alex/IdeaProjects/jboss-another-example/out/artifacts/jboss_another_example_war_exploded.war/WEB-INF/jboss-deployment-structure.xml
    Caused by: javax.xml.stream.XMLStreamException: ParseError at [row,col]:[5,13]
Message: JBAS018754: Unexpected content of type 'element start', name is '{urn:jboss:domain:jaxrs:1.0}subsystem', text is: 'null'"}}
[0m[31m17:20:15,582 ERROR [org.jboss.as.server] (management-handler-thread - 2) JBAS015870: Deploy of deployment "jboss_another_example_war_exploded.war" was rolled back with the following failure message: 
{"JBAS014671: Failed services" => {"jboss.deployment.unit.\"jboss_another_example_war_exploded.war\".STRUCTURE" => "org.jboss.msc.service.StartException in service jboss.deployment.unit.\"jboss_another_example_war_exploded.war\".STRUCTURE: JBAS018733: Failed to process phase STRUCTURE of deployment \"jboss_another_example_war_exploded.war\"
    Caused by: org.jboss.as.server.deployment.DeploymentUnitProcessingException: JBAS018748: Error loading jboss-deployment-structure.xml from /Users/alex/IdeaProjects/jboss-another-example/out/artifacts/jboss_another_example_war_exploded.war/WEB-INF/jboss-deployment-structure.xml
    Caused by: javax.xml.stream.XMLStreamException: ParseError at [row,col]:[5,13]
Message: JBAS018754: Unexpected content of type 'element start', name is '{urn:jboss:domain:jaxrs:1.0}subsystem', text is: 'null'"}}
[0m[0m17:20:15,586 INFO  [org.jboss.as.server.deployment] (MSC service thread 1-3) JBAS015877: Stopped deployment jboss_another_example_war_exploded.war (runtime-name: jboss_another_example_war_exploded.war) in 4ms
[0m[0m17:20:15,589 INFO  [org.jboss.as.controller] (management-handler-thread - 2) JBAS014774: Service status report
JBAS014777:   Services which failed to start:      service jboss.deployment.unit."jboss_another_example_war_exploded.war".STRUCTURE

[0m[2014-10-28 05:20:15,667] Artifact jboss-another-example:war exploded: Error during artifact deployment. See server log for details.
[2014-10-28 05:20:15,669] Artifact jboss-another-example:war exploded: java.lang.Exception: {"JBAS014671: Failed services" => {"jboss.deployment.unit.\"jboss_another_example_war_exploded.war\".STRUCTURE" => "org.jboss.msc.service.StartException in service jboss.deployment.unit.\"jboss_another_example_war_exploded.war\".STRUCTURE: JBAS018733: Failed to process phase STRUCTURE of deployment \"jboss_another_example_war_exploded.war\"
    Caused by: org.jboss.as.server.deployment.DeploymentUnitProcessingException: JBAS018748: Error loading jboss-deployment-structure.xml from /Users/alex/IdeaProjects/jboss-another-example/out/artifacts/jboss_another_example_war_exploded.war/WEB-INF/jboss-deployment-structure.xml
    Caused by: javax.xml.stream.XMLStreamException: ParseError at [row,col]:[5,13]
Message: JBAS018754: Unexpected content of type 'element start', name is '{urn:jboss:domain:jaxrs:1.0}subsystem', text is: 'null'"}}

【问题讨论】:

    标签: java jersey-2.0 jersey-client wildfly-8


    【解决方案1】:

    不确定是否可行,但请尝试发表评论

    <subsystem xmlns="urn:jboss:domain:jaxrs:1.0"/> 
    

    来自您的 Wildfly 配置文件。

    如果您在独立模式下运行 wildfly,请在 Standalone.xml 中编辑它 否则 domain.xml

    【讨论】:

    猜你喜欢
    • 2010-11-14
    • 2020-08-07
    • 2014-08-10
    • 2010-10-03
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多