java.lang.NoSuchMethodError: javax.servlet.http.HttpServletRequest.isAsyncStarted()Z in Wicket Web Hello World Project - tomcat7

I'm writing Wicket Framework Hello World application 1st time using Maven build. In Eclipse I've created Maven project. Build is getting successful.
But while running , it is throwing "java.lang.NoSuchMethodError: javax.servlet.http.HttpServletRequest.isAsyncStarted()Z".
pom.xml
<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/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.practice.wicket</groupId>
<artifactId>WicketFirst</artifactId>
<packaging>war</packaging>
<version>1.0-SNAPSHOT</version>
<!-- TODO project name -->
<name>quickstart</name>
<description></description>
<!--
<organization>
<name>company name</name>
<url>company url</url>
</organization>
-->
<licenses>
<license>
<name>The Apache Software License, Version 2.0</name>
<url>http://www.apache.org/licenses/LICENSE-2.0.txt</url>
<distribution>repo</distribution>
</license>
</licenses>
<properties>
<wicket.version>8.5.0</wicket.version>
<jetty9.version>9.4.18.v20190429</jetty9.version>
<slf4j.version>1.7.26</slf4j.version>
<junit.version>4.12</junit.version>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<!-- allowed values: R7, 1.0, 1.5, 2.0 or none -->
<wtp.version>none</wtp.version>
</properties>
<dependencies>
<!-- WICKET DEPENDENCIES -->
<dependency>
<groupId>org.apache.wicket</groupId>
<artifactId>wicket-core</artifactId>
<version>${wicket.version}</version>
</dependency>
<!-- OPTIONAL DEPENDENCY
<dependency>
<groupId>org.apache.wicket</groupId>
<artifactId>wicket-extensions</artifactId>
<version>${wicket.version}</version>
</dependency>
-->
<!-- LOGGING DEPENDENCIES - SLF4J-SIMPLE -->
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-simple</artifactId>
<version>${slf4j.version}</version>
</dependency>
<!-- JUNIT DEPENDENCY FOR TESTING -->
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>${junit.version}</version>
<scope>test</scope>
</dependency>
<!-- JETTY DEPENDENCIES FOR TESTING -->
<dependency>
<groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-webapp</artifactId>
<scope>test</scope>
<version>${jetty9.version}</version>
</dependency>
<dependency>
<groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-jmx</artifactId>
<version>${jetty9.version}</version>
<scope>test</scope>
</dependency>
<!-- uncomment if WebSocket support is needed
<dependency>
<groupId>org.eclipse.jetty.websocket</groupId>
<artifactId>javax-websocket-server-impl</artifactId>
<version>${jetty9.version}</version>
<scope>test</scope>
</dependency>
-->
</dependencies>
<build>
<resources>
<resource>
<filtering>false</filtering>
<directory>src/main/resources</directory>
</resource>
<resource>
<filtering>false</filtering>
<directory>src/main/java</directory>
<includes>
<include>**</include>
</includes>
<excludes>
<exclude>**/*.java</exclude>
</excludes>
</resource>
</resources>
<testResources>
<testResource>
<filtering>false</filtering>
<directory>src/test/resources</directory>
</testResource>
<testResource>
<filtering>false</filtering>
<directory>src/test/java</directory>
<includes>
<include>**</include>
</includes>
<excludes>
<exclude>**/*.java</exclude>
</excludes>
</testResource>
</testResources>
<plugins>
<plugin>
<inherited>true</inherited>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.6.1</version>
<configuration>
<source>1.8</source>
<target>1.8</target>
<encoding>UTF-8</encoding>
<showWarnings>true</showWarnings>
<showDeprecation>true</showDeprecation>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.tomcat.maven</groupId>
<artifactId>tomcat7-maven-plugin</artifactId>
<version>2.0</version>
<configuration>
<url>http://localhost:8080</url>
</configuration>
</plugin>
<plugin>
<groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-maven-plugin</artifactId>
<version>${jetty9.version}</version>
<configuration>
<systemProperties>
<systemProperty>
<name>maven.project.build.directory.test-classes</name>
<value>${project.build.directory}/test-classes</value>
</systemProperty>
</systemProperties>
<jettyXml>${project.basedir}/src/test/jetty/jetty.xml,${project.basedir}/src/test/jetty/jetty-ssl.xml,${project.basedir}/src/test/jetty/jetty-http.xml,${project.basedir}/src/test/jetty/jetty-https.xml</jettyXml>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-eclipse-plugin</artifactId>
<version>2.10</version>
<configuration>
<downloadSources>true</downloadSources>
<wtpversion>${wtp.version}</wtpversion>
</configuration>
</plugin>
</plugins>
</build>
<repositories>
<repository>
<id>Apache Nexus</id>
<url>https://repository.apache.org/content/repositories/snapshots/</url>
<releases>
<enabled>false</enabled>
</releases>
<snapshots>
<enabled>true</enabled>
</snapshots>
</repository>
</repositories>
</project>
web.xml:
<?xml version="1.0" encoding="ISO-8859-1"?>
<web-app xmlns="http://java.sun.com/xml/ns/javaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee
http://www.oracle.com/webfolder/technetwork/jsc/xml/ns/javaee/web-app_3_0.xsd"
version="3.0">
<display-name>WicketFirst</display-name>
<filter>
<filter-name>wicket.WicketFirst</filter-name>
<filter-class>org.apache.wicket.protocol.http.WicketFilter</filter-class>
<init-param>
<param-name>applicationClassName</param-name>
<param-value>com.practice.wicket.WicketApplication</param-value>
</init-param>
</filter>
<filter-mapping>
<filter-name>wicket.WicketFirst</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
</web-app>
Project Structure:
WicketFirst
/src/main/java/
com.practice.wicket
WicketApplication.java
I have not put tomcat 7 .jar in libs. I've used plugin for this in pom.xml and ran mvn package and mvn install from command prompt.
It has build successfully but when I run it using Maven in Eclipse and try to open http://localhost:8080/WicketFirst , it throws above mentioned error.

Tomcat 7 supports Servlet API 3.0. For Wicket 8 you need to use a container which supports at least Servlet API 3.1, which would be Tomcat 8 or higher.
See also: http://tomcat.apache.org/whichversion.html

Related

maven cannot access any package in my project

I've tried anything I would find on the internet but nothing seems to work.
I am using Intellij with OpenJDK 17.0.2
The only error is cannot access package for every class in my project
I tried:
Invalidating everithyng and restarting
Restarting my pc
Removing all the repositories in the .m2 folder
Probably something else I don't remember
Pom.xml:
<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>
<groupId>me.iseal</groupId>
<artifactId>CPit</artifactId>
<version>1.0</version>
<packaging>jar</packaging>
<name>CPit</name>
<properties>
<java.version>1.8</java.version>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.8.1</version>
<configuration>
<source>${java.version}</source>
<target>${java.version}</target>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
<version>3.2.4</version>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>shade</goal>
</goals>
<configuration>
<createDependencyReducedPom>false</createDependencyReducedPom>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
<resources>
<resource>
<directory>src/main/resources</directory>
<filtering>true</filtering>
</resource>
</resources>
</build>
<repositories>
<repository>
<id>jitpack.io</id>
<url>https://jitpack.io</url>
</repository>
<repository>
<id>papermc-repo</id>
<url>https://repo.papermc.io/repository/maven-public/</url>
</repository>
<repository>
<id>sonatype</id>
<url>https://oss.sonatype.org/content/groups/public/</url>
</repository>
</repositories>
<dependencies>
<dependency>
<groupId>me.mrdarkness462</groupId>
<artifactId>thepit</artifactId>
<version>4.0</version>
<scope>system</scope>
<systemPath>${project.basedir}\src\main\resources\ThePit-0.6.4beta - API 4.jar</systemPath>
</dependency>
<dependency>
<groupId>com.github.simplix-softworks</groupId>
<artifactId>simplixstorage</artifactId>
<version>3.2.5</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>io.papermc.paper</groupId>
<artifactId>paper-api</artifactId>
<version>1.19-R0.1-SNAPSHOT</version>
<scope>provided</scope>
</dependency>
</dependencies>
</project>

Maven: include selected folder into jar

I have the below folder structures inside the src/main/resources folder.
My requirement is to build jar only for the com.test.rma folder only. I want to exclude the other folders during build. I tried with the below pom.xml. Currently, it is including all the folders. How do I explicitly keep only selected folders for build?
src/main/resources
com.test.rma/
sample.txt
com.test.uw/
sample.txt
com.test.uw/
sample.txt
POM.xml
<?xml version="1.0" encoding="UTF-8"?>
<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>
<groupId>architecture-drools-services</groupId>
<artifactId>com.org.uwrules</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>jar</packaging>
<properties>
<maven.compiler.source>1.8</maven.compiler.source>
<maven.compiler.target>1.8</maven.compiler.target>
</properties>
<repositories>
<repository>
<id>myorg-io-maven-hosted</id>
<name>myorgio Repository</name>
<url>https://nexus.myorgdigital.com/repository/myorg-io-maven-hosted/</url>
</repository>
</repositories>
<dependencies>
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<version>1.18.22</version>
</dependency>
<dependency>
<groupId>org.drools</groupId>
<artifactId>drools-decisiontables</artifactId>
<version>7.59.0.Final</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.drools</groupId>
<artifactId>drools-core</artifactId>
<version>7.59.0.Final</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.drools</groupId>
<artifactId>drools-compiler</artifactId>
<version>7.59.0.Final</version>
<scope>provided</scope>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.kie</groupId>
<artifactId>kie-maven-plugin</artifactId>
<version>7.59.0.Final</version>
<extensions>true</extensions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<configuration>
<resources>
<resource>
<directory>src/main/resources</directory>
<includes>
<include>/com.test.rma/**</include>
</includes>
</resource>
</resources>
</configuration>
</plugin>
</plugins>
</build>
</project>
Able to find the solution. maven jar plugin is not required post changing to maven resources plugin able to achieve it.
<build>
<resources>
<resource>
<directory>src/main/resources</directory>
<includes>
<include>com.test.rma/*.txt</include>
</includes>
<filtering>false</filtering>
</resource>
</resources>
</build>

Uber/fat jar containing SQL Server JDBC driver via Maven shade plugin

I am trying to build a sample jar which contains the SQL Server JDBC driver via Maven dependency. The class connecting to the db and querying compiles and executes correctly in the IDE(IntelliJ).
When I execute a 'mvn clean install' or 'install' from IntelliJ, the jar built is containing only the db class that I have written but not the SQL Server JDBC jar(should be in exploded format, I suppose).
<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>
<groupId>com.company</groupId>
<artifactId>JavaMavenProject</artifactId>
<version>1.0-SNAPSHOT</version>
<packaging>jar</packaging>
<name>JavaMavenProject</name>
<url>http://maven.apache.org</url>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<maven.compiler.source>1.8</maven.compiler.source>
<maven.compiler.target>1.8</maven.compiler.target>
</properties>
<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>3.8.1</version>
<scope>test</scope>
</dependency>
<!-- https://mvnrepository.com/artifact/com.microsoft.sqlserver/mssql-jdbc -->
<dependency>
<groupId>com.microsoft.sqlserver</groupId>
<artifactId>mssql-jdbc</artifactId>
<version>6.3.4.jre8-preview</version>
<scope>test</scope>
</dependency>
</dependencies>
<build>
<pluginManagement>
<plugins>
<!--For building an uber jar-->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
<version>3.1.0</version>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>shade</goal>
</goals>
<configuration>
<!--<artifactSet>
<!– groupId:artifactId[[:type]:classifier]–>
<includes>
<include>com.microsoft.sqlserver:mssql-jdbc</include>
</includes>
</artifactSet>-->
<filters>
<filter>
<artifact>*:*</artifact>
<excludes>
<exclude>META-INF/*.SF</exclude>
<exclude>META-INF/*.DSA</exclude>
<exclude>META-INF/*.RSA</exclude>
</excludes>
</filter>
</filters>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</pluginManagement>
</build>
</project>
Interesting part is that if I include another dependency e.g: scala and provide it before sql server, the uber jar contains both the required dependencies and the sql code executes well from the target jar. I think for some reason the sql server jdbc jar is not picked up during building the jar. The below pom works perfectly and gives the desired uber jar :
<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/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.company</groupId>
<artifactId>JavaMavenUber</artifactId>
<packaging>jar</packaging>
<version>1.0-SNAPSHOT</version>
<name>JavaMavenUber</name>
<url>http://maven.apache.org</url>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<scala.version>2.12.3</scala.version>
<maven.compiler.source>1.8</maven.compiler.source>
<maven.compiler.target>1.8</maven.compiler.target>
</properties>
<dependencies>
<dependency>
<groupId>org.scala-lang</groupId>
<artifactId>scala-library</artifactId>
<version>${scala.version}</version>
</dependency>
<dependency>
<groupId>com.microsoft.sqlserver</groupId>
<artifactId>mssql-jdbc</artifactId>
<version>6.3.4.jre8-preview</version>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>3.8.1</version>
<scope>test</scope>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<executions>
<execution>
<phase>compile</phase>
<goals>
<goal>compile</goal>
</goals>
</execution>
</executions>
</plugin>
<!--For building an uber jar-->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
<version>3.1.0</version>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>shade</goal>
</goals>
<configuration>
<artifactSet>
<!--groupId:artifactId[[:type]:classifier]-->
<includes>
<include>org.scala-lang:scala-library</include>
<include>com.microsoft.sqlserver:mssql-jdbc</include>
</includes>
</artifactSet>
<filters>
<filter>
<artifact>*:*</artifact>
<excludes>
<exclude>META-INF/*.SF</exclude>
<exclude>META-INF/*.DSA</exclude>
<exclude>META-INF/*.RSA</exclude>
</excludes>
</filter>
</filters>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>
Edit-1: pom modified as suggested by #Gladiator
<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>
<groupId>com.company</groupId>
<artifactId>JavaMavenProject</artifactId>
<version>1.0-SNAPSHOT</version>
<packaging>jar</packaging>
<name>JavaMavenProject</name>
<url>http://maven.apache.org</url>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<maven.compiler.source>1.8</maven.compiler.source>
<maven.compiler.target>1.8</maven.compiler.target>
</properties>
<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>3.8.1</version>
<scope>test</scope>
</dependency>
<!-- https://mvnrepository.com/artifact/com.microsoft.sqlserver/mssql-jdbc -->
<dependency>
<groupId>com.microsoft.sqlserver</groupId>
<artifactId>mssql-jdbc</artifactId>
<version>6.3.4.jre8-preview</version>
</dependency>
</dependencies>
<build>
<pluginManagement>
<plugins>
<!--For building an uber jar-->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
<version>3.1.0</version>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>shade</goal>
</goals>
<configuration>
<shadedArtifactAttached>true</shadedArtifactAttached>
<shadedClassifierName>all</shadedClassifierName>
<filters>
<filter>
<artifact>*:*</artifact>
<excludes>
<exclude>META-INF/*.SF</exclude>
<exclude>META-INF/*.DSA</exclude>
<exclude>META-INF/*.RSA</exclude>
</excludes>
</filter>
</filters>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</pluginManagement>
</build>
</project>
Changes scope of below from test to compile
<dependency>
<groupId>com.microsoft.sqlserver</groupId>
<artifactId>mssql-jdbc</artifactId>
<version>6.3.4.jre8-preview</version>
<scope>test</scope>
</dependency>
Use below it can help
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
<version>2.4.3</version>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>shade</goal>
</goals>
<configuration>
<shadedArtifactAttached>true</shadedArtifactAttached>
<shadedClassifierName>all</shadedClassifierName>
</configuration>
</execution>
</executions>
</plugin>

Spring Web Flow validation not working in IDE

As a follow up to my last question about Web Flow not finding my validator class, I ran into another problem concerning the validation.
When I run my project via mvn spring-boot:run the validation works without problems. However, when I run it in Eclipse, STS or IntelliJ via executing the main class as Spring Boot application, validation is not working anymore.
I don't know where to look for hints on this problem. For starters these are my pom files. I based them on the JHipster pom.xml because I liked their dev and prod profile implementations.
Parent pom
<?xml version="1.0" encoding="UTF-8"?>
<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>
<groupId>twofa</groupId>
<artifactId>2fa-parent</artifactId>
<version>1.0.0</version>
<packaging>pom</packaging>
<modules>
<module>../2fa-portal</module>
</modules>
<properties>
<java.version>1.7</java.version>
<maven-enforcer-plugin.version>1.4.1</maven-enforcer-plugin.version>
<maven-war-plugin.version>2.6</maven-war-plugin.version>
<maven.compiler.source>1.7</maven.compiler.source>
<maven.compiler.target>1.7</maven.compiler.target>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<sortpom-maven-plugin.version>2.5.0</sortpom-maven-plugin.version>
<spring.boot.version>1.4.1.RELEASE</spring.boot.version>
</properties>
<dependencyManagement>
<dependencies>
<dependency>
<!-- Import dependency management from Spring Boot -->
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-dependencies</artifactId>
<version>${spring.boot.version}</version>
<type>pom</type>
<scope>import</scope>
</dependency>
</dependencies>
</dependencyManagement>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
</dependencies>
<repositories>
<repository>
<id>com.springsource.repository.bundles.release</id>
<name>SpringSource Enterprise Bundle Repository - SpringSource Bundle Releases</name>
<url>http://repository.springsource.com/maven/bundles/release</url>
</repository>
<repository>
<id>com.springsource.repository.bundles.external</id>
<name>SpringSource Enterprise Bundle Repository - External Bundle Releases</name>
<url>http://repository.springsource.com/maven/bundles/external</url>
</repository>
</repositories>
<build>
<defaultGoal>spring-boot:run</defaultGoal>
<plugins>
<plugin>
<groupId>com.github.ekryd.sortpom</groupId>
<artifactId>sortpom-maven-plugin</artifactId>
<version>${sortpom-maven-plugin.version}</version>
<executions>
<execution>
<phase>verify</phase>
<goals>
<goal>sort</goal>
</goals>
</execution>
</executions>
<configuration>
<sortProperties>true</sortProperties>
<nrOfIndentSpace>4</nrOfIndentSpace>
<sortDependencies>groupId,artifactId</sortDependencies>
<sortPlugins>groupId,artifactId</sortPlugins>
<keepBlankLines>true</keepBlankLines>
<expandEmptyElements>false</expandEmptyElements>
</configuration>
</plugin>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.6.0</version>
<configuration>
<source>${maven.compiler.source}</source>
<target>${maven.compiler.target}</target>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-enforcer-plugin</artifactId>
<version>${maven-enforcer-plugin.version}</version>
<executions>
<execution>
<id>enforce-versions</id>
<goals>
<goal>enforce</goal>
</goals>
</execution>
</executions>
<configuration>
<rules>
<requireMavenVersion>
<message>You are running an older version of Maven. Application requires at least Maven 3.0</message>
<version>[3.0.0,)</version>
</requireMavenVersion>
<requireJavaVersion>
<message>You are running an older version of Java. Application requires at least JDK ${java.version}</message>
<version>[${java.version}.0,)</version>
</requireJavaVersion>
</rules>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.18.1</version>
<configuration>
<!-- Force alphabetical order to have a reproducible build -->
<runOrder>alphabetical</runOrder>
<includes>
<include>**/*Tests.java</include>
<include>**/*Test.java</include>
<include>**/Test*.java</include>
</includes>
<excludes>
<exclude>**/Abstract*.java</exclude>
</excludes>
</configuration>
</plugin>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<version>${spring.boot.version}</version>
<configuration>
<executable>true</executable>
<fork>true</fork>
</configuration>
</plugin>
</plugins>
</build>
</project>
Portal pom
<?xml version="1.0" encoding="UTF-8"?>
<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>
<artifactId>2fa-parent</artifactId>
<groupId>twofa</groupId>
<version>1.0.0</version>
<relativePath>../2fa-parent/pom.xml</relativePath>
</parent>
<artifactId>2fa-portal</artifactId>
<packaging>war</packaging>
<name>2fa-portal</name>
<prerequisites>
<maven>3.0.0</maven>
</prerequisites>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-velocity</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.webflow</groupId>
<artifactId>spring-webflow</artifactId>
<version>2.4.4.RELEASE</version>
</dependency>
</dependencies>
<build>
<!-- creates 2fa-portal.war file -->
<!-- Resource filtering to fill in placeholders "#...#" in properties -->
<resources>
<resource>
<filtering>true</filtering>
<directory>${basedir}/src/main/resources</directory>
<includes>
<include>**/application*.properties</include>
</includes>
</resource>
<resource>
<directory>${basedir}/src/main/resources</directory>
<excludes>
<exclude>**/application*.properties</exclude>
</excludes>
</resource>
</resources>
<finalName>2fa-portal</finalName>
<pluginManagement>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-resources-plugin</artifactId>
<version>2.7</version>
<dependencies>
<dependency>
<groupId>org.apache.maven.shared</groupId>
<artifactId>maven-filtering</artifactId>
<version>1.3</version>
</dependency>
</dependencies>
<configuration>
<delimiters>
<delimiter>#</delimiter>
<!-- delimiter that doesn't clash with Spring ${} placeholders -->
</delimiters>
<useDefaultDelimiters>false</useDefaultDelimiters>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId>
<configuration>
<failOnMissingWebXml>false</failOnMissingWebXml>
<archive>
<manifest>
<addDefaultImplementationEntries>true</addDefaultImplementationEntries>
</manifest>
</archive>
</configuration>
</plugin>
</plugins>
</pluginManagement>
</build>
<profiles>
<profile>
<id>dev</id>
<activation>
<activeByDefault>true</activeByDefault>
</activation>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId>
<version>${maven-war-plugin.version}</version>
</plugin>
</plugins>
</build>
<properties>
<!-- log configuration -->
<logback.loglevel>DEBUG</logback.loglevel>
<!-- default Spring profile -->
<spring.profiles.active>dev</spring.profiles.active>
</properties>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-devtools</artifactId>
<optional>true</optional>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-tomcat</artifactId>
</dependency>
</dependencies>
</profile>
<profile>
<id>test</id>
<build>
<plugins>
<plugin>
<artifactId>maven-clean-plugin</artifactId>
<version>2.5</version>
<configuration>
<filesets>
<fileset>
<directory>target/</directory>
</fileset>
</filesets>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId>
<configuration>
<failOnMissingWebXml>false</failOnMissingWebXml>
</configuration>
</plugin>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<executions>
<execution>
<goals>
<goal>build-info</goal>
</goals>
</execution>
</executions>
<configuration>
<executable>false</executable>
</configuration>
</plugin>
</plugins>
</build>
<properties>
<spring.profiles.active>test</spring.profiles.active>
</properties>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-tomcat</artifactId>
<scope>provided</scope>
</dependency>
</dependencies>
</profile>
<profile>
<id>prod</id>
<build>
<plugins>
<plugin>
<artifactId>maven-clean-plugin</artifactId>
<version>2.5</version>
<configuration>
<filesets>
<fileset>
<directory>target/</directory>
</fileset>
</filesets>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId>
<configuration>
<failOnMissingWebXml>false</failOnMissingWebXml>
</configuration>
</plugin>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<executions>
<execution>
<goals>
<goal>build-info</goal>
</goals>
</execution>
</executions>
<configuration>
<executable>false</executable>
</configuration>
</plugin>
</plugins>
</build>
<properties>
<spring.profiles.active>prod</spring.profiles.active>
</properties>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-tomcat</artifactId>
<scope>provided</scope>
</dependency>
</dependencies>
</profile>
</profiles>
</project>
It turned out to be a problem with Spring Devtools together with Spring Web Flow. Further information and the workaround can be found at this Spring Boot issue.
Quoting the workaround:
I think the problem is due to the separation of restart and base class loaders and is easily solved by adding the following spring-devtools.properties entry
restart.include.spring=/spring-.*\.jar

jOOQ 3.1 prints logs, but jOOQ 3.4 doesn't

I'm having a strange problem in my project (Spring, log4j, maven, jOOQ). The project is a multi-jar with a parent and a common poms shared by all the children projects.
The problem
If I use jOOQ 3.1 in one of the child projects, the rolling file is created and updated with all the logs. If I recompile the project using jOOQ 3.4 (jar is a dependency of the common pom project) my rolling file is not created and I don't get any logs.
Why did I upgrade from 3.1 to 3.4? Because I was getting this error.
My log4j.properties file is as follows:
log4j.rootCategory=DEBUG, stdout, rollingFile
log4j.appender.stdout=org.apache.log4j.ConsoleAppender
log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
log4j.appender.stdout.layout.ConversionPattern=%5p [%t %c] - %m%n
log4j.appender.stdout.layout.ConversionPattern=%p [%c{3}] %m%n
log4j.appender.rollingFile=org.apache.log4j.RollingFileAppender
log4j.appender.rollingFile.File=${catalina.base}/logs/my_file.log
log4j.appender.rollingFile.layout.ConversionPattern=%5p %d{dd MMM yyyy HH:mm:ss} [%c] - %m%n
log4j.appender.rollingFile.Append=true
log4j.appender.rollingFile.layout=org.apache.log4j.PatternLayout
log4j.appender.rollingFile.DatePattern='.'yyyy-MM-dd
log4j.appender.rollingFile.MaxFileSize=10MB
log4j.appender.rollingFile.MaxBackupIndex=99
I can't think of a relation between the jOOQ version and printing / not printing logs, especially as the jOOQ documentation makes clear that it's very easy to log. So that's why I have to ask you guys.
Please don't hesitate to ask for more details.
Thanks everyone!
UPDATE 1 - Pom sources
These are all the concerned poms (some details have been modified for obvious reasons)
super_parent_module
<?xml version="1.0" encoding="UTF-8"?>
<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>
<groupId>my_group_id</groupId>
<artifactId>super_parent_module</artifactId>
<version>1.0.1-SNAPSHOT</version>
<packaging>pom</packaging>
<name>name</name>
<description>description</description>
<url>http://maven.apache.org</url>
<scm>
<developerConnection>XXXXX</developerConnection>
</scm>
<distributionManagement>
<!-- repository -->
</distributionManagement>
<profiles>
<!-- profiles -->
</profiles>
<properties>
<deployment.local.directory>XXXXX</deployment.local.directory>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<dependencies>
<dependency>
<groupId>log4j</groupId>
<artifactId>log4j</artifactId>
<version>1.2.17</version>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.11</version>
<scope>test</scope>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>2.5.1</version>
<configuration>
<source>1.6</source>
<target>1.6</target>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-checkstyle-plugin</artifactId>
<version>2.10</version>
<configuration>
<configLocation>XXXXXXX</configLocation>
</configuration>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>cobertura-maven-plugin</artifactId>
<version>2.6</version>
<configuration>
<instrumentation>
<excludes>
<exclude>**/generated/**</exclude>
</excludes>
</instrumentation>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-release-plugin</artifactId>
<version>2.4.2</version>
<configuration>
<tagNameFormat>v#{project.version}</tagNameFormat>
<autoVersionSubmodules>true</autoVersionSubmodules>
<releaseProfiles>releases</releaseProfiles>
<remoteTagging>true</remoteTagging>
<tagBase>XXXXXXXX</tagBase>
</configuration>
</plugin>
</plugins>
</build>
</project>
super_common_module
<?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">
<parent>
<groupId>my_group_id</groupId>
<artifactId>super_parent_module</artifactId>
<version>1.0.1-SNAPSHOT</version>
<relativePath />
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>super_common_module</artifactId>
<version>1.0.10-SNAPSHOT</version>
<name>name</name>
<url>http://maven.apache.org</url>
<scm>
<developerConnection>XXXXXX</developerConnection>
</scm>
<dependencies>
<dependency>
<!-- guava 15 -->
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-jdbc</artifactId>
<version>3.2.4.RELEASE</version>
</dependency>
<dependency>
<groupId>args4j</groupId>
<artifactId>args4j</artifactId>
<version>2.0.26</version>
</dependency>
<dependency>
<groupId>org.mockito</groupId>
<artifactId>mockito-all</artifactId>
<version>1.9.5</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>ojdbc</groupId>
<artifactId>ojdbc</artifactId>
<version>14</version>
<scope>provided</scope>
</dependency>
</dependencies>
<build>
<resources>
<resource>
<directory>${project.build.sourceDirectory}</directory>
</resource>
<resource>
<directory>${basedir}/src/main/resources</directory>
</resource>
</resources>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
<version>2.1</version>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>shade</goal>
</goals>
<configuration>
<transformers>
<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>
</transformers>
<shadedArtifactAttached>true</shadedArtifactAttached>
<shadedClassifierName>with-deps</shadedClassifierName>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>
parent_module
<?xml version="1.0" encoding="UTF-8"?>
<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">
<parent>
<groupId>my_group_id</groupId>
<artifactId>super_parent_module</artifactId>
<version>1.0.1-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<groupId>my_group_id.client</groupId>
<artifactId>parent_module</artifactId>
<version>1.0.0-SNAPSHOT</version>
<packaging>pom</packaging>
<name>parent_module</name>
<description>description</description>
<url>http://maven.apache.org</url>
<scm>
<developerConnection>XXXXXX</developerConnection>
</scm>
<modules>
<module>common_module</module>
<module>my_problematic_module</module>
<module>other_module</module>
<module>other_module</module>
</modules>
<profiles>
<!-- profiles -->
</profiles>
<properties>
<springws.version>2.1.3.RELEASE</springws.version>
<spring.version>3.2.4.RELEASE</spring.version>
<jooq.version>3.4.0</jooq.version>
<jooq-codegen.url>XXXXX</jooq-codegen.url>
<jooq-codegen.user>XXXXX</jooq-codegen.user>
<jooq-codegen.password>XXXX</jooq-codegen.password>
</properties>
<dependencies>
<dependency>
<groupId>my_group_id</groupId>
<artifactId>super_common_module</artifactId>
<version>1.0.10-SNAPSHOT</version>
</dependency>
</dependencies>
</project>
common_module
<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>my_group_id.client</groupId>
<artifactId>parent_module</artifactId>
<version>1.0.0-SNAPSHOT</version>
</parent>
<artifactId>common_module</artifactId>
<description>description</description>
<packaging>jar</packaging>
<name>name</name>
<url>http://maven.apache.org</url>
<dependencies>
<dependency>
<groupId>org.jooq</groupId>
<artifactId>jooq-codegen-maven</artifactId>
<version>${jooq.version}</version>
</dependency>
<dependency>
<groupId>org.jooq</groupId>
<artifactId>jooq</artifactId>
<version>${jooq.version}</version>
</dependency>
<dependency>
<groupId>org.jooq</groupId>
<artifactId>jooq-meta</artifactId>
<version>${jooq.version}</version>
</dependency>
</dependencies>
<build>
<plugins>
<!-- jOOQ configuration -->
<plugin>
<groupId>org.jooq</groupId>
<artifactId>jooq-codegen-maven</artifactId>
<version>${jooq.version}</version>
<executions>
<execution>
<goals>
<goal>generate</goal>
</goals>
</execution>
</executions>
<dependencies>
<dependency>
<groupId>ojdbc</groupId>
<artifactId>ojdbc</artifactId>
<version>14</version>
</dependency>
<dependency>
<groupId>javax.xml.bind</groupId>
<artifactId>jaxb-api</artifactId>
<version>2.2.6</version>
</dependency>
<dependency>
<groupId>my_group_id</groupId>
<artifactId>jooq-ext</artifactId>
<version>1.0.3-SNAPSHOT</version>
</dependency>
</dependencies>
<configuration>
<jdbc>
<driver>oracle.jdbc.OracleDriver</driver>
<url>${jooq-codegen.url}</url>
<user>${jooq-codegen.user}</user>
<password>${jooq-codegen.password}</password>
</jdbc>
<generator>
<name>org.jooq.util.MyGenerator</name>
<database>
<name>org.jooq.util.oracle.OracleDatabase</name>
<includes>tables and packages</includes>
<excludes />
<inputSchema>my_schema</inputSchema>
</database>
<generate>
<relations>true</relations>
<deprecated>false</deprecated>
<instanceFields>true</instanceFields>
<generatedAnnotation>false</generatedAnnotation>
<records>true</records>
<pojos>false</pojos>
<immutablePojos>false</immutablePojos>
<interfaces>false</interfaces>
<daos>false</daos>
<jpaAnnotations>false</jpaAnnotations>
<validationAnnotations>false</validationAnnotations>
<globalObjectReferences>false</globalObjectReferences>
</generate>
<target>
<packageName>my_group_id.model.generated</packageName>
<directory>${project.build.directory}/generated-xxxxx/jooq</directory>
</target>
</generator>
</configuration>
</plugin>
</plugins>
</build>
</project>
my_problematic_module
<?xml version="1.0" encoding="UTF-8"?>
<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/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>my_group_id.client</groupId>
<artifactId>parent_module</artifactId>
<version>1.0.0-SNAPSHOT</version>
</parent>
<artifactId>my_problematic_module</artifactId>
<packaging>war</packaging>
<name>name</name>
<description>description</description>
<url>http://www.springframework.org/spring-ws</url>
<profiles>
<!-- profiles... -->
</profiles>
<scm>
<connection>XXXXXX</connection>
</scm>
<build>
<finalName>${project.artifactId}-${project.version}-${lane}</finalName>
<resources>
<resource>
<directory>src/main/resources</directory>
<filtering>true</filtering>
</resource>
</resources>
<plugins>
<plugin>
<artifactId>maven-war-plugin</artifactId>
<version>2.4</version>
<configuration>
<attachClasses>true</attachClasses>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.tomcat.maven</groupId>
<artifactId>tomcat6-maven-plugin</artifactId>
<version>2.1</version>
<configuration>
<url>http://localhost:8084/manager</url>
<server>mytomcat</server>
<path>/project_path</path>
</configuration>
</plugin>
<plugin>
<groupId>org.jvnet.jax-ws-commons</groupId>
<artifactId>jaxws-maven-plugin</artifactId>
<version>2.3</version>
<dependencies>
<dependency>
<groupId>org.jvnet.jaxb2_commons</groupId>
<artifactId>jaxb2-basics</artifactId>
<version>0.6.5</version>
</dependency>
</dependencies>
<executions>
<execution>
<id>exec_id</id>
<goals>
<goal>wsimport</goal>
</goals>
<configuration>
<target>2.0</target>
<wsdlDirectory>src/main/resources/wsdl</wsdlDirectory>
<wsdlFiles>
<wsdlFile>exec_id.wsdl</wsdlFile>
</wsdlFiles>
<extension>true</extension>
<xjcArgs>
<!-- xjcArg>some args</xjcArg -->
</xjcArgs>
</configuration>
</execution>
<execution>
<!-- another execution -->
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>cobertura-maven-plugin</artifactId>
<version>2.6</version>
<configuration>
<instrumentation>
<excludes>
<exclude>XXXXX</exclude>
<exclude>**/generated/**</exclude>
</excludes>
</instrumentation>
</configuration>
</plugin>
</plugins>
</build>
<dependencies>
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>common_module</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>org.springframework.ws</groupId>
<artifactId>spring-ws-test</artifactId>
<version>${springws.version}</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-jdbc</artifactId>
<version>${spring.version}</version>
</dependency>
<dependency>
<groupId>org.jvnet.jaxb2_commons</groupId>
<artifactId>jaxb2-basics</artifactId>
<version>0.6.5</version>
</dependency>
<dependency>
<groupId>commons-dbcp</groupId>
<artifactId>commons-dbcp</artifactId>
<version>1.4</version>
</dependency>
</dependencies>
<reporting>
<plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>cobertura-maven-plugin</artifactId>
<version>2.6</version>
<configuration>
<instrumentation>
<excludes>
<exclude>XXXXX</exclude>
<exclude>**/generated/**</exclude>
</excludes>
</instrumentation>
</configuration>
</plugin>
</plugins>
</reporting>
</project>
I found a solution:
I have noticed that jooq-codegen-maven-3.4.0.jar has a log4j.xml and that jooq-codegen-maven-3.1.0.jar doesn't.
I have then created a log4j.xml file to replace my log4j.properties and the rollingFile has started writing again!
I believe log4j was using the xml version in jooq-codegen-maven-3.4.0.jar (which writes in console only) and not my log4j.properties. Maybe there's a way to tell log4j which file has more priority, but apparently creating this other log4j.xml has overriden jooq's.
#LukasEder, do you think this should be taken care of in jooq?
Thanks
It looks like you're missing the log4j dependency in your pom.xml file. jOOQ tries to find that dependency on the classpath, but you haven't added it (at least not in that module).
Try adding
<dependency>
<groupId>log4j</groupId>
<artifactId>log4j</artifactId>
<version>1.2.17</version>
</dependency>
(It's curious that this would have worked prior to jOOQ 3.4)

Resources