[英]deploy a Spring MVC + Maven in Tomcat 7
I want to deploy a maven project based in Spring MVC into a Tomcat server . 我想将基于Spring MVC的Maven项目部署到Tomcat服务器中 。 I have been working with eclipse + tomcat 7, in local mode, and the project work correctly, but now, i buy a host with PLESK and the app doesnt work.
我一直在本地模式下使用eclipse + tomcat 7,该项目正常运行,但是现在,我购买了PLESK主机,但该应用程序无法正常工作。
I build a .WAR with maven plugin method (Goal clean install, adn JDK 1.8 compiler): 我使用maven插件方法(目标全新安装,adj JDK 1.8编译器)构建了.WAR:
I test with a normal wep app .war file and the host work correctly, for this reason i suppouse that the problem is the structure of my proyect before build the .war file... but i dont know. 我使用正常的wep应用程序.war文件进行测试,并且主机可以正常工作,因此,我认为问题在于构建.war文件之前我的proyect的结构...但是我不知道。
Sample.war struct: Sample.war结构:
My current structure is this (Maven project using Spring MVC) : 我当前的结构是这个(使用Spring MVC的Maven项目):
An the lines of my pom.xml 我的pom.xml的行
<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>TreeBuk</groupId>
<artifactId>TreeBuk</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>war</packaging>
<build>
<sourceDirectory>src</sourceDirectory>
<plugins>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.3</version>
<configuration>
<source>1.8</source>
<target>1.8</target>
</configuration>
</plugin>
<plugin>
<artifactId>maven-war-plugin</artifactId>
<version>2.6</version>
<configuration>
<warSourceDirectory>WebContent</warSourceDirectory>
<failOnMissingWebXml>false</failOnMissingWebXml>
</configuration>
</plugin>
</plugins>
</build>
My index.jsp and all my other views is into WebContent/WEB-INF/views . 我的index.jsp和其他所有视图都位于WebContent / WEB-INF / views中 。 I saw some examples where index.jsp is in WebContent/WEB-INF/... but i dont know why...For other hand, i test it in local server tomcat too (no in eclipse instance) but dont work the deployment... I dont understand why WORK into eclipse on tomcat instance, but in local tomcat server doesnt work .
我在WebContent / WEB-INF /中看到了index.jsp的一些示例...但是我不知道为什么...另一方面,我也在本地服务器tomcat中对其进行了测试(在eclipse实例中没有),但是不进行部署...我不明白为什么要在tomcat实例上运行到eclipse中,但是在本地tomcat服务器中却无法正常工作 。
Anybody can help me to deploy my wepApp in server? 有人可以帮助我在服务器上部署wepApp吗? Where is the problem?
问题出在哪儿?
PD: im using Apache Tiles 3.0, some .xml configuration files (security-context.xml, persistence-context.xml, service-context, etc, into src/com.treebuk/config in addition to WebContent/WEB-INF/dispatcher-servlet.xml file) PD:除了WebContent / WEB-INF / dispatcher外,我还使用Apache Tiles 3.0,一些.xml配置文件(security-context.xml,persistence-context.xml,service-context等)导入src / com.treebuk / config中-servlet.xml文件)
EDIT 1 : When start the local tomcat server executing apache-tomcat-7.0.67\\bin\\startip.bat I can see this in the console: 编辑1 :当启动执行apache-tomcat-7.0.67 \\ bin \\ startip.bat的本地tomcat服务器时,我可以在控制台中看到以下内容:
and if I go to url http://localhost:8080/TreeBuk/ 如果我转到网址http:// localhost:8080 / TreeBuk /
EDIT 2 In my web.xml file I have configured the multi context files xml. 编辑2在我的web.xml文件中,我已经配置了多上下文文件xml。 (remind that the app works into tomcat server instance of Eclipse)
(提醒该应用程序可以在Eclipse的tomcat服务器实例中使用)
<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>
classpath:com/treebuk/config/persistence-context.xml
classpath:com/treebuk/config/service-context.xml
classpath:com/treebuk/config/security-context.xml
classpath:com/treebuk/config/application-context.xml
</param-value>
</context-param>
Finnaly, I dont know that happend, but the structure of .War was invalid... i rebuild the project in a new Spring MVC project with other valid structure and i could to generate the .war file. Finnaly,我不知道发生了什么,但是.War的结构无效...我在具有其他有效结构的新Spring MVC项目中重建了项目,并且可以生成.war文件。
Sorry but this havent a simple solution. 抱歉,这还没有一个简单的解决方案。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.