Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/gwt/3.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
在Tomcat中部署GWT/GWTP应用程序_Tomcat_Gwt_Gwtp - Fatal编程技术网

在Tomcat中部署GWT/GWTP应用程序

在Tomcat中部署GWT/GWTP应用程序,tomcat,gwt,gwtp,Tomcat,Gwt,Gwtp,我知道这可能与编程没有直接关系。我希望它无论如何适合这里。 我有一个GWTP web应用程序,它在eclipse或运行mvn gwt:run的命令提示符下在开发模式下运行得非常好。 现在我尝试在本地将其部署到Tomcat7。我运行了gwt:compile并将zip文件(重命名为.war后)复制到webapps文件夹。该应用程序列在Tomcat的manager gui中。但是当我尝试导航到localhost:8080/appname或localhost:8080/appname/Project.h

我知道这可能与编程没有直接关系。我希望它无论如何适合这里。 我有一个GWTP web应用程序,它在eclipse或运行mvn gwt:run的命令提示符下在开发模式下运行得非常好。 现在我尝试在本地将其部署到Tomcat7。我运行了gwt:compile并将zip文件(重命名为.war后)复制到webapps文件夹。该应用程序列在Tomcat的manager gui中。但是当我尝试导航到localhost:8080/appname或localhost:8080/appname/Project.html时,我只得到一个404错误。我错过了什么? 为了完整起见,这里是我的pom.xml:

<?xml version="1.0" encoding="UTF-8"?>

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

<groupId>testproject</groupId>
<artifactId>testme-gwtp</artifactId>
<version>1.0-SNAPSHOT</version>
<packaging>war</packaging>
<name>GWTP Basic</name>
<description>Basic GWTP application</description>

<properties>
    <!-- client -->
    <gwt.version>2.6.0</gwt.version>
    <gwtp.version>1.2.1</gwtp.version>
    <gin.version>2.1.2</gin.version>

    <!-- server -->
    <guice.version>3.0</guice.version>

    <!-- testing -->
    <junit.version>4.7</junit.version>
    <jukito.version>1.4</jukito.version>

    <!-- maven -->
    <gwt-maven-plugin.version>2.6.0</gwt-maven-plugin.version>
    <maven-surefire-plugin.version>2.6</maven-surefire-plugin.version>
    <maven-compiler-plugin.version>2.3.2</maven-compiler-plugin.version>
    <maven-resources-plugin.version>2.5</maven-resources-plugin.version>
    <maven-processor-plugin.version>2.0.5</maven-processor-plugin.version>
    <maven-build-helper-plugin.version>1.7</maven-build-helper-plugin.version>


    <target.jdk>1.7</target.jdk>
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
    <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>

    <webappDirectory>${project.build.directory}/${project.build.finalName}</webappDirectory>
</properties>

<build>
    <outputDirectory>${webappDirectory}/WEB-INF/classes</outputDirectory>

    <plugins>
        <!-- JUnit Testing - skip *.GwtTest cases -->
        <!-- 'mvn test' - runs the Jukito tests -->
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-surefire-plugin</artifactId>
            <version>${maven-surefire-plugin.version}</version>
            <configuration>
                <includes>
                    <include>**/*Test.java</include>
                </includes>
                <excludes>
                    <exclude>**/*GwtTest.java</exclude>
                </excludes>
            </configuration>
        </plugin>
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-compiler-plugin</artifactId>
            <version>2.3.2</version>
            <configuration>
                <source>1.7</source>
                <target>1.7</target>
            </configuration>
        </plugin>

        <!-- GWT -->
        <!-- 'mvn gwt:run' - runs development mode -->
        <!-- 'mvn gwt:debug' - runs debug mode -->
        <!-- 'mvn gwt:compile' - compiles gwt -->
        <!-- 'mvn integration-test' - runs the gwt tests (*GwtTest.java) -->
        <plugin>
            <groupId>org.codehaus.mojo</groupId>
            <artifactId>gwt-maven-plugin</artifactId>
            <version>${gwt.version}</version>
            <configuration>
                <!-- With multiple tests use GwtTestSuite.java for speed -->
                <includes>**/*GwtTest.java</includes>
                <extraJvmArgs>-Xss1024K -Xmx1024M -XX:MaxPermSize=256M</extraJvmArgs>

                <copyWebapp>true</copyWebapp>
                <hostedWebapp>${webappDirectory}</hostedWebapp>

                <runTarget>Project.html</runTarget>
                <modules>
                    <module>testproject.Project</module>
                </modules>
            </configuration>
            <executions>
                <execution>
                    <goals>
                        <goal>compile</goal>
                        <goal>test</goal>
                    </goals>
                </execution>
            </executions>
        </plugin>
    </plugins>
</build>

<dependencies>
    <!-- Google Web Toolkit -->
    <dependency>
        <groupId>com.google.gwt</groupId>
        <artifactId>gwt-user</artifactId>
        <version>${gwt.version}</version>
    </dependency>

    <!-- GWT-Platform -->
    <dependency>
        <groupId>com.gwtplatform</groupId>
        <artifactId>gwtp-all</artifactId>
        <version>${gwtp.version}</version>
    </dependency>

    <!-- DI -->
    <dependency>
        <groupId>com.google.inject</groupId>
        <artifactId>guice</artifactId>
        <version>${guice.version}</version>
    </dependency>
    <dependency>
        <groupId>com.google.inject.extensions</groupId>
        <artifactId>guice-servlet</artifactId>
        <version>${guice.version}</version>
    </dependency>
    <dependency>
        <groupId>com.google.inject.extensions</groupId>
        <artifactId>guice-assistedinject</artifactId>
        <version>${guice.version}</version>
    </dependency>
    <dependency>
        <groupId>com.google.gwt.inject</groupId>
        <artifactId>gin</artifactId>
        <version>${gin.version}</version>
    </dependency>

    <!-- Test -->
    <dependency>
        <groupId>junit</groupId>
        <artifactId>junit</artifactId>
        <version>${junit.version}</version>
        <scope>test</scope>
    </dependency>
    <dependency>
        <groupId>org.jukito</groupId>
        <artifactId>jukito</artifactId>
        <version>${jukito.version}</version>
        <scope>test</scope>
    </dependency>
    <!-- Hibernate -->
    <!-- for JPA, use hibernate-entitymanager instead of hibernate-core -->
    <dependency>
        <groupId>org.hibernate</groupId>
        <artifactId>hibernate-entitymanager</artifactId>
        <version>4.3.5.Final</version>
    </dependency>
    <!-- hSQLDB -->
    <dependency>
        <groupId>org.hsqldb</groupId>
        <artifactId>hsqldb</artifactId>
        <version>2.3.2</version>
    </dependency>
    <!-- add slf4j interfaces to classpath -->
    <dependency>
        <groupId>org.slf4j</groupId>
        <artifactId>slf4j-api</artifactId>
        <version>1.6.4</version>
        <scope>compile</scope>
    </dependency>
    <dependency>
        <groupId>log4j</groupId>
        <artifactId>log4j</artifactId>
        <version>1.2.16</version>
    </dependency>
    <!--  GWT-Log -->
    <dependency>
        <groupId>com.allen-sauer.gwt.log</groupId>
        <artifactId>gwt-log</artifactId>
        <version>3.3.0</version>
    </dependency>                   
</dependencies>
testproject
testme gwtp
1.0-快照
战争
GWTP基础
基本GWTP应用
2.6.0
1.2.1
2.1.2
3
4.7
1.4
2.6.0
2.6
2.3.2
2.5
2.0.5
1.7
1.7
UTF-8
UTF-8
${project.build.directory}/${project.build.finalName}
${webappDirectory}/WEB-INF/classes
org.apache.maven.plugins
maven surefire插件
${maven surefire plugin.version}
**/*Test.java
**/*GwtTest.java
org.apache.maven.plugins
maven编译器插件
2.3.2
1.7
1.7
org.codehaus.mojo
GWTMaven插件
${gwt.version}
**/*GwtTest.java
-Xss1024K-Xmx1024M-XX:MaxPermSize=256M
真的
${webappDirectory}
Project.html
testproject.Project
编译
测试
com.google.gwt
gwt用户
${gwt.version}
com.gwtplatform
gwtp所有
${gwtp.version}
com.google.inject
圭斯
${guice.version}
com.google.inject.extensions
guice servlet
${guice.version}
com.google.inject.extensions
guice助理项目
${guice.version}
com.google.gwt.inject
杜松子酒
${gin.version}
朱尼特
朱尼特
${junit.version}
测试
org.jukito
朱基托
${jukito.version}
测试
org.hibernate
休眠实体管理器
4.3.5.最终版本
org.hsqldb
hsqldb
2.3.2
org.slf4j
slf4j api
1.6.4
编译
log4j
log4j
1.2.16
com.allen-sauer.gwt.log
gwt日志
3.3.0


谢谢:)

您的
gwt-maven插件
目标似乎没有绑定到任何maven阶段。请尝试以下操作:


编译
编译
测试

要使其运行,您需要按照Vadim的指示进行操作,但这也必须添加到pom.xml中:

    <pluginManagement>
        <plugins>
            <plugin>
                <groupId>org.eclipse.m2e</groupId>
                <artifactId>lifecycle-mapping</artifactId>
                <version>1.0.0</version>
                <configuration>
                    <lifecycleMappingMetadata>
                        <pluginExecutions>
                            <pluginExecution>
                                <pluginExecutionFilter>
                                    <groupId>org.codehaus.mojo</groupId>
                                    <artifactId>gwt-maven-plugin</artifactId>
                                    <versionRange>[2.4.0,)</versionRange>
                                    <goals>
                                        <goal>resources</goal>
                                        <goal>compile</goal>
                                        <goal>i18n</goal>
                                        <goal>generateAsync</goal>
                                        <goal>test</goal>
                                    </goals>
                                </pluginExecutionFilter>
                                <action>
                                    <execute />
                                </action>
                            </pluginExecution>
                        </pluginExecutions>
                    </lifecycleMappingMetadata>
                </configuration>
            </plugin>
        </plugins>
    </pluginManagement>

org.eclipse.m2e
生命周期映射
1.0.0
org.codehaus.mojo
GWTMaven插件
[2.4.0,)
资源
编译
i18n
生成同步
测试

如果您将编译阶段指定为
prepare package
,则在tomcat管理控制台上调用部署的应用程序列表中的
mvn package

时,它将作为打包前的最后一步执行,您是否可以单击列表中的应用程序并找到它部署的确切url?至少在glassfish上(尽管服务器类型不同)您可以通过单击该应用程序找到指向该应用程序的直接链接。您不必手动猜测。您可以跟踪指向该应用程序的链接,但在这种情况下,它就是我尝试过的链接:在部署完成之前,日志上是否有任何内容?这一切都很好:服务器在…毫秒内启动,重新加载上下文已开始并完成…您能否详细说明这是如何实现的影响tomcat服务器中webapp的行为?编译似乎工作得很好。我猜gwt maven pugin在编译过程中不会被触发。因此,由于输出中缺少gwt工件,因此会出现404错误。
    <pluginManagement>
        <plugins>
            <plugin>
                <groupId>org.eclipse.m2e</groupId>
                <artifactId>lifecycle-mapping</artifactId>
                <version>1.0.0</version>
                <configuration>
                    <lifecycleMappingMetadata>
                        <pluginExecutions>
                            <pluginExecution>
                                <pluginExecutionFilter>
                                    <groupId>org.codehaus.mojo</groupId>
                                    <artifactId>gwt-maven-plugin</artifactId>
                                    <versionRange>[2.4.0,)</versionRange>
                                    <goals>
                                        <goal>resources</goal>
                                        <goal>compile</goal>
                                        <goal>i18n</goal>
                                        <goal>generateAsync</goal>
                                        <goal>test</goal>
                                    </goals>
                                </pluginExecutionFilter>
                                <action>
                                    <execute />
                                </action>
                            </pluginExecution>
                        </pluginExecutions>
                    </lifecycleMappingMetadata>
                </configuration>
            </plugin>
        </plugins>
    </pluginManagement>