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

GUI Serverbackend can not be compiled with Java 9 SDK #181

Open
MichaelRoeder opened this issue Dec 21, 2017 · 1 comment
Open

GUI Serverbackend can not be compiled with Java 9 SDK #181

MichaelRoeder opened this issue Dec 21, 2017 · 1 comment

Comments

@MichaelRoeder
Copy link
Contributor

Description

At the moment, it does not seem to be possible to use the Java 9 SDK to build the GUI Serverbackend project (although the pom.xml states that Java 1.8 compatibility should be used).

(Experience relies on Oracle Java 9 SDK)

1. Java 9 and missing JAXB

If compiled with Java 9, the project misses JAXB classes which where part of the SDK before Java 9 but are typically part of deactivated modules within Java 9. The activation of these modules is more a workaround (and would have to be part of compiling and executing the program). The easiest solution is to add the JAXB API as dependency.

        <!-- JAXB dependency - necessary to work with Java 9  -->
        <dependency>
            <groupId>javax.xml.bind</groupId>
            <artifactId>jaxb-api</artifactId>
            <version>2.3.0</version>
        </dependency>

2. Java 9 and Jetty

The JAXB API has been created with Java 9 and contains meta information that can not be understood by Jetty and leads to the following exception (similar to this one reported on Stack Overflow):

gui_1                  | java.lang.RuntimeException: Error scanning entry META-INF/versions/9/javax/xml/bind/ModuleUtil.class from jar file:///tmp/jetty/jetty-0.0.0.0-8080-ROOT.war-_-any-7311724399972089970.dir/webapp/WEB-INF/lib/jaxb-api-2.3.0.jar
gui_1                  | 	at org.eclipse.jetty.annotations.AnnotationParser.parseJar(AnnotationParser.java:906)
gui_1                  | 	at org.eclipse.jetty.annotations.AnnotationParser.parse(AnnotationParser.java:851)
gui_1                  | 	at org.eclipse.jetty.annotations.AnnotationConfiguration$ParserTask.call(AnnotationConfiguration.java:163)
gui_1                  | 	at org.eclipse.jetty.annotations.AnnotationConfiguration$1.run(AnnotationConfiguration.java:546)
gui_1                  | 	at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:671)
gui_1                  | 	at org.eclipse.jetty.util.thread.QueuedThreadPool$2.run(QueuedThreadPool.java:589)
gui_1                  | 	at java.lang.Thread.run(Thread.java:748)
gui_1                  | Caused by: 
gui_1                  | java.lang.IllegalArgumentException
gui_1                  | 	at org.objectweb.asm.ClassReader.<init>(Unknown Source)
gui_1                  | 	at org.objectweb.asm.ClassReader.<init>(Unknown Source)
gui_1                  | 	at org.objectweb.asm.ClassReader.<init>(Unknown Source)
gui_1                  | 	at org.eclipse.jetty.annotations.AnnotationParser.scanClass(AnnotationParser.java:977)
gui_1                  | 	at org.eclipse.jetty.annotations.AnnotationParser.parseJarEntry(AnnotationParser.java:958)
gui_1                  | 	at org.eclipse.jetty.annotations.AnnotationParser.parseJar(AnnotationParser.java:902)
gui_1                  | 	at org.eclipse.jetty.annotations.AnnotationParser.parse(AnnotationParser.java:851)
gui_1                  | 	at org.eclipse.jetty.annotations.AnnotationConfiguration$ParserTask.call(AnnotationConfiguration.java:163)
gui_1                  | 	at org.eclipse.jetty.annotations.AnnotationConfiguration$1.run(AnnotationConfiguration.java:546)
gui_1                  | 	at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:671)
gui_1                  | 	at org.eclipse.jetty.util.thread.QueuedThreadPool$2.run(QueuedThreadPool.java:589)
gui_1                  | 	at java.lang.Thread.run(Thread.java:748)

This is a known problem of Jetta 9.3 and is solved in Jetty 9.4.

Jetty 9.4.x and Keycloak

We introduced the possibility to set a flag whether the two Keycloak URLs (the URL used by the users browser and the URL used by the server backend) can be different. This has been done by adapting the Jetty plugin. However, this plugin has been developed for Jetty 9.3 and is not compatible with Jetty 9.4.

Solution

If it will become necessary to build the GUI serverbackend with Java 9+, we will have to migrate to a newer Jetty version including a newer version of the plugin. This might lead to a new adaptation of this plugin to be able to set the flag from outside.

This issue is for documenting this problem. At the moment, it is not necessary to solve it.

MichaelRoeder added a commit that referenced this issue Dec 21, 2017
…ith Java 9 and Jetty 9.3. Documented that the project has to be compiled with java 8 in #181.
@denkv
Copy link
Collaborator

denkv commented Dec 18, 2023

Looks like it is able to build now with Java 11 (it still runs in a container with Java 8):

# Build Java backend
FROM maven:3-eclipse-temurin-11 AS build

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

No branches or pull requests

2 participants