简体   繁体   English

wildfly 8 + jersey war文件部署问题

[英]wildfly 8 + jersey war file deployment issues

I'm having an issue that I can't seem to figure out. 我遇到了一个似乎无法解决的问题。 I can't seem to deploy the application successfully to wildfly, and it's not giving me much detail to try and rectify the issue. 我似乎无法成功地将应用程序部署到wildfly,并且也没有给我太多尝试解决此问题的详细信息。 Here is the deployment error from wildfly console: 这是来自wildfly控制台的部署错误:

17:57:24,735 ERROR [org.jboss.msc.service.fail] (MSC service thread 1-9) MSC000001: Failed to start service jboss.deployment.unit."iamws.war".WeldStartService: org.jboss.msc.service.StartException in service jboss.deployment.unit."iamws.war".WeldStartService: Failed to start service
    at org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1904) [jboss-msc-1.2.0.CR1.jar:1.2.0.CR1]
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145) [rt.jar:1.7.0_51]
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615) [rt.jar:1.7.0_51]
    at java.lang.Thread.run(Thread.java:744) [rt.jar:1.7.0_51]
Caused by: org.jboss.weld.exceptions.DeploymentException: WELD-001408: Unsatisfied dependencies for type ServiceLocator with qualifiers @Default
  at injection point [BackedAnnotatedParameter] Parameter 1 of [BackedAnnotatedConstructor] @Inject private org.glassfish.jersey.servlet.internal.PersistenceUnitBinder$PersistenceUnitInjectionResolver(ServiceLocator)
  at org.glassfish.jersey.servlet.internal.PersistenceUnitBinder$PersistenceUnitInjectionResolver.<init>(PersistenceUnitInjectionResolver.java:0)

    at org.jboss.weld.bootstrap.Validator.validateInjectionPointForDeploymentProblems(Validator.java:361)
    at org.jboss.weld.bootstrap.Validator.validateInjectionPoint(Validator.java:282)
    at org.jboss.weld.bootstrap.Validator.validateGeneralBean(Validator.java:133)
    at org.jboss.weld.bootstrap.Validator.validateRIBean(Validator.java:164)
    at org.jboss.weld.bootstrap.Validator.validateBean(Validator.java:507)
    at org.jboss.weld.bootstrap.ConcurrentValidator$1.doWork(ConcurrentValidator.java:68)
    at org.jboss.weld.bootstrap.ConcurrentValidator$1.doWork(ConcurrentValidator.java:66)
    at org.jboss.weld.executor.IterativeWorkerTaskFactory$1.call(IterativeWorkerTaskFactory.java:60)
    at org.jboss.weld.executor.IterativeWorkerTaskFactory$1.call(IterativeWorkerTaskFactory.java:53)
    at java.util.concurrent.FutureTask.run(FutureTask.java:262) [rt.jar:1.7.0_51]
    ... 3 more

17:57:24,742 ERROR [org.jboss.as.controller.management-operation] (Controller Boot Thread) JBAS014613: Operation ("deploy") failed - address: ([("deployment" => "iamws.war")]) - failure description: {"JBAS014671: Failed services" => {"jboss.deployment.unit.\"iamws.war\".WeldStartService" => "org.jboss.msc.service.StartException in service jboss.deployment.unit.\"iamws.war\".WeldStartService: Failed to start service
    Caused by: org.jboss.weld.exceptions.DeploymentException: WELD-001408: Unsatisfied dependencies for type ServiceLocator with qualifiers @Default
  at injection point [BackedAnnotatedParameter] Parameter 1 of [BackedAnnotatedConstructor] @Inject private org.glassfish.jersey.servlet.internal.PersistenceUnitBinder$PersistenceUnitInjectionResolver(ServiceLocator)
  at org.glassfish.jersey.servlet.internal.PersistenceUnitBinder$PersistenceUnitInjectionResolver.<init>(PersistenceUnitInjectionResolver.java:0)
"}}
17:57:24,793 INFO  [org.jboss.as.server] (ServerService Thread Pool -- 29) JBAS018559: Deployed "ojdbc6.jar" (runtime-name : "ojdbc6.jar")
17:57:24,793 INFO  [org.jboss.as.server] (ServerService Thread Pool -- 29) JBAS018559: Deployed "iamws.war" (runtime-name : "iamws.war")
17:57:24,795 INFO  [org.jboss.as.controller] (Controller Boot Thread) JBAS014774: Service status report
JBAS014777:   Services which failed to start:      service jboss.deployment.unit."iamws.war".WeldStartService: org.jboss.msc.service.StartException in service jboss.deployment.unit."iamws.war".WeldStartService: Failed to start service

17:57:24,801 INFO  [org.jboss.as] (Controller Boot Thread) JBAS015961: Http management interface listening on http://127.0.0.1:9990/management
17:57:24,801 INFO  [org.jboss.as] (Controller Boot Thread) JBAS015951: Admin console listening on http://127.0.0.1:9990
17:57:24,801 ERROR [org.jboss.as] (Controller Boot Thread) JBAS015875: WildFly 8.0.0.CR1 "WildFly" started (with errors) in 7749ms - Started 304 of 385 services (21 services failed or missing dependencies, 95 services are lazy, passive or on-demand)
17:57:25,020 INFO  [org.jboss.as.connector.deployers.jdbc] (MSC service thread 1-14) JBAS010418: Stopped Driver service with driver-name = iamws.war_oracle.jdbc.OracleDriver_11_2
17:57:25,022 INFO  [org.jboss.as.jpa] (ServerService Thread Pool -- 1) JBAS011410: Stopping Persistence Unit (phase 2 of 2) Service 'iamws.war#iamwsDev'
17:57:25,024 INFO  [org.jboss.weld.deployer] (MSC service thread 1-3) JBAS016009: Stopping weld service for deployment iamws.war
17:57:25,053 INFO  [org.jboss.as.jpa] (ServerService Thread Pool -- 1) JBAS011410: Stopping Persistence Unit (phase 1 of 2) Service 'iamws.war#iamwsDev'
17:57:25,067 INFO  [org.jboss.as.server.deployment] (MSC service thread 1-7) JBAS015877: Stopped deployment iamws.war (runtime-name: iamws.war) in 50ms
17:57:25,107 INFO  [org.jboss.as.server] (DeploymentScanner-threads - 2) JBAS018558: Undeployed "iamws.war" (runtime-name: "iamws.war")
17:57:25,117 INFO  [org.jboss.as.controller] (DeploymentScanner-threads - 2) JBAS014774: Service status report
JBAS014775:    New missing/unsatisfied dependencies:
      service jboss.deployment.unit."iamws.war".WeldBootstrapService (missing) dependents: [service jboss.deployment.unit."iamws.war".component."com.sun.faces.config.ConfigureListener".WeldInstantiator, service jboss.deployment.unit."iamws.war".component."javax.faces.webapp.FacetTag".WeldInstantiator, service jboss.deployment.unit."iamws.war".component."org.jboss.weld.servlet.WeldInitialListener".WeldInstantiator, service jboss.deployment.unit."iamws.war".component."org.jboss.weld.servlet.WeldTerminalListener".WeldInstantiator, JBAS014799: ... and 7 more ] 
      service jboss.deployment.unit."iamws.war".WeldStartService (missing) dependents: [service jboss.deployment.unit."iamws.war".component."com.sun.faces.config.ConfigureListener".WeldInstantiator, service jboss.deployment.unit."iamws.war".component."javax.faces.webapp.FacetTag".WeldInstantiator, service jboss.deployment.unit."iamws.war".component."org.jboss.weld.servlet.WeldInitialListener".WeldInstantiator, service jboss.deployment.unit."iamws.war".component."org.jboss.weld.servlet.WeldTerminalListener".WeldInstantiator, JBAS014799: ... and 5 more ] 
      service jboss.deployment.unit."iamws.war".component."ca.ubc.iamws.listeners.ServiceContextListener".CREATE (missing) dependents: [service jboss.deployment.unit."iamws.war".component."ca.ubc.iamws.listeners.ServiceContextListener".START] 
      service jboss.deployment.unit."iamws.war".component."ca.ubc.iamws.listeners.ServiceContextListener".START (missing) dependents: [service jboss.undertow.deployment.default-server.default-host./iamws, service jboss.deployment.unit."iamws.war".deploymentCompleteService] 
      service jboss.deployment.unit."iamws.war".component."ca.ubc.iamws.listeners.ServiceContextListener".WeldInstantiator (missing) dependents: [service jboss.deployment.unit."iamws.war".component."ca.ubc.iamws.listeners.ServiceContextListener".START] 
      service jboss.deployment.unit."iamws.war".component."com.sun.faces.config.ConfigureListener".CREATE (missing) dependents: [service jboss.deployment.unit."iamws.war".component."com.sun.faces.config.ConfigureListener".START] 
      service jboss.deployment.unit."iamws.war".component."com.sun.faces.config.ConfigureListener".START (missing) dependents: [service jboss.undertow.deployment.default-server.default-host./iamws, service jboss.deployment.unit."iamws.war".deploymentCompleteService, service jboss.undertow.deployment.default-server.default-host./iamws.UndertowDeploymentInfoService] 
      service jboss.deployment.unit."iamws.war".component."javax.faces.webapp.FacetTag".CREATE (missing) dependents: [service jboss.deployment.unit."iamws.war".component."javax.faces.webapp.FacetTag".START] 
      service jboss.deployment.unit."iamws.war".component."javax.faces.webapp.FacetTag".START (missing) dependents: [service jboss.undertow.deployment.default-server.default-host./iamws, service jboss.deployment.unit."iamws.war".deploymentCompleteService] 
      service jboss.deployment.unit."iamws.war".component."javax.faces.webapp.FacetTag".WeldInstantiator (missing) dependents: [service jboss.deployment.unit."iamws.war".component."javax.faces.webapp.FacetTag".START] 
      service jboss.deployment.unit."iamws.war".component."javax.servlet.jsp.jstl.tlv.PermittedTaglibsTLV".CREATE (missing) dependents: [service jboss.deployment.unit."iamws.war".component."javax.servlet.jsp.jstl.tlv.PermittedTaglibsTLV".START] 
      service jboss.deployment.unit."iamws.war".component."javax.servlet.jsp.jstl.tlv.PermittedTaglibsTLV".START (missing) dependents: [service jboss.undertow.deployment.default-server.default-host./iamws] 
      service jboss.deployment.unit."iamws.war".component."javax.servlet.jsp.jstl.tlv.PermittedTaglibsTLV".WeldInstantiator (missing) dependents: [service jboss.deployment.unit."iamws.war".component."javax.servlet.jsp.jstl.tlv.PermittedTaglibsTLV".START] 
      service jboss.deployment.unit."iamws.war".component."javax.servlet.jsp.jstl.tlv.ScriptFreeTLV".START (missing) dependents: [service jboss.undertow.deployment.default-server.default-host./iamws, service jboss.deployment.unit."iamws.war".deploymentCompleteService, service jboss.undertow.deployment.default-server.default-host./iamws.UndertowDeploymentInfoService] 
      service jboss.deployment.unit."iamws.war".component."org.glassfish.jersey.servlet.ServletContainer".CREATE (missing) dependents: [service jboss.deployment.unit."iamws.war".component."org.glassfish.jersey.servlet.ServletContainer".START] 
      service jboss.deployment.unit."iamws.war".component."org.glassfish.jersey.servlet.ServletContainer".START (missing) dependents: [service jboss.undertow.deployment.default-server.default-host./iamws, service jboss.deployment.unit."iamws.war".deploymentCompleteService, service jboss.undertow.deployment.default-server.default-host./iamws.UndertowDeploymentInfoService] 
      service jboss.deployment.unit."iamws.war".component."org.glassfish.jersey.servlet.ServletContainer".WeldInstantiator (missing) dependents: [service jboss.deployment.unit."iamws.war".component."org.glassfish.jersey.servlet.ServletContainer".START] 
      service jboss.deployment.unit."iamws.war".component."org.jboss.weld.servlet.WeldInitialListener".START (missing) dependents: [service jboss.undertow.deployment.default-server.default-host./iamws, service jboss.deployment.unit."iamws.war".deploymentCompleteService, service jboss.undertow.deployment.default-server.default-host./iamws.UndertowDeploymentInfoService] 
      service jboss.deployment.unit."iamws.war".component."org.jboss.weld.servlet.WeldTerminalListener".CREATE (missing) dependents: [service jboss.deployment.unit."iamws.war".component."org.jboss.weld.servlet.WeldTerminalListener".START] 
      service jboss.deployment.unit."iamws.war".component."org.jboss.weld.servlet.WeldTerminalListener".START (missing) dependents: [service jboss.undertow.deployment.default-server.default-host./iamws] 
      service jboss.deployment.unit."iamws.war".component."org.jboss.weld.servlet.WeldTerminalListener".WeldInstantiator (missing) dependents: [service jboss.deployment.unit."iamws.war".component."org.jboss.weld.servlet.WeldTerminalListener".START] 
      service jboss.deployment.unit."iamws.war".ee.ComponentRegistry (missing) dependents: [service jboss.undertow.deployment.default-server.default-host./iamws.UndertowDeploymentInfoService] 
      service jboss.deployment.unit."iamws.war".jndiDependencyService (missing) dependents: [service jboss.deployment.unit."iamws.war".component."javax.servlet.jsp.jstl.tlv.PermittedTaglibsTLV".START, service jboss.deployment.unit."iamws.war".component."org.jboss.weld.servlet.WeldTerminalListener".START, service jboss.deployment.unit."iamws.war".component."javax.faces.webapp.FacetTag".START, service jboss.deployment.unit."iamws.war".component."ca.ubc.iamws.listeners.ServiceContextListener".START] 
      service jboss.persistenceunit."iamws.war#iamwsDev" (missing) dependents: [service jboss.deployment.unit."iamws.war".component."javax.servlet.jsp.jstl.tlv.PermittedTaglibsTLV".START, service jboss.undertow.deployment.default-server.default-host./iamws, service jboss.deployment.unit."iamws.war".component."javax.faces.webapp.FacetTag".START, service jboss.deployment.unit."iamws.war".component."ca.ubc.iamws.listeners.ServiceContextListener".START] 
      service jboss.undertow.deployment.default-server.default-host./iamws.UndertowDeploymentInfoService (missing) dependents: [service jboss.undertow.deployment.default-server.default-host./iamws] 
JBAS014777:   Services which failed to start:      service jboss.deployment.unit."iamws.war".WeldStartService

17:57:29,828 INFO  [org.jboss.as.server.deployment.scanner] (DeploymentScanner-threads - 2) JBAS015003: Found iamws.war in deployment directory. To trigger deployment create a file called iamws.war.dodeploy

and here is my pom.xml: 这是我的pom.xml:

<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
  <modelVersion>4.0.0</modelVersion>
  <groupId>ca.ubc.iamws</groupId>
  <artifactId>iamws</artifactId>
  <packaging>war</packaging>
  <version>1.0-SNAPSHOT</version>
  <name>IAMS Web Service</name>
  <url>http://maven.apache.org</url>
  <properties>
        <jersey.version>2.5.1</jersey.version>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <maven.build.timestamp.format>yyyyMMdd'T'HHmmss</maven.build.timestamp.format>
        <hibernate-core-version>4.3.1.Final</hibernate-core-version>
        <codi.version>1.0.5</codi.version>
        <target.dir>target</target.dir>
    </properties>

    <repositories>
        <repository>
            <id>codelds</id>
            <url>https://code.lds.org/nexus/content/groups/main-repo</url>
        </repository>
    </repositories>

  <dependencies>
    <dependency>
    <groupId>org.glassfish.jersey</groupId>
    <artifactId>jersey-bom</artifactId>
    <version>${jersey.version}</version>
    <type>pom</type>
    <scope>import</scope>
    </dependency>
    <dependency>
            <groupId>org.hibernate</groupId>
            <artifactId>hibernate-core</artifactId>
            <version>${hibernate-core-version}</version>
            <scope>provided</scope>
        </dependency>
        <dependency>
    <groupId>org.slf4j</groupId>
    <artifactId>slf4j-log4j12</artifactId>
    <version>1.7.5</version>
</dependency>
<dependency>
    <groupId>org.slf4j</groupId>
    <artifactId>slf4j-api</artifactId>
    <version>1.7.5</version>
</dependency>
        <dependency>
            <groupId>org.hibernate</groupId>
            <artifactId>hibernate-entitymanager</artifactId>
            <version>${hibernate-core-version}</version>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>org.glassfish.jersey.containers</groupId>
            <artifactId>jersey-container-servlet-core</artifactId>
            <version>${jersey.version}</version>
        </dependency>
        <!--  jackson dependencies for pojo/json support -->
        <dependency>
        <groupId>org.glassfish.jersey.media</groupId>
        <artifactId>jersey-media-json-jackson</artifactId>
        <version>${jersey.version}</version>
        </dependency>
        <!-- end jackson deps -->
        <dependency>
            <groupId>org.glassfish.jersey.media</groupId>
            <artifactId>jersey-media-json-processing</artifactId>
            <version>${jersey.version}</version>
        </dependency>
        <dependency>
            <groupId>org.apache.commons</groupId>
            <artifactId>commons-lang3</artifactId>
        <version>3.0</version>
        </dependency>
        <!-- junit test and jersey client features -->
        <dependency>
            <groupId>junit</groupId>
            <artifactId>junit</artifactId>
            <version>4.9</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>com.sun.jersey</groupId>
            <artifactId>jersey-client</artifactId>
            <version>1.8</version>
        </dependency>
        <dependency>
            <groupId>com.oracle</groupId>
            <artifactId>ojdbc6</artifactId>
            <version>11.2.0.3</version>
        </dependency>
        <dependency>
            <groupId>javax.mail</groupId>
            <artifactId>mail</artifactId>
            <version>1.4</version>
            <scope>provided</scope>
        </dependency>
        <!--  Weld/CDI Begin -->
        <dependency>
            <groupId>javax.enterprise</groupId>
            <artifactId>cdi-api</artifactId>
            <version>1.1</version>
            <scope>provided</scope>
        </dependency>
         <dependency>
            <groupId>javax.annotation</groupId>
            <artifactId>jsr250-api</artifactId>
            <version>1.0</version>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>javax.servlet</groupId>
            <artifactId>javax.servlet-api</artifactId>
            <version>3.0.1</version>
            <scope>provided</scope>
        </dependency>
  </dependencies>
  <build>
    <finalName>iamws</finalName>
    <outputDirectory>${basedir}/${target.dir}/classes</outputDirectory>
    <testOutputDirectory>${basedir}/${target.dir}/test-classes</testOutputDirectory>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <version>3.1</version>
                <inherited>true</inherited>
                <configuration>
                    <source>1.7</source>
                    <target>1.7</target>
                </configuration>
            </plugin>
            <plugin>
                <artifactId>maven-war-plugin</artifactId>
                <version>2.4</version>
                <configuration>
                    <packagingExcludes>src/test/*</packagingExcludes>
                </configuration>
            </plugin>
        <plugin>
        <groupId>org.eclipse.m2e</groupId>
        <artifactId>lifecycle-mapping</artifactId>
        <version>1.0.0</version>
        <configuration>
            <lifecycleMappingMetadata>
                <pluginExecutions>
                    <!-- copy-dependency plugin -->
                    <pluginExecution>
                        <pluginExecutionFilter>
                            <groupId>org.apache.maven.plugins</groupId>
                            <artifactId>maven-dependency-plugin</artifactId>
                            <versionRange>[1.0.0,)</versionRange>
                            <goals>
                                <goal>copy-dependencies</goal>
                            </goals>
                        </pluginExecutionFilter>
                        <action>
                            <ignore />
                        </action>
                    </pluginExecution>
                </pluginExecutions>
            </lifecycleMappingMetadata>
        </configuration>
        </plugin>
        </plugins>
  </build>

  <profiles>
    <profile>
      <id>eclipse-folders</id>
      <properties>
        <target.dir>target-eclipse</target.dir>
      </properties>
    </profile>
  </profiles>
</project>

From what I've found, Jersey is no longer a viable option for use with Wildfly. 根据我的发现,Jersey不再是与Wildfly一起使用的可行选择。 I had all sorts of hassles trying to get a Jersey App deployed to Wildfly 8.2.0. 我遇到种种麻烦,试图将Jersey应用程序部署到Wildfly 8.2.0。 The Imixs Workflow project explain how they migrated their app from Glassfish to Wildfly and had to reconfigure their web.xml for deployment using RestEasy (being a rest app). Imixs Workflow项目说明了他们如何将其应用程序从Glassfish迁移到Wildfly,并必须重新配置其web.xml以使用RestEasy(即Rest应用程序)进行部署。

In essence: 在本质上:

Using RestServices makes it necessary to change things in the web.xml file because Jersey (used by GlassFish) and RestEasy (used by Wildfly) have different configurations. 使用RestServices使得必须更改web.xml文件中的内容,因为Jersey(由GlassFish使用)和RestEasy(由Wildfly使用)具有不同的配置。

This worked for my Rest App; 这适用于我的Rest App; and it was finally able to deploy. 最终得以部署。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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