Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

JDK 9 compatibility issues #3

Closed
cemo opened this issue Oct 10, 2017 · 27 comments
Closed

JDK 9 compatibility issues #3

cemo opened this issue Oct 10, 2017 · 27 comments

Comments

@cemo
Copy link

cemo commented Oct 10, 2017

It seems apache jsp has some issues to support JDK9. Here is the relevant commit. I wanted to open an issue at here as well to track issue at here.

@joakime
Copy link
Member

joakime commented Oct 10, 2017

Might want to also pay attention to our trials and tribulations with bytecode scanning ...

jetty/jetty.project#1692 - 'module-info.class' exclusions
jetty/jetty.project#1797 - JEP 238 Multi-Release jars support

@joakime
Copy link
Member

joakime commented Oct 10, 2017

@cemo is there a bug on the apache side where they are tracking these changes?

@janbartel
Copy link
Member

Just recording some info here:

  • when running with the jetty distribution, both the server classpath and the webapp classpath are URLClassloaders. Moreover jetty does its own scanning for tlds and passes them to jasper, so we don't use the StandardJarScanner in this case.

  • when running with the jetty maven plugin, maven classworld's classloader seems to be a urlclassloader, plus we still do our own scanning for tlds and pass them to jasper as per in the distro.

  • the jetty-jspc-maven-plugin does use the StandardJarScanner class, however we do some setup to ensure we have URLClassloaders for it to work with.

@cemo
Copy link
Author

cemo commented Oct 11, 2017

@joakime the issue was about Spring Boot. The discussion was over there. Here is the relavant issue.

spring-projects/spring-boot#10456 (comment)

@cemo
Copy link
Author

cemo commented Oct 11, 2017

@janbartel I am using Spring Boot and it is actually an emdedded server. I am starting project in the IntelliJ.

@janbartel
Copy link
Member

For completeness, yes I can confirm that jetty will have a similar problem finding jars to look into for tlds, web-fragment.xml and META-INF/resources when it is running embedded with java 9. For that we will probably be making some fixes to org.eclipse.jetty.webapp.MetaInfConfiguration, stay tuned.

@cemo
Copy link
Author

cemo commented Oct 16, 2017

@janbartel Any news on this? :)

@janbartel
Copy link
Member

Nothing yet. I'll update this issue when there is something to report.

@janbartel
Copy link
Member

Issue jetty/jetty.project#1933 should fix any problems with embedded jetty running in java 9. This fix is scheduled for release in jetty-9.4.8. I'll close this issue.

@cemo
Copy link
Author

cemo commented Dec 19, 2017

@janbartel I gave another try today but seems still having issues. I am using Spring Boot and still having issues unfortunately.

org.apache.jasper.JasperException: 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
	at org.apache.jasper.compiler.DefaultErrorHandler.jspError(DefaultErrorHandler.java:55) ~[apache-jsp-8.5.23.jar:2.3]
	at org.apache.jasper.compiler.ErrorDispatcher.dispatch(ErrorDispatcher.java:293) ~[apache-jsp-8.5.23.jar:2.3]
	at org.apache.jasper.compiler.ErrorDispatcher.jspError(ErrorDispatcher.java:80) ~[apache-jsp-8.5.23.jar:2.3]
	at org.apache.jasper.compiler.TagLibraryInfoImpl.generateTldResourcePath(TagLibraryInfoImpl.java:251) ~[apache-jsp-8.5.23.jar:2.3]
	at org.apache.jasper.compiler.TagLibraryInfoImpl.<init>(TagLibraryInfoImpl.java:122) ~[apache-jsp-8.5.23.jar:2.3]
	at org.apache.jasper.compiler.Parser.parseTaglibDirective(Parser.java:434) ~[apache-jsp-8.5.23.jar:2.3]
	at org.apache.jasper.compiler.Parser.parseDirective(Parser.java:492) ~[apache-jsp-8.5.23.jar:2.3]
	at org.apache.jasper.compiler.Parser.parseElements(Parser.java:1448) ~[apache-jsp-8.5.23.jar:2.3]
	at org.apache.jasper.compiler.Parser.parse(Parser.java:145) ~[apache-jsp-8.5.23.jar:2.3]
	at org.apache.jasper.compiler.ParserController.doParse(ParserController.java:244) ~[apache-jsp-8.5.23.jar:2.3]
	at org.apache.jasper.compiler.ParserController.parse(ParserController.java:105) ~[apache-jsp-8.5.23.jar:2.3]
	at org.apache.jasper.compiler.Compiler.generateJava(Compiler.java:203) ~[apache-jsp-8.5.23.jar:2.3]
	at org.apache.jasper.compiler.Compiler.compile(Compiler.java:374) ~[apache-jsp-8.5.23.jar:2.3]
	at org.apache.jasper.compiler.Compiler.compile(Compiler.java:351) ~[apache-jsp-8.5.23.jar:2.3]
	at org.apache.jasper.compiler.Compiler.compile(Compiler.java:335) ~[apache-jsp-8.5.23.jar:2.3]
	at org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:601) ~[apache-jsp-8.5.23.jar:2.3]
	at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:368) ~[apache-jsp-8.5.23.jar:2.3]
	at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:385) ~[apache-jsp-8.5.23.jar:2.3]
	at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:329) ~[apache-jsp-8.5.23.jar:2.3]
	at javax.servlet.http.HttpServlet.service(HttpServlet.java:790) ~[javax.servlet-api-3.1.0.jar:3.1.0]
	at org.eclipse.jetty.servlet.ServletHolder.handle(ServletHolder.java:860) ~[jetty-servlet-9.4.8.v20171121.jar:9.4.8.v20171121]

@cemo
Copy link
Author

cemo commented Dec 19, 2017

@janbartel I built the project with latest tomcat (8.5.24), I can confirm that it is working with it. Can you please cut a release with latest tomcat?

@janbartel
Copy link
Member

@cemo, it should not require any changes to tomcat to make this work for jetty. Please can you enable debug logging for org.eclipse.jetty.annotations and post the log? It is jetty that should be finding and resolving the jstl jars , not tomcat.

@cemo
Copy link
Author

cemo commented Dec 19, 2017

@janbartel I have no log regarding that package. I am using Spring Boot 1.5.x branch.
Here is my dependency tree. Also relevant part in Spring Boot 1.5.x for registering JSP Servlet is at here.

@joakime
Copy link
Member

joakime commented Dec 19, 2017

@cemo you have org.eclipse.jetty.annotations package, its provided by jetty-annotations-.jar found at line 114 on your gist of the dependency tree.

You also have slf4j-api (line 110) which jetty will use to output logging events too.

It appears you've configured slf4j-api to capture java.util.logging (line 57), and capture log4j (line 58), and capture jakarta commons-logging (line 111).
The slf4j implementation you are using is logback (line 55).

You'll need to configure logback to have DEBUG level logging for the named logger org.eclipse.jetty.annotations for us to understand what is going on with your environment.

@cemo
Copy link
Author

cemo commented Dec 19, 2017

@joakime I am not sure that any codes in this package is called. I can put a breakpoint and check it if you refer a place which is definitely called.

@cemo
Copy link
Author

cemo commented Dec 19, 2017

I had checked your commits and noticed changes in org.eclipse.jetty.annotations.AnnotationConfiguration . However when I put a breakpoint, I can not see attached my debugger to this class.

@joakime
Copy link
Member

joakime commented Dec 19, 2017

If jetty bytecode scanning (which includes annotation scanning) isn't occurring, that could explain a few things.

@joakime
Copy link
Member

joakime commented Dec 19, 2017

@cemo can you put a breakpoint in org.eclipse.jetty.webapp.WebAppContext.loadConfigurations() and tell us what the _configurations field contains after that method has executed?

@cemo
Copy link
Author

cemo commented Dec 19, 2017

image

It is already filled up when the method is executed.

@cemo
Copy link
Author

cemo commented Dec 19, 2017

sorry @joakime and @janbartel

I need to clarify a thing.

If I upgrade this repo, it still not working. However If I add a piece of code like this:

  static class ExplodedConfiguration extends AbstractConfiguration {

    @Override
    public void preConfigure(WebAppContext context) throws Exception {
      context.setBaseResource(classpathEntries);
    }
  }

It is starting to work. Sorry for creating confusion. But in any case that package is never called.

@cemo
Copy link
Author

cemo commented Dec 19, 2017

Hi @joakime and @janbartel,

I felt little responsibility on this issue. I prepared a sample based on this topic. Here is the relevant project with a test case which is causing an exception under jdk9 but not jdk8.

Please note that on my original question I was using a different setup. I was using jar packaging and modifying base directory to use custom directories. But in this sample, everything is copied from Spring Boot Project. It is pretty much a vanilla project.

Please let me know for further tests and helps. Million thanks so far you have done for the community.

@cemo
Copy link
Author

cemo commented Dec 20, 2017

@joakime is there anything I can provide?

@joakime
Copy link
Member

joakime commented Dec 20, 2017

@cemo support is kinda spotty this time of year (holidays / vacations / etc).
Not sure what's left to troubleshoot, sounds like you got it fixed with that ExplodedConfiguration setup?

@cemo
Copy link
Author

cemo commented Dec 20, 2017

The configuration I provided was related to my setup which is not causing exception when I upgrade this project with the latest tomcat dependency but causing exception with current latest dependency of jetty.

I have provided a sample application which I can reproduce issue. It can causing exception under jdk9 but not under jdk8.

Here is the related project to reproduce exception: https://github.com/cemo/bug-jetty-jsp

@joakime
Copy link
Member

joakime commented Dec 20, 2017

A reproduction case is definitely useful. Thanks for that.

@janbartel
Copy link
Member

@cemo thanks for the repro test case.

The issue is that springboot is not using any of the standard jetty Configuration classes, including those like AnnotationConfiguration and MetaInfConfiguration which crack open jars to find tag libs, as well as other stuff in META-INF (like META-INF/resources, or META-INF/web-fragment.xml).

Because it is not using jetty's classes, which take account of jdk9 classpath issues, it falls back to using the standard apache jasper JasperInitializer, which obviously isn't capable of using the jdk9 classpath in version 8.5.23.

I'll start the process to upgrade jetty to use apache jasper 8.5.24, but in the meanwhile you'll have to try and use those upgraded jars explicitly in your pom.

I would much rather that the springboot guys had used jetty code to do the initialization - particularly as they are explicitly calling jetty's JettyJasperInitializer class, but unfortunately they haven't called any of the other jetty classes that would have fed it with the info it needs, hence it falls back to the apache jasper JasperInitializer instead.

@cemo
Copy link
Author

cemo commented Dec 27, 2017

@janbartel Thanks for the clarification. I will be testing when you release it. I had already tested with the latest snapshot and was working properly.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants