GWT / Eclipse / Jetty问题:Jasper无法解析标记库

问题描述 投票:12回答:4

我正试图让GWT托管模式在Eclipse中运行,àlathis HOWTO。 Servlet工作正常,我的GWT代码也是如此,但是我的所有JSP都因为出现以下错误而失败:

[WARN] /view/lniExecutiveSummary.htm
org.apache.jasper.JasperException: /WEB-INF/jsp/lni/lniExecutiveSummary.jsp(1,1) The absolute uri: http://java.sun.com/jsp/jstl/fmt cannot be resolved in either web.xml or the jar files deployed with this application
    at org.apache.jasper.compiler.DefaultErrorHandler.jspError(DefaultErrorHandler.java:39)
    at org.apache.jasper.compiler.ErrorDispatcher.dispatch(ErrorDispatcher.java:409)
    [ trimmed ]

在Tomcat 5x下部署时,此webapp可以正常工作;在Eclipse中运行时,我似乎无法解决taglibs问题。我是Eclipse的新手,让它使用GWT + Maven所需的所有活动部件让我把头发拉出来。

更新:我不再使用Eclipse;我已经切换(返回!)到Intellij IDEA。所以我不能诚实地评估你们所发布的答案。一旦某些投票行动发生,或者其他人使用其中一种方法报告成功,我将接受适当的答案。谢谢。

eclipse gwt jetty jstl taglib
4个回答
1
投票

我感觉到你的痛苦。为了让gwt,maven和eclipse一起工作,我已经走了同样的痛苦。

我已经能够使用以下pom.xml使用maven。这样你可以使用mvn gwt:run在托管模式下运行,但不幸的是,我永远无法获得mvn目标mvn gwt:eclipse来生成eclipse启动运行时配置工作。

这是我的pom.xml中的相关片段。请注意,我发现更容易在单独的位置安装gwt并指向maven使用它而不是从repo下载mvn download gwt。 mvn依赖项中的“系统”级别范围是实现此目的的原因。

  <properties>

      <!-- convenience to define GWT version in one place -->
      <gwt.version>1.7.1</gwt.version>
      <google.webtoolkit.home>${env.GWT_HOME}</google.webtoolkit.home>

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

  </properties>

  <dependencies>

      <!--  GWT dependencies (from central repo) -->
    <dependency>
      <groupId>com.google.gwt</groupId>
      <artifactId>gwt-servlet</artifactId>
      <version>${gwt.version}</version>
      <scope>system</scope>
      <systemPath>${env.GWT_HOME}/gwt-servlet.jar</systemPath>
    </dependency>
    <dependency>
      <groupId>com.google.gwt</groupId>
      <artifactId>gwt-user</artifactId>
      <version>${gwt.version}</version>
      <scope>system</scope>
      <systemPath>${env.GWT_HOME}/gwt-user.jar</systemPath>
    </dependency>

    ... other dependencies...
  </dependencies>

  <build>
    <outputDirectory>war/WEB-INF/classes</outputDirectory>
    <plugins>
      <plugin>
        <groupId>org.codehaus.mojo</groupId>
        <artifactId>gwt-maven-plugin</artifactId>
        <version>1.1</version>
        <executions>
          <execution>
            <goals>
              <goal>compile</goal>
              <goal>generateAsync</goal>
              <goal>test</goal>
            </goals>
          </execution>
        </executions>
        <configuration>
            <runTarget>com.gwt.example/Application.html</runTarget>
            <extraJvmArgs>-Xmx512m</extraJvmArgs>
        </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>
            <module>com.gwt.example</module>
          </configuration>
      </plugin>
    </plugins>

    ...rest of pom.xml...

我成功的另一项技术是使用eclipse google gwt plugin。只需使用向导创建一个新的gwt项目,确保您可以从eclipse运行它,然后使用您自己的代码进行修改。


1
投票

在Tomcat 5x下部署时,此webapp可以正常工作;在Eclipse中运行时,我似乎无法解决taglibs问题。我是Eclipse的新手,让它使用GWT + Maven所需的所有活动部件让我把头发拉出来。

你显然在Tomcat/lib而不是WEB-INF/lib中有JSTL JAR文件。您可以通过至少三种方式解决此问题:

  1. 将JSTL JAR文件移动/复制到WEB-INF/lib
  2. 将JSTL JAR文件移动/复制到开发计算机的Tomcat/lib中。
  3. 将包含JSTL JAR文件的正确Tomcat服务器与Eclipse中的Web项目相关联。如果尚未完成,请在Servers视图中添加Tomcat服务器。然后在项目属性中转到Java Build Path> Libraries> Add Library> Server Runtime>选择有问题的服务器。

1
投票

在eclipse项目类路径中添加Jar文件。如果你已经有了这个文件tomcat lib。此选项适合您。如果你有eclipse web项目,第二个选项是在Web-Inf lib文件夹中添加jar。


1
投票

您是否尝试在Java项目中将“jsf-api.jar”标记为“已导出”? (如this thread中所述)

1.)进入java-project属性并将“jsf-api.jar”标记为已导出。 (project>properties>java build path>order and exports) 2.)进入高级全局tomcat首选项并将项目添加到tomcat类路径(windows>preferences>tomcat>advanced>add projects to tomcat classpath

然后,再次尝试在eclipse下运行您的webapp。

这里是an article描述相同的程序/设置,不是为JSF而是Hudson(虽然同样的问题)

你可以清楚地看到我上面提到的两个步骤:

(来源:hudson-ci.org

(来源:hudson-ci.org

© www.soinside.com 2019 - 2024. All rights reserved.