Re: Embedded Tomcat 9.0.x Classpath Modification Migrating From Java 8 to 17

2022-12-23 Thread Mark Thomas
On 23/12/2022 03:28, Tim N wrote: Do you think this thread is useful info for any Tomcat-embedded Java 17 migration guide/how-to? I'm happy to tidy it up and contribute if there's an official Tomcat-embedded place for it. It is on the mailing list so it shoudl alreayd be findable. The wiki is

Re: Embedded Tomcat 9.0.x Classpath Modification Migrating From Java 8 to 17

2022-12-22 Thread Tim N
> This should be unnecessary. The classes in that package should be > included in tomcat-embed-core Nice - thanks. I was reading and using the catalina code, but after trimming down my code it no longer needs that dependency. Do you think this thread is useful info for any Tomcat-embedded Java 17

Re: Embedded Tomcat 9.0.x Classpath Modification Migrating From Java 8 to 17

2022-12-22 Thread Mark Thomas
On 21/12/2022 22:37, Tim N wrote: This was fixed by adding "--add-opens=java.base/java.lang=ALL-UNNAMED". Now all applications are running, and various other issues have been fixed by other "--add-opens" arguments. So these and the last couple of issues are related to Java 17 and not the classloa

Re: Embedded Tomcat 9.0.x Classpath Modification Migrating From Java 8 to 17

2022-12-21 Thread Tim N
This was fixed by adding "--add-opens=java.base/java.lang=ALL-UNNAMED". Now all applications are running, and various other issues have been fixed by other "--add-opens" arguments. So these and the last couple of issues are related to Java 17 and not the classloader code above. Can a Tomcat expert

Re: Embedded Tomcat 9.0.x Classpath Modification Migrating From Java 8 to 17

2022-12-20 Thread Tim N
After sorting out the new dependencies (I think) 2 of the 3 web-apps are now running! One fails at startup with Caused by: java.lang.LinkageError: loader java.net.URLClassLoader @2328c243 attempted duplicate class definition for mypackage.MyUserDetailsService$$EnhancerBySpringCGLIB$$f761e392. (myp

Re: Embedded Tomcat 9.0.x Classpath Modification Migrating From Java 8 to 17

2022-12-20 Thread Tim N
Looks like this is due to a conflict with EE JARs added to replace those removed when moving from Java 8 to 17. On Wed, Dec 21, 2022 at 3:33 PM Tim N wrote: > Sorry - more of the stack-trace: > Caused by: java.lang.IllegalAccessError: failed to access class > com.sun.activation.registries.LogSup

Re: Embedded Tomcat 9.0.x Classpath Modification Migrating From Java 8 to 17

2022-12-20 Thread Tim N
Sorry - more of the stack-trace: Caused by: java.lang.IllegalAccessError: failed to access class com.sun.activation.registries.LogSupport from class javax.activation.MimetypesFileTypeMap (com.sun.activation.registries.LogSupport and javax.activation.MimetypesFileTypeMap are in unnamed module of loa

Re: Embedded Tomcat 9.0.x Classpath Modification Migrating From Java 8 to 17

2022-12-20 Thread Tim N
I tried this: List repositories = new ArrayList<>(); repositories.add(new ClassLoaderFactory.Repository(new File("/dir1").getAbsolutePath(), ClassLoaderFactory.RepositoryType.DIR)); repositories.add(new ClassLoaderFactory.Repository(new File("sub-mod1/target/classes").getAbsolutePath(), ClassLoade

Re: Embedded Tomcat 9.0.x Classpath Modification Migrating From Java 8 to 17

2022-12-20 Thread Tim N
> The custom class loader approach described in one of the answers is a > viable option. Thanks. > No. The same class loader hierarchy isn't constructed when running in > embedded mode. It looks like I would need to replicate all the classloading capabilities of Tomcat (e.g. loading classes from

Re: Embedded Tomcat 9.0.x Classpath Modification Migrating From Java 8 to 17

2022-12-14 Thread Mark Thomas
On 14/12/2022 03:20, Tim N wrote: I'm currently using embedded Tomcat 9.0.68 and have encountered the infamous compatibility issue with ClassLoader.getSystemClassLoader when upgrading from Java 8 to Java 17. See https://stackoverflow.com/questions/46694600/java-9-compatability-issue-with-classloa