2013-10-18 36 views
1

我試圖使用嵌入式Tomcat6(mvn tomcat6:run)來運行我的Vaadin應用程序(pom.xml在下面給出)。Maven嵌入式Tomcat6不啓動

它不工作 - 當我運行它,我得到

окт 18, 2013 1:51:57 PM org.apache.catalina.startup.Embedded start 
INFO: Starting tomcat server 
окт 18, 2013 1:51:57 PM org.apache.catalina.core.StandardEngine start 
INFO: Starting Servlet Engine: Apache Tomcat/6.0.36 
окт 18, 2013 1:51:57 PM org.apache.coyote.http11.Http11Protocol init 
INFO: Initializing Coyote HTTP/1.1 on http-9090 
окт 18, 2013 1:51:57 PM org.apache.coyote.http11.Http11Protocol start 
INFO: Starting Coyote HTTP/1.1 on http-9090 

然後什麼也沒有發生的消息。

我的項目設置有什麼問題?我該如何讓Tomcat6運行我的網絡應用程序(正如mvn jetty:run)?

這裏的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/maven-v4_0_0.xsd"> 
    <modelVersion>4.0.0</modelVersion> 
    <groupId>ru.mycompany</groupId> 
    <artifactId>vaadin-demo</artifactId> 
    <packaging>war</packaging> 
    <version>1.0-SNAPSHOT</version> 
    <name>Vaadin Web Application</name> 

    <properties> 
     <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> 
     <vaadin.version>7.1.6</vaadin.version> 
     <vaadin.plugin.version>${vaadin.version}</vaadin.plugin.version> 
     <powermock.version>1.5</powermock.version> 
    </properties> 
    <repositories> 
     <repository> 
      <id>repo1.maven.org</id> 
      <url>http://repo1.maven.org/</url> 
     </repository> 
     <repository> 
      <id>vaadin-addons</id> 
      <url>http://maven.vaadin.com/vaadin-addons</url> 
     </repository> 
     <repository> 
      <id>vaadin-snapshots</id> 
      <url>http://oss.sonatype.org/content/repositories/vaadin-snapshots/</url> 
      <releases> 
       <enabled>false</enabled> 
      </releases> 
      <snapshots> 
       <enabled>true</enabled> 
      </snapshots> 
     </repository> 
     <repository> 
      <id>codehaus</id> 
      <url>http://repository.codehaus.org/org/codehaus/groovy/</url> 
     </repository> 
    </repositories> 
    <pluginRepositories> 
     <pluginRepository> 
      <id>vaadin-snapshots</id> 
      <url>http://oss.sonatype.org/content/repositories/vaadin-snapshots/</url> 
      <releases> 
       <enabled>false</enabled> 
      </releases> 
      <snapshots> 
       <enabled>true</enabled> 
      </snapshots> 
     </pluginRepository> 
    </pluginRepositories> 
    <dependencies> 
     <dependency> 
      <groupId>com.vaadin</groupId> 
      <artifactId>vaadin-server</artifactId> 
      <version>${vaadin.version}</version> 
     </dependency> 
     <dependency> 
      <groupId>com.vaadin</groupId> 
      <artifactId>vaadin-client-compiled</artifactId> 
      <version>${vaadin.version}</version> 
     </dependency> 
     <!-- 
      Needed when using the widgetset optimizer (custom ConnectorBundleLoaderFactory). 

      For widgetset compilation, vaadin-client-compiler is automatically added on the 
      compilation classpath by vaadin-maven-plugin so normally there is no need for an 
      explicit dependency. 
     --> 
     <!-- 
     <dependency> 
      <groupId>com.vaadin</groupId> 
      <artifactId>vaadin-client-compiler</artifactId> 
      <version>${vaadin.version}</version> 
      <scope>provided</scope> 
     </dependency> 
     --> 
     <dependency> 
      <groupId>com.vaadin</groupId> 
      <artifactId>vaadin-client</artifactId> 
      <version>${vaadin.version}</version> 
      <scope>provided</scope> 
     </dependency> 
     <dependency> 
      <groupId>com.vaadin</groupId> 
      <artifactId>vaadin-push</artifactId> 
      <version>${vaadin.version}</version> 
     </dependency> 
     <dependency> 
      <groupId>com.vaadin</groupId> 
      <artifactId>vaadin-themes</artifactId> 
      <version>${vaadin.version}</version> 
     </dependency> 
     <dependency> 
      <groupId>javax.servlet</groupId> 
      <artifactId>javax.servlet-api</artifactId> 
      <version>3.0.1</version> 
      <scope>provided</scope> 
     </dependency> 
     <dependency> 
      <groupId>com.google.guava</groupId> 
      <artifactId>guava</artifactId> 
      <version>15.0</version> 
     </dependency> 
     <!-- Testing (start) --> 
     <dependency> 
      <groupId>org.easytesting</groupId> 
      <artifactId>fest-assert-core</artifactId> 
      <version>2.0M8</version> 
     </dependency> 
     <dependency> 
      <groupId>org.mockito</groupId> 
      <artifactId>mockito-core</artifactId> 
      <version>1.9.5</version> 
      <scope>test</scope> 
     </dependency> 
     <dependency> 
      <groupId>org.powermock</groupId> 
      <artifactId>powermock-module-junit4</artifactId> 
      <version>${powermock.version}</version> 
      <scope>test</scope> 
     </dependency> 
     <dependency> 
      <groupId>org.powermock</groupId> 
      <artifactId>powermock-api-mockito</artifactId> 
      <version>${powermock.version}</version> 
      <scope>test</scope> 
     </dependency> 
     <dependency> 
      <groupId>junit</groupId> 
      <artifactId>junit</artifactId> 
      <version>4.10</version> 
      <scope>test</scope> 
     </dependency> 
     <!-- Testing (end) --> 

     <dependency> 
      <groupId>org.codehaus.groovy</groupId> 
      <artifactId>groovy-all</artifactId> 
      <version>2.1.8</version> 
     </dependency> 

     <dependency> 
      <groupId>ru.mycompany</groupId> 
      <artifactId>myproduct2</artifactId> 
      <version>1.0</version> 
     </dependency> 

     <dependency> 
      <groupId>ru.mycompany</groupId> 
      <artifactId>myproduct3</artifactId> 
      <version>1.0</version> 
     </dependency> 

     <dependency> 
      <groupId>ru.mycompany</groupId> 
      <artifactId>myproduct1</artifactId> 
      <version>0.10.x</version> 
     </dependency> 
     <dependency> 
      <groupId>org.apache.commons</groupId> 
      <artifactId>commons-lang3</artifactId> 
      <version>3.0</version> 
     </dependency> 
     <dependency> 
      <groupId>com.microsoft.sqlserver</groupId> 
      <artifactId>sqljdbc4</artifactId> 
      <version>3.0</version> 
     </dependency> 
    </dependencies> 

    <build> 
     <plugins> 
      <plugin> 
       <groupId>org.apache.maven.plugins</groupId> 
       <artifactId>maven-compiler-plugin</artifactId> 
       <configuration> 
        <source>1.6</source> 
        <target>1.6</target> 
       </configuration> 
      </plugin> 
      <!-- As we are doing "inplace" GWT compilation, ensure the widgetset --> 
      <!-- directory is cleaned properly --> 
      <plugin> 
       <artifactId>maven-clean-plugin</artifactId> 
       <version>2.4.1</version> 
       <configuration> 
        <filesets> 
         <fileset> 
          <directory>src/main/webapp/VAADIN/widgetsets</directory> 
         </fileset> 
        </filesets> 
       </configuration> 
      </plugin> 
      <plugin> 
       <groupId>org.apache.maven.plugins</groupId> 
       <artifactId>maven-war-plugin</artifactId> 
       <version>2.2</version> 
       <configuration> 
        <failOnMissingWebXml>false</failOnMissingWebXml> 
       </configuration> 
      </plugin> 
      <plugin> 
       <groupId>com.vaadin</groupId> 
       <artifactId>vaadin-maven-plugin</artifactId> 
       <version>${vaadin.plugin.version}</version> 
       <configuration> 
        <extraJvmArgs>-Xmx512M -Xss1024k</extraJvmArgs> 
        <!-- <runTarget>mobilemail</runTarget> --> 
        <!-- We are doing "inplace" but into subdir VAADIN/widgetsets. This 
         way compatible with Vaadin eclipse plugin. --> 
        <webappDirectory>${basedir}/src/main/webapp/VAADIN/widgetsets 
        </webappDirectory> 
        <hostedWebapp>${basedir}/src/main/webapp/VAADIN/widgetsets 
        </hostedWebapp> 
        <noServer>true</noServer> 
        <!-- Remove draftCompile when project is ready --> 
        <draftCompile>false</draftCompile> 
        <compileReport>true</compileReport> 
        <style>OBF</style> 
        <strict>true</strict> 
        <runTarget>http://localhost:8080/</runTarget> 
       </configuration> 
       <executions> 
        <execution> 
         <configuration> 
          <!-- if you don't specify any modules, the plugin will find them --> 
          <!-- <modules> <module>com.vaadin.demo.mobilemail.gwt.ColorPickerWidgetSet</module> 
           </modules> --> 
         </configuration> 
         <goals> 
          <goal>clean</goal> 
          <goal>resources</goal> 
          <goal>update-theme</goal> 
          <goal>update-widgetset</goal> 
          <goal>compile-theme</goal> 
          <goal>compile</goal> 
         </goals> 
        </execution> 
       </executions> 
      </plugin> 
      <plugin> 
       <groupId>org.mortbay.jetty</groupId> 
       <artifactId>jetty-maven-plugin</artifactId> 
      </plugin> 
      <plugin> 
       <groupId>org.apache.tomcat.maven</groupId> 
       <artifactId>tomcat6-maven-plugin</artifactId> 
       <version>2.1</version> 
       <configuration> 
        <!-- http port --> 
        <port>9090</port> 
        <!-- application path always starts with /--> 
        <path>/bookkeeping</path> 
        <useTestClasspath>false</useTestClasspath> 
       </configuration> 
      </plugin> 
     </plugins> 
     <pluginManagement> 
      <plugins> 
       <!--This plugin's configuration is used to store Eclipse m2e settings only. It has no influence on the Maven build itself.--> 
       <plugin> 
        <groupId>org.eclipse.m2e</groupId> 
        <artifactId>lifecycle-mapping</artifactId> 
        <version>1.0.0</version> 
        <configuration> 
         <lifecycleMappingMetadata> 
          <pluginExecutions> 
           <pluginExecution> 
            <pluginExecutionFilter> 
             <groupId>com.vaadin</groupId> 
             <artifactId> 
              vaadin-maven-plugin 
             </artifactId> 
             <versionRange> 
              [7.1.6,) 
             </versionRange> 
             <goals> 
              <goal>resources</goal> 
              <goal>update-widgetset</goal> 
              <goal>compile</goal> 
              <goal>update-theme</goal> 
              <goal>compile-theme</goal> 
             </goals> 
            </pluginExecutionFilter> 
            <action> 
             <ignore></ignore> 
            </action> 
           </pluginExecution> 
          </pluginExecutions> 
         </lifecycleMappingMetadata> 
        </configuration> 
       </plugin> 
      </plugins> 
     </pluginManagement> 
    </build> 
</project> 

更新1:我得到了同樣的問題,如果我創建一個空的Vaadin項目,並嘗試使用Tomcat運行它。

  1. mvn archetype:generate -DarchetypeGroupId=com.vaadin -DarchetypeArtifactId=vaadin-archetype-application -DarchetypeVersion=LATEST -DgroupId=your.company -DartifactId=project-name -Dversion=1.0 -Dpackaging=war
  2. mvn tomcat6:run
+0

什麼是輸出,當你訪問http:// localhost:8080 – Satya

+0

@Satya'localhost:8080'不響應。 –

+0

你嘗試看看線程轉儲嗎?例如通過jconsole? – sodik

回答

2

tomcat6中不提供servlet-api:3.0,它只有2.5 compilant容器,你應該使用tomcat7或寫正確web.xml

+0

謝謝。我的'web.xml'究竟有什麼問題? –

+1

你沒有在你的消息中提供它。 在具有原型的空Vaading項目中:生成根本沒有web.xml。 您可以在https://github.com/vaadin/addressbook/blob/master/src/main/webapp/WEB-INF/web.xml中獲得簡單示例 –