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

Not a file URL - Ikasan module Java 11 bytecode running under Java 17 #1114

Open
robinroos opened this issue Jun 10, 2022 · 2 comments
Open

Comments

@robinroos
Copy link
Collaborator

We thought we'd see what happens when an Ikasan module is launched under Java 17. This activity retained Java 11 bytecode, and merely switched the runtime Java version.

After configuring a module to run under Java 17 we observe the following:

IkasanEIP (v3.2.3)

...

2022-06-09 10:50:47,529 INFO org.springframework.boot.StartupInfoLogger [main] Starting Application using Java 17.0.3 on adl-esbap04 with PID 3899969 (/opt/app/dev/standalone/mymodulename-1.0.2-SNAPSHOT/lib/mymodulename-1.0.2-SNAPSHOT.jar started by cmi2d in /opt/app/dev/standalone/mymodulename-1.0.2-SNAPSHOT)

...

2022-06-09 10:50:52,489 INFO org.springframework.boot.web.embedded.tomcat.TomcatWebServer [main] Tomcat initialized with port(s): 32450 (http)
2022-06-09 10:50:52,504 INFO org.apache.juli.logging.DirectJDKLog [main] Initializing ProtocolHandler ["http-nio-10.160.43.40-32450"]
2022-06-09 10:50:52,505 INFO org.apache.juli.logging.DirectJDKLog [main] Starting service [Tomcat]
2022-06-09 10:50:52,505 INFO org.apache.juli.logging.DirectJDKLog [main] Starting Servlet engine: [Apache Tomcat/9.0.46]
2022-06-09 10:50:53,005 WARN org.apache.juli.logging.DirectJDKLog [main] Failed to scan [jar:file:/opt/app/dev/standalone/mymodulename-1.0.2-SNAPSHOT/lib/mymodulename-1.0.2-SNAPSHOT.jar!/BOOT-INF/lib/spring-webmvc-5.3.18.jar!/] from classloader hierarchy
java.io.IOException: Unable to open root Jar file 'war:file:/opt/app/dev/standalone/mymodulename-1.0.2-SNAPSHOT/lib/mymodulename-1.0.2-SNAPSHOT.jar*/BOOT-INF/lib/spring-webmvc-5.3.18.jar'
	at org.springframework.boot.loader.jar.Handler.getRootJarFile(Handler.java:318)
	at org.springframework.boot.loader.jar.Handler.getRootJarFileFromUrl(Handler.java:300)
	at org.springframework.boot.loader.jar.Handler.openConnection(Handler.java:86)
	at java.base/java.net.URL.openConnection(URL.java:1094)
	at java.base/java.net.URL.openStream(URL.java:1161)
	at org.apache.tomcat.util.descriptor.tld.TldResourcePath.openStream(TldResourcePath.java:127)
	at org.apache.tomcat.util.descriptor.tld.TldParser.parse(TldParser.java:61)
	at org.apache.jasper.servlet.TldScanner.parseTld(TldScanner.java:275)
	at org.apache.jasper.servlet.TldScanner$TldScannerCallback.scan(TldScanner.java:315)
	at org.apache.tomcat.util.scan.StandardJarScanner.process(StandardJarScanner.java:387)
	at org.apache.tomcat.util.scan.StandardJarScanner.processURLs(StandardJarScanner.java:318)
	at org.apache.tomcat.util.scan.StandardJarScanner.doScanClassPath(StandardJarScanner.java:270)
	at org.apache.tomcat.util.scan.StandardJarScanner.scan(StandardJarScanner.java:233)
	at org.apache.jasper.servlet.TldScanner.scanJars(TldScanner.java:262)
	at org.apache.jasper.servlet.TldScanner.scan(TldScanner.java:104)
	at org.apache.jasper.servlet.JasperInitializer.onStartup(JasperInitializer.java:83)
	at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5161)
	at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183)
	at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1384)
	at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1374)
	at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
	at org.apache.tomcat.util.threads.InlineExecutorService.execute(InlineExecutorService.java:75)
	at java.base/java.util.concurrent.AbstractExecutorService.submit(AbstractExecutorService.java:145)
	at org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:909)
	at org.apache.catalina.core.StandardHost.startInternal(StandardHost.java:829)
	at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183)
	at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1384)
	at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1374)
	at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
	at org.apache.tomcat.util.threads.InlineExecutorService.execute(InlineExecutorService.java:75)
	at java.base/java.util.concurrent.AbstractExecutorService.submit(AbstractExecutorService.java:145)
	at org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:909)
	at org.apache.catalina.core.StandardEngine.startInternal(StandardEngine.java:262)
	at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183)
	at org.apache.catalina.core.StandardService.startInternal(StandardService.java:433)
	at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183)
	at org.apache.catalina.core.StandardServer.startInternal(StandardServer.java:930)
	at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183)
	at org.apache.catalina.startup.Tomcat.start(Tomcat.java:486)
	at org.springframework.boot.web.embedded.tomcat.TomcatWebServer.initialize(TomcatWebServer.java:123)
	at org.springframework.boot.web.embedded.tomcat.TomcatWebServer.<init>(TomcatWebServer.java:104)
	at org.springframework.boot.web.embedded.tomcat.TomcatServletWebServerFactory.getTomcatWebServer(TomcatServletWebServerFactory.java:455)
	at org.springframework.boot.web.embedded.tomcat.TomcatServletWebServerFactory.getWebServer(TomcatServletWebServerFactory.java:204)
	at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.createWebServer(ServletWebServerApplicationContext.java:182)
	at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.onRefresh(ServletWebServerApplicationContext.java:160)
	at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:577)
	at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.refresh(ServletWebServerApplicationContext.java:145)
	at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:775)
	at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:448)
	at org.springframework.boot.SpringApplication.run(SpringApplication.java:339)
	at org.springframework.boot.SpringApplication.run(SpringApplication.java:1365)
	at org.springframework.boot.SpringApplication.run(SpringApplication.java:1354)
	at com.mymodulepackage.Application.main(Application.java:11)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77)
	at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.base/java.lang.reflect.Method.invoke(Method.java:568)
	at org.springframework.boot.loader.MainMethodRunner.run(MainMethodRunner.java:49)
	at org.springframework.boot.loader.Launcher.launch(Launcher.java:107)
	at org.springframework.boot.loader.Launcher.launch(Launcher.java:58)
	at org.springframework.boot.loader.JarLauncher.main(JarLauncher.java:88)
Caused by: java.lang.IllegalStateException: Not a file URL
	at org.springframework.boot.loader.jar.Handler.getRootJarFile(Handler.java:306)
	... 60 common frames omitted

Difficulties with parsing "Tomcat-style" URLs have been variously mentioned and resolved in recent Spring releases.

My suggestion is to upgrade Ikasan's dependency Spring Boot 2.5.12 -> 2.5.14 which itself curates a more recent version of Tomcat 9 (9.0.63).

If the problem recurs on the most up-to-date 2.5.* Spring Boot then it should be raised as an issue at their github site.

@robinroos
Copy link
Collaborator Author

To launch under Java 17 we are using:

jvm.module.opts=--illegal-access=warn --add-opens java.base/java.lang=ALL-UNNAMED --add-opens java.base/java.util=ALL-UNNAMED --add-opens java.base/java.io=ALL-UNNAMED --add-opens java.base/java.time=ALL-UNNAMED

@G1ngwy
Copy link

G1ngwy commented Sep 22, 2023

Hello, our project is Springboot 2.7.10. Upgrading from JDK1.8 to JDK1.8 encountered the same error. Could you please advise on how you handled it.
Error message:WARN c.b.e.w.u.scan.StandardJarScanner - Failed to scan [jar:file:/tp***1.0-SNAPSHOT.jar!/BOOT-INF/lib/struts2-core-2.5.30.jar!/] from classloader hierarchy
java.io.IOException: Unable to open root Jar file 'war:file:/tp
1.0-SNAPSHOT.jar
/BOOT-INF/lib/struts2-core-2.5.30.jar'

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

2 participants