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
NPE resulting from bad JEP 238 MultiReleaseJarFile structure #1892
Comments
@phax, can you supply a reproduction test case? I can't understand why you would be scanning the java.lang.Object class itself as this is not in a jar that is normally subject to scanning. |
It happens as part of a bigger project. |
Yes please. Can you also tell me what the org.eclipse.jetty.server.webapp.ContainerIncludeJarPattern is set to? And maybe the org.eclipse.jetty.server.webapp.WebInfIncludeJarPattern for good measure. Unless the ContainerIncludeJarPattern is including every single jar on the container classpath all the way to the root loader, I can't see how you could wind up scanning java.lang.Object. Moreover, java.lang.Object doesn't have any interfaces, so again, I can't see how we're getting to that snippet of code you posted. |
I'm trying to narrow it down. I think it might have something to do with Eclipse resolving Maven SNAPSHOTs to open projects - so having a directory and not a JAR file as a dependency. But this is work in progress. Here are settings that may be of interest: final WebAppContext aWebAppCtx = new WebAppContext ();
...
aWebAppCtx.setParentLoaderPriority (true);
aWebAppCtx.setThrowUnavailableOnStartupException (true);
// http://www.eclipse.org/jetty/documentation/9.3.x/configuring-webapps.html#container-include-jar-pattern
// https://github.com/eclipse/jetty.project/issues/680
aWebAppCtx.setAttribute (WebInfConfiguration.CONTAINER_JAR_PATTERN, ".*\\.jar$|.*/classes/.*"); |
I am getting the same, but with a slightly different stacktrace: this is from my 'test' server that I run in my IDE. My uberjar which contains the same version of jetty (but is slightly different jetty startup code) seems to work.
|
One difference is the asm version. You have 5.0.1, I have 5.1 (the latest 5.x version is 5.2).... |
Well I give up: I can't reproduce it on linux running with your settings either in the distro, embedded or embedded running in eclipse. Must be something specific to windows. In any case, I've checked in a change to ClassInheritanceHandler. I'd appreciate it if you could build jetty locally and test the change. |
@janbartel here's a testcase that cause a NPE (before your latest commit) in @Test
public void testNpeInJavaRuntime() throws Exception
{
URI stringLocation = TypeUtil.getLocationOfClass(String.class);
assumeThat(stringLocation, notNullValue()); // skip on odd JVMs
AnnotationParser parser = new AnnotationParser();
Set<Handler> emptySet = Collections.emptySet();
parser.parse(emptySet, stringLocation);
// Should throw no exceptions
} |
@phax have you been able to test the change I committed? |
Is there a public Maven SNAPSHOT repository where I can retrieve 9.4.8-SNAPSHOT? It's obviously not on the oss.sonatype repo. Thx |
You can use
Please note snapshots are build & deployed once a day by this Jenkins job: https://jenkins.webtide.net/job/nightlies/job/jetty-9.4-snapshot/ |
I tried the latest SNAPSHOT but run again in problem with multi release JAR :(
I was trying with Log4J 2.9.1 (as in the original multi jar issue #1797 ) - you may wanna create a separate issue from this... The problem is that |
@phax Does that sound plausible for your test? Regardless, I will fix this issue by ignoring such classes. They may have worked in the past with their outer classes being in different jars, but no longer in a MR jar world! |
Works with todays SNAPSHOT, so the issue can be closed |
Hi, I get a similar exception on 9.3.22.v20171030, after upgrading from 9.3.17.v20170317. |
@nadavwe and please post your exact exception, as "similar" is not good enough to debug with! |
hey @gregw, @janbartel sorry for this, it was a little silly.
|
Thanks for the reply. =) |
@nadavwe That is clearly a yes |
Same problem on JDK 1.8.0_131 and jetty-9.2.23.v20171218 and log4j2 2.10.0
|
Jetty 9.2 has no support for JEP 238 and Java 9, sorry. |
Thanks. Similar issue here: https://stackoverflow.com/questions/49492583/sprint-boot-web-application-running-on-google-app-engine-throws-jetty-exceptio . So then how can we run a Spring Boot application (.war) with Gradle build on App Engine Standard. |
@vinayapp search your |
@vinayapp or alternatively, look at your exceptions, they'll tell you which artifacts are incompatible for your Spring Boot and GAE combination. Example from @jeremyhill-up
|
Sure. Will check on this. |
In my current setup (Jetty 9.4.7 and JDK 1.8.0_144 64 Bit on Win 64) I get an error starting up Jetty, with annotation scanning enabled:
The reason is in the following method in class
ClassInheritanceHandler
:because
classInfo.getSuperName()
for the class info of classjava.lang.Object
returnsnull
. See the comment above.Update: the same error occurrs with Jetty 9.4.6 - so it might be a problem with the JDK 1.8.0_144 version...
Update 2: in v9.4.6 the application starts up anyway, in v9.4.7 the Jetty bootstrapping fails
The text was updated successfully, but these errors were encountered: