Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [jetty-users] Embedded Jetty 9 + JSTL = 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

Hello everyone,
As many others, I'm also facing the PWC6188-Error saying 
> "http://java.sun.com/jsp/jstl/core cannot be resolved in either web.xml or
> the jar files deployed with this application".
This is a quite common problem, however, I didn't make it to find a suitable
solution. 

First off, some background. We just migrated to Maven. Switching from a fat
Tomcat web-server to an embedded Jetty 9 web-server. 

Following, I already read this very usefull documentation:
http://stackoverflow.com/tags/jstl/info
Regarding this doc, following might be useful...

**JSP - Taglib reference:**
> .<.%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%.>.

**web.xml header**

    <web-app 
        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"; 
        xmlns="http://java.sun.com/xml/ns/javaee";
        xsi:schemaLocation="http://java.sun.com/xml/ns/javaee 
        http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd";
        id="YourWebAppID"
        version="2.5">

In conclusion, I need at least JSTL 1.1 and a servletcontainer with support
for 2.5 Servlet specification. 
*Thus, Jetty 9 with JSTL 1.2 might fit. <-- Really?*


Furthermore, I want to talk about building and deploying of the webapp. 
Regarding this post:
> http://stackoverflow.com/questions/2151075/cannot-load-jstl-taglib-within-embedded-jetty-server

I might have some dependency issues. Here you can see all the dependencies
defined in pom.xml of the web-application:

    <dependencies>
        <dependency>
            <groupId>junit</groupId>
            <artifactId>junit</artifactId>
            <version>3.8.1</version>
            <scope>test</scope>
        </dependency>
        
        <dependency>
            <groupId>log4j</groupId>
            <artifactId>log4j</artifactId>
            <version>${log4j.version}</version>
            <scope>provided</scope>
        </dependency>
        
        <dependency>
            <groupId>org.apache.struts</groupId>
            <artifactId>struts-core</artifactId>
            <version>${struts.version}</version>
        </dependency>
        <dependency>
            <groupId>org.apache.struts</groupId>
            <artifactId>struts-taglib</artifactId>
            <version>${struts.version}</version>
        </dependency>
        <dependency>
            <groupId>commons-fileupload</groupId>
            <artifactId>commons-fileupload</artifactId>
            <version>1.3.1</version>
        </dependency>
        
        

        
        
        <dependency>
            <groupId>org.eclipse.jetty</groupId>
            <artifactId>jetty-webapp</artifactId>
            <version>${jetty.version}</version>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>javax.servlet</groupId>
            <artifactId>jsp-api</artifactId>
            <version>2.0</version>
            <scope>provided</scope>
        </dependency>
    </dependencies>

Running 'mvn jetty:run' works just fine. It also packages the war-file,
containing the following libs:

    ls target/ROOT/WEB-INF/lib
        antlr-2.7.2.jar
        commons-beanutils-1.8.0.jar
        commons-chain-1.2.jar
        commons-digester-1.8.jar
        commons-fileupload-1.3.1.jar
        commons-io-2.2.jar
        commons-logging-1.0.4.jar
        commons-validator-1.3.1.jar
        oro-2.0.8.jar
For me, this looks just fine. All web-app related libs are packed inside
war. 
So, this war might not work properly in Tomcat web-server, thus the JSTL tag
lib is not provided by the web-app. However, I'm going to use embedded Jetty
9... and here are all the dependencies defined in pom.xml from my
server-container:

    <dependencies>
        <dependency>
            <groupId>junit</groupId>
            <artifactId>junit</artifactId>
            <version>3.8.1</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>log4j</groupId>
            <artifactId>log4j</artifactId>
            <version>${lib.log4j.version}</version>
        </dependency>
        
        

        
        <dependency>
            <groupId>javax.mail</groupId>
            <artifactId>mail</artifactId>
            <version>1.4.7</version>
        </dependency>
        <dependency>
            <groupId>org.apache.derby</groupId>
            <artifactId>derby</artifactId>
            <version>10.10.2.0</version>
        </dependency>
        <dependency>
            <groupId>org.apache.commons</groupId>
            <artifactId>commons-email</artifactId>
            <version>1.3.3</version>
        </dependency>

        
        <dependency>
            <groupId>org.eclipse.jetty</groupId>
            <artifactId>jetty-webapp</artifactId>
            <version>${jetty.version}</version>
        </dependency>
        <dependency>
            <groupId>org.eclipse.jetty</groupId>
            <artifactId>jetty-jsp</artifactId>
            <version>${jetty.version}</version>
        </dependency>
    </dependencies>

Because of licensing of some included libraries, I need to provide all jars
as they are. Meaning, I might not extract and include classes to my
resulting jar. Thus, my maven assembly creates a following structure:

    *prefix*
        /bin
        myexecute.sh (calls java -jar ${prefix}/lib/java/main_app.jar)
        /lib/java
        *.jar (all the jar files)


*prefix*/lib/java lists following libraries:

    ls
        activation-1.1.jar
        commons-email-1.3.3.jar
        derby-10.10.2.0.jar
        main_app.jar
        javax.el-3.0.0.jar
        javax.servlet-api-3.1.0.jar
        javax.servlet.jsp-2.3.2.jar
        javax.servlet.jsp-api-2.3.1.jar
        javax.servlet.jsp.jstl-1.2.0.v201105211821.jar
        javax.servlet.jsp.jstl-1.2.2.jar
        jetty-http-9.2.2.v20140723.jar
        jetty-io-9.2.2.v20140723.jar
        jetty-jsp-9.2.2.v20140723.jar
        jetty-schemas-3.1.M0.jar
        jetty-security-9.2.2.v20140723.jar
        jetty-server-9.2.2.v20140723.jar
        jetty-servlet-9.2.2.v20140723.jar
        jetty-util-9.2.2.v20140723.jar
        jetty-webapp-9.2.2.v20140723.jar
        jetty-xml-9.2.2.v20140723.jar
        log4j-1.2.17.jar
        mail-1.4.7.jar
        org.eclipse.jdt.core-3.8.2.v20130121.jar

The classpath inside the main_app.jar looks just fine. All necessary java
libraries are listed and the application works properly. However, I can't
access the web-app, because of the PWC6188.
Please notice, **There is no PWC6188-error, when running the application
using eclipse or maven**. I set up the project using 'mvn eclipse:eclipse'
btw. 
Following, regarding this thread 

> http://stackoverflow.com/questions/19448594/jetty-9-the-absolute-uri-http-java-sun-com-jsp-jstl-core-cannot-be-resolved

just jetty-webapp and jetty-jsp artifacts are required, to set up Jetty
containerserver with JSP, JSTL, Servlet etc. support.


What else have I done? I read some useful info about Jetty class loading. 
> http://www.eclipse.org/jetty/documentation/current/jetty-classloading.html
It states, that libraries defined in WEB-INF folder has a higher priority
than libs from it's container server. However, even if I switch priority,
I'm facing PWC6188. As mentioned here

> http://stackoverflow.com/questions/2151075/cannot-load-jstl-taglib-within-embedded-jetty-server

it might be a solution to set a classloader - I tried, without success. 

Because of the fact, that the webapp runs properly using eclipse IDE, I took
a deeper look on what it actually does. I figured that:
When I use eclipse to create a runnable jar ...
1) ... and choose to extract all dependencies in target jar (resulting to
have just one jar), the webapp works well.
--> However, this conflicts with some licenses of dependencies. I might not
extract and include object-code in resulting jar.
2) ... and choose to place dependencies as jar next to my resulting jar
(leaving all depedencies as they are), I'm facing PWC6188-Error.



In conclusion, as you might notice, I tried a lot and got quite deep into
all this JSTL lib. However, I can't manage to get rid of PWC6188 error. I
bet it's something trivial, however, it might also be a major problem of
Jetty 9. 
Thus, I like to say thanks for any help! 



--
View this message in context: http://jetty.4.x6.nabble.com/jetty-users-Embedded-Jetty-9-JSTL-The-absolute-uri-http-java-sun-com-jsp-jstl-core-cannot-be-resolven-tp4961067p4962870.html
Sent from the Jetty User mailing list archive at Nabble.com.


Back to the top