Fixed issues with multi-release jar (#706, #708)
Change-Id: I97d70dde790a3838962f0ffe270b9b1d8595a489
diff --git a/full/Changes b/full/Changes
index 8709b67..64cd2c9 100644
--- a/full/Changes
+++ b/full/Changes
@@ -23,6 +23,8 @@
- Updated token response using Nimbus (#650)
- Remove Oltu request and validator implementations (#650)
- Updated OAuth2 response handler (#650)
+- Fixed ShutdownHandler (fixed #708)
+- Fixed issues with multi-release jar (#706, #708)
# version 0.71.1
diff --git a/full/pom.xml b/full/pom.xml
index 66d6448..8697ab8 100644
--- a/full/pom.xml
+++ b/full/pom.xml
@@ -12,6 +12,9 @@
<hibernate.ehcache.version>6.0.0.Alpha7</hibernate.ehcache.version>
<hibernate.version>6.1.7.Final</hibernate.version>
<spring.version>6.0.13</spring.version>
+ <!-- spring6.version is used in jersey and defined here
+ to make sure that jersey uses the correct spring version-->
+ <spring6.version>${spring.version}</spring6.version>
<jetty.version>11.0.18</jetty.version>
<flyway.version>10.0.1</flyway.version>
<log4j.version>2.21.1</log4j.version>
@@ -40,21 +43,29 @@
<configuration>
<finalName>Kustvakt-full-${project.version}</finalName>
<transformers>
- <transformer
- implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer">
+ <transformer implementation="org.apache.maven.plugins.shade.resource.ServicesResourceTransformer"/>
+ <transformer implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer">
<mainClass>
de.ids_mannheim.korap.server.KustvaktServer
</mainClass>
+ <manifestEntries>
+ <Multi-Release>true</Multi-Release>
+ </manifestEntries>
</transformer>
- <transformer
- implementation="org.apache.maven.plugins.shade.resource.AppendingTransformer">
- <resource>META-INF/spring.handlers
- </resource>
+ <transformer implementation="org.apache.maven.plugins.shade.resource.AppendingTransformer">
+ <resource>META-INF/spring.handlers</resource>
</transformer>
- <transformer
- implementation="org.apache.maven.plugins.shade.resource.AppendingTransformer">
- <resource>META-INF/spring.schemas
- </resource>
+ <transformer implementation="org.apache.maven.plugins.shade.resource.AppendingTransformer">
+ <resource>META-INF/spring.schemas</resource>
+ </transformer>
+ <transformer implementation="org.apache.maven.plugins.shade.resource.AppendingTransformer">
+ <resource>META-INF/spring/aot.factories</resource>
+ </transformer>
+ <transformer implementation="org.apache.maven.plugins.shade.resource.AppendingTransformer">
+ <resource>META-INF/hk2-locator/default</resource>
+ </transformer>
+ <transformer implementation="org.apache.maven.plugins.shade.resource.AppendingTransformer">
+ <resource>META-INF/spring.tooling</resource>
</transformer>
</transformers>
<filters>
@@ -99,6 +110,9 @@
<mainClass>
de.ids_mannheim.korap.server.KustvaktLiteServer
</mainClass>
+ <manifestEntries>
+ <Multi-Release>true</Multi-Release>
+ </manifestEntries>
</transformer>
<transformer
implementation="org.apache.maven.plugins.shade.resource.AppendingTransformer">
@@ -124,7 +138,6 @@
<exclude>org.glassfish.jersey.test-framework*</exclude>
<exclude>org.apache.velocity*</exclude>
<exclude>com.sun.mail</exclude>
- <exclude>javax.activation</exclude>
</excludes>
</filter>
</filters>
@@ -255,28 +268,8 @@
<groupId>org.glassfish.jersey.ext</groupId>
<artifactId>jersey-spring6</artifactId>
<version>${jersey.version}</version>
- <exclusions>
- <exclusion>
- <groupId>org.springframework</groupId>
- <artifactId>spring-core</artifactId>
- </exclusion>
- <exclusion>
- <groupId>org.springframework</groupId>
- <artifactId>spring-web</artifactId>
- </exclusion>
- <exclusion>
- <groupId>org.springframework</groupId>
- <artifactId>spring-beans</artifactId>
- </exclusion>
- <exclusion>
- <groupId>org.springframework</groupId>
- <artifactId>spring-context</artifactId>
- </exclusion>
- <exclusion>
- <groupId>org.springframework</groupId>
- <artifactId>spring-aop</artifactId>
- </exclusion>
- </exclusions>
+ <!-- as long as we set spring6.version property transitive deps are ok
+ -->
</dependency>
<!-- JSON -->
@@ -422,9 +415,6 @@
<version>0.4</version>
</dependency>
- <!--<dependency> <groupId>javax.annotation</groupId> <artifactId>javax.annotation-api</artifactId>
- <version>1.3.2</version> </dependency> -->
-
<dependency>
<groupId>de.ids_mannheim.korap</groupId>
<artifactId>Krill</artifactId>
@@ -483,16 +473,6 @@
<version>${spring.version}</version>
</dependency>
- <dependency>
- <groupId>org.springframework</groupId>
- <artifactId>spring-jdbc</artifactId>
- <version>${spring.version}</version>
- </dependency>
- <dependency>
- <groupId>org.springframework</groupId>
- <artifactId>spring-tx</artifactId>
- <version>${spring.version}</version>
- </dependency>
<!-- <dependency> <groupId>org.springframework.security</groupId> <artifactId>spring-security-core</artifactId>
<version>${spring.version}</version> </dependency> <dependency> <groupId>org.springframework.security</groupId>
<artifactId>spring-security-web</artifactId> <version>${spring.version}</version>
@@ -723,12 +703,6 @@
<version>2.1.2</version>
</dependency>
- <dependency>
- <groupId>javax.activation</groupId>
- <artifactId>activation</artifactId>
- <version>1.1.1</version>
- </dependency>
-
<!-- OAuth -->
<dependency>
<groupId>com.nimbusds</groupId>
diff --git a/full/src/main/java/de/ids_mannheim/korap/server/KustvaktBaseServer.java b/full/src/main/java/de/ids_mannheim/korap/server/KustvaktBaseServer.java
index 324a98d..d13517c 100644
--- a/full/src/main/java/de/ids_mannheim/korap/server/KustvaktBaseServer.java
+++ b/full/src/main/java/de/ids_mannheim/korap/server/KustvaktBaseServer.java
@@ -19,11 +19,11 @@
import org.glassfish.jersey.server.ServerProperties;
import org.glassfish.jersey.servlet.ServletContainer;
import org.springframework.web.context.ContextLoaderListener;
+import org.springframework.web.context.support.XmlWebApplicationContext;
import de.ids_mannheim.korap.config.KustvaktConfiguration;
import de.ids_mannheim.korap.encryption.RandomCodeGenerator;
import de.ids_mannheim.korap.exceptions.KustvaktException;
-import jakarta.servlet.ServletContextListener;
import lombok.Getter;
import lombok.Setter;
@@ -40,9 +40,10 @@
protected static KustvaktArgs kargs;
public KustvaktBaseServer () {
- rootPackages = "de.ids_mannheim.korap.core.web; "
- + "de.ids_mannheim.korap.web; "
- + "com.fasterxml.jackson.jaxrs.json;";
+ rootPackages = "de.ids_mannheim.korap.core.web;"
+ + "de.ids_mannheim.korap.web;"
+// + "com.fasterxml.jackson.jaxrs.json;"
+ ;
File d = new File(KustvaktConfiguration.DATA_FOLDER);
if (!d.exists()) {
@@ -103,24 +104,21 @@
Server server = new Server();
+ String configLocation = "classpath:" + springConfig;
+ if (kargs.getSpringConfig() != null) {
+ configLocation = "file:" + kargs.getSpringConfig();
+ }
+ XmlWebApplicationContext context = new XmlWebApplicationContext();
+ context.setConfigLocation(configLocation);
+
ServletContextHandler contextHandler = new ServletContextHandler(
ServletContextHandler.NO_SESSIONS);
contextHandler.setContextPath("/");
-
- if (kargs.getSpringConfig() != null) {
- contextHandler.setInitParameter("contextConfigLocation",
- "file:" + kargs.getSpringConfig());
- }
- else {
- contextHandler.setInitParameter("contextConfigLocation",
- "classpath:" + this.springConfig);
- }
-
- ServletContextListener listener = new ContextLoaderListener();
- contextHandler.addEventListener(listener);
+ contextHandler.addEventListener(new ContextLoaderListener(context));
contextHandler.setInitParameter("adminToken", adminToken);
- ServletHolder servletHolder = new ServletHolder(new ServletContainer());
+ ServletHolder servletHolder = new ServletHolder(
+ new ServletContainer());
servletHolder.setInitParameter(ServerProperties.PROVIDER_PACKAGES,
rootPackages);
servletHolder.setInitOrder(1);
diff --git a/full/src/main/java/de/ids_mannheim/korap/web/utils/SearchResourceFiltersFeature.java b/full/src/main/java/de/ids_mannheim/korap/web/utils/SearchResourceFiltersFeature.java
index 0b44ae8..6063aa0 100644
--- a/full/src/main/java/de/ids_mannheim/korap/web/utils/SearchResourceFiltersFeature.java
+++ b/full/src/main/java/de/ids_mannheim/korap/web/utils/SearchResourceFiltersFeature.java
@@ -1,5 +1,6 @@
package de.ids_mannheim.korap.web.utils;
+import java.util.Arrays;
import java.util.List;
import org.glassfish.jersey.model.internal.CommonConfig;
@@ -7,7 +8,8 @@
import org.springframework.stereotype.Component;
import de.ids_mannheim.korap.web.filter.APIVersionFilter;
-import edu.emory.mathcs.backport.java.util.Arrays;
+import jakarta.annotation.PostConstruct;
+import jakarta.annotation.Priority;
import jakarta.ws.rs.container.DynamicFeature;
import jakarta.ws.rs.container.ResourceInfo;
import jakarta.ws.rs.core.FeatureContext;