0

I opened a previous ticket (Deploying existing WAR to embedded Jetty) that I had problem to deploy a WAR (containing JSP pages) to Jetty. It seems that the solution that I accepted didn't work (I was stuck I was happy at that time that I got a different exception).

So I got the following exception:

An error occurred at line: [52] in the generated java file: [/tmp/embedded-jetty-jsp/jsp/org/apache/jsp/WEB_002dINF/jsp/MainLayout_jsp.java]
Syntax error on token "<", ? expected after this token

I was recommended to remove the jstl and standard JARs from the WAR. I did that and I added them to the classpath (but outside the WAR).
Now I get the following

javax.servlet.ServletException: org.apache.jasper.JasperException: /WEB-INF/jsp/MainLayout.jsp (line: 11, column: 0) 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

Usually it means that an older JSTL is used (where the http://java.sun.com/jstl/core URI is applied). I only use the jstl-1.2.jar so in my case it means that the jstl JAR cannot be found.

So I use a single class to start Jetty and added the JARs (like JSTL and standard JARs) to the MANIFEST file of the JAR that contains this single class.

All the other information can be found in the previous ticket.
I tried several things so I am stuck at the moment.

Any idea what can go wrong?
Thanks,
V.

Viktor
  • 1,325
  • 2
  • 19
  • 41
  • "Added to the classpath, but outside the WAR" means what exactly? – Joakim Erdfelt Feb 20 '18 at 01:01
  • Hi, it means that I wrote a simple class that start Jetty. This class is bundled to a JAR file (name it like `acme-jetty-starter.jar`) and the Class-Path entry of the MANIFEST file contains the jstl and standard JAR files. These JAR files are in the same folder where the `acme-jetty-starter.jar` file resides. – Viktor Feb 20 '18 at 07:19

1 Answers1

1

Be careful where you put your jstl.jar files, and how you declare the WebAppContext's own ClassLoader. It matters.

The TldScanner expects a bunch of things, and if any of them are not true, the taglibs are not found (including the jstl standard taglib)

See:

Joakim Erdfelt
  • 46,896
  • 7
  • 86
  • 136
  • Funny, if I set the classloader (`ClassLoader jspClassLoader = new URLClassLoader(new URL[0], this.getClass().getClassLoader()); webAppContext.setClassLoader(jspClassLoader);` - I got this from the official sample embedded-jetty sample) then the JARs from WAR (in WEB-INF/lib) are not loaded (I got ClassNotFoundExceptions), if I don't set the classloader then I get the well-known URI exception (see above). It seems like a catch 22 problem, I will give it up. Might try a different container. – Viktor Feb 21 '18 at 08:50