Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/eclipse/8.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 如何让GWT2.0和Restlet 2.0更好地发挥作用_Java_Eclipse_Maven 2_Gwt_Restlet - Fatal编程技术网

Java 如何让GWT2.0和Restlet 2.0更好地发挥作用

Java 如何让GWT2.0和Restlet 2.0更好地发挥作用,java,eclipse,maven-2,gwt,restlet,Java,Eclipse,Maven 2,Gwt,Restlet,我很难让Restlet在同一个项目中很好地与GWT配合。我一直在尝试RESTlet中的示例,但都没有用 我正在使用Eclipse、Maven2插件、GWT和Restlet GWT。我以前从未在这个GWT项目中使用过服务器端代码,我知道其中涉及一些自定义设置。我目前正在本地部署,使用GWT托管模式下的内置Jetty。我可以让我的前端显示,但我的后端没有执行 我确实将它添加到了我的web.xml文件中,该文件来自示例(目前我正在尝试将示例放入我的项目中) 适配器 org.restlet.ext.g

我很难让Restlet在同一个项目中很好地与GWT配合。我一直在尝试RESTlet中的示例,但都没有用

我正在使用Eclipse、Maven2插件、GWT和Restlet GWT。我以前从未在这个GWT项目中使用过服务器端代码,我知道其中涉及一些自定义设置。我目前正在本地部署,使用GWT托管模式下的内置Jetty。我可以让我的前端显示,但我的后端没有执行

我确实将它添加到了我的web.xml文件中,该文件来自示例(目前我正在尝试将示例放入我的项目中)


适配器
org.restlet.ext.gwt.GwtShellServletWrapper
org.restlet.application
org.restlet.example.gwt.server.TestServerApplication
适配器
/*
我注意到我的web.xml文件与我的war部署目录是分开的。我的项目目录结构设置如下

Project Root
   src/main/java
   src/main/resources
   src/main/test
   JRE
   Maven Dependecies
   GWT SDK
   src
      main
          webapp
              WEB-INF
                 web.xml
   target
   war
      <my project dir>
      WEB-INF
         lib
   pom.xml
项目根目录
src/main/java
src/main/resources
src/主/测试
JRE
专家依赖
GWT SDK
src
主要的
网络应用
WEB-INF
web.xml
目标
战争
WEB-INF
解放党
pom.xml
因此,我的war文件web-INF目录下没有web.xml。我是这种类型应用程序的新手,所以很可能是我不了解目录结构以及GWT项目是如何编译成这些目录的

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">
  <!--
    POM generated by gwt-maven-plugin archetype
  -->
  <modelVersion>4.0.0</modelVersion>
  <groupId>com.tdc</groupId>
  <artifactId>Propspace</artifactId>
  <packaging>war</packaging>
  <version>0.0.1-SNAPSHOT</version>

  <properties>

      <!-- convenience to define GWT version in one place -->
      <gwt.version>2.0.0</gwt.version>

      <!--  tell the compiler we can use 1.5 -->
      <maven.compiler.source>1.5</maven.compiler.source>
      <maven.compiler.target>1.5</maven.compiler.target>

  </properties>

  <repositories>
    <repository>
        <snapshots>
        </snapshots>
        <id>com.smartgwt</id>
        <name>smartgwt</name>
        <url>http://www.smartclient.com/maven2</url>
    </repository>
    <repository>
        <id>maven-restlet</id>
        <name>Public online Restlet repository</name>
        <url>http://maven.restlet.org</url>
    </repository>
  </repositories>
  <dependencies>

      <!--  GWT dependencies (from central repo) -->
    <dependency>
      <groupId>com.google.gwt</groupId>
      <artifactId>gwt-servlet</artifactId>
      <version>${gwt.version}</version>
      <scope>runtime</scope>
    </dependency>
    <dependency>
      <groupId>com.google.gwt</groupId>
      <artifactId>gwt-user</artifactId>
      <version>${gwt.version}</version>
      <scope>provided</scope>
    </dependency>

    <!-- test -->
    <dependency>
      <groupId>junit</groupId>
      <artifactId>junit</artifactId>
      <version>4.7</version>
      <scope>test</scope>
    </dependency>
    <dependency>
        <groupId>com.smartgwt</groupId>
        <artifactId>smartgwt</artifactId>
        <version>2.0-SNAPSHOT</version>
    </dependency>
    <dependency>
        <groupId>mysql</groupId>
        <artifactId>mysql-connector-java</artifactId>
        <version>3.1.14</version>
        <type>jar</type>
        <scope>compile</scope>
    </dependency>
    <dependency>
        <groupId>org.restlet</groupId>
        <artifactId>org.restlet.ext.gwt</artifactId>
        <version>2.0-SNAPSHOT</version>
    </dependency>
    <dependency>
        <groupId>org.restlet</groupId>
        <artifactId>org.restlet.ext.json</artifactId>
        <version>2.0-SNAPSHOT</version>
    </dependency>
    <dependency>
        <groupId>org.restlet</groupId>
        <artifactId>org.restlet.ext.xml</artifactId>
        <version>2.0-SNAPSHOT</version>
    </dependency>
    <dependency>
        <groupId>org.restlet.gwt</groupId>
        <artifactId>org.restlet</artifactId>
        <version>2.0-SNAPSHOT</version>
    </dependency>
    <dependency>
        <groupId>org.restlet.jee</groupId>
        <artifactId>org.restlet</artifactId>
        <version>2.0-SNAPSHOT</version>
    </dependency>
    <dependency>
        <groupId>org.restlet.jee</groupId>
        <artifactId>org.restlet.ext.servlet</artifactId>
        <version>2.0-SNAPSHOT</version>
    </dependency>
    <dependency>
        <groupId>org.restlet.jee</groupId>
        <artifactId>org.restlet.ext.gwt</artifactId>
        <version>2.0-SNAPSHOT</version>
    </dependency>
  </dependencies>

  <build>
    <outputDirectory>war/WEB-INF/classes</outputDirectory>
    <plugins>
      <plugin>
        <groupId>org.codehaus.mojo</groupId>
        <artifactId>gwt-maven-plugin</artifactId>
        <version>1.2</version>
        <executions>
          <execution>
            <goals>
              <goal>compile</goal>
              <goal>generateAsync</goal>
              <goal>test</goal>
            </goals>
          </execution>
        </executions>
        <configuration>
          <runTarget>com.tdc.Propspace.Application/Application.html</runTarget>
        </configuration>
      </plugin>
      <!--
          If you want to use the target/web.xml file mergewebxml produces,
          tell the war plugin to use it.
          Also, exclude what you want from the final artifact here.
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-war-plugin</artifactId>
                <configuration>
                    <webXml>target/web.xml</webXml>
                    <warSourceExcludes>.gwt-tmp/**</warSourceExcludes>
                </configuration>
            </plugin>
            -->

      <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-compiler-plugin</artifactId>
          <version>2.0.2</version>
          <configuration>
            <source>${maven.compiler.source}</source>
            <target>${maven.compiler.target}</target>
          </configuration>
      </plugin>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-war-plugin</artifactId>
        <version>2.1-beta-1</version>
        <configuration>
          <warSourceDirectory>war</warSourceDirectory>
          <webXml>src/main/webapp/WEB-INF/web.xml</webXml>
        </configuration>
      </plugin>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-resources-plugin</artifactId>
        <version>2.4.2</version>
      </plugin>
    </plugins>
  </build>

</project>

4.0.0
com.tdc
支撑空间
战争
0.0.1-快照
2.0.0
1.5
1.5
com.smartgwt
smartgwt
http://www.smartclient.com/maven2
maven restlet
公共在线Restlet存储库
http://maven.restlet.org
com.google.gwt
gwt servlet
${gwt.version}
运行时
com.google.gwt
gwt用户
${gwt.version}
假如
朱尼特
朱尼特
4.7
测试
com.smartgwt
smartgwt
2.0-快照
mysql
mysql连接器java
3.1.14
罐子
编译
org.restlet
org.restlet.ext.gwt
2.0-快照
org.restlet
org.restlet.ext.json
2.0-快照
org.restlet
org.restlet.ext.xml
2.0-快照
org.restlet.gwt
org.restlet
2.0-快照
org.restlet.jee
org.restlet
2.0-快照
org.restlet.jee
org.restlet.ext.servlet
2.0-快照
org.restlet.jee
org.restlet.ext.gwt
2.0-快照
war/WEB-INF/classes
org.codehaus.mojo
GWTMaven插件
1.2
编译
生成同步
测试
com.tdc.Propspace.Application/Application.html
org.apache.maven.plugins
maven编译器插件
2.0.2
${maven.compiler.source}
${maven.compiler.target}
org.apache.maven.plugins
maven战争插件
2.1-β-1
战争
src/main/webapp/WEB-INF/WEB.xml
org.apache.maven.plugins
maven资源插件
2.4.2
感谢您的帮助!如果我需要提供更多信息,请告诉我


谢谢

如果不查看pom.xml,很难判断问题的确切原因,但是您是否按照下面的说明配置了maven war插件:

配置maven war插件 Google Eclipse插件需要您的 要创建为web应用程序的web应用程序 战争中爆炸/战争(硬编码) 路径)。为了满足这一要求,您需要 有两种选择:

  • 将您的
    src/main/webapp
    文件夹移动到
    /war
    并进行配置 maven war插件
    warSourceDirectory
    参数这是就地设置, 因为webapp源将用于 构建爆炸战争布局
  • /war
    webappDirectory
    parameter) 标准的
    outputDirectory
gwt maven插件有一个布尔值 用于配置 您选择的选项。
就地
模式 如果您将JSP用作no,那么这很有趣 需要构建/打包/部署 查看JSP文件中所做的更改。 这同样适用于CSS等静态文件

下面是用于inplace设置的maven war插件的典型配置:

<plugin>
  <groupId>org.apache.maven.plugins</groupId>
  <artifactId>maven-war-plugin</artifactId>
  <version>2.0.2</version>
  <configuration>
    <warSourceDirectory>war</warSourceDirectory>
    <webXml>src/main/webapp/WEB-INF/web.xml</webXml>
  </configuration>
</plugin> 

org.apache.maven.plugins

.

如果不查看pom.xml,很难判断问题的确切原因,但是您是否按照下面的说明配置了maven war插件:

配置maven war插件 Google Eclipse插件需要您的 要创建为web应用程序的web应用程序 战争中爆炸/战争(硬编码) 路径)。为了满足这一要求,您需要 有两种选择:

  • 将您的
    src/main/webapp
    文件夹移动到
    /war
    并进行配置 maven war插件
    warSourceDirectory
    参数这是就地设置, 因为webapp源将用于 构建爆炸战争布局
  • /war
    webappDirectory
    parameter) 标准的
    outputDirectory
gwt maven插件有一个布尔值 用于配置 您选择的选项。
就地
模式 如果您将JSP用作no,那么这很有趣 需要构建/打包/部署 看到变化吗
<plugin>
  <groupId>org.apache.maven.plugins</groupId>
  <artifactId>maven-war-plugin</artifactId>
  <version>2.0.2</version>
  <configuration>
    <warSourceDirectory>war</warSourceDirectory>
    <webXml>src/main/webapp/WEB-INF/web.xml</webXml>
  </configuration>
</plugin>