I am have multi-module java project. Database logic in one module (common), restapi web app in other module (restapi). I have a problem with call methods from common module in restapi module. Does not resolve mysql dependency from common module pom.
it is my pom.xml
for root
<?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>qwerty.project</groupId>
<artifactId>project</artifactId>
<version>0.1</version>
<modules>
<module>common</module>
<module>restapi</module>
</modules>
<packaging>pom</packaging>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>1.8</source>
<target>1.8</target>
</configuration>
</plugin>
</plugins>
</build>
</project>
for common 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>
<artifactId>project</artifactId>
<groupId>qwerty.project</groupId>
<version>0.1</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<name>common</name>
<packaging>jar</packaging>
<artifactId>qwerty.common</artifactId>
<dependencies>
<dependency>
<groupId>com.mchange</groupId>
<artifactId>c3p0</artifactId>
<version>0.9.5.2</version>
</dependency>
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<version>8.0.12</version>
</dependency>
</dependencies>
</project>
and this is for restapi 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>
<artifactId>project</artifactId>
<groupId>qwerty.project</groupId>
<version>0.1</version>
<relativePath>../pom.xml</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>rest-api</artifactId>
<dependencies>
<dependency>
<groupId>qwerty.project</groupId>
<artifactId>qwerty.common</artifactId>
<version>0.1</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.jayway.jsonpath</groupId>
<artifactId>json-path</artifactId>
<scope>test</scope>
</dependency>
</dependencies>
<dependencyManagement>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-dependencies</artifactId>
<version>1.5.6.RELEASE</version>
<type>pom</type>
<scope>import</scope>
</dependency>
</dependencies>
</dependencyManagement>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
</plugins>
</build>
</project>
in my restapi controller i am to inject Dao from common module.
#RestController
public class VideoController {
#Autowired
VideoDAO videoDAO;
#RequestMapping("/video")
public String getVideo() throws SQLException {
List<String> links = videoDAO.doSome();
return links.get(0);
}
}
I am make mvn clean install
if am start spring boot app (from module restapi) i am see in log that c3p0 from common module successfully initialized. But mysql is not, - NoClassFoundException. Why is this happening ?
2018-10-12 11:34:34.060 WARN 10160 --- [HelperThread-#2] c.m.v2.c3p0.DriverManagerDataSource : Could not load driverClass com.mysql.cj.jdbc.Driver
java.lang.ClassNotFoundException: com.mysql.cj.jdbc.Driver
at java.net.URLClassLoader.findClass(URLClassLoader.java:381) ~[na:1.8.0_144]
at java.lang.ClassLoader.loadClass(ClassLoader.java:424) ~[na:1.8.0_144]
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:335) ~[na:1.8.0_144]
at java.lang.ClassLoader.loadClass(ClassLoader.java:357) ~[na:1.8.0_144]
jdbc class is declared in the common module in the settings file in the resources
c3p0.driverClass=com.mysql.cj.jdbc.Driver
c3p0.jdbcUrl=jdbc:mysql://localhost:3306/Some
c3p0.user=***
c3p0.password=***
c3p0.initialPoolSize=5
c3p0.minPoolSize=5
...
I noticed that if mysql dependency is transferred to the root pom file, the project starts working normally.
But this is not a good idea, I think, since logically the mysql should be in the common module.
I would be grateful for the advice
update
dependency tree for restapi module
qwerty.project:rest-api:jar:0.1
[INFO] +- qwerty.project:qwerty.common:jar:0.1:compile
[INFO] | +- com.mchange:c3p0:jar:0.9.5.2:compile
[INFO] | | \- com.mchange:mchange-commons-java:jar:0.2.11:compile
[INFO] | \- mysql:mysql-connector-java:jar:5.1.43:compile
[INFO] +- org.springframework.boot:spring-boot-starter-web:jar:1.5.6.RELEASE:compile
[INFO] | +- org.springframework.boot:spring-boot-starter:jar:1.5.6.RELEASE:compile
[INFO] | | +- org.springframework.boot:spring-boot:jar:1.5.6.RELEASE:compile
[INFO] | | +- org.springframework.boot:spring-boot-autoconfigure:jar:1.5.6.RELEASE:compile
[INFO] | | +- org.springframework.boot:spring-boot-starter-logging:jar:1.5.6.RELEASE:compile
[INFO] | | | +- ch.qos.logback:logback-classic:jar:1.1.11:compile
[INFO] | | | | \- ch.qos.logback:logback-core:jar:1.1.11:compile
[INFO] | | | +- org.slf4j:jcl-over-slf4j:jar:1.7.25:compile
[INFO] | | | +- org.slf4j:jul-to-slf4j:jar:1.7.25:compile
[INFO] | | | \- org.slf4j:log4j-over-slf4j:jar:1.7.25:compile
[INFO] | | \- org.yaml:snakeyaml:jar:1.17:runtime
[INFO] | +- org.springframework.boot:spring-boot-starter-tomcat:jar:1.5.6.RELEASE:compile
[INFO] | | +- org.apache.tomcat.embed:tomcat-embed-core:jar:8.5.16:compile
[INFO] | | +- org.apache.tomcat.embed:tomcat-embed-el:jar:8.5.16:compile
[INFO] | | \- org.apache.tomcat.embed:tomcat-embed-websocket:jar:8.5.16:compile
[INFO] | +- org.hibernate:hibernate-validator:jar:5.3.5.Final:compile
[INFO] | | +- javax.validation:validation-api:jar:1.1.0.Final:compile
[INFO] | | +- org.jboss.logging:jboss-logging:jar:3.3.1.Final:compile
[INFO] | | \- com.fasterxml:classmate:jar:1.3.3:compile
[INFO] | +- com.fasterxml.jackson.core:jackson-databind:jar:2.8.9:compile
[INFO] | | +- com.fasterxml.jackson.core:jackson-annotations:jar:2.8.0:compile
[INFO] | | \- com.fasterxml.jackson.core:jackson-core:jar:2.8.9:compile
[INFO] | +- org.springframework:spring-web:jar:4.3.10.RELEASE:compile
[INFO] | | +- org.springframework:spring-aop:jar:4.3.10.RELEASE:compile
[INFO] | | +- org.springframework:spring-beans:jar:4.3.10.RELEASE:compile
[INFO] | | \- org.springframework:spring-context:jar:4.3.10.RELEASE:compile
[INFO] | \- org.springframework:spring-webmvc:jar:4.3.10.RELEASE:compile
[INFO] | \- org.springframework:spring-expression:jar:4.3.10.RELEASE:compile
[INFO] +- org.springframework.boot:spring-boot-starter-test:jar:1.5.6.RELEASE:test
[INFO] | +- org.springframework.boot:spring-boot-test:jar:1.5.6.RELEASE:test
[INFO] | +- org.springframework.boot:spring-boot-test-autoconfigure:jar:1.5.6.RELEASE:test
[INFO] | +- junit:junit:jar:4.12:test
[INFO] | +- org.assertj:assertj-core:jar:2.6.0:test
[INFO] | +- org.mockito:mockito-core:jar:1.10.19:test
[INFO] | | \- org.objenesis:objenesis:jar:2.1:test
[INFO] | +- org.hamcrest:hamcrest-core:jar:1.3:test
[INFO] | +- org.hamcrest:hamcrest-library:jar:1.3:test
[INFO] | +- org.skyscreamer:jsonassert:jar:1.4.0:test
[INFO] | | \- com.vaadin.external.google:android-json:jar:0.0.20131108.vaadin1:test
[INFO] | +- org.springframework:spring-core:jar:4.3.10.RELEASE:compile
[INFO] | \- org.springframework:spring-test:jar:4.3.10.RELEASE:test
[INFO] +- com.jayway.jsonpath:json-path:jar:2.2.0:test
[INFO] | +- net.minidev:json-smart:jar:2.2.1:test
[INFO] | | \- net.minidev:accessors-smart:jar:1.1:test
[INFO] | | \- org.ow2.asm:asm:jar:5.0.3:test
[INFO] | \- org.slf4j:slf4j-api:jar:1.7.25:compile
[INFO] +- org.projectlombok:lombok:jar:1.16.20:compile
[INFO] \- log4j:log4j:jar:1.2.17:compile
and for common
[INFO] qwerty.project:qwerty.common:jar:0.1
[INFO] +- com.mchange:c3p0:jar:0.9.5.2:compile
[INFO] | \- com.mchange:mchange-commons-java:jar:0.2.11:compile
[INFO] +- mysql:mysql-connector-java:jar:8.0.12:compile
[INFO] | \- com.google.protobuf:protobuf-java:jar:2.6.0:compile
[INFO] +- org.projectlombok:lombok:jar:1.16.20:compile
[INFO] \- log4j:log4j:jar:1.2.17:compile
The problem has nothing to do with Maven. The dependency you include simply doesn't contain the class com.mysql.cj.jdbc.Driver. Did you mean com.mysql.jdbc.Driver? Or do you need a newer version of the connector?
-- edit --
OK. Just realized, you had two different versions. So it is a Maven problem.
I assume that one of the parent projects manages the version of the dependency to this old one.
Solution: Put a dependency management to the expected version in you root pom.
Related
Can anyone help me with this one? I already tried different solutions posted here but nothing works.
APPLICATION FAILED TO START
***************************
Description:
An attempt was made to call a method that does not exist. The attempt was made from the following location:
org.hibernate.cfg.annotations.EntityBinder.processComplementaryTableDefinitions(EntityBinder.java:1239)
The following method did not exist:
javax.persistence.Table.indexes()[Ljavax/persistence/Index;
The calling method's class, org.hibernate.cfg.annotations.EntityBinder, was loaded from the following location:
jar:file:/C:/Users/csatl/.m2/repository/org/hibernate/hibernate-core/5.6.5.Final/hibernate-core-5.6.5.Final.jar!/org/hibernate/cfg/annotations/EntityBinder.class
The called method's class, javax.persistence.Table, is available from the following locations:
jar:file:/C:/Users/csatl/Desktop/Facultate/An%203-sem2/SD/labs/lab2/lib/javax.persistence.jar!/javax/persistence/Table.class
jar:file:/C:/Users/csatl/.m2/repository/jakarta/persistence/jakarta.persistence-api/2.2.3/jakarta.persistence-api-2.2.3.jar!/javax/persistence/Table.class
jar:file:/C:/Users/csatl/.m2/repository/javax/persistence/javax.persistence-api/2.2/javax.persistence-api-2.2.jar!/javax/persistence/Table.class
jar:file:/C:/Users/csatl/.m2/repository/org/hibernate/javax/persistence/hibernate-jpa-2.1-api/1.0.0.Final/hibernate-jpa-2.1-api-1.0.0.Final.jar!/javax/persistence/Table.class
The called method's class hierarchy was loaded from the following locations:
javax.persistence.Table: file:/C:/Users/csatl/Desktop/Facultate/An%203-sem2/SD/labs/lab2/lib/javax.persistence.jar
Action:
Correct the classpath of your application so that it contains compatible versions of the classes org.hibernate.cfg.annotations.EntityBinder and javax.persistence.Table
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'entityManagerFactory' defined in class path resource [org/springframework/boot/autoconfigure/orm/jpa/HibernateJpaConfiguration.class]: Invocation of init method failed; nested exception is java.lang.NoSuchMethodError: javax.persistence.Table.indexes()[Ljavax/persistence/Index;
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1804)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:620)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:542)
at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:335)
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:234)
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:333)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:208)
at org.springframework.context.support.AbstractApplicationContext.getBean(AbstractApplicationContext.java:1154)
at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:908)
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:583)
at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.refresh(ServletWebServerApplicationContext.java:145)
at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:740)
at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:415)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:303)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1312)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1301)
at ro.sd.firstapp.FirstAppApplication.main(FirstAppApplication.java:11)
Caused by: java.lang.NoSuchMethodError: javax.persistence.Table.indexes()[Ljavax/persistence/Index;
at org.hibernate.cfg.annotations.EntityBinder.processComplementaryTableDefinitions(EntityBinder.java:1239)
at org.hibernate.cfg.AnnotationBinder.bindClass(AnnotationBinder.java:826)
at org.hibernate.boot.model.source.internal.annotations.AnnotationMetadataSourceProcessorImpl.processEntityHierarchies(AnnotationMetadataSourceProcessorImpl.java:225)
at org.hibernate.boot.model.process.spi.MetadataBuildingProcess$1.processEntityHierarchies(MetadataBuildingProcess.java:239)
at org.hibernate.boot.model.process.spi.MetadataBuildingProcess.complete(MetadataBuildingProcess.java:282)
at org.hibernate.jpa.boot.internal.EntityManagerFactoryBuilderImpl.metadata(EntityManagerFactoryBuilderImpl.java:1460)
at org.hibernate.jpa.boot.internal.EntityManagerFactoryBuilderImpl.build(EntityManagerFactoryBuilderImpl.java:1494)
at org.springframework.orm.jpa.vendor.SpringHibernateJpaPersistenceProvider.createContainerEntityManagerFactory(SpringHibernateJpaPersistenceProvider.java:58)
at org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean.createNativeEntityManagerFactory(LocalContainerEntityManagerFactoryBean.java:365)
at org.springframework.orm.jpa.AbstractEntityManagerFactoryBean.buildNativeEntityManagerFactory(AbstractEntityManagerFactoryBean.java:409)
at org.springframework.orm.jpa.AbstractEntityManagerFactoryBean.afterPropertiesSet(AbstractEntityManagerFactoryBean.java:396)
at org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean.afterPropertiesSet(LocalContainerEntityManagerFactoryBean.java:341)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1863)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1800)
... 16 more
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 https://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.6.4</version>
<relativePath/> <!-- lookup parent from repository -->
</parent>
<groupId>ro.sd</groupId>
<artifactId>first-app</artifactId>
<version>0.0.1-SNAPSHOT</version>
<name>first-app</name>
<description>Demo project for Spring Boot</description>
<properties>
<java.version>1.8</java.version>
<frontend-maven-plugin.version>1.6</frontend-maven-plugin.version>
<node.version>v14.8.0</node.version>
<yarn.version>v1.12.1</yarn.version>
</properties>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-jpa</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.security</groupId>
<artifactId>spring-security-crypto</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-validation</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<version>1.18.22</version>
</dependency>
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-core</artifactId>
<version>5.6.5.Final</version>
</dependency>
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-entitymanager</artifactId>
<version>5.6.5.Final</version>
</dependency>
<!-- <dependency>-->
<!-- <groupId>org.hibernate</groupId>-->
<!-- <artifactId>hibernate-core</artifactId>-->
<!-- <version>4.1.4.Final</version>-->
<!-- </dependency>-->
<!-- <dependency>-->
<!-- <groupId>org.hibernate</groupId>-->
<!-- <artifactId>hibernate-entitymanager</artifactId>-->
<!-- <version>5.2.3.Final</version>-->
<!-- </dependency>-->
<dependency>
<groupId>javax.xml.bind</groupId>
<artifactId>jaxb-api</artifactId>
<version>2.3.0</version>
</dependency>
<dependency>
<groupId>javax.persistence</groupId>
<artifactId>persistence-api</artifactId>
<version>1.0.2</version>
</dependency>
<!-- <dependency>-->
<!-- <groupId>javax.persistence</groupId>-->
<!-- <artifactId>javax.persistence-api</artifactId>-->
<!-- <version>2.1</version>-->
<!-- </dependency>-->
<!-- <dependency>-->
<!-- <groupId>org.hibernate.javax.persistence</groupId>-->
<!-- <artifactId>hibernate-jpa-2.1-api</artifactId>-->
<!-- <version>1.0.0.Final</version>-->
<!-- </dependency>-->
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<version>${project.parent.version}</version>
</plugin>
</plugins>
</build>
</project>
The BeanCreationException is from my main class. I used a try catch.
package ro.sd.firstapp;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
#SpringBootApplication
public class FirstAppApplication {
public static void main(String[] args) {
try{
SpringApplication.run(FirstAppApplication.class, args);
}catch (Exception e)
{
e.printStackTrace();
}
}
I tried changing the env variables. I tried including more dependencies, delete dependencies. I don't know what's wrong.
Here is my mvn dependency:tree
[INFO] --- maven-dependency-plugin:3.2.0:tree (default-cli) # first-app ---
[INFO] ro.sd:first-app:jar:0.0.1-SNAPSHOT
[INFO] +- org.springframework.boot:spring-boot-starter-data-jpa:jar:2.6.4:compile
[INFO] | +- org.springframework.boot:spring-boot-starter-aop:jar:2.6.4:compile
[INFO] | | +- org.springframework:spring-aop:jar:5.3.16:compile
[INFO] | | \- org.aspectj:aspectjweaver:jar:1.9.7:compile
[INFO] | +- org.springframework.boot:spring-boot-starter-jdbc:jar:2.6.4:compile
[INFO] | | +- com.zaxxer:HikariCP:jar:4.0.3:compile
[INFO] | | \- org.springframework:spring-jdbc:jar:5.3.16:compile
[INFO] | +- jakarta.transaction:jakarta.transaction-api:jar:1.3.3:compile
[INFO] | +- jakarta.persistence:jakarta.persistence-api:jar:2.2.3:compile
[INFO] | +- org.springframework.data:spring-data-jpa:jar:2.6.2:compile
[INFO] | | +- org.springframework.data:spring-data-commons:jar:2.6.2:compile
[INFO] | | +- org.springframework:spring-orm:jar:5.3.16:compile
[INFO] | | +- org.springframework:spring-context:jar:5.3.16:compile
[INFO] | | +- org.springframework:spring-tx:jar:5.3.16:compile
[INFO] | | +- org.springframework:spring-beans:jar:5.3.16:compile
[INFO] | | \- org.slf4j:slf4j-api:jar:1.7.36:compile
[INFO] | \- org.springframework:spring-aspects:jar:5.3.16:compile
[INFO] +- org.springframework.boot:spring-boot-starter:jar:2.6.4:compile
[INFO] | +- org.springframework.boot:spring-boot:jar:2.6.4:compile
[INFO] | +- org.springframework.boot:spring-boot-autoconfigure:jar:2.6.4:compile
[INFO] | +- org.springframework.boot:spring-boot-starter-logging:jar:2.6.4:compile
[INFO] | | +- ch.qos.logback:logback-classic:jar:1.2.10:compile
[INFO] | | | \- ch.qos.logback:logback-core:jar:1.2.10:compile
[INFO] | | +- org.apache.logging.log4j:log4j-to-slf4j:jar:2.17.1:compile
[INFO] | | | \- org.apache.logging.log4j:log4j-api:jar:2.17.1:compile
[INFO] | | \- org.slf4j:jul-to-slf4j:jar:1.7.36:compile
[INFO] | +- jakarta.annotation:jakarta.annotation-api:jar:1.3.5:compile
[INFO] | +- org.springframework:spring-core:jar:5.3.16:compile
[INFO] | | \- org.springframework:spring-jcl:jar:5.3.16:compile
[INFO] | \- org.yaml:snakeyaml:jar:1.29:compile
[INFO] +- org.springframework.security:spring-security-crypto:jar:5.6.2:compile
[INFO] +- org.springframework.boot:spring-boot-starter-web:jar:2.6.4:compile
[INFO] | +- org.springframework.boot:spring-boot-starter-json:jar:2.6.4:compile
[INFO] | | +- com.fasterxml.jackson.core:jackson-databind:jar:2.13.1:compile
[INFO] | | | +- com.fasterxml.jackson.core:jackson-annotations:jar:2.13.1:compile
[INFO] | | | \- com.fasterxml.jackson.core:jackson-core:jar:2.13.1:compile
[INFO] | | +- com.fasterxml.jackson.datatype:jackson-datatype-jdk8:jar:2.13.1:compile
[INFO] | | +- com.fasterxml.jackson.datatype:jackson-datatype-jsr310:jar:2.13.1:compile
[INFO] | | \- com.fasterxml.jackson.module:jackson-module-parameter-names:jar:2.13.1:compile
[INFO] | +- org.springframework.boot:spring-boot-starter-tomcat:jar:2.6.4:compile
[INFO] | | +- org.apache.tomcat.embed:tomcat-embed-core:jar:9.0.58:compile
[INFO] | | \- org.apache.tomcat.embed:tomcat-embed-websocket:jar:9.0.58:compile
[INFO] | +- org.springframework:spring-web:jar:5.3.16:compile
[INFO] | \- org.springframework:spring-webmvc:jar:5.3.16:compile
[INFO] | \- org.springframework:spring-expression:jar:5.3.16:compile
[INFO] +- org.springframework.boot:spring-boot-starter-validation:jar:2.6.4:compile
[INFO] | +- org.apache.tomcat.embed:tomcat-embed-el:jar:9.0.58:compile
[INFO] | \- org.hibernate.validator:hibernate-validator:jar:6.2.2.Final:compile
[INFO] | \- jakarta.validation:jakarta.validation-api:jar:2.0.2:compile
[INFO] +- org.springframework.boot:spring-boot-starter-test:jar:2.6.4:test
[INFO] | +- org.springframework.boot:spring-boot-test:jar:2.6.4:test
[INFO] | +- org.springframework.boot:spring-boot-test-autoconfigure:jar:2.6.4:test
[INFO] | +- com.jayway.jsonpath:json-path:jar:2.6.0:test
[INFO] | | \- net.minidev:json-smart:jar:2.4.8:test
[INFO] | | \- net.minidev:accessors-smart:jar:2.4.8:test
[INFO] | | \- org.ow2.asm:asm:jar:9.1:test
[INFO] | +- jakarta.xml.bind:jakarta.xml.bind-api:jar:2.3.3:compile
[INFO] | | \- jakarta.activation:jakarta.activation-api:jar:1.2.2:compile
[INFO] | +- org.assertj:assertj-core:jar:3.21.0:test
[INFO] | +- org.hamcrest:hamcrest:jar:2.2:test
[INFO] | +- org.junit.jupiter:junit-jupiter:jar:5.8.2:test
[INFO] | | +- org.junit.jupiter:junit-jupiter-api:jar:5.8.2:test
[INFO] | | | +- org.opentest4j:opentest4j:jar:1.2.0:test
[INFO] | | | +- org.junit.platform:junit-platform-commons:jar:1.8.2:test
[INFO] | | | \- org.apiguardian:apiguardian-api:jar:1.1.2:test
[INFO] | | +- org.junit.jupiter:junit-jupiter-params:jar:5.8.2:test
[INFO] | | \- org.junit.jupiter:junit-jupiter-engine:jar:5.8.2:test
[INFO] | | \- org.junit.platform:junit-platform-engine:jar:1.8.2:test
[INFO] | +- org.mockito:mockito-core:jar:4.0.0:test
[INFO] | | +- net.bytebuddy:byte-buddy-agent:jar:1.11.22:test
[INFO] | | \- org.objenesis:objenesis:jar:3.2:test
[INFO] | +- org.mockito:mockito-junit-jupiter:jar:4.0.0:test
[INFO] | +- org.skyscreamer:jsonassert:jar:1.5.0:test
[INFO] | | \- com.vaadin.external.google:android-json:jar:0.0.20131108.vaadin1:test
[INFO] | +- org.springframework:spring-test:jar:5.3.16:test
[INFO] | \- org.xmlunit:xmlunit-core:jar:2.8.4:test
[INFO] +- org.projectlombok:lombok:jar:1.18.22:compile
[INFO] +- mysql:mysql-connector-java:jar:8.0.28:runtime
[INFO] +- org.hibernate:hibernate-core:jar:5.6.5.Final:compile
[INFO] | +- org.jboss.logging:jboss-logging:jar:3.4.3.Final:compile
[INFO] | +- javax.persistence:javax.persistence-api:jar:2.2:compile
[INFO] | +- net.bytebuddy:byte-buddy:jar:1.11.22:compile
[INFO] | +- antlr:antlr:jar:2.7.7:compile
[INFO] | +- org.jboss.spec.javax.transaction:jboss-transaction-api_1.2_spec:jar:1.1.1.Final:compile
[INFO] | +- org.jboss:jandex:jar:2.4.2.Final:compile
[INFO] | +- com.fasterxml:classmate:jar:1.5.1:compile
[INFO] | +- javax.activation:javax.activation-api:jar:1.2.0:compile
[INFO] | +- org.hibernate.common:hibernate-commons-annotations:jar:5.1.2.Final:compile
[INFO] | \- org.glassfish.jaxb:jaxb-runtime:jar:2.3.6:compile
[INFO] | +- org.glassfish.jaxb:txw2:jar:2.3.6:compile
[INFO] | +- com.sun.istack:istack-commons-runtime:jar:3.0.12:compile
[INFO] | \- com.sun.activation:jakarta.activation:jar:1.2.2:runtime
[INFO] +- org.hibernate:hibernate-entitymanager:jar:5.6.5.Final:compile
[INFO] +- javax.xml.bind:jaxb-api:jar:2.3.0:compile
[INFO] \- javax.persistence:persistence-api:jar:1.0.2:compile
I get the following message when I deploy my war to the Tomcat 7:
nested exception is java.lang.NoClassDefFoundError: javax/el/ELManager
I added <tomcat.version>7.0.61</tomcat.version> to my pom.xml and can now reproduce the error on my development environment.
The error happens after the bean creation, the other changes that were necessary to get the war to run I made.
I tried to change my pom.xml so that it uses old versions which might play nice with tomcat 7, but failed to remove the problem. I don't know which package produces the problem.
See 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>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.1.2.RELEASE</version>
<relativePath/> <!-- lookup parent from repository -->
</parent>
<groupId>com.xxx</groupId>
<artifactId>monitormonitor</artifactId>
<version>0.0.1-SNAPSHOT</version>
<name>monitormonitor</name>
<description>Web Service Monitoring project for Spring Boot</description>
<properties>
<java.version>1.8</java.version>
<start-class>com.xxx.monitormonitor.MonitormonitorApplication</start-class>
<!-- deploying war-file on tomcat 7 -->
<tomcat.version>7.0.61</tomcat.version><!-- nested exception is java.lang.NoClassDefFoundError: javax/el/ELManager -->
<servlet-api.version>3.0.1</servlet-api.version>
</properties>
<packaging>war</packaging>
<dependencies>
<!-- added other version of log4j for invalid byte tag error -->
<dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-api</artifactId>
<!-- changed version vs. ClassFormatException: Invalid byte tag in constant pool: 19 -->
<!--<version>2.11.1</version>-->
<version>2.7</version>
<!--<scope>provided</scope>-->
</dependency>
<dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-core</artifactId>
<version>2.7</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-jdbc</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-mail</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
<!-- <scope>provided</scope> -->
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-tomcat</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-devtools</artifactId>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-context-support</artifactId>
</dependency>
<!--
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-tomcat</artifactId>
<version>1.1.6.RELEASE</version>
<scope>provided</scope>
</dependency>
-->
<!-- added vs java.lang.NoClassDefFoundError: javax/el/ELManager -->
<!--<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-validation</artifactId>
</dependency>
-->
<dependency>
<groupId>javax.el</groupId>
<artifactId>javax.el-api</artifactId>
<version>2.2.4</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.glassfish.web</groupId>
<artifactId>javax.el</artifactId>
<version>2.2.4</version>
<scope>provided</scope>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<configuration>
<mainClass>com.xxx.monitormonitor.MonitormonitorApplication</mainClass>
</configuration>
</plugin>
</plugins>
</build>
</project>
dependency tree:
[INFO] com.xxx:monitormonitor:war:0.0.1-SNAPSHOT
[INFO] +- org.apache.logging.log4j:log4j-api:jar:2.7:compile
[INFO] +- org.apache.logging.log4j:log4j-core:jar:2.7:compile
[INFO] +- org.springframework.boot:spring-boot-starter-jdbc:jar:2.1.2.RELEASE:compile
[INFO] | +- org.springframework.boot:spring-boot-starter:jar:2.1.2.RELEASE:compile
[INFO] | | +- org.springframework.boot:spring-boot-starter-logging:jar:2.1.2.RELEASE:compile
[INFO] | | | +- ch.qos.logback:logback-classic:jar:1.2.3:compile
[INFO] | | | | \- ch.qos.logback:logback-core:jar:1.2.3:compile
[INFO] | | | +- org.apache.logging.log4j:log4j-to-slf4j:jar:2.11.1:compile
[INFO] | | | \- org.slf4j:jul-to-slf4j:jar:1.7.25:compile
[INFO] | | \- org.yaml:snakeyaml:jar:1.23:runtime
[INFO] | +- com.zaxxer:HikariCP:jar:3.2.0:compile
[INFO] | | \- org.slf4j:slf4j-api:jar:1.7.25:compile
[INFO] | \- org.springframework:spring-jdbc:jar:5.1.4.RELEASE:compile
[INFO] | \- org.springframework:spring-tx:jar:5.1.4.RELEASE:compile
[INFO] +- org.springframework.boot:spring-boot-starter-mail:jar:2.1.2.RELEASE:compile
[INFO] | \- com.sun.mail:javax.mail:jar:1.6.2:compile
[INFO] | \- javax.activation:activation:jar:1.1:compile
[INFO] +- org.springframework.boot:spring-boot-starter-web:jar:2.1.2.RELEASE:compile
[INFO] | +- org.springframework.boot:spring-boot-starter-json:jar:2.1.2.RELEASE:compile
[INFO] | | +- com.fasterxml.jackson.core:jackson-databind:jar:2.9.8:compile
[INFO] | | | +- com.fasterxml.jackson.core:jackson-annotations:jar:2.9.0:compile
[INFO] | | | \- com.fasterxml.jackson.core:jackson-core:jar:2.9.8:compile
[INFO] | | +- com.fasterxml.jackson.datatype:jackson-datatype-jdk8:jar:2.9.8:compile
[INFO] | | +- com.fasterxml.jackson.datatype:jackson-datatype-jsr310:jar:2.9.8:compile
[INFO] | | \- com.fasterxml.jackson.module:jackson-module-parameter-names:jar:2.9.8:compile
[INFO] | +- org.hibernate.validator:hibernate-validator:jar:6.0.14.Final:compile
[INFO] | | +- javax.validation:validation-api:jar:2.0.1.Final:compile
[INFO] | | +- org.jboss.logging:jboss-logging:jar:3.3.2.Final:compile
[INFO] | | \- com.fasterxml:classmate:jar:1.4.0:compile
[INFO] | +- org.springframework:spring-web:jar:5.1.4.RELEASE:compile
[INFO] | \- org.springframework:spring-webmvc:jar:5.1.4.RELEASE:compile
[INFO] | +- org.springframework:spring-aop:jar:5.1.4.RELEASE:compile
[INFO] | \- org.springframework:spring-expression:jar:5.1.4.RELEASE:compile
[INFO] +- org.springframework.boot:spring-boot-starter-tomcat:jar:2.1.2.RELEASE:provided
[INFO] | +- javax.annotation:javax.annotation-api:jar:1.3.2:compile
[INFO] | +- org.apache.tomcat.embed:tomcat-embed-core:jar:7.0.61:provided
[INFO] | +- org.apache.tomcat.embed:tomcat-embed-el:jar:7.0.61:provided
[INFO] | \- org.apache.tomcat.embed:tomcat-embed-websocket:jar:7.0.61:provided
[INFO] +- org.springframework.boot:spring-boot-devtools:jar:2.1.2.RELEASE:runtime
[INFO] | +- org.springframework.boot:spring-boot:jar:2.1.2.RELEASE:compile
[INFO] | \- org.springframework.boot:spring-boot-autoconfigure:jar:2.1.2.RELEASE:compile
[INFO] +- org.springframework.boot:spring-boot-starter-test:jar:2.1.2.RELEASE:test
[INFO] | +- org.springframework.boot:spring-boot-test:jar:2.1.2.RELEASE:test
[INFO] | +- org.springframework.boot:spring-boot-test-autoconfigure:jar:2.1.2.RELEASE:test
[INFO] | +- com.jayway.jsonpath:json-path:jar:2.4.0:test
[INFO] | | \- net.minidev:json-smart:jar:2.3:test
[INFO] | | \- net.minidev:accessors-smart:jar:1.2:test
[INFO] | | \- org.ow2.asm:asm:jar:5.0.4:test
[INFO] | +- junit:junit:jar:4.12:test
[INFO] | +- org.assertj:assertj-core:jar:3.11.1:test
[INFO] | +- org.mockito:mockito-core:jar:2.23.4:test
[INFO] | | +- net.bytebuddy:byte-buddy:jar:1.9.7:test
[INFO] | | +- net.bytebuddy:byte-buddy-agent:jar:1.9.7:test
[INFO] | | \- org.objenesis:objenesis:jar:2.6:test
[INFO] | +- org.hamcrest:hamcrest-core:jar:1.3:test
[INFO] | +- org.hamcrest:hamcrest-library:jar:1.3:test
[INFO] | +- org.skyscreamer:jsonassert:jar:1.5.0:test
[INFO] | | \- com.vaadin.external.google:android-json:jar:0.0.20131108.vaadin1:test
[INFO] | +- org.springframework:spring-core:jar:5.1.4.RELEASE:compile
[INFO] | | \- org.springframework:spring-jcl:jar:5.1.4.RELEASE:compile
[INFO] | +- org.springframework:spring-test:jar:5.1.4.RELEASE:test
[INFO] | \- org.xmlunit:xmlunit-core:jar:2.6.2:test
[INFO] +- org.springframework:spring-context-support:jar:5.1.4.RELEASE:compile
[INFO] | +- org.springframework:spring-beans:jar:5.1.4.RELEASE:compile
[INFO] | \- org.springframework:spring-context:jar:5.1.4.RELEASE:compile
[INFO] +- javax.el:javax.el-api:jar:2.2.4:provided
[INFO] \- org.glassfish.web:javax.el:jar:2.2.4:provided
spring boot 2.1.2 release supports any Servlet 3.1+ compatible container.
Tomcat 7 is not one of them
spring boot docs
Use tomcat 8 or beyond http://tomcat.apache.org/whichversion.html
Spring Boot 2.1 requires a Servlet 3.1 compatible container. Tomcat 7 is a Servlet 3.0 container so you cannot use it with Spring Boot 2.1.
You'll need to upgrade to Tomcat 8.5.x or 9.0.x.
It is because javax/el/ELManager was introduced in el-api 3.0 and tomcat 7 is using el-api 2.2 so this class is not present in it.
Please make sure your dev and prod environment are the same when you are developing.
Or you can add following dependency in your pom.xml
<dependency>
<groupId>javax.el</groupId>
<artifactId>javax.el-api</artifactId>
<version>3.0.0</version>
</dependency>
I'm trying to connect my Java web project to Firebase, so I'll be able to store my data in Firestore. I'm using Java Admin SDK, following official guide: FirebaseAdminSDK. Sadly, I'm getting exceptions when FirebaseAp is being initialized:
java.lang.NoSuchMethodError: com.google.common.base.Preconditions.checkState(ZLjava/lang/String;Ljava/lang/Object;)V
at com.google.firebase.FirebaseApp.checkNotDeleted(FirebaseApp.java:352)
at com.google.firebase.FirebaseApp.getOptions(FirebaseApp.java:267)
at com.google.firebase.FirebaseApp$TokenRefresher.<init>(FirebaseApp.java:434)
at com.google.firebase.FirebaseApp$TokenRefresher$Factory.create(FirebaseApp.java:535)
at com.google.firebase.FirebaseApp.<init>(FirebaseApp.java:113)
at com.google.firebase.FirebaseApp.initializeApp(FirebaseApp.java:201)
at com.google.firebase.FirebaseApp.initializeApp(FirebaseApp.java:188)
Now, I read here and there, that it's problem with guava project and it is recommended to use different versions of guava library. I tried all versions starting from 18.
Then, I read that it can be caused by multiple guava libraries referenced by different libraries in my classpath in defferent versions fighting each other. So, I checked maven dependency tree to see if there are multiple dependencies on guava. Nope.
Then, I unpacked .WAR file to see what exact jars are being deployed to glassfish with my app. Only one guava jar is there (the one pointed by my pom.xml file).
To be honest, I've run out of ideas. Please help. You can see pom.xml and generated maven dependency tree appended below.
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.greenstudio</groupId>
<artifactId>trekking-project</artifactId>
<version>1.0</version>
<packaging>war</packaging>
<name>trekking-project</name>
<properties>
<endorsed.dir>${project.build.directory}/endorsed</endorsed.dir>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<dependencies>
<dependency>
<groupId>com.google.firebase</groupId>
<artifactId>firebase-admin</artifactId>
<version>5.6.0</version>
<exclusions>
<exclusion>
<artifactId>guava</artifactId>
<groupId>com.google.guava</groupId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>com.google.guava</groupId>
<artifactId>guava</artifactId>
<version>21.0</version>
</dependency>
<dependency>
<groupId>joda-time</groupId>
<artifactId>joda-time</artifactId>
<version>2.9.9</version>
</dependency>
<dependency>
<groupId>org.eclipse.persistence</groupId>
<artifactId>eclipselink</artifactId>
<version>2.5.2</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.eclipse.persistence</groupId>
<artifactId>org.eclipse.persistence.jpa.modelgen.processor</artifactId>
<version>2.5.2</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.apache.httpcomponents</groupId>
<artifactId>httpcore</artifactId>
<version>4.3.3</version>
<type>jar</type>
</dependency>
<dependency>
<groupId>org.apache.httpcomponents</groupId>
<artifactId>httpclient</artifactId>
<version>4.3.6</version>
<type>jar</type>
</dependency>
<dependency>
<groupId>primefaces</groupId>
<artifactId>primefaces</artifactId>
<version>5.3</version>
</dependency>
<dependency>
<groupId>primefaces.blacktie</groupId>
<artifactId>primefaces.blacktie</artifactId>
<version>1.0</version>
</dependency>
<dependency>
<groupId>bootstrap</groupId>
<artifactId>bootstrap</artifactId>
<version>1.0</version>
</dependency>
<dependency>
<groupId>org.apache.commons.validator.routines.EmailValidatororg.apache.commons.validator.routines.EmailValidator</groupId>
<artifactId>org.apache.commons.validator.routines.EmailValidator</artifactId>
<version>1.0</version>
<type>jar</type>
</dependency>
<dependency>
<groupId>javax</groupId>
<artifactId>javaee-web-api</artifactId>
<version>7.0</version>
<scope>provided</scope>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.1</version>
<configuration>
<source>1.7</source>
<target>1.7</target>
<compilerArguments>
<endorseddirs>${endorsed.dir}</endorseddirs>
</compilerArguments>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId>
<version>2.3</version>
<configuration>
<failOnMissingWebXml>false</failOnMissingWebXml>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<version>2.8</version>
<executions>
<execution>
<phase>validate</phase>
<goals>
<goal>copy</goal>
</goals>
<configuration>
<outputDirectory>${endorsed.dir}</outputDirectory>
<silent>true</silent>
<artifactItems>
<artifactItem>
<groupId>javax</groupId>
<artifactId>javaee-endorsed-api</artifactId>
<version>7.0</version>
<type>jar</type>
</artifactItem>
</artifactItems>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>
dependency tree
[INFO] Scanning for projects...
Downloading from central: https://repo.maven.apache.org/maven2/org/apache/maven/plugins/maven-dependency-plugin/2.8/maven-dependency-plugin-2.8.pom
Downloaded from central: https://repo.maven.apache.org/maven2/org/apache/maven/plugins/maven-dependency-plugin/2.8/maven-dependency-plugin-2.8.pom (11 kB at 18 kB/s)
Downloading from central: https://repo.maven.apache.org/maven2/org/apache/maven/plugins/maven-dependency-plugin/2.8/maven-dependency-plugin-2.8.jar
Downloaded from central: https://repo.maven.apache.org/maven2/org/apache/maven/plugins/maven-dependency-plugin/2.8/maven-dependency-plugin-2.8.jar (153 kB at 709 kB/s)
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building trekking-project 1.0
[INFO] ------------------------------------------------------------------------
[WARNING] The POM for primefaces:primefaces:jar:5.3 is missing, no dependency information available
[WARNING] The POM for primefaces.blacktie:primefaces.blacktie:jar:1.0 is missing, no dependency information available
[WARNING] The POM for bootstrap:bootstrap:jar:1.0 is missing, no dependency information available
[WARNING] The POM for org.apache.commons.validator.routines.EmailValidatororg.apache.commons.validator.routines.EmailValidator:org.apache.commons.validator.routines.EmailValidator:jar:1.0 is missing, no dependency information available
[INFO]
[INFO] --- maven-dependency-plugin:2.8:tree (default-cli) # trekking-project ---
Downloading from central: https://repo.maven.apache.org/maven2/org/codehaus/plexus/plexus-archiver/2.3/plexus-archiver-2.3.pom
Downloaded from central: https://repo.maven.apache.org/maven2/org/codehaus/plexus/plexus-archiver/2.3/plexus-archiver-2.3.pom (3.4 kB at 38 kB/s)
Downloading from central: https://repo.maven.apache.org/maven2/org/apache/maven/shared/maven-dependency-analyzer/1.4/maven-dependency-analyzer-1.4.pom
Downloaded from central: https://repo.maven.apache.org/maven2/org/apache/maven/shared/maven-dependency-analyzer/1.4/maven-dependency-analyzer-1.4.pom (5.2 kB at 58 kB/s)
Downloading from central: https://repo.maven.apache.org/maven2/org/codehaus/plexus/plexus-archiver/2.3/plexus-archiver-2.3.jar
Downloading from central: https://repo.maven.apache.org/maven2/org/apache/maven/shared/maven-dependency-analyzer/1.4/maven-dependency-analyzer-1.4.jar
Downloaded from central: https://repo.maven.apache.org/maven2/org/apache/maven/shared/maven-dependency-analyzer/1.4/maven-dependency-analyzer-1.4.jar (27 kB at 105 kB/s)
Downloaded from central: https://repo.maven.apache.org/maven2/org/codehaus/plexus/plexus-archiver/2.3/plexus-archiver-2.3.jar (186 kB at 704 kB/s)
[INFO] com.greenstudio:trekking-project:war:1.0
[INFO] +- com.google.firebase:firebase-admin:jar:5.6.0:compile
[INFO] | +- com.google.api-client:google-api-client:jar:1.22.0:compile
[INFO] | | +- com.google.oauth-client:google-oauth-client:jar:1.22.0:compile
[INFO] | | \- com.google.http-client:google-http-client-jackson2:jar:1.22.0:compile
[INFO] | | \- com.fasterxml.jackson.core:jackson-core:jar:2.1.3:compile
[INFO] | +- com.google.api-client:google-api-client-gson:jar:1.22.0:compile
[INFO] | | \- com.google.http-client:google-http-client-gson:jar:1.22.0:compile
[INFO] | | \- com.google.code.gson:gson:jar:2.1:compile
[INFO] | +- com.google.http-client:google-http-client:jar:1.22.0:compile
[INFO] | | \- com.google.code.findbugs:jsr305:jar:1.3.9:compile
[INFO] | +- com.google.api:api-common:jar:1.2.0:compile
[INFO] | +- com.google.auth:google-auth-library-oauth2-http:jar:0.8.0:compile
[INFO] | | \- com.google.auth:google-auth-library-credentials:jar:0.8.0:compile
[INFO] | +- com.google.cloud:google-cloud-storage:jar:1.7.0:compile
[INFO] | | +- com.google.cloud:google-cloud-core:jar:1.7.0:compile
[INFO] | | | +- com.google.api:gax:jar:1.8.1:compile
[INFO] | | | +- com.google.protobuf:protobuf-java-util:jar:3.3.1:compile
[INFO] | | | +- com.google.api.grpc:proto-google-common-protos:jar:0.1.20:compile
[INFO] | | | \- com.google.api.grpc:proto-google-iam-v1:jar:0.1.20:compile
[INFO] | | +- com.google.cloud:google-cloud-core-http:jar:1.7.0:compile
[INFO] | | | +- com.google.http-client:google-http-client-appengine:jar:1.22.0:compile
[INFO] | | | \- com.google.http-client:google-http-client-jackson:jar:1.22.0:compile
[INFO] | | | \- org.codehaus.jackson:jackson-core-asl:jar:1.9.11:compile
[INFO] | | \- com.google.apis:google-api-services-storage:jar:v1-rev108-1.22.0:compile
[INFO] | +- com.google.cloud:google-cloud-firestore:jar:0.25.0-beta:compile
[INFO] | | +- io.netty:netty-tcnative-boringssl-static:jar:2.0.3.Final:compile
[INFO] | | +- com.google.cloud:google-cloud-core-grpc:jar:1.7.0:compile
[INFO] | | | +- com.google.protobuf:protobuf-java:jar:3.3.1:compile
[INFO] | | | +- io.grpc:grpc-protobuf:jar:1.6.1:compile
[INFO] | | | | \- io.grpc:grpc-protobuf-lite:jar:1.6.1:compile
[INFO] | | | \- io.grpc:grpc-context:jar:1.6.1:compile
[INFO] | | +- com.google.api:gax-grpc:jar:0.25.1:compile
[INFO] | | | +- com.google.auto.value:auto-value:jar:1.2:compile
[INFO] | | | \- org.threeten:threetenbp:jar:1.3.3:compile
[INFO] | | +- com.google.api.grpc:proto-google-cloud-firestore-v1beta1:jar:0.1.20:compile
[INFO] | | +- io.grpc:grpc-netty:jar:1.6.1:compile
[INFO] | | | +- io.grpc:grpc-core:jar:1.6.1:compile (version selected from constraint [1.6.1,1.6.1])
[INFO] | | | | +- com.google.errorprone:error_prone_annotations:jar:2.0.19:compile
[INFO] | | | | +- com.google.instrumentation:instrumentation-api:jar:0.4.3:compile
[INFO] | | | | \- io.opencensus:opencensus-api:jar:0.5.1:compile
[INFO] | | | +- io.netty:netty-codec-http2:jar:4.1.14.Final:compile (version selected from constraint [4.1.14.Final,4.1.14.Final])
[INFO] | | | \- io.netty:netty-handler-proxy:jar:4.1.14.Final:compile
[INFO] | | | \- io.netty:netty-codec-socks:jar:4.1.14.Final:compile
[INFO] | | +- io.grpc:grpc-stub:jar:1.6.1:compile
[INFO] | | \- io.grpc:grpc-auth:jar:1.6.1:compile
[INFO] | +- org.json:json:jar:20160810:compile
[INFO] | +- org.slf4j:slf4j-api:jar:1.7.25:compile
[INFO] | +- io.netty:netty-codec-http:jar:4.1.14.Final:compile
[INFO] | | \- io.netty:netty-codec:jar:4.1.14.Final:compile
[INFO] | +- io.netty:netty-handler:jar:4.1.14.Final:compile
[INFO] | | \- io.netty:netty-buffer:jar:4.1.14.Final:compile
[INFO] | | \- io.netty:netty-common:jar:4.1.14.Final:compile
[INFO] | \- io.netty:netty-transport:jar:4.1.14.Final:compile
[INFO] | \- io.netty:netty-resolver:jar:4.1.14.Final:compile
[INFO] +- com.google.guava:guava:jar:21.0:compile
[INFO] +- joda-time:joda-time:jar:2.9.9:compile
[INFO] +- org.eclipse.persistence:eclipselink:jar:2.5.2:provided
[INFO] | +- org.eclipse.persistence:javax.persistence:jar:2.1.0:provided
[INFO] | \- org.eclipse.persistence:commonj.sdo:jar:2.1.1:provided
[INFO] +- org.eclipse.persistence:org.eclipse.persistence.jpa.modelgen.processor:jar:2.5.2:provided
[INFO] | +- org.eclipse.persistence:org.eclipse.persistence.core:jar:2.5.2:provided
[INFO] | | \- org.eclipse.persistence:org.eclipse.persistence.asm:jar:2.5.2:provided
[INFO] | \- org.eclipse.persistence:org.eclipse.persistence.jpa:jar:2.5.2:provided
[INFO] | +- org.eclipse.persistence:org.eclipse.persistence.antlr:jar:2.5.2:provided
[INFO] | \- org.eclipse.persistence:org.eclipse.persistence.jpa.jpql:jar:2.5.2:provided
[INFO] +- org.apache.httpcomponents:httpcore:jar:4.3.3:compile
[INFO] +- org.apache.httpcomponents:httpclient:jar:4.3.6:compile
[INFO] | +- commons-logging:commons-logging:jar:1.1.3:compile
[INFO] | \- commons-codec:commons-codec:jar:1.6:compile
[INFO] +- primefaces:primefaces:jar:5.3:compile
[INFO] +- primefaces.blacktie:primefaces.blacktie:jar:1.0:compile
[INFO] +- bootstrap:bootstrap:jar:1.0:compile
[INFO] +- org.apache.commons.validator.routines.EmailValidatororg.apache.commons.validator.routines.EmailValidator:org.apache.commons.validator.routines.EmailValidator:jar:1.0:compile
[INFO] \- javax:javaee-web-api:jar:7.0:provided
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 4.897 s
[INFO] Finished at: 2018-01-12T10:16:59+01:00
[INFO] Final Memory: 15M/215M
[INFO] ------------------------------------------------------------------------
I even downloaded github repository of google firebase sdk and got rid of all guava code references there, but then I'm getting similar errors when trying to read/write Firestore. It seems that some other google libraries depend on that crappy little jar as well.
I had the same problem with Guava versions in different dependencies.
I resolved this in Gradle like this :
configurations.all {
resolutionStrategy {
force 'com.google.guava:guava:17.0'
}
}
There should be a Maven way, otherwise exclude Guava from all your dependencies and add it explicitly with your version.
It enforces Guava version globally. Fortunatelly for me, version 17 was compatible with all my dependencies. Neither 16- nor 18+ were... Sad thing these are using Guava.
Hope it helps,
Regards
I try run unit test for rest controller follow http://spring.io/guides/tutorials/bookmarks/
#RunWith(SpringJUnit4ClassRunner.class)
#SpringApplicationConfiguration(classes = Application.class)
#WebAppConfiguration
public class GreetingControllerTest {
//body
}
For this class I always get error:
java.lang.NoSuchMethodError: org.springframework.core.annotation.AnnotationUtils.isInJavaLangAnnotationPackage(Ljava/lang/annotation/Annotation;)
I found that someone had similar error because he used few spring versions (java.lang.NoSuchMethodError: org.springframework.core.annotation.AnnotationUtils.isInJavaLangAnnotationPackage(Ljava/lang/annotation/Annotation;)Z)
But I think that I use newest libraries and it isn't problem. For reliability I attach my 'mvn dependency:tree' result
[INFO] +- org.springframework.boot:spring-boot-starter- web:jar:1.2.7.RELEASE:compile
[INFO] | +- org.springframework.boot:spring-boot-starter:jar:1.2.7.RELEASE:compile
[INFO] | | +- org.springframework.boot:spring-boot:jar:1.2.7.RELEASE:compile
[INFO] | | +- org.springframework.boot:spring-boot-autoconfigure:jar:1.2.7.RELEASE:compile
[INFO] | | +- org.springframework.boot:spring-boot-starter-logging:jar:1.2.7.RELEASE:compile
[INFO] | | | +- org.slf4j:jul-to-slf4j:jar:1.7.12:compile
[INFO] | | | +- org.slf4j:log4j-over-slf4j:jar:1.7.12:compile
[INFO] | | | \- ch.qos.logback:logback-classic:jar:1.1.3:compile
[INFO] | | | \- ch.qos.logback:logback-core:jar:1.1.3:compile
[INFO] | | \- org.yaml:snakeyaml:jar:1.14:compile
[INFO] | +- com.fasterxml.jackson.core:jackson-databind:jar:2.4.6:compile
[INFO] | | +- com.fasterxml.jackson.core:jackson-annotations:jar:2.4.6:compile
[INFO] | | \- com.fasterxml.jackson.core:jackson-core:jar:2.4.6:compile
[INFO] | +- org.hibernate:hibernate-validator:jar:5.1.3.Final:compile
[INFO] | | +- javax.validation:validation-api:jar:1.1.0.Final:compile
[INFO] | | +- org.jboss.logging:jboss-logging:jar:3.1.3.GA:compile
[INFO] | | \- com.fasterxml:classmate:jar:1.0.0:compile
[INFO] | +- org.springframework:spring-core:jar:4.1.8.RELEASE:compile
[INFO] | +- org.springframework:spring-web:jar:4.1.8.RELEASE:compile
[INFO] | \- org.springframework:spring-webmvc:jar:4.1.8.RELEASE:compile
[INFO] +- org.springframework.boot:spring-boot-starter-data-jpa:jar:1.2.7.RELEASE:compile
[INFO] | +- org.springframework.boot:spring-boot-starter-aop:jar:1.2.7.RELEASE:compile
[INFO] | | +- org.aspectj:aspectjrt:jar:1.8.7:compile
[INFO] | | \- org.aspectj:aspectjweaver:jar:1.8.7:compile
[INFO] | +- org.springframework.boot:spring-boot-starter-jdbc:jar:1.2.7.RELEASE:compile
[INFO] | | \- org.apache.tomcat:tomcat-jdbc:jar:8.0.28:compile
[INFO] | | \- org.apache.tomcat:tomcat-juli:jar:8.0.28:compile
[INFO] | +- org.hibernate:hibernate-entitymanager:jar:4.3.11.Final:compile
[INFO] | | +- org.jboss.logging:jboss-logging-annotations:jar:1.2.0.Beta1:compile
[INFO] | | +- org.hibernate:hibernate-core:jar:4.3.11.Final:compile
[INFO] | | | +- antlr:antlr:jar:2.7.7:compile
[INFO] | | | \- org.jboss:jandex:jar:1.1.0.Final:compile
[INFO] | | +- dom4j:dom4j:jar:1.6.1:compile
[INFO] | | | \- xml-apis:xml-apis:jar:1.0.b2:compile
[INFO] | | +- org.hibernate.common:hibernate-commons-annotations:jar:4.0.5.Final:compile
[INFO] | | +- org.hibernate.javax.persistence:hibernate-jpa-2.1-api:jar:1.0.0.Final:compile
[INFO] | | \- org.javassist:javassist:jar:3.18.1-GA:compile
[INFO] | +- javax.transaction:javax.transaction-api:jar:1.2:compile
[INFO] | +- org.springframework:spring-orm:jar:4.1.8.RELEASE:compile
[INFO] | +- org.springframework.data:spring-data-jpa:jar:1.7.4.RELEASE:compile
[INFO] | | +- org.springframework.data:spring-data-commons:jar:1.9.4.RELEASE:compile
[INFO] | | +- org.slf4j:slf4j-api:jar:1.7.12:compile
[INFO] | | \- org.slf4j:jcl-over-slf4j:jar:1.7.12:compile
[INFO] | \- org.springframework:spring-aspects:jar:4.1.8.RELEASE:compile
[INFO] +- org.springframework.boot:spring-boot-starter-security:jar:1.2.7.RELEASE:compile
[INFO] | +- org.springframework:spring-beans:jar:4.1.8.RELEASE:compile
[INFO] | +- org.springframework:spring-context:jar:4.1.8.RELEASE:compile
[INFO] | +- org.springframework:spring-expression:jar:4.1.8.RELEASE:compile
[INFO] | +- org.springframework.security:spring-security-config:jar:3.2.8.RELEASE:compile
[INFO] | | \- aopalliance:aopalliance:jar:1.0:compile
[INFO] | +- org.springframework.security:spring-security-web:jar:3.2.8.RELEASE:compile
[INFO] | \- org.springframework:spring-aop:jar:4.1.8.RELEASE:compile
[INFO] +- org.springframework:spring-jdbc:jar:4.1.8.RELEASE:compile
[INFO] | \- org.springframework:spring-tx:jar:4.1.8.RELEASE:compile
[INFO] +- com.h2database:h2:jar:1.4.190:compile
[INFO] +- org.springframework.boot:spring-boot-starter-tomcat:jar:1.2.7.RELEASE:compile
[INFO] | +- org.apache.tomcat.embed:tomcat-embed-core:jar:8.0.28:compile
[INFO] | +- org.apache.tomcat.embed:tomcat-embed-el:jar:8.0.28:compile
[INFO] | +- org.apache.tomcat.embed:tomcat-embed-logging-juli:jar:8.0.28:compile
[INFO] | \- org.apache.tomcat.embed:tomcat-embed-websocket:jar:8.0.28:compile
[INFO] +- org.springframework.security.oauth:spring-security-oauth2:jar:2.0.7.RELEASE:compile
[INFO] | +- org.springframework.security:spring-security-core:jar:3.2.8.RELEASE:compile
[INFO] | +- commons-codec:commons-codec:jar:1.6:compile
[INFO] | \- org.codehaus.jackson:jackson-mapper-asl:jar:1.9.13:compile
[INFO] | \- org.codehaus.jackson:jackson-core-asl:jar:1.9.13:compile
[INFO] +- org.springframework:spring-test:jar:4.1.8.RELEASE:test
[INFO] \- junit:junit:jar:4.12:test
[INFO] \- org.hamcrest:hamcrest-core:jar:1.3:test
Edit:
Attached pom file:
<?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>team.pocket.lublin</groupId>
<artifactId>pocket-lublin</artifactId>
<version>1.0.0-SNAPSHOT</version>
<properties>
<java.version>1.8</java.version>
</properties>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>1.2.7.RELEASE</version>
</parent>
<packaging>war</packaging>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-jpa</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-security</artifactId>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-jdbc</artifactId>
</dependency>
<dependency>
<groupId>com.h2database</groupId>
<artifactId>h2</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-tomcat</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.security.oauth</groupId>
<artifactId>spring-security-oauth2</artifactId>
<version>2.0.7.RELEASE</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-test</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.12</version>
<scope>test</scope>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
</plugins>
</build>
<repositories>
<repository>
<id>spring-releases</id>
<url>https://repo.spring.io/libs-release</url>
</repository>
</repositories>
<pluginRepositories>
<pluginRepository>
<id>spring-releases</id>
<url>https://repo.spring.io/libs-release</url>
</pluginRepository>
</pluginRepositories>
</project>
I've recently prepared spring-boot configuration to work properly on a standalone jetty.
I've encountered a strange behavior from maven. It adds jars to my .war archive which are not present in mvn dependency:tree. I've worked around the problem by adding this to my pom.xml:
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId>
<configuration>
<packagingExcludes>WEB-INF/lib/tomcat-*.jar</packagingExcludes>
</configuration>
</plugin>
But that's obviously an ugly solution.
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.pretius</groupId>
<artifactId>springBootJettyExample</artifactId>
<version>0.0.1-SNAPSHOT</version>
<name>Spring-Boot jetty example app</name>
<packaging>war</packaging>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>1.3.0.BUILD-SNAPSHOT</version>
</parent>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
<exclusions>
<exclusion>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-tomcat</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-jetty</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-jdbc</artifactId>
<exclusions>
<exclusion>
<groupId>org.apache.tomcat</groupId>
<artifactId>tomcat-jdbc</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-jpa</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-actuator</artifactId>
</dependency>
<dependency>
<groupId>org.hsqldb</groupId>
<artifactId>hsqldb</artifactId>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-log4j12</artifactId>
</dependency>
</dependencies>
<build>
<finalName>spbj-example</finalName>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId>
<configuration>
<packagingExcludes>WEB-INF/lib/tomcat-*.jar</packagingExcludes>
</configuration>
</plugin>
</plugins>
</build>
<repositories>
<repository>
<id>spring-snapshots</id>
<url>http://repo.spring.io/snapshot</url>
<snapshots>
<enabled>true</enabled>
</snapshots>
</repository>
<repository>
<id>spring-milestones</id>
<url>http://repo.spring.io/milestone</url>
</repository>
</repositories>
<pluginRepositories>
<pluginRepository>
<id>spring-snapshots</id>
<url>http://repo.spring.io/snapshot</url>
</pluginRepository>
<pluginRepository>
<id>spring-milestones</id>
<url>http://repo.spring.io/milestone</url>
</pluginRepository>
</pluginRepositories>
</project>
mvn dependency:tree:
[INFO] Scanning for projects...
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building Spring-Boot jetty example app 0.0.1-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] --- maven-dependency-plugin:2.10:tree (default-cli) # springBootJettyExample ---
[INFO] com.pretius:springBootJettyExample:war:0.0.1-SNAPSHOT
[INFO] +- org.springframework.boot:spring-boot-starter-web:jar:1.3.0.BUILD-SNAPSHOT:compile
[INFO] | +- org.springframework.boot:spring-boot-starter:jar:1.3.0.BUILD-SNAPSHOT:compile
[INFO] | | +- org.springframework.boot:spring-boot:jar:1.3.0.BUILD-SNAPSHOT:compile
[INFO] | | +- org.springframework.boot:spring-boot-autoconfigure:jar:1.3.0.BUILD-SNAPSHOT:compile
[INFO] | | +- org.springframework.boot:spring-boot-starter-logging:jar:1.3.0.BUILD-SNAPSHOT:compile
[INFO] | | | +- ch.qos.logback:logback-classic:jar:1.1.3:compile
[INFO] | | | | \- ch.qos.logback:logback-core:jar:1.1.3:compile
[INFO] | | | +- org.slf4j:jul-to-slf4j:jar:1.7.12:compile
[INFO] | | | \- org.slf4j:log4j-over-slf4j:jar:1.7.12:compile
[INFO] | | +- org.springframework:spring-core:jar:4.2.2.BUILD-SNAPSHOT:compile
[INFO] | | \- org.yaml:snakeyaml:jar:1.16:runtime
[INFO] | +- org.springframework.boot:spring-boot-starter-validation:jar:1.3.0.BUILD-SNAPSHOT:compile
[INFO] | | +- org.apache.tomcat.embed:tomcat-embed-el:jar:8.0.26:compile
[INFO] | | \- org.hibernate:hibernate-validator:jar:5.2.1.Final:compile
[INFO] | | +- javax.validation:validation-api:jar:1.1.0.Final:compile
[INFO] | | \- com.fasterxml:classmate:jar:1.1.0:compile
[INFO] | +- com.fasterxml.jackson.core:jackson-databind:jar:2.6.1:compile
[INFO] | | +- com.fasterxml.jackson.core:jackson-annotations:jar:2.6.1:compile
[INFO] | | \- com.fasterxml.jackson.core:jackson-core:jar:2.6.1:compile
[INFO] | +- org.springframework:spring-web:jar:4.2.2.BUILD-SNAPSHOT:compile
[INFO] | | +- org.springframework:spring-aop:jar:4.2.2.BUILD-SNAPSHOT:compile
[INFO] | | | \- aopalliance:aopalliance:jar:1.0:compile
[INFO] | | +- org.springframework:spring-beans:jar:4.2.2.BUILD-SNAPSHOT:compile
[INFO] | | \- org.springframework:spring-context:jar:4.2.2.BUILD-SNAPSHOT:compile
[INFO] | \- org.springframework:spring-webmvc:jar:4.2.2.BUILD-SNAPSHOT:compile
[INFO] | \- org.springframework:spring-expression:jar:4.2.2.BUILD-SNAPSHOT:compile
[INFO] +- org.springframework.boot:spring-boot-starter-jetty:jar:1.3.0.BUILD-SNAPSHOT:provided
[INFO] | +- org.eclipse.jetty:jetty-servlets:jar:9.2.13.v20150730:provided
[INFO] | | +- org.eclipse.jetty:jetty-continuation:jar:9.2.13.v20150730:provided
[INFO] | | +- org.eclipse.jetty:jetty-http:jar:9.2.13.v20150730:provided
[INFO] | | +- org.eclipse.jetty:jetty-util:jar:9.2.13.v20150730:provided
[INFO] | | \- org.eclipse.jetty:jetty-io:jar:9.2.13.v20150730:provided
[INFO] | +- org.eclipse.jetty:jetty-webapp:jar:9.2.13.v20150730:provided
[INFO] | | +- org.eclipse.jetty:jetty-xml:jar:9.2.13.v20150730:provided
[INFO] | | \- org.eclipse.jetty:jetty-servlet:jar:9.2.13.v20150730:provided
[INFO] | | \- org.eclipse.jetty:jetty-security:jar:9.2.13.v20150730:provided
[INFO] | | \- org.eclipse.jetty:jetty-server:jar:9.2.13.v20150730:provided
[INFO] | +- org.eclipse.jetty.websocket:websocket-server:jar:9.2.13.v20150730:provided
[INFO] | | +- org.eclipse.jetty.websocket:websocket-common:jar:9.2.13.v20150730:provided
[INFO] | | | \- org.eclipse.jetty.websocket:websocket-api:jar:9.2.13.v20150730:provided
[INFO] | | +- org.eclipse.jetty.websocket:websocket-client:jar:9.2.13.v20150730:provided
[INFO] | | \- org.eclipse.jetty.websocket:websocket-servlet:jar:9.2.13.v20150730:provided
[INFO] | | \- javax.servlet:javax.servlet-api:jar:3.1.0:provided
[INFO] | \- org.eclipse.jetty.websocket:javax-websocket-server-impl:jar:9.2.13.v20150730:provided
[INFO] | +- org.eclipse.jetty:jetty-annotations:jar:9.2.13.v20150730:provided
[INFO] | | +- org.eclipse.jetty:jetty-plus:jar:9.2.13.v20150730:provided
[INFO] | | | \- org.eclipse.jetty:jetty-jndi:jar:9.2.13.v20150730:provided
[INFO] | | +- javax.annotation:javax.annotation-api:jar:1.2:provided
[INFO] | | +- org.ow2.asm:asm:jar:5.0.1:provided
[INFO] | | \- org.ow2.asm:asm-commons:jar:5.0.1:provided
[INFO] | | \- org.ow2.asm:asm-tree:jar:5.0.1:provided
[INFO] | +- org.eclipse.jetty.websocket:javax-websocket-client-impl:jar:9.2.13.v20150730:provided
[INFO] | \- javax.websocket:javax.websocket-api:jar:1.0:provided
[INFO] +- org.springframework.boot:spring-boot-starter-jdbc:jar:1.3.0.BUILD-SNAPSHOT:compile
[INFO] | \- org.springframework:spring-jdbc:jar:4.2.2.BUILD-SNAPSHOT:compile
[INFO] | \- org.springframework:spring-tx:jar:4.2.2.BUILD-SNAPSHOT:compile
[INFO] +- org.springframework.boot:spring-boot-starter-data-jpa:jar:1.3.0.BUILD-SNAPSHOT:compile
[INFO] | +- org.springframework.boot:spring-boot-starter-aop:jar:1.3.0.BUILD-SNAPSHOT:compile
[INFO] | | +- org.aspectj:aspectjrt:jar:1.8.6:compile
[INFO] | | \- org.aspectj:aspectjweaver:jar:1.8.6:compile
[INFO] | +- org.hibernate:hibernate-entitymanager:jar:4.3.11.Final:compile
[INFO] | | +- org.jboss.logging:jboss-logging:jar:3.1.3.GA:compile
[INFO] | | +- org.jboss.logging:jboss-logging-annotations:jar:1.2.0.Beta1:compile
[INFO] | | +- org.hibernate:hibernate-core:jar:4.3.11.Final:compile
[INFO] | | | +- antlr:antlr:jar:2.7.7:compile
[INFO] | | | \- org.jboss:jandex:jar:1.1.0.Final:compile
[INFO] | | +- dom4j:dom4j:jar:1.6.1:compile
[INFO] | | | \- xml-apis:xml-apis:jar:1.0.b2:compile
[INFO] | | +- org.hibernate.common:hibernate-commons-annotations:jar:4.0.5.Final:compile
[INFO] | | +- org.hibernate.javax.persistence:hibernate-jpa-2.1-api:jar:1.0.0.Final:compile
[INFO] | | \- org.javassist:javassist:jar:3.18.1-GA:compile
[INFO] | +- javax.transaction:javax.transaction-api:jar:1.2:compile
[INFO] | +- org.springframework.data:spring-data-jpa:jar:1.9.0.RELEASE:compile
[INFO] | | +- org.springframework.data:spring-data-commons:jar:1.11.0.RELEASE:compile
[INFO] | | +- org.springframework:spring-orm:jar:4.2.2.BUILD-SNAPSHOT:compile
[INFO] | | \- org.slf4j:jcl-over-slf4j:jar:1.7.12:compile
[INFO] | \- org.springframework:spring-aspects:jar:4.2.2.BUILD-SNAPSHOT:compile
[INFO] +- org.springframework.boot:spring-boot-starter-actuator:jar:1.3.0.BUILD-SNAPSHOT:compile
[INFO] | \- org.springframework.boot:spring-boot-actuator:jar:1.3.0.BUILD-SNAPSHOT:compile
[INFO] +- org.hsqldb:hsqldb:jar:2.3.3:runtime
[INFO] \- org.slf4j:slf4j-log4j12:jar:1.7.12:compile
[INFO] +- org.slf4j:slf4j-api:jar:1.7.12:compile
[INFO] \- log4j:log4j:jar:1.2.17:compile
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 2.746 s
[INFO] Finished at: 2015-10-05T09:36:47+02:00
[INFO] Final Memory: 21M/309M
[INFO] ------------------------------------------------------------------------
(Yes, there is one tomcat lib in the tree, but there are several added to .war)
Unwanted jars:
tomcat-embed-core-8.0.26.jar
tomcat-embed-logging-juli-8.0.26.jar
tomcat-embed-websocket-8.0.26.jar
tomcat-jdbc-8.0.26.jar
tomcat-juli-8.0.26.jar
Here's a link to the sample application.
What is adding the tomcat* jars to my .war? How can I stop it doing so?
Well when I run maven package this pom produces two war files one named "spbj-example.war" for running with
org.springframework.boot.loader.WarLauncher
and another one named "spbj-example.war.original".
You should use the second war which doesn't contain anything related to servers.
The first one contains a lib directory in which you have jar files to run a server like "jetty-server-9.2.13.v20150730.jar" and lots of others.
So most likey problem is related to your dirty "target" directory.
You should use
mvn clean package/install