Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [jetty-users] Problems precompiling with Jasper2 in Jetty8

Thanks Joakim, we use Maven to precompile jsp in our other products so we know all about that, but this product still uses Ant and has a really strange layout for historical reasons.  We'll have to see what we can do about that.


On Fri, Nov 9, 2012 at 11:19 AM, Joakim Erdfelt <joakim@xxxxxxxxxxx> wrote:
The use of taglibs under Servlet 3.0 requires that the taglib support implementation classes are obtained through a server classloader.
It started with the JSTL 1.2 standard, these taglibs cannot be in the webapp classpath, only the server classpath/classloader.
Jasper Compiler even enforces this requirement.
Jetty itself also enforces this requirement by filtering webapp included versions.
With ant you cannot satisfy this requirement.

That being said, you can have precompiled JSP's, but with maven instead.
Here's the same index.jsp, with a web.xml suited for servlet spec 3.0, and using the jetty 8.1.7 version of the jetty-jspc-maven-plugin.
JSP precompile will work via jetty-jspc-maven-plugin as our plugin creates the appropriate server classloader tree for the jasper JSPC to work with.

If you have no servlet-3.0 requirement, stick with the Jetty 7.x series, as that supports servlet 2.5.
If you have a servlet 3.0 requirement, then consider upgrading your build infrastructure to maven.
If you cannot upgrade to maven, and are stuck with ant, then you lose the ability to do JSP precompile if you also use taglibs (especially the standard JSTL and even the JSF taglibs).

Know that jetty 7.x and 8.x are released in parallel, from essentially the same codebase, with the only difference being the servlet spec support.

Jetty 7.x = Servlet 2.5
Jetty 8.x = Servlet 3.0

Note: Jetty 7.6.8 and Jetty 8.1.8 were released November 8th.

And for future reference ...
Jetty 9.x (currently in milestones) = Servlet 3.1 (spec still in early alpha)

Joakim Erdfelt <joakim@xxxxxxxxxxx>
Developer advice, services and support
from the Jetty & CometD experts

On Fri, Nov 9, 2012 at 9:02 AM, Craig Ching <craigching@xxxxxxxxx> wrote:
I'm curious if the way Jetty 8 resolves taglibs via the container might be causing us problems with this?

On Thu, Nov 8, 2012 at 11:01 AM, Craig Ching <craigching@xxxxxxxxx> wrote:
Hi Joakim,

I am a colleague of Wayne's helping him with his problem.  I've attached a simple ant build script and source to reproduce the problem we're having.  The build script is from your stackoverflow entry that Wayne linked to.  Note there is a circular dependency in that ant script as the "jspc" target depends on the "compile" target and compile is supposed to compile the servlet generated by the "jspc" target.  I'm no ant expert, but that doesn't seem to be related to the problem that Wayne is having.

Thanks and any help is much appreciated!


On Thu, Nov 8, 2012 at 10:24 AM, Johnson, Wayne <Wayne_Johnson@xxxxxxx> wrote:

Thanks for the reply.


I don't have anything in the WEB-INF/lib directory. 


I do have both javax.servlet.jsp.jstl-1.2.0.v201105211821.jar and org.apache.taglibs.standard.glassfish-1.2.0.v201112081803.jar on the classpath.  This is correct, right?



From: jetty-users-bounces@xxxxxxxxxxx [mailto:jetty-users-bounces@xxxxxxxxxxx] On Behalf Of Joakim Erdfelt
Sent: Thursday, November 08, 2012 10:06 AM
To: JETTY user mailing list
Subject: Re: [jetty-users] Problems precompiling with Jasper2 in Jetty8


Make sure you don't have any conflicting jars between what is in your WEB-INF/lib and what is in ${jetty.home}/lib/jsp


Keep in mind that Jetty itself, and even the maven plugin, isolates these differences for you with a webapp classloader.

But with ANT you have no such safety net, so you have to be extra careful to not have duplicate classes in both places.


A common scenario for that error is having 2 different (jstl) standard taglib jars.


Joakim Erdfelt <joakim@xxxxxxxxxxx>

Developer advice, services and support
from the Jetty & CometD experts

On Thu, Nov 8, 2012 at 8:40 AM, Johnson, Wayne <Wayne_Johnson@xxxxxxx> wrote:

I am migrating a webapp from Jetty6 (stop laughing, it's worked well for years) to Jetty8 and I'm getting the following error:

org.apache.jasper.JasperException: file:D:/dev/HEAD/eadev/clients/java/cfgmgr/jsp/displayAttribute.jsp(7,62) PWC6188: The absolute uri: cannot be resolved in either web.xml or the jar files deployed with this application

This compile use to work in Jetty 6 but now fails.  I see this in quite a few places in a Google search, but most appear in reference to this error when loading the webapp, not when precompiling it.

I tried changing the Ant task to follow joakime suggested task at but to no avail.

I am using 8.1.7.v20120910, but I get the same error with 7.6.7.v20120910.

The webapp is precompiled using an Ant task with the following target:
  <target name="jspc" depends="init, version_compile, mqservlets">

    <path id="jasper2.classpath">
      <fileset dir="${env.JETTY_HOME}">
            <include name="lib/servlet-api-*.jar" />
            <include name="lib/jsp/*.jar" />

    <pathconvert property="jasper2.classpath" refid="jasper2.classpath" />
    <echo message="jasper2.classpath=${jasper2.classpath}" />

    <mkdir dir="${webcfgmgr}/jsp/servlets"/>
    <taskdef classname="org.apache.jasper.JspC" name="jasper2" classpathref="jasper2.classpath"/>


The classpath output is:
     [echo] jasper2.classpath=D:\dev\jetty-distribution-8.1.7.v20120910\lib\jsp\com.sun.el-2.2.0.v201108011116.jar;D:\dev\jetty-distribution-8.1.7.v20120910\lib\jsp\javax.el-2.2.0.v201108011116.jar;D:\dev\jetty-distribution-8.1.7.v20120910\lib\jsp\javax.servlet.jsp-2.2.0.v201112011158.jar;D:\dev\jetty-distribution-8.1.7.v20120910\lib\jsp\javax.servlet.jsp.jstl-1.2.0.v201105211821.jar;D:\dev\jetty-distribution-8.1.7.v20120910\lib\jsp\org.apache.jasper.glassfish-2.2.2.v201112011158.jar;D:\dev\jetty-distribution-8.1.7.v20120910\lib\jsp\org.apache.taglibs.standard.glassfish-1.2.0.v201112081803.jar;D:\dev\jetty-distribution-8.1.7.v20120910\lib\jsp\org.eclipse.jdt.core-3.7.1.jar;D:\dev\jetty-distribution-8.1.7.v20120910\lib\servlet-api-3.0.jar

The source line this barfs on is:
<%@ taglib prefix="c" uri="" %>

Anyone have any suggestions?  Thanks for any help you can give me.
jetty-users mailing list


jetty-users mailing list

jetty-users mailing list

jetty-users mailing list

Back to the top