views:

1459

answers:

5

I'm trying to get GWT Hosted mode working in Eclipse, à la this HOWTO. Servlets work fine, as does my GWT code, but all my JSPs fail because with errors such as the following:

[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 ]

This webapp works fine when deployed under Tomcat 5x; I just can't seem to get it to resolve the taglibs when running in Eclipse. I'm new to Eclipse, and getting it working with all the moving parts required for GWT+Maven has me pulling my hair out.

Update: I'm no longer using Eclipse; I've switched (back!) to Intellij IDEA. So I can't honestly evaluate the answers you kind folks have posted. Once some voting action happens, or someone else reports success with one of these methods, I'll accept the appropriate answer. Thanks.

A: 
VonC
Hmm, why jsf? Did you mean to say jstl? I already have that as a dep in my maven config, so it should already be on the classpath. But I'll go ahead and try adding it manually to the build path. Thanks.
Caffeine Coma
JSTL is more like it :) But the general principle described in this answer still stands. So, did it worked for your case ?
VonC
Nope. I already have jstl listed as a dependency via Maven; it appears under the Maven deps on the "Libraries" tab, and I do have "Maven Dependencies" checkmarked on the "Order and Export" tab. Still no joy. :-(
Caffeine Coma
Sorry to hear, err... read that. If you do find a solution, do not forget to post it here ;)
VonC
Will do. Thanks for your help in any case.
Caffeine Coma
A: 

I feel your pain. I've gone thru the same pain trying to get gwt, maven, and eclipse to work together.

I've been able to get it working with maven using the following pom.xml. This way you can use mvn gwt:run to run in hosted mode, but unfortunately, I could never get the mvn goal mvn gwt:eclipse for generating an eclipse launch run time config to work.

Here's the relevant snippets from my pom.xml. Note that I've found it easier to install gwt in separate location and point maven to use that instead of having mvn download gwt from repo. The "system" level scope in the mvn dependencies are what make this happen.

  <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...

Another technique I've had success with is to use the eclipse google gwt plugin. Just use the wizard to create a new gwt project, make sure that you can run it from eclipse, then modify with your own code.

Dave Paroulek
A: 

This webapp works fine when deployed under Tomcat 5x; I just can't seem to get it to resolve the taglibs when running in Eclipse. I'm new to Eclipse, and getting it working with all the moving parts required for GWT+Maven has me pulling my hair out.

You apparently have the JSTL JAR file(s) in Tomcat/lib instead of WEB-INF/lib. You can fix this in at least three ways:

  1. Move/copy the JSTL JAR file(s) into WEB-INF/lib.
  2. Move/copy the JSTL JAR file(s) into Tomcat/lib of your development machine.
  3. Associate the right Tomcat server containing the JSTL JAR file(s) with web project in Eclipse. If not done yet, add the Tomcat server in Servers view. Then in project properties go to Java Build Path > Libraries > Add Library > Server Runtime > select the server in question.
BalusC
A: 

Add the Jar files in eclipse project classpath. if you already had this file tomcat lib. This option will works for you. Second option is add jar in Web-Inf lib folder if you have eclipse web project.

Kamahire
A: 

Back to Idea? Good for you!

I was involved in a project where I was using Idea and other developers were using Eclipse. Usually this works smoothly. But this project used Maven. Idea never had problems with it, but Eclipse had problems constantly. Maven support in Eclipse isn't not really good for larger projects. Avoid it.

Peter Knego