Java 无法在tomcat上启动Spring引导war文件

Java 无法在tomcat上启动Spring引导war文件,java,spring,spring-boot,tomcat,Java,Spring,Spring Boot,Tomcat,我正在尝试在tomcat上部署spring boot应用程序war文件。我成功创建了spring boot应用程序的war文件。但每当我试图在tomcat上部署war文件时,它都不会启动并发出消息-FAIL-上下文路径[/onlineshopping]处的应用程序无法启动 pom.xml <?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.ap

我正在尝试在tomcat上部署spring boot应用程序war文件。我成功创建了spring boot应用程序的war文件。但每当我试图在tomcat上部署war文件时,它都不会启动并发出消息-
FAIL-上下文路径[/onlineshopping]处的应用程序无法启动

pom.xml

<?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/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.springboot</groupId>
<artifactId>wabit</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>war</packaging>
<name>wabit</name>
<parent>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-starter-parent</artifactId>
    <version>2.0.6.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>
</properties>

<dependencies>

    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-web</artifactId>
    </dependency>


    <dependency>
        <groupId>org.apache.tomcat.embed</groupId>
        <artifactId>tomcat-embed-jasper</artifactId>
        <scope>provided</scope>
    </dependency>


</dependencies>


<build>
    <finalName>onlineshopping</finalName>
    <plugins>
        <plugin>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-maven-plugin</artifactId>
        </plugin>
    </plugins>
</build>
SecurityConfig.java

@Bean   
public CorsConfigurationSource corsConfigurationSource() {
    CorsConfiguration configuration = new CorsConfiguration();
    configuration.setAllowedOrigins(Arrays.asList("http://localhost:4200"));
    configuration.setAllowedOrigins(Arrays.asList("http://localhost:8080"));
    configuration.setAllowCredentials(true);
    configuration.setAllowedMethods(Arrays.asList("GET", "POST", "PUT", "PATCH", "DELETE", "OPTIONS"));
    configuration.setAllowedHeaders(Arrays.asList("Access-Control-Allow-Origin","Authorization", "Cache-Control", "Content-Type", "xsrfheadername","xsrfcookiename"
    ,"X-Requested-With","XSRF-TOKEN","Accept", "x-xsrf-token","withcredentials","x-csrftoken"));
    configuration.setExposedHeaders(Arrays.asList("custom-header1", "custom-header2"));
    UrlBasedCorsConfigurationSource source = new UrlBasedCorsConfigurationSource();
    source.registerCorsConfiguration("/**", configuration); 
    return source; 
}
Controller.java

@RequestMapping(value = "/clientProducts/products/{start}")
public Stack<List> getAllCLientproduct(@PathVariable int start) {

    List<ClientProducts> clientProductsinfo = 
    productDAO.getAllCLientproducts(start);
    List<List<ClientProducts>> strings = Arrays.asList(clientProductsinfo);
    Stack<List> STACK = new Stack<List>();
    STACK.push( clientProductsinfo);

    return STACK;
}

失败-无法启动上下文路径[/onlineshopping]处的应用程序。此消息是因为我在应用程序属性中提供了上下文路径和端口号?

查看tomcat日志文件以了解更多信息请添加完整的堆栈跟踪和提供/onlineshopping的控制器代码。@Milgo我添加了tomcat的日志文件。这与web.xml文件有关。我的web.xml文件为空。可能会解决你的问题。
@RequestMapping(value = "/clientProducts/products/{start}")
public Stack<List> getAllCLientproduct(@PathVariable int start) {

    List<ClientProducts> clientProductsinfo = 
    productDAO.getAllCLientproducts(start);
    List<List<ClientProducts>> strings = Arrays.asList(clientProductsinfo);
    Stack<List> STACK = new Stack<List>();
    STACK.push( clientProductsinfo);

    return STACK;
}
org.apache.tomcat.util.descriptor.web.WebXmlParser.parseWebXml Parse
error in application web.
xml file at[file:/C:/Program%20F iles/Apache%20 Software%20F 
oundation/Tomcat%209.0/webapps/onlineshopping/WEB- 
INF/web.xml]org.xml.sax.SAXParseException;systemId:file:/C:/Program%20F 
iles/Apache%20 Software%20F 
oundation/Tomcat%209.0/webapps/onlineshopping/WEB- 
INF/web.xml;lineNumber:53;columnNumber:15;
Premature end of file.