I'm working on a project that uses the Prosys-OPC-UA-Java-SDK-Client-Binary-2.2.6-708
library (it's an opc-ua client). This library has a series of dependencies:
- 'Opc.A.Stack-1.02.336.8'
- 'org.bouncycastle: bcprov-jdk15on: 1.52'
- 'org.bouncycastle: bcpkix-jdk15on: 1.52'
- 'log4j: log4j: 1.2.17'
- 'commons-logging: commons-logging: 1.1.1'
- 'org.apache.httpcomponents: httpclient: 4.3.6'
- 'org.apache.httpcomponents: httpcore: 4.3.3'
- 'org.apache.httpcomponents: httpcore-nio: 4.3.3'
When I try to deploy my Tomcat project, the server throws the following error:
Caused by: java.lang.NoClassDefFoundError: org/slf4j/LoggerFactory
at org.atmosphere.util.IOUtils.<clinit>(IOUtils.java:58)
at org.atmosphere.cpr.ContainerInitializer.onStartup(ContainerInitializer.java:58)
at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5244)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:147)
... 42 more
Caused by: java.lang.ClassNotFoundException: org.slf4j.LoggerFactory
at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1308)
at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1142)
... 46 more
From what I have read, the dependency slf4j-api
requires an implementation. In my case I provided the implementation of slf4j-log4j12
. Next I present the dependencies of the file build.gradle
of the project:
dependencies {
compile 'org.hibernate:hibernate-core:5.2.3.Final'
compile 'org.hibernate:hibernate-entitymanager:5.2.3.Final'
compile 'org.hibernate:hibernate-c3p0:5.2.3.Final'
compile 'org.hibernate.javax.persistence:hibernate-jpa-2.1-api:1.0.0.Final-redhat-1'
compile group: 'commons-collections', name: 'commons-collections', version: '3.2.1'
compile group: 'org.apache.commons', name: 'commons-lang3', version: '3.0.1'
compile group: 'mysql', name: 'mysql-connector-java', version: '5.1.35'
compile group: 'javax.mail', name: 'mail', version: '1.4'
compile group: 'commons-digester', name: 'commons-digester', version: '2.1'
compile group: 'com.lowagie', name: 'itext', version: '4.2.1'
compile group: 'net.sf.jasperreports', name: 'jasperreports', version: '5.1.0'
compile group: 'net.sf.jasperreports', name: 'jasperreports-fonts', version: '5.6.1'
compile group: 'org.apache.poi', name: 'poi', version: '3.7'
compile group: 'org.apache.poi', name: 'poi-ooxml', version: '3.7'
compile group: 'org.apache.poi', name: 'poi-ooxml-schemas', version: '3.7'
compile name: 'bcprov-jdk16-146'
// Librerías para la versión 2.2.6-708 de prosys
compile name: 'Opc.Ua.Stack-1.02.336.8'
compile name: 'Prosys-OPC-UA-Java-SDK-Client-Binary-2.2.6-708'
compile 'org.bouncycastle:bcprov-jdk15on:1.52'
compile 'org.bouncycastle:bcpkix-jdk15on:1.52'
compile 'commons-logging:commons-logging:1.1.1'
compile 'org.apache.httpcomponents:httpclient:4.3.6'
compile 'org.apache.httpcomponents:httpcore:4.3.3'
compile 'org.apache.httpcomponents:httpcore-nio:4.3.3'
compile 'log4j:log4j:1.2.17'
compile name: 'sc-core-1.52.0.0'
compile name: 'scpkix-1.52.0.0'
compile name: 'scprov-1.52.0.0'
compile 'org.slf4j:slf4j-api:1.7.7'
compile 'org.slf4j:slf4j-log4j12:1.7.7'
compile group: 'commons-io', name: 'commons-io', version: '2.4'
compile(group: 'org.quartz-scheduler', name: 'quartz', version: '2.1.0') {
exclude(module: 'c3p0')
}
compile group: 'net.objecthunter', name: 'exp4j', version: '0.4.3.BETA-3'
testCompile group: 'junit', name: 'junit', version: '4.10'
provided group: 'javax', name: 'javaee-api', version: '7.0'
compile group: 'com.h2database', name: 'h2', version: '1.4.187'
}
I am using the 8.0.32 version of tomcat.