我有一个带有maven的spring web应用程序构建。如果我通过Netbean运行它,它会运行,但如果我在.war
文件夹中复制webapps
它就不会运行。
以下是context.xml
:
<?xml version="1.0" encoding="UTF-8"?>
<Context antiJARLocking="true" path="/myapp"/>
web.xml
<display-name>myapp</display-name>
<listener>
<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
</listener>
<servlet>
<servlet-name>dispatcher</servlet-name>
<servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>dispatcher</servlet-name>
<url-pattern>/</url-pattern>
</servlet-mapping>
<filter>
<filter-name>springSecurityFilterChain</filter-name>
<filter-class>org.springframework.web.filter.DelegatingFilterProxy</filter-class>
</filter>
<filter-mapping>
<filter-name>springSecurityFilterChain</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
这是目录结构
myapp
|-----------META-INF
|-----------resources
|-----------Web-inf
通过Netbean我可以运行localhost:8084/myapp
但是如果我只是将.war文件复制到webapps文件夹我就不能