Deploying Spring Boot war with Jersey in Wildfly

匿名 (未验证) 提交于 2019-12-03 01:09:02

问题:

I have a project where I use Spring boot to build a stand alone jar. It uses jersey to serve up the back end, and I have it configured to also host an angular/js front end in the resources folder.

The solution I would like is that this can be standalone in the jar file, and run by itself. But also have a configuration where we build it as a war file, and run it alongside another war inside of Wildfly.

I can get it to compile a war, but as soon as I try to start it up, it appears I get issues with Tomcat. Has anyone tried running an environment like this?

Here is the exception logs.

    11:14:22,316 ERROR [org.jboss.msc.service.fail] (MSC service thread 1-9) MSC000001: Failed to start service jboss.deployment.unit."testApp-0.0.1-SNAPSHOT.war".INSTALL: org.jboss.msc.service.StartException in service jboss.deployment.unit."testApp-0.0.1-SNAPSHOT.war".INSTALL: JBAS018733: Failed to process phase INSTALL of deployment "testApp-0.0.1-SNAPSHOT.war"     at org.jboss.as.server.deployment.DeploymentUnitPhaseService.start(DeploymentUnitPhaseService.java:166) [wildfly-server-8.2.1.Final-patch9.jar:8.2.1.Final-patch9]     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_101]     at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) [rt.jar:1.8.0_101]     at java.lang.Thread.run(Thread.java:745) [rt.jar:1.8.0_101] Caused by: org.jboss.as.server.deployment.DeploymentUnitProcessingException: JBAS017327: Deployment error processing SCI for jar: tomcat-embed-websocket-8.5.28.jar     at org.wildfly.extension.undertow.deployment.ServletContainerInitializerDeploymentProcessor.loadSci(ServletContainerInitializerDeploymentProcessor.java:207)     at org.wildfly.extension.undertow.deployment.ServletContainerInitializerDeploymentProcessor.deploy(ServletContainerInitializerDeploymentProcessor.java:128)     at org.jboss.as.server.deployment.DeploymentUnitPhaseService.start(DeploymentUnitPhaseService.java:159) [wildfly-server-8.2.1.Final-patch9.jar:8.2.1.Final-patch9]     ... 5 more Caused by: org.jboss.as.server.deployment.DeploymentUnitProcessingException: JBAS017327: Deployment error processing SCI for jar: tomcat-embed-websocket-8.5.28.jar     at org.wildfly.extension.undertow.deployment.ServletContainerInitializerDeploymentProcessor.loadSci(ServletContainerInitializerDeploymentProcessor.java:199)     ... 7 more Caused by: java.lang.ClassNotFoundException: # Licensed to the Apache Software Foundation (ASF) under one or more from [Module "deployment.testApp-0.0.1-SNAPSHOT.war:main" from Service Module Loader]     at org.jboss.modules.ModuleClassLoader.findClass(ModuleClassLoader.java:213) [jboss-modules.jar:1.3.3.Final]     at org.jboss.modules.ConcurrentClassLoader.performLoadClassUnchecked(ConcurrentClassLoader.java:459) [jboss-modules.jar:1.3.3.Final]     at org.jboss.modules.ConcurrentClassLoader.performLoadClassChecked(ConcurrentClassLoader.java:408) [jboss-modules.jar:1.3.3.Final]     at org.jboss.modules.ConcurrentClassLoader.performLoadClass(ConcurrentClassLoader.java:389) [jboss-modules.jar:1.3.3.Final]     at org.jboss.modules.ConcurrentClassLoader.loadClass(ConcurrentClassLoader.java:134) [jboss-modules.jar:1.3.3.Final]     at org.wildfly.extension.undertow.deployment.ServletContainerInitializerDeploymentProcessor.loadSci(ServletContainerInitializerDeploymentProcessor.java:191)     ... 7 more  11:14:22,321 ERROR [org.jboss.as.controller.management-operation] (management-handler-thread - 2) JBAS014613: Operation ("deploy") failed - address: ([("deployment" => "testApp-0.0.1-SNAPSHOT.war")]) - failure description: {"JBAS014671: Failed services" => {"jboss.deployment.unit.\"testApp-0.0.1-SNAPSHOT.war\".INSTALL" => "org.jboss.msc.service.StartException in service jboss.deployment.unit.\"testApp-0.0.1-SNAPSHOT.war\".INSTALL: JBAS018733: Failed to process phase INSTALL of deployment \"testApp-0.0.1-SNAPSHOT.war\"     Caused by: org.jboss.as.server.deployment.DeploymentUnitProcessingException: JBAS017327: Deployment error processing SCI for jar: tomcat-embed-websocket-8.5.28.jar     Caused by: org.jboss.as.server.deployment.DeploymentUnitProcessingException: JBAS017327: Deployment error processing SCI for jar: tomcat-embed-websocket-8.5.28.jar     Caused by: java.lang.ClassNotFoundException: # Licensed to the Apache Software Foundation (ASF) under one or more from [Module \"deployment.testApp-0.0.1-SNAPSHOT.war:main\" from Service Module Loader]"}} 11:14:22,323 ERROR [org.jboss.as.server] (management-handler-thread - 2) JBAS015870: Deploy of deployment "testApp-0.0.1-SNAPSHOT.war" was rolled back with the following failure message:  {"JBAS014671: Failed services" => {"jboss.deployment.unit.\"testApp-0.0.1-SNAPSHOT.war\".INSTALL" => "org.jboss.msc.service.StartException in service jboss.deployment.unit.\"testApp-0.0.1-SNAPSHOT.war\".INSTALL: JBAS018733: Failed to process phase INSTALL of deployment \"testApp-0.0.1-SNAPSHOT.war\"     Caused by: org.jboss.as.server.deployment.DeploymentUnitProcessingException: JBAS017327: Deployment error processing SCI for jar: tomcat-embed-websocket-8.5.28.jar     Caused by: org.jboss.as.server.deployment.DeploymentUnitProcessingException: JBAS017327: Deployment error processing SCI for jar: tomcat-embed-websocket-8.5.28.jar     Caused by: java.lang.ClassNotFoundException: # Licensed to the Apache Software Foundation (ASF) under one or more from [Module \"deployment.testApp-0.0.1-SNAPSHOT.war:main\" from Service Module Loader]"}} 11:14:22,344 INFO  [org.hibernate.validator.internal.util.Version] (MSC service thread 1-7) HV000001: Hibernate Validator 5.1.3.Final 11:14:25,469 INFO  [org.jboss.as.server.deployment] (MSC service thread 1-5) JBAS015877: Stopped deployment testApp-0.0.1-SNAPSHOT.war (runtime-name: testApp-0.0.1-SNAPSHOT.war) in 3146ms 11:14:25,470 INFO  [org.jboss.as.controller] (management-handler-thread - 2) JBAS014774: Service status report JBAS014777:   Services which failed to start:      service jboss.deployment.unit."testApp-0.0.1-SNAPSHOT.war".INSTALL  [2018-03-09 11:14:25,528] Artifact testApp:war: Error during artifact deployment. See server log for details. [2018-03-09 11:14:25,528] Artifact testApp:war: java.lang.Exception: {"JBAS014671: Failed services" => {"jboss.deployment.unit.\"testApp-0.0.1-SNAPSHOT.war\".INSTALL" => "org.jboss.msc.service.StartException in service jboss.deployment.unit.\"testApp-0.0.1-SNAPSHOT.war\".INSTALL: JBAS018733: Failed to process phase INSTALL of deployment \"testApp-0.0.1-SNAPSHOT.war\"     Caused by: org.jboss.as.server.deployment.DeploymentUnitProcessingException: JBAS017327: Deployment error processing SCI for jar: tomcat-embed-websocket-8.5.28.jar     Caused by: org.jboss.as.server.deployment.DeploymentUnitProcessingException: JBAS017327: Deployment error processing SCI for jar: tomcat-embed-websocket-8.5.28.jar     Caused by: java.lang.ClassNotFoundException: # Licensed to the Apache Software Foundation (ASF) under one or more from [Module \"deployment.testApp-0.0.1-SNAPSHOT.war:main\" from Service Module Loader]"}} 

Here is my current pom file

<?xml version="1.0" encoding="UTF-8"?> <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>com.dematic.wms</groupId>     <artifactId>app-workflow</artifactId>     <version>0.0.1-SNAPSHOT</version>     <packaging>war</packaging>      <name>app-workflow</name>     <description>Demo project for Spring Boot</description>      <parent>         <groupId>org.springframework.boot</groupId>         <artifactId>spring-boot-starter-parent</artifactId>         <version>1.2.7.RELEASE</version>         <relativePath/> <!-- lookup parent from repository -->     </parent>      <properties>         <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>         <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>         <java.version>1.8</java.version>          <spring.version>5.0.4.RELEASE</spring.version>         <!--<hsqldb.version>2.4.0</hsqldb.version>-->         <dbh2.version>1.4.195</dbh2.version>         <!--<derby.version>10.11.1.1</derby.version>-->          <wildfly.version>9.0.2.Final</wildfly.version>         <cargo.container.id>wildfly9x</cargo.container.id>         <cargo.container.url>http://download.jboss.org/wildfly/${wildfly.version}/wildfly-${wildfly.version}.zip         </cargo.container.url>     </properties>      <dependencies>         <dependency>             <groupId>org.springframework.boot</groupId>             <artifactId>spring-boot-starter-web</artifactId>             <exclusions>                 <exclusion>                     <artifactId>tomcat-embed-el</artifactId>                     <groupId>org.apache.tomcat.embed</groupId>                 </exclusion>                 <exclusion>                     <groupId>tomcat-embed-core</groupId>                     <artifactId>org.apache.tomcat.embed</artifactId>                 </exclusion>                 <exclusion>                     <groupId>tomcat-embed-websocket</groupId>                     <artifactId>org.apache.tomcat.embed</artifactId>                 </exclusion>                 <exclusion>                     <artifactId>spring-boot-starter-tomcat</artifactId>                     <groupId>org.springframework.boot</groupId>                 </exclusion>             </exclusions>         </dependency>         <dependency>             <groupId>org.springframework.boot</groupId>             <artifactId>spring-boot-starter-actuator</artifactId>         </dependency>         <dependency>             <groupId>javax.servlet</groupId>             <artifactId>javax.servlet-api</artifactId>             <scope>provided</scope>         </dependency>         <dependency>             <groupId>org.springframework.boot</groupId>             <artifactId>spring-boot-starter-test</artifactId>             <scope>test</scope>         </dependency>           <dependency>             <groupId>org.glassfish.jersey.containers</groupId>             <artifactId>jersey-container-servlet</artifactId>             <version>2.26</version>         </dependency>         <dependency>             <groupId>org.apache.commons</groupId>             <artifactId>commons-lang3</artifactId>             <version>3.5</version>         </dependency>         <dependency>             <groupId>commons-io</groupId>             <artifactId>commons-io</artifactId>             <version>2.6</version>         </dependency>         <dependency>             <groupId>javax.ws.rs</groupId>             <artifactId>jsr311-api</artifactId>             <version>1.1.1</version>         </dependency>         <dependency>             <groupId>org.springframework.boot</groupId>             <artifactId>spring-boot-starter-logging</artifactId>             <exclusions>                 <exclusion>                     <groupId>org.slf4j</groupId>                     <artifactId>log4j-over-slf4j</artifactId>                 </exclusion>                 <exclusion>                     <groupId>ch.qos.logback</groupId>                     <artifactId>logback-classic</artifactId>                 </exclusion>             </exclusions>         </dependency>     </dependencies>     <build>         <plugins>             <plugin>                 <groupId>org.apache.maven.plugins</groupId>                 <artifactId>maven-war-plugin</artifactId>                 <version>2.4</version>                 <configuration>                     <packagingExcludes>WEB-INF/lib/tomcat-*.jar</packagingExcludes>                 </configuration>             </plugin>         </plugins>     </build>       <profiles>         <profile>             <id>jdk8</id>             <activation>                 <jdk>1.8</jdk>             </activation>             <build>                 <plugins>                     <plugin>                         <groupId>org.codehaus.mojo</groupId>                         <artifactId>build-helper-maven-plugin</artifactId>                         <executions>                             <execution>                                 <id>reserve-network-port</id>                                 <goals>                                     <goal>reserve-network-port</goal>                                 </goals>                                 <phase>process-resources</phase>                                 <configuration>                                     <portNames>                                         <portName>appserver.port</portName>                                         <portName>appserver.ajp.port</portName>                                         <portName>appserver.transaction.port</portName>                                     </portNames>                                 </configuration>                             </execution>                         </executions>                     </plugin>                     <plugin>                         <groupId>org.codehaus.cargo</groupId>                         <artifactId>cargo-maven2-plugin</artifactId>                         <configuration>                             <configuration>                                 <properties>                                     <cargo.servlet.port>${appserver.port}</cargo.servlet.port>                                     <cargo.jboss.ajp.port>${appserver.ajp.port}</cargo.jboss.ajp.port>                                     <cargo.jboss.transaction.statusManager.port>                                         ${appserver.transaction.port}                                     </cargo.jboss.transaction.statusManager.port>                                     <cargo.jboss.configuration>standalone-full</cargo.jboss.configuration>                                 </properties>                             </configuration>                         </configuration>                     </plugin>                     <plugin>                         <groupId>org.apache.maven.plugins</groupId>                         <artifactId>maven-failsafe-plugin</artifactId>                         <configuration>                             <systemPropertyVariables>                                 <port>${appserver.port}</port>                             </systemPropertyVariables>                         </configuration>                     </plugin>                 </plugins>             </build>         </profile>     </profiles> </project> 
标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!