Cannot access enunciate generated doc from deployed war in browser - java

I am using enunciate to generate my rest api documentation, initially it was working fine unless I added spring dependency to my project.
My current pom:
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-context</artifactId>
<version>3.2.5.RELEASE</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-core</artifactId>
<version>3.2.5.RELEASE</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-beans</artifactId>
<version>3.2.5.RELEASE</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-webmvc</artifactId>
<version>3.2.5.RELEASE</version>
</dependency>
<dependency>
<groupId>org.springframework.data</groupId>
<artifactId>spring-data-rest-webmvc</artifactId>
<version>2.0.2.RELEASE</version>
</dependency>
<dependency>
<groupId>org.springframework.data</groupId>
<artifactId>spring-data-neo4j</artifactId>
<version>3.0.1.RELEASE</version>
</dependency>
<dependency>
<groupId>org.springframework.data</groupId>
<artifactId>spring-data-neo4j-rest</artifactId>
<version>3.0.1.RELEASE</version>
</dependency>
<dependency>
<groupId>javax.validation</groupId>
<artifactId>validation-api</artifactId>
<version>1.0.0.GA</version>
</dependency>
<dependency>
<groupId>com.sun.jersey</groupId>
<artifactId>jersey-server</artifactId>
<version>1.18.1</version>
</dependency>
<dependency>
<groupId>com.sun.jersey</groupId>
<artifactId>jersey-servlet</artifactId>
<version>1.18.1</version>
</dependency>
<dependency>
<groupId>org.codehaus.enunciate</groupId>
<artifactId>enunciate-rt</artifactId>
<version>1.26</version>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId>
<version>2.2</version>
<configuration>
<webResources>
<resource>
<directory>src/main/webapp</directory>
<filtering>true</filtering>
<includes>
<include>index.html</include>
</includes>
</resource>
</webResources>
</configuration>
</plugin>
<plugin>
<groupId>org.codehaus.enunciate</groupId>
<artifactId>maven-enunciate-plugin</artifactId>
<version>1.26</version>
<configuration>
<configFile>src/main/resources/enunciate.xml</configFile>
</configuration>
<executions>
<execution>
<goals>
<goal>assemble</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
<pluginManagement>
<plugins>
<plugin>
<groupId>org.eclipse.m2e</groupId>
<artifactId>lifecycle-mapping</artifactId>
<version>1.0.0</version>
<configuration>
<lifecycleMappingMetadata>
<pluginExecutions>
<pluginExecution>
<pluginExecutionFilter>
<groupId>org.codehaus.enunciate</groupId>
<artifactId>maven-enunciate-plugin</artifactId>
<versionRange>[1.26,)</versionRange>
<goals>
<goal>assemble</goal>
</goals>
</pluginExecutionFilter>
<action>
<ignore></ignore>
</action>
</pluginExecution>
</pluginExecutions>
</lifecycleMappingMetadata>
</configuration>
</plugin>
</plugins>
</pluginManagement>
</build>
above configuration is generating docs in api directory under war generated. I have following enunciate.xml configuration:
<enunciate xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="http://enunciate.codehaus.org/schemas/enunciate-1.26.xsd">
<webapp mergeWebXML="../webapp/WEB-INF/web.xml"></webapp>
<modules>
<docs splashPackage="com.pack.resources" docsDir="api" title="My API" copyright="amg" includeDefaultDownloads="true" />
<jersey useSubcontext="true" />
</modules>
docs are generated properly, but when I am trying to hit http://localhost:8080/amg-web/api/index.html its giving 404 response.! I checked with extracted war in tomcat webapp where api directory is successfully generated with all the required files, but still not able to access it from deployed app in browser. please help.

I think I found the solution. It may be related with either older version of enunciate which I am using i.e. v1.26 or there are multiple <url-pattern> in my web.xml.
I added additional servlet mapping and it worked..
<servlet-mapping>
<servlet-name>default</servlet-name>
<url-pattern>/api/*</url-pattern>
</servlet-mapping>
where /api/ is path to my api documentation. I still did not get why there necessity of this. It would be great if someone explain this to me.

Related

org/sonar/batch/bootstrapper/EnvironmentInformation compiled by more recent version (55), this version of Java recognises class file versions up to 52

I have installed sonar locally to run it on my java project code. My this code is using java 8. My environment variable is also set to java 8 but I have installed Java 11 on my machine and set a environment variable SONAR_JAVA_PATH in my machine which is pointing to java 11. Here are my environment variables.
export SONAR_HOME=/opt/homebrew/Cellar/sonar-scanner/4.7.0.2747/libexec
export SONAR=$SONAR_HOME/bin
export PATH=$SONAR:$PATH
export SONAR_JAVA_PATH=/Library/Java/JavaVirtualMachines/zulu-11.jdk/Contents/Home/bin/java
export PATH=$SONAR_JAVA_PATH:$PATH
export JAVA_HOME=/Library/Java/JavaVirtualMachines/zulu-8.jdk/Contents/Home
export PATH=${JAVA_HOME}/bin:${PATH}
export PATH
When I run following command in my root directory
mvn clean verify sonar:sonar \
-Dsonar.projectKey=tirebattery-orderprocessing-svcs \
-Dsonar.host.url=http://localhost:9000 \
-Dsonar.login=sqp_17296fe6fac85ebd5f0c0f0490b78216b5ea7140
It throws following error
Execution default-cli of goal
org.sonarsource.scanner.maven:sonar-maven-plugin:3.9.1.2184:sonar
failed: An API incompatibility was encountered while executing
org.sonarsource.scanner.maven:sonar-maven-plugin:3.9.1.2184:sonar:
java.lang.UnsupportedClassVersionError:
org/sonar/batch/bootstrapper/EnvironmentInformation has been compiled
by a more recent version of the Java Runtime (class file version
55.0), this version of the Java Runtime only recognises class file versions up to 52.0
I am very confused about this error. In my IntelliJ how can i build code in Java 8 and run sonar on java 11 ? In few previous answers I red to edit wrapper.conf file but in MAC there is no such file created after installation of sonar through Brew.
Can anyOne kindly explain me in simple words that why this issue is happening, What is the root cause and what changes I have to make to my POM to resolve this issue. Here is my POM.xml file
<?xml version="1.0" encoding="UTF-8"?>
4.0.0
<groupId>com.sams.clubops.orderprocessing</groupId>
<artifactId>tbcorderprocessing</artifactId>
<version>1.8.3</version>
<packaging>jar</packaging>
<name>tbcorderprocessing</name>
<description>Purchase order processing services</description>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.7.2</version>
<relativePath/> <!-- lookup parent from repository -->
</parent>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
<azure.version>2.0.5</azure.version>
<java.version>1.8</java.version>
<camel.version>2.20.1</camel.version>
<spring.boot.version>2.7.2</spring.boot.version>
<swagger2.version>2.9.2</swagger2.version>
<tbc-common.version>1.8.4-SNAPSHOT</tbc-common.version>
</properties>
<distributionManagement>
<repository>
<id>pangaea_releases</id>
<name>xyz Releases</name>
<url>http://gec-maven-nexus.xyz.com/nexus/content/repositories/pangaea_releases</url>
</repository>
<snapshotRepository>
<id>pangaea_snapshots</id>
<name>xyz Snapshots</name>
<url>http://gec-maven-nexus.xyz.com/nexus/content/repositories/pangaea_snapshots</url>
</snapshotRepository>
</distributionManagement>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.ws</groupId>
<artifactId>spring-ws-core</artifactId>
</dependency>
<dependency>
<groupId>wsdl4j</groupId>
<artifactId>wsdl4j</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<version>${spring.boot.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.azure</groupId>
<artifactId>azure-spring-data-cosmos</artifactId>
<version>3.25.0</version>
</dependency>
<!-- Added for SQL Server Connection 12/07 -->
<dependency>
<groupId>com.microsoft.sqlserver</groupId>
<artifactId>mssql-jdbc</artifactId>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-jpa</artifactId>
</dependency>
<!-- https://mvnrepository.com/artifact/org.springframework.retry/spring-retry -->
<dependency>
<groupId>org.springframework.retry</groupId>
<artifactId>spring-retry</artifactId>
<version>1.2.4.RELEASE</version>
</dependency>
<!-- https://mvnrepository.com/artifact/org.springframework.boot/spring-boot-starter-aop -->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-aop</artifactId>
<version>${spring.boot.version}</version>
</dependency>
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.sams.event.horizon</groupId>
<artifactId>evclient</artifactId>
<version>0.0.60</version>
<exclusions>
<exclusion>
<groupId>com.google.code.gson</groupId>
<artifactId>gson</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>com.google.code.gson</groupId>
<artifactId>gson</artifactId>
<version>2.8.5</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-actuator</artifactId>
<version>${spring.boot.version}</version>
</dependency>
<dependency>
<groupId>com.h2database</groupId>
<artifactId>h2</artifactId>
<version>1.4.197</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>io.springfox</groupId>
<artifactId>springfox-swagger2</artifactId>
<version>${swagger2.version}</version>
<scope>compile</scope>
<exclusions>
<exclusion>
<groupId>com.google.guava</groupId>
<artifactId>guava</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>io.springfox</groupId>
<artifactId>springfox-swagger-ui</artifactId>
<version>${swagger2.version}</version>
<scope>compile</scope>
</dependency>
<!--TBC Commons dependency-->
<dependency>
<groupId>com.sams.clubops.tbc</groupId>
<artifactId>tbc-common</artifactId>
<version>${tbc-common.version}</version>
</dependency>
<!-- EVENT HUB EVENT PROCESSOR-->
<dependency>
<groupId>com.microsoft.azure</groupId>
<artifactId>azure-eventhubs</artifactId>
<version>3.0.2</version>
</dependency>
<dependency>
<groupId>com.microsoft.azure</groupId>
<artifactId>azure-eventhubs-eph</artifactId>
<version>3.0.2</version>
<exclusions>
<exclusion>
<groupId>com.google.code.gson</groupId>
<artifactId>gson</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>com.microsoft.azure</groupId>
<artifactId>azure-servicebus</artifactId>
<version>1.2.11</version>
</dependency>
<dependency>
<groupId>org.apache.directory.studio</groupId>
<artifactId>org.apache.commons.collections</artifactId>
<version>3.2.1</version>
</dependency>
<dependency>
<groupId>com.microsoft.azure</groupId>
<artifactId>applicationinsights-logging-logback</artifactId>
<version>2.5.1</version>
</dependency>
<dependency>
<groupId>com.sams.mth</groupId>
<artifactId>common</artifactId>
<version>3.0.2</version>
</dependency>
<dependency>
<groupId>commons-lang</groupId>
<artifactId>commons-lang</artifactId>
<version>2.6</version>
</dependency>
<dependency>
<groupId>com.microsoft.azure</groupId>
<artifactId>azure-keyvault-secrets-spring-boot-starter</artifactId>
<version>2.1.7</version>
</dependency>
<dependency>
<groupId>org.mockito</groupId>
<artifactId>mockito-inline</artifactId>
<version>3.8.0</version>
<scope>test</scope>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<executions>
<execution>
<goals>
<goal>build-info</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<artifactId>maven-resources-plugin</artifactId>
<executions>
<execution>
<id>copy-resources</id>
<phase>process-resources</phase>
<goals>
<goal>copy-resources</goal>
</goals>
<configuration>
<outputDirectory>${basedir}/target</outputDirectory>
<resources>
<resource>
<directory>src/main/resources/docker</directory>
<includes>
<include>Dockerfile</include>
<include>sshd_config</include>
</includes>
</resource>
<resource>
<directory>src/main/resources/docker</directory>
<includes>
<include>startup.sh</include>
</includes>
</resource>
<resource>
<directory>src/main/resources/docker</directory>
<includes>
<include>proxy-intranet-ref-app.conf</include>
</includes>
</resource>
<resource>
<directory>src/main/resources/keystore</directory>
<includes>
<include>stage-extes-replenishment.crt</include>
</includes>
</resource>
<resource>
<directory>src/main/resources/docker</directory>
<includes>
<include>stage-event-horizon-eus.cld.samsclub.com.cer</include>
<include>stage-event-horizon-wus.cld.samsclub.com.cer</include>
<include>stage-event-horizon-station.cld.samsclub.com.cer</include>
<include>event-horizon-eus.cld.samsclub.com.cer</include>
<include>event-horizon-wus.cld.samsclub.com.cer</include>
<include>event-horizon-station.cld.samsclub.com.cer</include>
<include>stage-extes-replenishment.wal-mart.com.cer</include>
</includes>
</resource>
</resources>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>com.coveo</groupId>
<artifactId>fmt-maven-plugin</artifactId>
<version>2.9</version>
<configuration>
<displayLimit>10</displayLimit>
</configuration>
<executions>
<execution>
<goals>
<goal>check</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.jacoco</groupId>
<artifactId>jacoco-maven-plugin</artifactId>
<version>0.7.7.201606060606</version>
<executions>
<execution>
<goals>
<goal>prepare-agent</goal>
</goals>
</execution>
<execution>
<id>report</id>
<phase>prepare-package</phase>
<goals>
<goal>report</goal>
</goals>
</execution>
<execution>
<id>jacoco-check</id>
<goals>
<goal>check</goal>
</goals>
<configuration>
<excludes>
<exclude>com/sams/clubops/orderprocessing/object/**/*</exclude>
<exclude>com/sams/clubops/orderprocessing/repository/document/*</exclude>
<exclude>**/*EventConsumerManager.class</exclude>
<exclude>**/*EventProcessHostObjFactory.class</exclude>
<exclude>**/*DotComOrdersPoLogRepo.class</exclude>
<exclude>**/*OrderProcessingCosmosConfig.class</exclude>
</excludes>
<rules>
<rule>
<element>BUNDLE</element>
<limits>
<limit>
<counter>LINE</counter>
<value>COVEREDRATIO</value>
<!--CHange it back to 80-->
<minimum>0.83</minimum>
</limit>
</limits>
</rule>
</rules>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.22.0</version>
<configuration>
<testFailureIgnore>false</testFailureIgnore>
</configuration>
</plugin>
</plugins>
</build>
SonarQube 9.8 has stopped supporting Scanner tool 3.9.1 for Java 8 version. So you need to use SonarQube version 8.9 or below for analysis. Or you can refer to the following but may still not work with the new Scanner tool version:
mvn sonar:sonar
-Dsonar.login=xxxxxxxxxxxxx
-Dsonar.host.url=http://localhost:9001/sonarqube 1
-Dsonar.java.jdkHome=/Library/Java/JavaVirtualMachines/jdk1.8.0_301.jdk/Contents/Home
Reference from: https://community.sonarsource.com/t/java-versions-in-sonarqube/67551

Maven skips tests,

I have Java 8 maven project which has couple for modules, each module has own pom.xml and there is one pom.xml in main project folder. Problem is that mvn test skips tests. I've run mvn test -X which provided me under maven-surefire-plugin:3.0.0-M3:test label with
[DEBUG] (s) skip = true
[DEBUG] (s) skipTests = true
After help from other stackoveflow posts I've added
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
<skipTests>false</skipTests>
<skip>false</skip>
</configuration>
</plugin>
which solved problem under that label, but also under section maven-compiler-plugin:3.8.0:testCompile there is still:
[DEBUG] (f) skip = true
Tests still aren't being executed and I cannot find anything usefull. Below is pom.xml of one of submodules and main pom.xml, I have ommited including internal dependencies.
main 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>
<parent>
<groupId>pl.com.REDACTED</groupId>
<artifactId>bom</artifactId>
<version>5.6.0</version>
</parent>
<artifactId></artifactId>
<packaging>pom</packaging>
<version>1.0</version>
<properties>
<!-- Logging -->
<log4j.version>1.2.17</log4j.version>
<slf4j-log4j12.version>1.7.12</slf4j-log4j12.version>
<guava.version>18.0</guava.version>
<!-- Arquillian -->
<arquillian.version>1.1.12.Final</arquillian.version>
<arquillian_persistence.version>1.0.0.Alpha7</arquillian_persistence.version>
<arq.version-glassfish-remote>1.0.0.Final</arq.version-glassfish-remote>
<shrinkwrap-resolver-depchain.version>2.2.5</shrinkwrap-resolver-depchain.version>
<!-- Lombok -->
<lombok-maven.version>1.16.16.0</lombok-maven.version>
<lombok.version>1.18.16</lombok.version>
<!-- Jackson -->
<jackson.version>2.25.1</jackson.version>
<poi.version>3.16</poi.version>
<maven-failsafe-plugin.version>2.22.1</maven-failsafe-plugin.version>
<TransferManager-Internal-Common.version>1.1.0-SNAPSHOT</TransferManager-Internal-Common.version>
<gson.version>2.8.6</gson.version>
</properties>
<build>
<finalName>REDACTED</finalName>
<pluginManagement>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-failsafe-plugin</artifactId>
<version>${maven-failsafe-plugin.version}</version>
</plugin>
<plugin>
<groupId>org.projectlombok</groupId>
<artifactId>lombok-maven</artifactId>
<version>${lombok-maven.version}</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
<skip>false</skip>
<skipTests>false</skipTests>
</configuration>
</plugin>
</plugins>
</pluginManagement>
<resources>
<resource>
<filtering>true</filtering>
<directory>src/main/resources</directory>
</resource>
</resources>
</build>
<dependencyManagement>
<dependencies>
<dependency>
<groupId>org.apache.poi</groupId>
<artifactId>poi</artifactId>
<version>${poi.version}</version>
</dependency>
<dependency>
<groupId>org.glassfish.jersey.media</groupId>
<artifactId>jersey-media-json-jackson</artifactId>
<version>${jackson.version}</version>
</dependency>
<dependency>
<groupId>org.glassfish.jersey.core</groupId>
<artifactId>jersey-client</artifactId>
<version>${jackson.version}</version>
</dependency>
<dependency>
<groupId>com.google.code.gson</groupId>
<artifactId>gson</artifactId>
<version>${gson.version}</version>
</dependency>
</dependencies>
</dependencyManagement>
<dependencies>
<!-- JAVAEE 7 API -->
<dependency>
<groupId>javax</groupId>
<artifactId>javaee-api</artifactId>
<scope>provided</scope>
</dependency>
<!-- Logging -->
<dependency>
<groupId>log4j</groupId>
<artifactId>log4j</artifactId>
<version>${log4j.version}</version>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-log4j12</artifactId>
<version>${slf4j-log4j12.version}</version>
</dependency>
<dependency>
<groupId>com.google.guava</groupId>
<artifactId>guava</artifactId>
<version>${guava.version}</version>
</dependency>
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<version>${lombok.version}</version>
</dependency>
</dependencies>
</project>
submodule 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">
<parent>
<artifactId>REDACTED</artifactId>
<groupId>REDACTED</groupId>
<version>1.0</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>REDACTED</artifactId>
<build>
<resources>
<resource>
<filtering>true</filtering>
<directory>src/main/resources</directory>
<excludes>
<exclude>jasper/**/*</exclude>
<exclude>fonts/**/*</exclude>
</excludes>
</resource>
<resource>
<directory>src/main/resources/fonts</directory>
<targetPath>fonts/</targetPath>
</resource>
</resources>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-failsafe-plugin</artifactId>
<executions>
<execution>
<id>integration-test</id>
<goals>
<goal>integration-test</goal>
<goal>verify</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
<skipTests>false</skipTests>
<skip>false</skip>
</configuration>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>jasperreports-maven-plugin</artifactId>
<version>1.0-beta-2</version>
<configuration>
<sourceDirectory>src/main/resources/report</sourceDirectory>
<outputDirectory>${project.build.directory}/classes/report</outputDirectory>
</configuration>
<executions>
<execution>
<goals>
<goal>compile-reports</goal>
</goals>
<phase>compile</phase>
</execution>
</executions>
<dependencies>
<dependency>
<groupId>net.sf.jasperreports</groupId>
<artifactId>jasperreports</artifactId>
<version>4.5.1</version>
<exclusions>
<exclusion>
<artifactId>jdtcore</artifactId>
<groupId>eclipse</groupId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>xerces</groupId>
<artifactId>xercesImpl</artifactId>
<version>2.8.1</version>
</dependency>
<dependency>
<groupId>log4j</groupId>
<artifactId>log4j</artifactId>
<version>1.2.14</version>
</dependency>
<dependency>
<groupId>xml-apis</groupId>
<artifactId>xml-apis</artifactId>
<version>1.4.01</version>
</dependency>
</dependencies>
</plugin>
</plugins>
</build>
<profiles>
<profile>
<id>REDACTED</id>
<build>
<resources>
<resource>
<filtering>true</filtering>
<directory>src/main/resources</directory>
<excludes>
<exclude>jasper/**/*</exclude>
<exclude>fonts/**/*</exclude>
</excludes>
</resource>
<resource>
<directory>src/main/resources/fonts</directory>
<targetPath>fonts/</targetPath>
</resource>
</resources>
<plugins>
<plugin>
<artifactId>maven-resources-plugin</artifactId>
<executions>
<execution>
<id>copy-resources</id>
<phase>compile</phase>
<goals>
<goal>copy-resources</goal>
</goals>
<configuration>
<outputDirectory>${basedir}/target/classes/META-INF</outputDirectory>
<resources>
<resource>
<directory>src/main/resources/META-INF/REDACTED</directory>
<filtering>true</filtering>
</resource>
</resources>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>2.0.2</version>
<configuration>
<excludes>
Buch of excluded locations for finders, not related to tests
</excludes>
</configuration>
</plugin>
</plugins>
</build>
</profile>
<profile>
<id>REDACTED</id>
<build>
<resources>
<resource>
<filtering>true</filtering>
<directory>src/main/resources</directory>
<excludes>
<exclude>jasper/**/*</exclude>
<exclude>fonts/**/*</exclude>
</excludes>
</resource>
<resource>
<directory>src/main/resources/fonts</directory>
<targetPath>fonts/</targetPath>
</resource>
</resources>
<plugins>
<plugin>
<artifactId>maven-resources-plugin</artifactId>
<executions>
<execution>
<id>copy-resources</id>
<phase>compile</phase>
<goals>
<goal>copy-resources</goal>
</goals>
<configuration>
<outputDirectory>${basedir}/target/classes/META-INF</outputDirectory>
<resources>
<resource>
<directory>src/main/resources/META-INF/REDACTED2</directory>
<filtering>true</filtering>
</resource>
</resources>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>2.0.2</version>
<configuration>
<excludes>
Buch of excluded locations for finders, not related to tests
</excludes>
</configuration>
</plugin>
</plugins>
</build>
</profile>
</profiles>
<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>${junit.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.assertj</groupId>
<artifactId>assertj-core</artifactId>
<version>${assertj-core.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.mockito</groupId>
<artifactId>mockito-core</artifactId>
<version>${mockito.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.mockito</groupId>
<artifactId>mockito-junit-jupiter</artifactId>
<version>${mockito.version}</version>
<scope>test</scope>
</dependency>
<!-- Arquillian junit -->
<dependency>
<groupId>org.jboss.arquillian.junit</groupId>
<artifactId>arquillian-junit-container</artifactId>
<version>${arquillian.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.jboss.arquillian.container</groupId>
<artifactId>arquillian-container-spi</artifactId>
<version>${arquillian.version}</version>
<scope>test</scope>
</dependency>
<!-- Arquillian persistence -->
<dependency>
<groupId>org.jboss.arquillian.extension</groupId>
<artifactId>arquillian-persistence-api</artifactId>
<version>${arquillian_persistence.version}</version>
<scope>test</scope>
</dependency>
<!-- Glassfish Remote -->
<dependency>
<groupId>org.jboss.arquillian.container</groupId>
<artifactId>arquillian-glassfish-remote-3.1</artifactId>
<version>${arq.version-glassfish-remote}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.jboss.shrinkwrap.resolver</groupId>
<artifactId>shrinkwrap-resolver-depchain</artifactId>
<version>${shrinkwrap-resolver-depchain.version}</version>
<scope>test</scope>
<type>pom</type>
</dependency>
<!-- HIBERNATE -->
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-envers</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-entitymanager</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-core</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-validator</artifactId>
<scope>provided</scope>
</dependency>
<!-- Jasper Reports -->
<dependency>
<groupId>net.sf.jasperreports</groupId>
<artifactId>jasperreports</artifactId>
</dependency>
<dependency>
<groupId>org.apache.poi</groupId>
<artifactId>poi</artifactId>
</dependency>
<dependency>
<groupId>org.glassfish.jersey.media</groupId>
<artifactId>jersey-media-json-jackson</artifactId>
</dependency>
<dependency>
<groupId>org.glassfish.jersey.core</groupId>
<artifactId>jersey-client</artifactId>
</dependency>
<dependency>
<groupId>com.google.code.gson</groupId>
<artifactId>gson</artifactId>
</dependency>
<dependency>
<groupId>com.fatboyindustrial.gson-javatime-serialisers</groupId>
<artifactId>gson-javatime-serialisers</artifactId>
<version>1.1.1</version>
</dependency>
<dependency>
<groupId>commons-collections</groupId>
<artifactId>commons-collections</artifactId>
<version>3.2.2</version>
<scope>test</scope>
</dependency>
</dependencies>
</project>
EDIT:
I, run mvn help:effective-pom -Doutput=effective-pom-results.xml command and it has whon me bunch of places where sip is set as true. How can i resolve that? Do i have to manualy look for these places and set those properties? I cannot include it here, because it has 1,8k lines, if it is necessary i can upload it to some hosting
To main pom.xml I've added execution under maven-compiler-plugin artifact :
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<executions>
<execution>
<id>default-testCompile</id>
<phase>test-compile</phase>
<goals>
<goal>testCompile</goal>
</goals>
</execution>
</executions>
</plugin>
and in properties in the same pom:
<properties>
<maven.test.skip>false</maven.test.skip>
<skipIntTests>false</skipIntTests>
<skipTests>false</skipTests>
Thanks to #j-woodchuck and #antoniossss I've figured it out studying result of
mvn help:effective-pom -Doutput=effective-pom-results.xml
command which generates effective pom.

SAM build fails because Maven install fails with "The packaging for this project did not assign a file to the build artifact"

I have an issue where I am trying to get mvn install to work so that my sam build works with local invocation using Docker, but it keeps failing due to the following error:
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-install-plugin:2.4:install (default-install) on project my-project: The packaging for this project did not assign a file to the build artifact -> [Help 1]
There are many different iterations of problems and solutions regarding "The packaging for this project did not assign a file to the build artifact" on StackOverflow, but none of them seem to resolve my issue.
For example, I can do a mvn jar:jar install:install and that works correctly, but I can't specify goals like that in the SAM build, so that isn't a proper solution -- I need mvn install to work. I have tried many variations of deleting the .m2 folder, which does nothing. I can also change the version of the maven-install-plugin to no avail. I can specify the file in the maven-install-plugin and if the path is correct, it doesn't see it, but if it is incorrect, it says it doesn't exist.
Nothing seems to solve the issue, so I need to find a real solution.
Here is my 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>my.groupId</groupId>
<artifactId>my-artifact</artifactId>
<version>1.0-SNAPSHOT</version>
<packaging>jar</packaging>
<properties>
<maven.compiler.source>1.8</maven.compiler.source>
<maven.compiler.target>1.8</maven.compiler.target>
<jersey.version>2.30.1</jersey.version>
<jackson.version>2.10.2</jackson.version>
</properties>
<dependencies>
<dependency>
<groupId>com.amazonaws.serverless</groupId>
<artifactId>aws-serverless-java-container-jersey</artifactId>
<version>1.4</version>
</dependency>
<dependency>
<groupId>org.glassfish.jersey.media</groupId>
<artifactId>jersey-media-json-jackson</artifactId>
<version>${jersey.version}</version>
<exclusions>
<exclusion>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-annotations</artifactId>
</exclusion>
<exclusion>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-databind</artifactId>
</exclusion>
<exclusion>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-core</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-databind</artifactId>
<version>${jackson.version}</version>
</dependency>
<dependency>
<groupId>org.glassfish.jersey.inject</groupId>
<artifactId>jersey-hk2</artifactId>
<version>${jersey.version}</version>
<!-- excluding redundant javax.inject dependency -->
<exclusions>
<exclusion>
<groupId>javax.inject</groupId>
<artifactId>javax.inject</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>com.amazonaws</groupId>
<artifactId>aws-java-sdk-dynamodb</artifactId>
<version>1.11.925</version>
</dependency>
<dependency>
<groupId>com.amazonaws</groupId>
<artifactId>aws-lambda-java-core</artifactId>
<version>1.2.1</version>
</dependency>
<!--START LOGGING DEPENDENCIES-->
<dependency>
<groupId>com.amazonaws</groupId>
<artifactId>aws-lambda-java-log4j2</artifactId>
<version>1.2.0</version>
</dependency>
<dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-api</artifactId>
<version>2.13.0</version>
</dependency>
<dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-core</artifactId>
<version>2.13.2</version>
</dependency>
<dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-slf4j18-impl</artifactId>
<version>2.13.3</version>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
<version>2.0.0-alpha1</version>
</dependency>
<!--END LOGGING DEPENDENCIES-->
<dependency>
<groupId>com.google.code.gson</groupId>
<artifactId>gson</artifactId>
<version>2.8.6</version>
</dependency>
<dependency>
<groupId>org.postgresql</groupId>
<artifactId>postgresql</artifactId>
<version>42.2.18</version>
</dependency>
<dependency>
<groupId>com.amazonaws</groupId>
<artifactId>aws-java-sdk-cloudfront</artifactId>
<version>1.11.927</version>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.12</version>
<scope>test</scope>
</dependency>
</dependencies>
<profiles>
<profile>
<id>shaded-jar</id>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
<version>3.2.2</version>
<configuration>
<createDependencyReducedPom>false</createDependencyReducedPom>
</configuration>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>shade</goal>
</goals>
<configuration>
<transformers>
<transformer implementation="com.github.edwgiz.maven_shade_plugin.log4j2_cache_transformer.PluginsCacheFileTransformer" />
</transformers>
</configuration>
</execution>
</executions>
<dependencies>
<dependency>
<groupId>com.github.edwgiz</groupId>
<artifactId>maven-shade-plugin.log4j2-cachefile-transformer</artifactId>
<version>2.13.0</version>
</dependency>
</dependencies>
</plugin>
</plugins>
</build>
</profile>
<profile>
<id>assembly-zip</id>
<activation>
<activeByDefault>true</activeByDefault>
</activation>
<build>
<plugins>
<!-- don't build a jar, we'll use the classes dir -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<version>3.2.0</version>
<executions>
<execution>
<id>default-jar</id>
<phase>none</phase>
</execution>
</executions>
</plugin>
<!-- select and copy only runtime dependencies to a temporary lib folder -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<version>3.1.1</version>
<executions>
<execution>
<id>copy-dependencies</id>
<phase>package</phase>
<goals>
<goal>copy-dependencies</goal>
</goals>
<configuration>
<outputDirectory>${project.build.directory}${file.separator}lib</outputDirectory>
<includeScope>runtime</includeScope>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-assembly-plugin</artifactId>
<version>3.1.1</version>
<executions>
<execution>
<id>zip-assembly</id>
<phase>package</phase>
<goals>
<goal>single</goal>
</goals>
<configuration>
<finalName>${project.artifactId}-${project.version}</finalName>
<descriptors>
<descriptor>src${file.separator}assembly${file.separator}bin.xml</descriptor>
</descriptors>
<attach>false</attach>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>
</profiles>
</project>
And here is my bin.xml:
<assembly xmlns="http://maven.apache.org/ASSEMBLY/2.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/ASSEMBLY/2.0.0 http://maven.apache.org/xsd/assembly-2.0.0.xsd">
<id>lambda-package</id>
<formats>
<format>zip</format>
</formats>
<includeBaseDirectory>false</includeBaseDirectory>
<fileSets>
<!-- copy runtime dependencies with some exclusions -->
<fileSet>
<directory>${project.build.directory}${file.separator}lib</directory>
<outputDirectory>lib</outputDirectory>
</fileSet>
<!-- copy all classes -->
<fileSet>
<directory>${project.build.directory}${file.separator}classes</directory>
<includes>
<include>**</include>
</includes>
<outputDirectory>${file.separator}</outputDirectory>
</fileSet>
</fileSets>
</assembly>
After much searching and many trial and errors, I finally figured out how to resolve this and figured I would share for those that are suffering through this like I was. There are two methods:
You can remove the following plugin:
<!-- don't build a jar, we'll use the classes dir -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<version>3.2.0</version>
<executions>
<execution>
<id>default-jar</id>
<phase>none</phase>
</execution>
</executions>
</plugin>
While this makes it function correctly, it also produces a jar file, which may not be desirable, especially in the case of a Lambda (unnecessarily increases its size).
(Preferred solution) Add the maven-install-plugin with a skip configuration:
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-install-plugin</artifactId>
<version>3.0.0-M1</version>
<configuration>
<skip>true</skip>
</configuration>
</plugin>
This solution both solves the problem and prevents you needing to create a jar file. This allowed my SAM build to work as a result of Maven functioning correctly.

NamingException: Cannot create resource instance with Jackrabbit in Tomcat

I have deployed Jackrabbit in Tomcat 7 using the model 2 (Shared J2EE Resource), but when I try to acces the repository I get the NamingException exception.
javax.naming.NamingException: Cannot create resource instance
at org.apache.naming.factory.ResourceFactory.getObjectInstance(ResourceFactory.java:144)
at javax.naming.spi.NamingManager.getObjectInstance(Unknown Source)
at org.apache.naming.NamingContext.lookup(NamingContext.java:842)
at org.apache.naming.NamingContext.lookup(NamingContext.java:153)
at org.apache.naming.NamingContext.lookup(NamingContext.java:830)
at org.apache.naming.NamingContext.lookup(NamingContext.java:167)
My code is:
InitialContext context = new InitialContext();
Context environment = (Context) context.lookup("java:comp/env");
// The exception is thrown in this line
Repository repository = (Repository) environment.lookup("jcr/repository");
I added this resource as a GlobalNamingResource in my Tomcat server.xml:
<Resource name="jcr/globalRepository"
auth="Container"
type="javax.jcr.Repository"
factory="org.apache.jackrabbit.core.jndi.BindableRepositoryFactory"
configFilePath="C:\Users\vgomez\repository.xml"
repHomeDir="C:\Users\vgomez\repository"/>
In context.xml I added the ResourceLink:
<ResourceLink
name="jcr/repository"
global="jcr/globalRepository"
type="javax.jcr.Repository"/>
And the web.xml of my web app is:
<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns="http://java.sun.com/xml/ns/j2ee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd"
version="2.4">
<display-name>Archetype Created Web Application</display-name>
<resource-ref>
<description>JCR Repository</description>
<res-ref-name>jcr/repository</res-ref-name>
<res-type>javax.jcr.Repository</res-type>
<res-auth>Container</res-auth>
</resource-ref>
</web-app>
Edit: This problem appears when the web app uses Vaadin. If the web app uses jsf for example this configuration works.
I found the problem. I think I didn't have all the dependencies needed. For a Vaadin project created using the comand given in the Book of Vaadin this is the 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>com.example</groupId>
<artifactId>jackrabbitVaadin</artifactId>
<packaging>war</packaging>
<version>1.0</version>
<name>jackrabbitVaadin</name>
<properties>
<vaadin.version>7.5.9</vaadin.version>
<vaadin.plugin.version>${vaadin.version}</vaadin.plugin.version>
<jetty.plugin.version>9.2.3.v20140905</jetty.plugin.version>
<project.source.version>1.7</project.source.version>
<project.target.version>1.7</project.target.version>
<project.encoding>UTF-8</project.encoding>
</properties>
<repositories>
<repository>
<id>vaadin-addons</id>
<url>http://maven.vaadin.com/vaadin-addons</url>
</repository>
<repository>
<id>vaadin-snapshots</id>
<url>https://oss.sonatype.org/content/repositories/vaadin-snapshots/</url>
<releases>
<enabled>false</enabled>
</releases>
<snapshots>
<enabled>true</enabled>
</snapshots>
</repository>
</repositories>
<dependencyManagement>
<dependencies>
<dependency>
<groupId>com.vaadin</groupId>
<artifactId>vaadin-bom</artifactId>
<version>${vaadin.version}</version>
<type>pom</type>
<scope>import</scope>
</dependency>
</dependencies>
</dependencyManagement>
<dependencies>
<dependency>
<groupId>org.ow2.asm</groupId>
<artifactId>asm</artifactId>
<version>5.0.3</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>javax.servlet-api</artifactId>
<version>3.0.1</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.vaadin</groupId>
<artifactId>vaadin-server</artifactId>
</dependency>
<dependency>
<groupId>com.vaadin</groupId>
<artifactId>vaadin-push</artifactId>
</dependency>
<dependency>
<groupId>com.vaadin</groupId>
<artifactId>vaadin-client</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>javax.jcr</groupId>
<artifactId>jcr</artifactId>
<version>2.0</version>
</dependency>
<dependency>
<groupId>org.apache.jackrabbit</groupId>
<artifactId>jackrabbit-core</artifactId>
<version>2.8.1</version>
<scope></scope>
</dependency>
<dependency>
<groupId>org.apache.jackrabbit</groupId>
<artifactId>jackrabbit-jcr-rmi</artifactId>
<version>1.4</version>
</dependency>
<dependency>
<groupId>org.apache.jackrabbit</groupId>
<artifactId>jackrabbit-jcr-server</artifactId>
<version>1.4</version>
</dependency>
<dependency>
<groupId>org.apache.jackrabbit</groupId>
<artifactId>jackrabbit-webapp</artifactId>
<version>1.4</version>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
<version>1.7.5</version>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-log4j12</artifactId>
<version>1.7.5</version>
</dependency>
<dependency>
<groupId>commons-collections</groupId>
<artifactId>commons-collections</artifactId>
<version>3.2.1</version>
</dependency>
<dependency>
<groupId>xerces</groupId>
<artifactId>xercesImpl</artifactId>
<version>2.8.1</version>
</dependency>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>servlet-api</artifactId>
<version>2.4</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>jsp-api</artifactId>
<version>2.0</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.oracle</groupId>
<artifactId>ojdbc14</artifactId>
<version>10.2.0.5.0</version>
</dependency>
<!-- Needed when using the widgetset optimizer (custom ConnectorBundleLoaderFactory).
For widgetset compilation, vaadin-client-compiler is automatically added
on the compilation classpath by vaadin-maven-plugin so normally there is
no need for an explicit dependency. -->
<!-- <dependency> <groupId>com.vaadin</groupId> <artifactId>vaadin-client-compiler</artifactId>
<scope>provided</scope> </dependency> -->
<dependency>
<groupId>com.vaadin</groupId>
<artifactId>vaadin-themes</artifactId>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.0</version>
<configuration>
<encoding>${project.encoding}</encoding>
<source>${project.source.version}</source>
<target>${project.target.version}</target>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-resources-plugin</artifactId>
<version>2.6</version>
<configuration>
<encoding>${project.encoding}</encoding>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId>
<version>2.3</version>
<configuration>
<failOnMissingWebXml>false</failOnMissingWebXml>
<!-- Exclude some unnecessary files generated by the GWT compiler. -->
<packagingExcludes>WEB-INF/classes/VAADIN/gwt-unitCache/**,
WEB-INF/classes/VAADIN/widgetsets/WEB-INF/**</packagingExcludes>
</configuration>
</plugin>
<plugin>
<groupId>com.vaadin</groupId>
<artifactId>vaadin-maven-plugin</artifactId>
<version>${vaadin.plugin.version}</version>
<configuration>
<extraJvmArgs>-Xmx512M -Xss1024k</extraJvmArgs>
<webappDirectory>${basedir}/target/classes/VAADIN/widgetsets</webappDirectory>
<draftCompile>false</draftCompile>
<compileReport>false</compileReport>
<style>OBF</style>
<strict>true</strict>
</configuration>
<executions>
<execution>
<goals>
<goal>update-theme</goal>
<goal>update-widgetset</goal>
<goal>compile</goal>
<!-- disabled by default to use on-the-fly theme compilation -->
<!-- <goal>compile-theme</goal> -->
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-source-plugin</artifactId>
<version>2.4</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-clean-plugin</artifactId>
<version>2.6.1</version>
<!-- Clean up also any pre-compiled themes -->
<configuration>
<filesets>
<fileset>
<directory>src/main/webapp/VAADIN/themes</directory>
<includes>
<include>**/styles.css</include>
<include>**/styles.scss.cache</include>
</includes>
</fileset>
</filesets>
</configuration>
</plugin>
<!-- The Jetty plugin allows us to easily test the development build by
running jetty:run on the command line. -->
<plugin>
<groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-maven-plugin</artifactId>
<version>${jetty.plugin.version}</version>
<configuration>
<scanIntervalSeconds>2</scanIntervalSeconds>
</configuration>
</plugin>
</plugins>
<pluginManagement>
<plugins>
<!--This plugin's configuration is used to store Eclipse m2e settings
only. It has no influence on the Maven build itself. -->
<!-- TODO Remove when http://dev.vaadin.com/ticket/14924 is resolved -->
<plugin>
<groupId>org.eclipse.m2e</groupId>
<artifactId>lifecycle-mapping</artifactId>
<version>1.0.0</version>
<configuration>
<lifecycleMappingMetadata>
<pluginExecutions>
<pluginExecution>
<pluginExecutionFilter>
<groupId>com.vaadin</groupId>
<artifactId>
vaadin-maven-plugin
</artifactId>
<versionRange>[7.1.11,)</versionRange>
<goals>
<goal>resources</goal>
<goal>update-widgetset</goal>
<goal>compile</goal>
<goal>compile-theme</goal>
<goal>update-theme</goal>
</goals>
</pluginExecutionFilter>
<action>
<ignore></ignore>
</action>
</pluginExecution>
</pluginExecutions>
</lifecycleMappingMetadata>
</configuration>
</plugin>
</plugins>
</pluginManagement>
</build>

NoClassFoundError runtime at tomcat

Java.lang.NoClassDefFoundError: com/google/gwt/event/dom/client/HasClickHandlers at java.lang.ClassLoader.defineClass1(Native Method) at ...
However at the WEB-INF/lib there is the jar which contains the class...
But tomcat shows:
INFO: validateJarFile(C:\Users\Boss\workspace\.metadata\.plugins\org.eclipse.wst.server.core\tmp0\wtpwebapps\applicLiquidator\WEB-INF\lib\gwt-dev-2.3.0.jar) - jar not loaded. See Servlet Spec 2.3, section 9.7.2. Offending class: javax/servlet/Servlet.class
márc. 10, 2014 1:54:55 DU org.apache.catalina.loader.WebappClassLoader validateJarFile
INFO: validateJarFile(C:\Users\Boss\workspace\.metadata\.plugins\org.eclipse.wst.server.core\tmp0\wtpwebapps\applicLiquidator\WEB-INF\lib\gwt-user-2.3.0.jar) - jar not loaded. See Servlet Spec 2.3, section 9.7.2. Offending class: javax/servlet/Servlet.class
So how can i make these classes available in runtime when they violate servlet.class?
Update:
Seems like a vicious circle because of Servlet.class violation and because of the needs of this jars at runtime:(
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/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>Reignsoft</groupId>
<artifactId>Liquidator</artifactId>
<packaging>war</packaging>
<version>0.2</version>
<name>Felszámoló Ügyviteli Rendszer</name>
<ciManagement>
<system>hudson</system>
<url>http://reign.ti:58084/jenkins/job/Liquidator%20-%20Maven/</url>
</ciManagement>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<vaadin.version>6.8.13</vaadin.version>
<jpacontainer.version>2.0.0</jpacontainer.version>
<gwt.version>2.3.0</gwt.version>
<gwt.plugin.version>2.3.0-1</gwt.plugin.version>
<url>http://localhost:8080/manager/text</url>
<path>/applicLiquidator</path>
<update>true</update>
<username>tomcat</username>
<password>tomcat</password>
</properties>
<repositories>
<repository>
<id>vaadin-addons</id>
<url>http://maven.vaadin.com/vaadin-addons</url>
</repository>
<repository>
<id>vaadin-snapshots</id>
<url>http://oss.sonatype.org/content/repositories/vaadin-snapshots/</url>
<releases>
<enabled>false</enabled>
</releases>
<snapshots>
<enabled>true</enabled>
</snapshots>
</repository>
<repository>
<id>EclipseLink Repo</id>
<url>http://www.eclipse.org/downloads/download.php?r=1&nf=1&file=/rt/eclipselink/maven.repo</url>
</repository>
</repositories>
<dependencies>
<dependency>
<groupId>com.vaadin.addon</groupId>
<artifactId>jpacontainer-addon-agpl-3.0</artifactId>
<version>${jpacontainer.version}</version>
<type>jar</type>
</dependency>
<dependency>
<groupId>org.vaadin.addons</groupId>
<artifactId>customfield</artifactId>
<version>0.9.3</version>
</dependency>
<dependency>
<groupId>com.vaadin.addon</groupId>
<artifactId>beanvalidation-addon</artifactId>
<version>1.0.0</version>
</dependency>
<dependency>
<groupId>org.vaadin.addons</groupId>
<artifactId>filteringtable</artifactId>
<version>0.8.4</version>
</dependency>
<dependency>
<groupId>org.vaadin.addons</groupId>
<artifactId>popupbutton</artifactId>
<version>1.2.1</version>
</dependency>
<dependency>
<groupId>com.vaadin</groupId>
<artifactId>vaadin</artifactId>
<version>${vaadin.version}</version>
</dependency>
<dependency>
<groupId>org.eclipse.persistence</groupId>
<artifactId>eclipselink</artifactId>
<version>2.2.0</version>
</dependency>
<dependency>
<groupId>org.eclipse.persistence</groupId>
<artifactId>javax.persistence</artifactId>
<version>2.0.0</version>
</dependency>
<dependency>
<groupId>com.h2database</groupId>
<artifactId>h2</artifactId>
<version>1.3.160</version>
</dependency>
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-validator</artifactId>
<version>4.2.0.Final</version>
</dependency>
<dependency>
<groupId>com.google.gwt</groupId>
<artifactId>gwt-user</artifactId>
<version>${gwt.version}</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.google.gwt</groupId>
<artifactId>gwt-dev</artifactId>
<version>${gwt.version}</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>javax.validation</groupId>
<artifactId>validation-api</artifactId>
<version>1.0.0.GA</version>
</dependency>
<dependency>
<groupId>javax.validation</groupId>
<artifactId>validation-api</artifactId>
<version>1.0.0.GA</version>
<classifier>sources</classifier>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.11</version>
</dependency>
<dependency>
<groupId>org.easymock</groupId>
<artifactId>easymockclassextension</artifactId>
<version>3.2</version>
</dependency>
<dependency>
<groupId>org.powermock</groupId>
<artifactId>powermock-api-easymock</artifactId>
<version>1.5.2</version>
</dependency>
<dependency>
<groupId>org.powermock</groupId>
<artifactId>powermock-module-junit4</artifactId>
<version>1.5.2</version>
</dependency>
<dependency>
<groupId>org.vaadin.addon</groupId>
<artifactId>confirmdialog</artifactId>
<version>1.2.1</version>
</dependency>
<dependency>
<groupId>log4j</groupId>
<artifactId>log4j</artifactId>
<version>1.2.17</version>
</dependency>
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<version>5.1.6</version>
</dependency>
<dependency>
<groupId>org.apache.maven.surefire</groupId>
<artifactId>surefire</artifactId>
<version>2.16</version>
<type>pom</type>
</dependency>
<!-- for PDF document generatioon -->
<!-- 1.0 rather than 1.1 due to http://apache-fop.1065347.n5.nabble.com/Maven-dependencies-for-fop-1-1-td37437.html -->
<dependency>
<groupId>org.apache.xmlgraphics</groupId>
<artifactId>fop</artifactId>
<version>1.0</version>
</dependency>
<!-- for Office document generation -->
<dependency>
<groupId>org.docx4j</groupId>
<artifactId>docx4j</artifactId>
<version> 3.0.0</version>
</dependency>
<!-- for generating HTML pages, a HTML template engine -->
<dependency>
<groupId>org.freemarker</groupId>
<artifactId>freemarker</artifactId>
<version>2.3.20</version>
</dependency>
<!-- for drawing with GWT graphics -->
<!--
<dependency>
<groupId>org.vaadin.addons</groupId>
<artifactId>gwt-graphics</artifactId>
<version>1.0.0</version>
</dependency> -->
</dependencies>
<build>
<pluginManagement>
<plugins>
<!--This plugin's configuration is used to store Eclipse m2e settings
only. It has no influence on the Maven build itself. -->
<plugin>
<groupId>org.eclipse.m2e</groupId>
<artifactId>lifecycle-mapping</artifactId>
<version>1.0.0</version>
<configuration>
<lifecycleMappingMetadata>
<pluginExecutions>
<pluginExecution>
<pluginExecutionFilter>
<groupId>com.vaadin</groupId>
<artifactId>
vaadin-maven-plugin
</artifactId>
<versionRange>
[1.0.2,)
</versionRange>
<goals>
<goal>update-widgetset</goal>
</goals>
</pluginExecutionFilter>
<action>
<ignore></ignore>
</action>
</pluginExecution>
<pluginExecution>
<pluginExecutionFilter>
<groupId>org.codehaus.mojo</groupId>
<artifactId>
gwt-maven-plugin
</artifactId>
<versionRange>
[${gwt.plugin.version},)
</versionRange>
<goals>
<goal>resources</goal>
<goal>compile</goal>
</goals>
</pluginExecutionFilter>
<action>
<ignore></ignore>
</action>
</pluginExecution>
</pluginExecutions>
</lifecycleMappingMetadata>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.tomcat.maven</groupId>
<artifactId>tomcat7-maven-plugin</artifactId>
<version>2.2</version>
<configuration>
<url>${url}</url>
<username>${username}</username>
<password>${password}</password>
<path>${path}</path>
<update>${update}</update>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>1.7</source>
<target>1.7</target>
</configuration>
</plugin>
<!-- Uncomment to enable widgetset compilation -->
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>gwt-maven-plugin</artifactId>
<version>${gwt.plugin.version}</version>
<configuration>
<extraJvmArgs>-Xmx512M -Xss1024k</extraJvmArgs>
<webappDirectory>${basedir}/src/main/webapp/VAADIN/widgetsets
</webappDirectory>
<hostedWebapp>${basedir}/src/main/webapp/VAADIN/widgetsets
</hostedWebapp>
<noServer>true</noServer>
<draftCompile>false</draftCompile>
<style>OBF</style>
<runTarget>http://localhost:8080/</runTarget>
</configuration>
<executions>
<execution>
<goals>
<goal>resources</goal>
<goal>compile</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<artifactId>maven-clean-plugin</artifactId>
<version>2.4.1</version>
<configuration>
<filesets>
<fileset>
<directory>src/main/webapp/VAADIN/widgetsets</directory>
</fileset>
</filesets>
</configuration>
</plugin>
<plugin>
<groupId>com.vaadin</groupId>
<artifactId>vaadin-maven-plugin</artifactId>
<version>1.0.2</version>
<executions>
<execution>
<goals>
<goal>update-widgetset</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.surefire</groupId>
<artifactId>surefire</artifactId>
<version>2.16</version>
<configuration>
<excludes>
<exclude>**/*.java</exclude>
</excludes>
</configuration>
</plugin>
<plugin>
<groupId>org.mortbay.jetty</groupId>
<artifactId>jetty-maven-plugin</artifactId>
</plugin>
</plugins>
</pluginManagement>
</build>
</project>
I'm guessing you are bundling a version of Servlet in your application.
Tomcat doesn't like this so it stops loading and it simply doesn't get to the class you actually need. If you are using maven, set the servlet dependency to:
<scope>provided</scope>
UPDATE
The relevant passage is:
The classloader that a container uses to load a servlet in a WAR must
allow the developer to load any resources contained in library JARs within
the WAR following normal J2SE semantics using getResource.
It must not allow the WAR to override J2SE or Java servlet API classes.
It is further recommended that the loader not allow servlets in the WAR
access to the web container’s implementation classes.
It is recommended also that the application class loader be implemented
so that classes and resources packaged within the WAR are loaded in
preference to classes and resources residing in container-wide library JARs.
Please post your maven pom dependencies and double check that the resulting war file does not contain a jar that contains the servlet class.

Categories