Skip to content

Commit

Permalink
fixed #407 - class loading issues in web app
Browse files Browse the repository at this point in the history
  • Loading branch information
marcanpilami committed Aug 28, 2020
1 parent 1ca9772 commit bce44ce
Show file tree
Hide file tree
Showing 8 changed files with 82 additions and 71 deletions.
84 changes: 43 additions & 41 deletions jqm-all/jqm-admin/pom.xml
Original file line number Diff line number Diff line change
@@ -1,54 +1,56 @@
<?xml version="1.0"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>com.enioka.jqm</groupId>
<artifactId>jqm-all</artifactId>
<version>3.0.0-SNAPSHOT</version>
</parent>
<artifactId>jqm-admin</artifactId>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>com.enioka.jqm</groupId>
<artifactId>jqm-all</artifactId>
<version>3.0.0-SNAPSHOT</version>
</parent>
<artifactId>jqm-admin</artifactId>

<name>${project.groupId}:${project.artifactId}</name>
<url>http://jqm.readthedocs.org</url>
<name>${project.groupId}:${project.artifactId}</name>
<url>http://jqm.readthedocs.org</url>

<dependencies>
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>jqm-model</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>org.apache.shiro</groupId>
<artifactId>shiro-web</artifactId>
<version>${shiro.version}</version>
</dependency>
<dependencies>
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>jqm-model</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>org.apache.shiro</groupId>
<artifactId>shiro-web</artifactId>
<version>${shiro.version}</version>
</dependency>

<!-- TEST DEPENDENCIES -->
<dependency>
<groupId>org.hsqldb</groupId>
<artifactId>hsqldb</artifactId>
<version>${hsqldb.version}</version>
<scope>test</scope>
</dependency>
<!-- TEST DEPENDENCIES -->
<dependency>
<groupId>org.hsqldb</groupId>
<artifactId>hsqldb</artifactId>
<version>${hsqldb.version}</version>
<scope>test</scope>
</dependency>

<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>${junit.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>${junit.version}</version>
<scope>test</scope>
</dependency>

<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-log4j12</artifactId>
<version>${slf4j.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-log4j12</artifactId>
<version>${slf4j.version}</version>
<scope>test</scope>
</dependency>

<dependency>
<groupId>javax.xml.bind</groupId>
<artifactId>jaxb-api</artifactId>
<version>2.3.1</version>
<scope>provided</scope>
</dependency>
</dependencies>
</dependencies>
</project>
26 changes: 14 additions & 12 deletions jqm-all/jqm-client/jqm-api-client-core/pom.xml
Original file line number Diff line number Diff line change
@@ -1,21 +1,23 @@
<?xml version="1.0"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>com.enioka.jqm</groupId>
<artifactId>jqm-client</artifactId>
<version>3.0.0-SNAPSHOT</version>
</parent>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>com.enioka.jqm</groupId>
<artifactId>jqm-client</artifactId>
<version>3.0.0-SNAPSHOT</version>
</parent>

<artifactId>jqm-api-client-core</artifactId>
<name>${project.groupId}:${project.artifactId}</name>
<url>http://jqm.readthedocs.org</url>
<artifactId>jqm-api-client-core</artifactId>
<name>${project.groupId}:${project.artifactId}</name>
<url>http://jqm.readthedocs.org</url>

<dependencies>
<dependencies>
<dependency>
<groupId>javax.xml.bind</groupId>
<artifactId>jaxb-api</artifactId>
<version>2.3.1</version>
<scope>provided</scope>
</dependency>
</dependencies>
</dependencies>
</project>
3 changes: 2 additions & 1 deletion jqm-all/jqm-client/jqm-api-client-jersey/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -41,11 +41,12 @@
<version>${jersey-version}</version>
</dependency>

<!-- Java 9+ compat -->
<!-- Java 9+ compat -->
<dependency>
<groupId>javax.xml.bind</groupId>
<artifactId>jaxb-api</artifactId>
<version>2.3.1</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.sun.xml.bind</groupId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -274,9 +274,10 @@ private void loadWar(DbConn cnx)
webAppContext.setDisplayName("JqmWebServices");

// Hide server classes from the web app
webAppContext.getServerClasspathPattern().add("com.enioka.jqm.api."); // engine and webapp can have different API implementations
// (during tests mostly)
webAppContext.getServerClasspathPattern().add("com.enioka.jqm.tools.");
webAppContext.getServerClasspathPattern().add("com.enioka.jqm.api.", "com.enioka.api.admin."); // engine and webapp can have
// different API implementations
// (during tests mostly)
webAppContext.getServerClasspathPattern().add("com.enioka.jqm.tools."); // The engine itself should not be exposed to the webapp.
webAppContext.getServerClasspathPattern().add("-com.enioka.jqm.tools.JqmXmlException"); // inside XML bundle, not engine.
webAppContext.getServerClasspathPattern().add("-com.enioka.jqm.tools.XmlJobDefExporter");

Expand Down
23 changes: 11 additions & 12 deletions jqm-all/jqm-ws/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@
<dependency>
<groupId>org.eclipse.persistence</groupId>
<artifactId>org.eclipse.persistence.moxy</artifactId>
<version>2.7.4</version>
<version>2.7.6</version>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
Expand Down Expand Up @@ -233,7 +233,12 @@
<artifactId>jersey-media-moxy</artifactId>
<version>${jersey-version}</version>
<exclusions>
<!-- API is actually referenced twice in this artifact... -->
<!-- These API are actually not needed as jersey-container-servlet provides the implementation which also contains the API... This would create warnings on Jetty startup. -->
<!-- Note they are only provided on Java 11+ by Jersey -->
<exclusion>
<groupId>jakarta.activation</groupId>
<artifactId>jakarta.activation-api</artifactId>
</exclusion>
<exclusion>
<groupId>jakarta.json</groupId>
<artifactId>jakarta.json-api</artifactId>
Expand All @@ -244,12 +249,6 @@
<groupId>org.glassfish.jersey.inject</groupId>
<artifactId>jersey-hk2</artifactId>
<version>${jersey-version}</version>
<exclusions>
<exclusion>
<groupId>javax.inject</groupId>
<artifactId>javax.inject</artifactId>
</exclusion>
</exclusions>
</dependency>

<!-- Security -->
Expand All @@ -274,19 +273,18 @@
</dependency>
<dependency>
<groupId>com.enioka.jqm</groupId>
<artifactId>jqm-model</artifactId>
<artifactId>jqm-admin</artifactId>
<version>${project.version}</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.enioka.jqm</groupId>
<artifactId>jqm-xml</artifactId>
<artifactId>jqm-model</artifactId>
<version>${project.version}</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.enioka.jqm</groupId>
<artifactId>jqm-admin</artifactId>
<artifactId>jqm-xml</artifactId>
<version>${project.version}</version>
<scope>provided</scope>
</dependency>
Expand Down Expand Up @@ -350,6 +348,7 @@
<groupId>javax.xml.bind</groupId>
<artifactId>jaxb-api</artifactId>
<version>2.3.1</version>
<scope>provided</scope>
</dependency>

</dependencies>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ public JqmRestApp(@Context ServletContext context)
// These two properties ensure lists are properly named in JSON objects
this.property(MarshallerProperties.JSON_WRAPPER_AS_ARRAY_NAME, true);
this.property(UnmarshallerProperties.JSON_WRAPPER_AS_ARRAY_NAME, true);
this.property("jersey.config.server.wadl.disableWadl", "true");

// Determine which of the three APIs should be loaded
boolean loadApiSimple;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,11 @@ public class SessionEvaluator implements SessionStorageEvaluator
@Override
public boolean isSessionStorageEnabled(Subject subject)
{
if (subject == null)
{
return false;
}

// If disabled in request (e.g. by using the noSessionCreation filter, it stays disabled.
if (WebUtils.isWeb(subject))
{
Expand Down
4 changes: 2 additions & 2 deletions jqm-all/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -71,8 +71,8 @@
<hibernate.version>4.2.21.Final</hibernate.version>
<junit.version>4.12</junit.version>
<hsqldb.version>2.3.4</hsqldb.version>
<jersey-version>2.28</jersey-version>
<jetty.version>9.4.15.v20190215</jetty.version>
<jersey-version>2.31</jersey-version>
<jetty.version>9.4.31.v20200723</jetty.version>
<slf4j.version>1.7.25</slf4j.version>
<shiro.version>1.3.2</shiro.version>
<surefire.version>2.22.1</surefire.version>
Expand Down

0 comments on commit bce44ce

Please sign in to comment.