Pregunta

I am trying to precompile my JSP files with Jetty, so I do not have to ship a compiler with my Jetty project. I am using Ant to achieve this, but there appears an error and I don't know how to solve it.

taglibs.jsp(4,62) PWC6188: The absolute uri: http://java.sun.com/jsp/jstl/core cannot be resolved in either web.xml or the jar files deployed with this application

I am using the following ant script as mentioned in another StackOverflow question : precompile jsps into classes for Jetty8 using ant

<property name="jetty.home" value="C:/jetty-distribution-8.1.8.v20121106" />     
<path id="compile.jspc">
     <fileset dir="${jetty.home}">
          <include name="lib/servlet-api-*.jar" />
          <include name="lib/jsp/*.jar" />
     </fileset>
</path>
<target name="jspc" depends="compile">
    <taskdef classname="org.apache.jasper.JspC" name="jasper2" classpathref="compile.jspc" />
    <jasper2 validateXml="false"
        uriroot="WebContent"
        addWebXmlMappings="true"
        webXmlFragment="WebContent/WEB-INF/generated_web.xml"
        compilerSourceVM="1.6"
        compilerTargetVM="1.6"
        outputDir="build/gen-src"
        verbose="9" />
</target>

What could go wrong and trigger this error? Double checked the classpath and all necassary .jar files are loaded. Has nothing to do with the JSTL version as mentioned in other forum posts.

Best Regards, user2255297

UPDATE: The content of Taglibs.jsp

<%@ taglib prefix="stripes" uri="http://stripes.sourceforge.net/stripes.tld" %>
<%@ taglib prefix="stripesDynamic" uri="http://stripes.sourceforge.net/stripes-dynattr.tld" %>

<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %>

<%-- Short hand for the context root. --%>
<c:set var="ctx" value="${pageContext.request.contextPath}"/>
¿Fue útil?

Solución 2

Precompiling JSP files in combination with ANT and TagLibs was not possible. I've decided to move from ANT to MAVEN and was able to successfully precompile the files with the help of the maven-jetty-jspc-plugin It is also possible to run parts of the ANT script in maven.

Otros consejos

The most common cause for this error is conflicting jars between what the web container has and your web application's WEB-INF/lib has.

Having mismatched versions between Jetty and your project is the most common source of this error.

With Jetty 8.x, you are on Servlet API 3.0.

Be sure you are using the following versions in your WEB-INF/lib

  • JSTL 1.2
  • EL 2.2
  • JSP 2.2
  • Servlet API 3.0
Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top