0
votes

I am running a web application that uses Jersey 1.19.4 and JSTL 1.2.

Here is the maven dependency tree for the Embedded jetty project.


    [INFO] +- org.eclipse.jetty:jetty-webapp:jar:9.4.14.v20181114:compile
    [INFO] |  +- org.eclipse.jetty:jetty-xml:jar:9.4.14.v20181114:compile
    [INFO] |  \- org.eclipse.jetty:jetty-servlet:jar:9.4.14.v20181114:compile
    [INFO] |     \- org.eclipse.jetty:jetty-security:jar:9.4.14.v20181114:compile
    [INFO] |        \- org.eclipse.jetty:jetty-server:jar:9.4.14.v20181114:compile
    [INFO] +- org.eclipse.jetty:jetty-servlets:jar:9.4.14.v20181114:compile
    [INFO] |  +- org.eclipse.jetty:jetty-continuation:jar:9.4.14.v20181114:compile
    [INFO] |  +- org.eclipse.jetty:jetty-http:jar:9.4.14.v20181114:compile
    [INFO] |  +- org.eclipse.jetty:jetty-util:jar:9.4.14.v20181114:compile
    [INFO] |  \- org.eclipse.jetty:jetty-io:jar:9.4.14.v20181114:compile
    [INFO] +- org.eclipse.jetty:jetty-jsp:jar:9.2.26.v20180806:compile
    [INFO] |  +- org.eclipse.jetty.toolchain:jetty-schemas:jar:3.1.M0:compile
    [INFO] |  +- javax.servlet:javax.servlet-api:jar:3.1.0:compile
    [INFO] |  +- javax.servlet.jsp:javax.servlet.jsp-api:jar:2.3.1:compile
    [INFO] |  +- org.glassfish.web:javax.servlet.jsp:jar:2.3.2:compile
    [INFO] |  +- org.eclipse.jetty.orbit:javax.servlet.jsp.jstl:jar:1.2.0.v201105211821:compile
    [INFO] |  +- org.glassfish.web:javax.servlet.jsp.jstl:jar:1.2.2:compile
    [INFO] |  +- org.glassfish:javax.el:jar:3.0.0:compile
    [INFO] |  \- org.eclipse.jetty.orbit:org.eclipse.jdt.core:jar:3.8.2.v20130121:compile
    [INFO] +- org.eclipse.jetty.toolchain:jetty-jsp-jdt:jar:2.3.3:compile
    [INFO] +- org.slf4j:slf4j-api:jar:1.7.25:compile
    [INFO] +- org.slf4j:slf4j-log4j12:jar:1.7.25:compile
    [INFO] +- commons-io:commons-io:jar:2.4:compile
    [INFO] +- commons-logging:commons-logging:jar:1.1.3:compile
    [INFO] +- log4j:log4j:jar:1.2.17:compile
    [INFO] \- log4j:apache-log4j-extras:jar:1.2.17:compile

Error:



    com.sun.jersey.api.container.ContainerException:
          org.apache.jasper.JasperException: /test.jsp(2,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

3

3 Answers

0
votes
org.eclipse.jetty:jetty-jsp:jar:9.2.26.v20180806:compile

All versions of artifacts from org.eclipse.jetty.* should be the same version.

Upgrade the above one to 9.4.14.v20181114 too.

0
votes

Thanks a lot for the immediate reply.

I am using the GlassFish JSP Implementation and the most stable version that is available "org.eclipse.jetty:jetty-jsp:jar:9.2.26.v20180806:compile". https://mvnrepository.com/artifact/org.eclipse.jetty/jetty-jsp

I am running this embedded jetty program within Eclipse IDE 2018-09 using OpenJDK 11+28.


    java -version
    openjdk version "11" 2018-09-25
    OpenJDK Runtime Environment 18.9 (build 11+28)
    OpenJDK 64-Bit Server VM 18.9 (build 11+28, mixed mode)

The same issue while using Oracle JDK as well.


    java -version
    java version "11.0.2" 2018-10-16 LTS
    Java(TM) SE Runtime Environment 18.9 (build 11.0.2+7-LTS)
    Java HotSpot(TM) 64-Bit Server VM 18.9 (build 11.0.2+7-LTS, mixed mode)

The application successfully works when I use Oracle JDK 1.8

In order to work in JDK 11, I have to change TLD URI in JSP page to well know name and then copy the tld's under WEB-INF directory and refer explicitly in web.xml file.

JSP(no error),

<%@ taglib prefix="c" uri="jstl-core" %>
<%@ taglib prefix="fn" uri="jstl-functions" %>

web.xml

  <jsp-config>
    <taglib>
      <taglib-uri>jstl-core</taglib-uri>
      <taglib-location>/WEB-INF/c.tld</taglib-location>
    </taglib>
    <taglib>
      <taglib-uri>jstl-functions</taglib-uri>
      <taglib-location>/WEB-INF/fn.tld</taglib-location>
    </taglib>
  </jsp-config>

Earlier JSP (with error)

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

I am not sure I am doing the right thing here, if anyone has right solution please let me know.

0
votes

Thanks a Lot Joakim, after changing to apache-jsp it works great. I have reverted back to use the URI in JSP.

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

Here is my new dependency tree for the Jetty Embedded project,

+- org.eclipse.jetty:jetty-webapp:jar:9.4.12.v20180830:compile
|  +- org.eclipse.jetty:jetty-xml:jar:9.4.12.v20180830:compile
|  \- org.eclipse.jetty:jetty-servlet:jar:9.4.12.v20180830:compile
|     \- org.eclipse.jetty:jetty-security:jar:9.4.12.v20180830:compile
|        \- org.eclipse.jetty:jetty-server:jar:9.4.12.v20180830:compile
+- org.eclipse.jetty:jetty-servlets:jar:9.4.12.v20180830:compile
|  +- org.eclipse.jetty:jetty-continuation:jar:9.4.12.v20180830:compile
|  +- org.eclipse.jetty:jetty-http:jar:9.4.12.v20180830:compile
|  +- org.eclipse.jetty:jetty-util:jar:9.4.12.v20180830:compile
|  \- org.eclipse.jetty:jetty-io:jar:9.4.12.v20180830:compile
+- org.eclipse.jetty:jetty-annotations:jar:9.4.12.v20180830:compile
|  +- org.eclipse.jetty:jetty-plus:jar:9.4.12.v20180830:compile
|  |  \- org.eclipse.jetty:jetty-jndi:jar:9.4.12.v20180830:compile
|  +- javax.annotation:javax.annotation-api:jar:1.2:compile
|  +- org.ow2.asm:asm:jar:6.2:compile
|  \- org.ow2.asm:asm-commons:jar:6.2:compile
|     +- org.ow2.asm:asm-tree:jar:6.2:compile
|     \- org.ow2.asm:asm-analysis:jar:6.2:compile
+- org.eclipse.jetty:apache-jsp:jar:9.4.12.v20180830:compile
|  +- org.eclipse.jetty.toolchain:jetty-schemas:jar:3.1:compile
|  +- javax.servlet:javax.servlet-api:jar:3.1.0:compile
|  \- org.mortbay.jasper:apache-jsp:jar:8.5.24.2:compile
|     +- org.mortbay.jasper:apache-el:jar:8.5.24.2:compile
|     \- org.eclipse.jdt:ecj:jar:3.12.3:compile
+- jstl:jstl:jar:1.2:compile
+- org.slf4j:slf4j-api:jar:1.7.25:compile
+- org.slf4j:slf4j-log4j12:jar:1.7.25:compile

I have also added the following in the embedded jetty server code,

//org.eclipse.jetty.webapp.WebAppContext
context.setAttribute("org.eclipse.jetty.server.webapp.ContainerIncludeJarPattern", ".*/[^/]*jstl.*\\.jar$");

org.eclipse.jetty.webapp.Configuration.ClassList classlist = org.eclipse.jetty.webapp.Configuration.ClassList.setServerDefault(server);
classlist.addAfter("org.eclipse.jetty.webapp.FragmentConfiguration","org.eclipse.jetty.plus.webapp.EnvConfiguration", "org.eclipse.jetty.plus.webapp.PlusConfiguration");
classlist.addBefore("org.eclipse.jetty.webapp.JettyWebXmlConfiguration","org.eclipse.jetty.annotations.AnnotationConfiguration");

Please let me know if any changes required with the above approach.