gpt4 book ai didi

angularjs - Spring Boot + Tomcat 8.5.12 + Linux

转载 作者:太空宇宙 更新时间:2023-11-04 12:31:12 25 4
gpt4 key购买 nike

我正在使用 Spring Boot 版本 1.5.2.ReleaseAngular 2 与前端的 systemjs 配置使用以下高级配置构建 Maven

Pom.xml

<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
<exclusions>
<exclusion>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-tomcat</artifactId>
</exclusion>
<exclusion>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-logging</artifactId>
</exclusion>
<exclusion>
<groupId>ch.qos.logback</groupId>
<artifactId>logback-classic</artifactId>
</exclusion>
</exclusions>
</dependency>

<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-tomcat</artifactId>
<scope>provided</scope>
</dependency>

<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<configuration>
<fork>true</fork>
<skip>false</skip>
</configuration>
<executions>
<execution>
<goals>
<goal>repackage</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.19.1</version>
<configuration>
<testFailureIgnore>true</testFailureIgnore>
</configuration>
</plugin>

<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
<java.version>1.8</java.version>
<start-class>mmm.his.empi.WebComponentApplication</start-class>
</properties>

应用程序.java

@SpringBootApplication
@EnableJpaRepositories
@EnableAutoConfiguration (exclude = {HibernateJpaAutoConfiguration.class})
@Import({ AppConfig.class, HibernateConfiguration.class, SwaggerConfig.class })
public class Application extends SpringBootServletInitializer{

@Override
protected SpringApplicationBuilder configure(SpringApplicationBuilder application) {
return application.sources(applicationClass);
}

public static void main(String[] args) {
System.out.println("WebComponentApplication started... 7.10");
SpringApplication.run(applicationClass, args);
}

private static Class<Application> applicationClass = Application.class;
}

This configuration works fine with Tomcat deployment on Windows. But when i deploy the same war on tomcat, i am just getting 404 - No Resource found error

war 结构

  • ROOT.war
  • META-INF - Maven - MANIFEST
  • WEB-INF - 类 - lib - lib 提供的
  • org - springframework - boot - 加载器 - (加载器类)

classes contains the spring boot application class and controllers. classes folder also contains the dist folder of Angular application

list

Manifest-Version: 1.0
Implementation-Title: test-component
Implementation-Version: 0.0.1-SNAPSHOT
Built-By: XXX
Implementation-Vendor-Id: com.test.proj
Spring-Boot-Version: 1.5.2.RELEASE
Implementation-Vendor: Pivotal Software, Inc.
Main-Class: org.springframework.boot.loader.WarLauncher
Start-Class: com.test.proj.Application
Spring-Boot-Classes: WEB-INF/classes/
Spring-Boot-Lib: WEB-INF/lib/
Created-By: Apache Maven 3.3.9
Build-Jdk: 1.8.0_91
Implementation-URL: http://maven.apache.org

我在 Tomcat 的根上下文中部署我的 war 作为 ROOT.war我不确定这里出了什么问题。请帮忙。

最佳答案

我解决了这个问题。其实是linux机器上的JDK冲突。我安装了 JDK 1.8,但仅为用户设置了环境变量。但我以 ROOT 用户身份部署了该应用程序。我必须再次为 ROOT 用户设置它才能正常工作。

关于angularjs - Spring Boot + Tomcat 8.5.12 + Linux,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/43234845/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com