George Armhold
George Armhold

Reputation: 31074

GWT/Eclipse/Jetty issue: Jasper can't resolve tag libraries

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.

Upvotes: 13

Views: 2948

Answers (4)

VonC
VonC

Reputation: 1327384

Did you try to mark the "jsf-api.jar" as "exported" in your Java project ?
(as mentioned in this thread)

1.) Go into the java-project properties and mark the "jsf-api.jar" as exported. (project>properties>java build path>order and exports)
2.) Go into the advanced global tomcat preferences and add your project to the tomcat classpath (windows>preferences>tomcat>advanced>add projects to tomcat classpath)

Then, try again to run your webapp under eclipse.

Here is an article describing the same procedure/setup, not for JSF but Hudson (same problem though)

You can clearly see the two steps I mentioned above:


(source: hudson-ci.org)


(source: hudson-ci.org)

Upvotes: 1

Kamahire
Kamahire

Reputation: 2209

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.

Upvotes: 1

BalusC
BalusC

Reputation: 1109292

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.

Upvotes: 1

Upgradingdave
Upgradingdave

Reputation: 13076

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.

Upvotes: 1

Related Questions