当前位置: 首页 > 知识库问答 >
问题:

Spring Tomcat mvc api错误

柴修筠
2023-03-14

我对api和servlets有点陌生,一直在开发一个servlet来充当MySQL数据库的api,过了一段时间后,我意识到我正在制作的maven项目不是作为war文件编译的,为了使它作为war文件编译,我添加了以下行

appilcation.java

@SpringBootApplication
public class Application extends SpringBootServletInitializer {

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

public static void main(String[] args) throws Exception {
    SpringApplication.run(Application.class, args);
}

}
 
Using CATALINA_BASE:   "C:\Users\systo\Downloads\apache-tomcat-8.0.33-windows-x64\apache-tomcat-8.0.33"
Using CATALINA_HOME:   "C:\Users\systo\Downloads\apache-tomcat-8.0.33-windows-x64\apache-tomcat-8.0.33"
Using CATALINA_TMPDIR: "C:\Users\systo\Downloads\apache-tomcat-8.0.33-windows-x64\apache-tomcat-8.0.33\temp"
Using JRE_HOME:        "C:\Program Files\Java\jdk1.8.0_73"
Using CLASSPATH:       "C:\Users\systo\Downloads\apache-tomcat-8.0.33-windows-x64\apache-tomcat-8.0.33\bin\bootstrap.jar;C:\Users\systo\Downloads\apache-tomcat-8.0.33-windows-x64\apache-tomcat-8.0.33\bin\tomcat-juli.jar"
28-Apr-2016 16:23:34.997 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Server version:        Apache Tomcat/8.0.33
28-Apr-2016 16:23:35.000 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Server built:          Mar 18 2016 20:31:49 UTC
28-Apr-2016 16:23:35.001 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Server number:         8.0.33.0
28-Apr-2016 16:23:35.001 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log OS Name:               Windows 10
28-Apr-2016 16:23:35.002 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log OS Version:            10.0
28-Apr-2016 16:23:35.002 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Architecture:          amd64
28-Apr-2016 16:23:35.002 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Java Home:             C:\Program Files\Java\jdk1.8.0_73\jre
28-Apr-2016 16:23:35.002 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log JVM Version:           1.8.0_73-b02
28-Apr-2016 16:23:35.003 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log JVM Vendor:            Oracle Corporation
28-Apr-2016 16:23:35.003 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log CATALINA_BASE:         C:\Users\systo\Downloads\apache-tomcat-8.0.33-windows-x64\apache-tomcat-8.0.33
28-Apr-2016 16:23:35.003 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log CATALINA_HOME:         C:\Users\systo\Downloads\apache-tomcat-8.0.33-windows-x64\apache-tomcat-8.0.33
28-Apr-2016 16:23:35.004 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Dhttp.nonProxyHosts=localhost|127.0.0.1|DESKTOP-LFKQO6C
28-Apr-2016 16:23:35.004 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Djava.util.logging.config.file=C:\Users\systo\Downloads\apache-tomcat-8.0.33-windows-x64\apache-tomcat-8.0.33\conf\logging.properties
28-Apr-2016 16:23:35.004 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager
28-Apr-2016 16:23:35.005 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Djava.endorsed.dirs=C:\Users\systo\Downloads\apache-tomcat-8.0.33-windows-x64\apache-tomcat-8.0.33\endorsed
28-Apr-2016 16:23:35.005 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Dcatalina.base=C:\Users\systo\Downloads\apache-tomcat-8.0.33-windows-x64\apache-tomcat-8.0.33
28-Apr-2016 16:23:35.005 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Dcatalina.home=C:\Users\systo\Downloads\apache-tomcat-8.0.33-windows-x64\apache-tomcat-8.0.33
28-Apr-2016 16:23:35.006 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Djava.io.tmpdir=C:\Users\systo\Downloads\apache-tomcat-8.0.33-windows-x64\apache-tomcat-8.0.33\temp
28-Apr-2016 16:23:35.006 INFO [main] org.apache.catalina.core.AprLifecycleListener.lifecycleEvent Loaded APR based Apache Tomcat Native library 1.2.5 using APR version 1.5.1.
28-Apr-2016 16:23:35.007 INFO [main] org.apache.catalina.core.AprLifecycleListener.lifecycleEvent APR capabilities: IPv6 [true], sendfile [true], accept filters [false], random [true].
28-Apr-2016 16:23:36.053 INFO [main] org.apache.catalina.core.AprLifecycleListener.initializeSSL OpenSSL successfully initialized (OpenSSL 1.0.2g  1 Mar 2016)
28-Apr-2016 16:23:36.294 INFO [main] org.apache.coyote.AbstractProtocol.init Initializing ProtocolHandler ["http-apr-8080"]
28-Apr-2016 16:23:36.311 INFO [main] org.apache.coyote.AbstractProtocol.init Initializing ProtocolHandler ["ajp-apr-8009"]
28-Apr-2016 16:23:36.313 INFO [main] org.apache.catalina.startup.Catalina.load Initialization processed in 2299 ms
28-Apr-2016 16:23:36.367 INFO [main] org.apache.catalina.core.StandardService.startInternal Starting service Catalina
28-Apr-2016 16:23:36.368 INFO [main] org.apache.catalina.core.StandardEngine.startInternal Starting Servlet Engine: Apache Tomcat/8.0.33
28-Apr-2016 16:23:36.383 INFO [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployDescriptor Deploying configuration descriptor C:\Users\systo\Downloads\apache-tomcat-8.0.33-windows-x64\apache-tomcat-8.0.33\conf\Catalina\localhost\mavenproject1.xml
28-Apr-2016 16:23:36.530 SEVERE [localhost-startStop-1] org.apache.catalina.core.ContainerBase.addChildInternal ContainerBase.addChild: start: 
 org.apache.catalina.LifecycleException: Failed to start component [StandardEngine[Catalina].StandardHost[localhost].StandardContext[/mavenproject1]]
    at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:153)
    at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:725)
    at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:701)
    at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:717)
    at org.apache.catalina.startup.HostConfig.deployDescriptor(HostConfig.java:587)
    at org.apache.catalina.startup.HostConfig$DeployDescriptor.run(HostConfig.java:1798)
    at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
    at java.util.concurrent.FutureTask.run(FutureTask.java:266)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
    at java.lang.Thread.run(Thread.java:745)
Caused by: org.apache.catalina.LifecycleException: Failed to start component [org.apache.catalina.webresources.StandardRoot@47ebf2f8]
    at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:153)
    at org.apache.catalina.core.StandardContext.resourcesStart(StandardContext.java:4927)
    at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5057)
    at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:147)
    ... 10 more
Caused by: java.lang.IllegalArgumentException: The main resource set specified [C:\Users\systo\Documents\NetBeansProjects\mavenproject1\target\mavenproject1-1.0-SNAPSHOT] is not valid
    at org.apache.catalina.webresources.StandardRoot.createMainResourceSet(StandardRoot.java:723)
    at org.apache.catalina.webresources.StandardRoot.startInternal(StandardRoot.java:684)
    at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:147)
    ... 13 more

28-Apr-2016 16:23:36.533 SEVERE [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployDescriptor Error deploying configuration descriptor C:\Users\systo\Downloads\apache-tomcat-8.0.33-windows-x64\apache-tomcat-8.0.33\conf\Catalina\localhost\mavenproject1.xml
 java.lang.IllegalStateException: ContainerBase.addChild: start: org.apache.catalina.LifecycleException: Failed to start component [StandardEngine[Catalina].StandardHost[localhost].StandardContext[/mavenproject1]]
    at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:729)
    at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:701)
    at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:717)
    at org.apache.catalina.startup.HostConfig.deployDescriptor(HostConfig.java:587)
    at org.apache.catalina.startup.HostConfig$DeployDescriptor.run(HostConfig.java:1798)
    at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
    at java.util.concurrent.FutureTask.run(FutureTask.java:266)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
    at java.lang.Thread.run(Thread.java:745)

28-Apr-2016 16:23:36.537 INFO [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployDescriptor Deployment of configuration descriptor C:\Users\systo\Downloads\apache-tomcat-8.0.33-windows-x64\apache-tomcat-8.0.33\conf\Catalina\localhost\mavenproject1.xml has finished in 152 ms
28-Apr-2016 16:23:36.537 INFO [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployDescriptor Deploying configuration descriptor C:\Users\systo\Downloads\apache-tomcat-8.0.33-windows-x64\apache-tomcat-8.0.33\conf\Catalina\localhost\ROOT.xml
28-Apr-2016 16:23:39.327 INFO [localhost-startStop-1] org.apache.jasper.servlet.TldScanner.scanJars At least one JAR was scanned for TLDs yet contained no TLDs. Enable debug logging for this logger for a complete list of JARs that were scanned but no TLDs were found in them. Skipping unneeded JARs during scanning can improve startup time and JSP compilation time.

  .   ____          _            __ _ _
 /\\ / ___'_ __ _ _(_)_ __  __ _ \ \ \ \
( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \
 \\/  ___)| |_)| | | | | || (_| |  ) ) ) )
  '  |____| .__|_| |_|_| |_\__, | / / / /
 =========|_|==============|___/=/_/_/_/
 :: Spring Boot ::        (v1.3.3.RELEASE)

28-Apr-2016 16:23:43.879 INFO [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployDescriptor Deployment of configuration descriptor C:\Users\systo\Downloads\apache-tomcat-8.0.33-windows-x64\apache-tomcat-8.0.33\conf\Catalina\localhost\ROOT.xml has finished in 7,341 ms
28-Apr-2016 16:23:43.879 INFO [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployDescriptor Deploying configuration descriptor C:\Users\systo\Downloads\apache-tomcat-8.0.33-windows-x64\apache-tomcat-8.0.33\conf\Catalina\localhost\Spring4MVCCRUDRestService.xml
28-Apr-2016 16:23:45.444 SEVERE [localhost-startStop-1] org.apache.catalina.core.ContainerBase.addChildInternal ContainerBase.addChild: start: 
 org.apache.catalina.LifecycleException: Failed to start component [StandardEngine[Catalina].StandardHost[localhost].StandardContext[/Spring4MVCCRUDRestService]]
    at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:153)
    at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:725)
    at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:701)
    at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:717)
    at org.apache.catalina.startup.HostConfig.deployDescriptor(HostConfig.java:587)
    at org.apache.catalina.startup.HostConfig$DeployDescriptor.run(HostConfig.java:1798)
    at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
    at java.util.concurrent.FutureTask.run(FutureTask.java:266)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
    at java.lang.Thread.run(Thread.java:745)
Caused by: java.lang.IllegalArgumentException: Failed to register servlet with name 'dispatcher'.Check if there is another servlet registered under the same name.
    at org.springframework.util.Assert.notNull(Assert.java:115)
    at org.springframework.web.servlet.support.AbstractDispatcherServletInitializer.registerDispatcherServlet(AbstractDispatcherServletInitializer.java:97)
    at org.springframework.web.servlet.support.AbstractDispatcherServletInitializer.onStartup(AbstractDispatcherServletInitializer.java:70)
    at org.springframework.web.SpringServletContainerInitializer.onStartup(SpringServletContainerInitializer.java:175)
    at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5240)
    at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:147)
    ... 10 more

28-Apr-2016 16:23:45.445 SEVERE [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployDescriptor Error deploying configuration descriptor C:\Users\systo\Downloads\apache-tomcat-8.0.33-windows-x64\apache-tomcat-8.0.33\conf\Catalina\localhost\Spring4MVCCRUDRestService.xml
 java.lang.IllegalStateException: ContainerBase.addChild: start: org.apache.catalina.LifecycleException: Failed to start component [StandardEngine[Catalina].StandardHost[localhost].StandardContext[/Spring4MVCCRUDRestService]]
    at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:729)
    at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:701)
    at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:717)
    at org.apache.catalina.startup.HostConfig.deployDescriptor(HostConfig.java:587)
    at org.apache.catalina.startup.HostConfig$DeployDescriptor.run(HostConfig.java:1798)
    at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
    at java.util.concurrent.FutureTask.run(FutureTask.java:266)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
    at java.lang.Thread.run(Thread.java:745)

28-Apr-2016 16:23:45.446 INFO [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployDescriptor Deployment of configuration descriptor C:\Users\systo\Downloads\apache-tomcat-8.0.33-windows-x64\apache-tomcat-8.0.33\conf\Catalina\localhost\Spring4MVCCRUDRestService.xml has finished in 1,567 ms
28-Apr-2016 16:23:45.446 INFO [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployDirectory Deploying web application directory C:\Users\systo\Downloads\apache-tomcat-8.0.33-windows-x64\apache-tomcat-8.0.33\webapps\docs
28-Apr-2016 16:23:45.495 INFO [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployDirectory Deployment of web application directory C:\Users\systo\Downloads\apache-tomcat-8.0.33-windows-x64\apache-tomcat-8.0.33\webapps\docs has finished in 49 ms
28-Apr-2016 16:23:45.496 INFO [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployDirectory Deploying web application directory C:\Users\systo\Downloads\apache-tomcat-8.0.33-windows-x64\apache-tomcat-8.0.33\webapps\examples
28-Apr-2016 16:23:45.846 INFO [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployDirectory Deployment of web application directory C:\Users\systo\Downloads\apache-tomcat-8.0.33-windows-x64\apache-tomcat-8.0.33\webapps\examples has finished in 350 ms
28-Apr-2016 16:23:45.847 INFO [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployDirectory Deploying web application directory C:\Users\systo\Downloads\apache-tomcat-8.0.33-windows-x64\apache-tomcat-8.0.33\webapps\host-manager
28-Apr-2016 16:23:45.902 INFO [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployDirectory Deployment of web application directory C:\Users\systo\Downloads\apache-tomcat-8.0.33-windows-x64\apache-tomcat-8.0.33\webapps\host-manager has finished in 56 ms
28-Apr-2016 16:23:45.902 INFO [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployDirectory Deploying web application directory C:\Users\systo\Downloads\apache-tomcat-8.0.33-windows-x64\apache-tomcat-8.0.33\webapps\manager
28-Apr-2016 16:23:45.939 INFO [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployDirectory Deployment of web application directory C:\Users\systo\Downloads\apache-tomcat-8.0.33-windows-x64\apache-tomcat-8.0.33\webapps\manager has finished in 37 ms
28-Apr-2016 16:23:45.944 INFO [main] org.apache.coyote.AbstractProtocol.start Starting ProtocolHandler ["http-apr-8080"]
28-Apr-2016 16:23:45.962 INFO [main] org.apache.coyote.AbstractProtocol.start Starting ProtocolHandler ["ajp-apr-8009"]
28-Apr-2016 16:23:45.965 INFO [main] org.apache.catalina.startup.Catalina.start Server startup in 9651 ms
28-Apr-2016 16:23:46.929 INFO [http-apr-8080-exec-5] org.apache.catalina.startup.HostConfig.undeploy Undeploying context []
28-Apr-2016 16:23:46.967 INFO [http-apr-8080-exec-10] org.apache.catalina.startup.HostConfig.deployDescriptor Deploying configuration descriptor C:\Users\systo\Downloads\apache-tomcat-8.0.33-windows-x64\apache-tomcat-8.0.33\conf\Catalina\localhost\code.xml

  .   ____          _            __ _ _
 /\\ / ___'_ __ _ _(_)_ __  __ _ \ \ \ \
( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \
 \\/  ___)| |_)| | | | | || (_| |  ) ) ) )
  '  |____| .__|_| |_|_| |_\__, | / / / /
 =========|_|==============|___/=/_/_/_/
 :: Spring Boot ::        (v1.3.3.RELEASE)

28-Apr-2016 16:23:53.686 INFO [http-apr-8080-exec-10] org.apache.catalina.startup.HostConfig.deployDescriptor Deployment of configuration descriptor C:\Users\systo\Downloads\apache-tomcat-8.0.33-windows-x64\apache-tomcat-8.0.33\conf\Catalina\localhost\code.xml has finished in 6,718 ms
28-Apr-2016 16:23:53.693 INFO [http-apr-8080-exec-8] org.apache.catalina.util.LifecycleBase.start The start() method was called on component [StandardEngine[Catalina].StandardHost[localhost].StandardContext[/code]] after start() had already been called. The second call will be ignored.

 
 

http://maven.apache.org/xsd/maven-4.0.0.xsd">
    4.0.0

共有1个答案

娄浩荡
2023-03-14

将以下依赖项添加到pom.xml

<dependency>
    <groupId>commons-logging</groupId>
    <artifactId>commons-logging</artifactId>
    <version>1.1.1</version>
</dependency>
 类似资料:
  • 我正在尝试搜索亚马逊的产品广告,并使用botlenose来帮助我做到这一点。但是,我刚刚收到HTTP错误400。 其他一些重要信息: 我来自巴西,我的标签也来自亚马逊。这是个问题吗? 我确实检查了我的钥匙、秘密和标签,一切正常。我确实在StackOverflow上查看了其他一些问题,但对我来说没有任何效果。 当然,出于安全原因,我更改了密钥。 Traceback(最近一次调用最后一次):File"

  • 我有一个基于Spring Web model view controller(MVC)框架的项目。Spring Web模型-视图-控制器(MVC)框架的版本是3.2.8 我有这个控制器 这个URL一切正常:

  • 目前从Angular JS controller中,我试图将JSON数据发送到后端服务。但是我有400个错误的请求错误。 在Controller中,我试图通过http服务发送数据,如下所示:

  • 我得到了这个错误,有什么想法会导致它吗?我试图发送一个DTO,它有一个扩展抽象类的对象列表,我想这个问题可能是因为DTO中的列表,还是因为抽象类的子类?

  • 在月食中, ”org.apache.axis2。AxisFault:传输错误: 403错误:禁止”试图从svn检出项目时发生错误。我不能实现这个错误,因此我检查了从终端使用"svn-co"命令的项目。 但是,有趣的是,当我试图在Eclipse中运行应用程序时,在输入凭据(用户名和密码)并按下“登录”按钮之后,我又遇到了相同的错误。响应是JFrame上的无效用户名/密码,但凭据没有错误。这只发生在日

  • Errors 错误 Library routines must often return some sort of error indication to the caller. As mentioned earlier, Go’s multivalue return makes it easy to return a detailed error description alongside th

  • 本章概述了Google API错误模型,以及开发人员如何正确生成和处理错误的一般指南。 Google API使用简单的协议无关错误模型,这使我们能够在不同的API,API协议(如gRPC或HTTP)以及错误上下文(例如,异步,批处理或工作流错误)中获得一致的体验。 错误模型 错误模型在逻辑上由google.rpc.Status定义,当API发生错误时,返回一个Status实例给客户端。 以下代码段

  • 5.4. 错误 在Go中有一部分函数总是能成功的运行。比如strings.Contains和strconv.FormatBool函数,对各种可能的输入都做了良好的处理,使得运行时几乎不会失败,除非遇到灾难性的、不可预料的情况,比如运行时的内存溢出。导致这种错误的原因很复杂,难以处理,从错误中恢复的可能性也很低。 还有一部分函数只要输入的参数满足一定条件,也能保证运行成功。比如time.Date函数