简体   繁体   中英

There is an issue when running Jersey2 REST Client on WildFly 8.1

I'm trying to embedded my REST client which is written on Jersey 2.13 to WildFly 8.1 application server. I know that WF8 has its own implementation of REST client (RestEasy). And it seams that WF8 doesn't wont to let Jersey live. It intercepts Jersey and replaces with own classes.

Here is my exception log:

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)

Is there any solution to fix this issue?

UPDATE

After modification of jboss-deployment-structure file:

<?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>

I got

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'"}}

Not sure if it would work but try commenting

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

from your wildfly configuration file.

If you are running wildfly in standalone mode edit it in standalone.xml or else domain.xml

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM