Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/java/337.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/maven/6.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Java 无法使用maven项目启动tomcat_Java_Maven_Spring Mvc_Tomcat - Fatal编程技术网

Java 无法使用maven项目启动tomcat

Java 无法使用maven项目启动tomcat,java,maven,spring-mvc,tomcat,Java,Maven,Spring Mvc,Tomcat,使用maven启动tomcat时,出现以下错误 java.util.concurrent.ExecutionException:org.apache.catalina.LifecycleException:启动组件失败 [StandardEngine[Catalina].StandardHost[localhost].StandardContext[/web\u store]] 位于java.util.concurrent.FutureTask.report(未知源) java.util.con

使用maven启动tomcat时,出现以下错误

java.util.concurrent.ExecutionException:org.apache.catalina.LifecycleException:启动组件失败 [StandardEngine[Catalina].StandardHost[localhost].StandardContext[/web\u store]] 位于java.util.concurrent.FutureTask.report(未知源) java.util.concurrent.FutureTask.get(未知源)

原因:org.apache.catalina.LifecycleException:启动失败 成分 [StandardEngine[Catalina].StandardHost[localhost].StandardContext[/web\u store]] 在 org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:153) ... 还有6个

原因:java.lang.IllegalArgumentException:Servlet映射 指定位于的未知servlet名称dispatcherServlet servlet org.apache.catalina.core.StandardContext.addServletMapping(StandardContext.java:3180) 在 org.apache.catalina.core.StandardContext.addServletMapping(StandardContext.java:3159) 在 org.apache.catalina.startup.ContextConfig.configureContext(ContextConfig.java:1376)

2016年8月10日下午2:28:01 org.apache.catalina.core.ContainerBase startInternal严重:启动期间子容器失败 java.util.concurrent.ExecutionException: org.apache.catalina.LifecycleException:无法启动组件 [StandardEngine[Catalina].StandardHost[localhost]]位于 java.util.concurrent.FutureTask.report(未知源代码)位于 java.util.concurrent.FutureTask.get(未知源)

我正在使用maven并得到错误信息 启动tomcat时运行正常,但使用tomcat运行项目时显示以下错误

编辑

1 web.xml

<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xmlns="http://java.sun.com/xml/ns/javaee"
    xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
    version="2.5">
    <display-name>webstore</display-name>
    <welcome-file-list>
        <welcome-file>view/index.html</welcome-file>
    </welcome-file-list>
    <servlet>
        <servlet-name>dispatcherServlet</servlet-name>
        <servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
    </servlet>
    <servlet-mapping>
        <servlet-name>dispatcherServlet-servlet</servlet-name>
        <url-pattern>/</url-pattern>
    </servlet-mapping>
</web-app> 
<mvc:annotation-driven />
    <context:component-scan base-package="web_store.*" />
    <bean
        class="org.springframework.web.servlet.view.InternalResourceViewResolver">
        <property name="prefix" value="/view/" />
        <property name="suffix" value=".jsp" />
    </bean>

网上商店
view/index.html
调度员服务
org.springframework.web.servlet.DispatcherServlet
dispatcherServlet servlet
/
2 dispatcherServlet.xml

<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xmlns="http://java.sun.com/xml/ns/javaee"
    xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
    version="2.5">
    <display-name>webstore</display-name>
    <welcome-file-list>
        <welcome-file>view/index.html</welcome-file>
    </welcome-file-list>
    <servlet>
        <servlet-name>dispatcherServlet</servlet-name>
        <servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
    </servlet>
    <servlet-mapping>
        <servlet-name>dispatcherServlet-servlet</servlet-name>
        <url-pattern>/</url-pattern>
    </servlet-mapping>
</web-app> 
<mvc:annotation-driven />
    <context:component-scan base-package="web_store.*" />
    <bean
        class="org.springframework.web.servlet.view.InternalResourceViewResolver">
        <property name="prefix" value="/view/" />
        <property name="suffix" value=".jsp" />
    </bean>

您的错误在这里:

<servlet>
    <servlet-name>dispatcherServlet</servlet-name>
    <servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
</servlet>
<servlet-mapping>
    <servlet-name>dispatcherServlet-servlet</servlet-name>
    <url-pattern>/</url-pattern>
</servlet-mapping>

和dispatcherServlet servlet。xml@NicolasFilotto,请检查我添加的文件
中必须相同,不幸的是,这导致我从ServletContext资源[/WEB-INF/dispatcherServlet servlet.XML]解析XML文档时出现另一个错误
IOException;嵌套异常为java.io.FileNotFoundException:无法打开ServletContext资源[/WEB-INF/dispatcherServlet servlet.xml]
无法找到bean.xml,因此尝试在web.xml中的两个位置将dispatcherServlet重命名为dispatcherServlet,但根据maven,在资源文件夹下声明时,应该可以找到资源文件。我将两者都更改为
dispatcherServlet
解决了错误,您能指导我如何解决将dispatcherServlet-servlet.xml迁移到src/main/webapp/WEB-INF的问题吗