Hi, I am trying to get the gradle-tomcat-plugin working - we are running gradle + maven concurrently because haven’t ever been able to get tomcat plugin working in gradle.
The tomcatRun and tomcatRunWar tasks don’t work - tomcatRunWar has library issues and tomcatRun seems to just load an empty webapp.
build.gradle:
apply plugin: "war"
apply plugin: "groovy"
apply plugin: "tomcat"
buildscript {
classpath "gradle-tomcat-plugin:gradle-tomcat-plugin:0.8.2", "org.apache.tomcat:catalina:6.0.35" // and coyote, jasper, jdbc, mysql, etc
}
dependencies {
tomcat "org.jboss.weld.servlet:weld-servlet:1.1.3.Final"
}
war {
from('../content/src/main/webapp/resources') { into('resources') }
webXml = file('src/main/resources/web.xml')
}
tomcatRun {
dependsOn("war")
contextPath = ""
webDefaultXml = file("src/main/resources/web.xml")
configFile = file("src/main/etc/embedded-context.xml")
}
tomcatRunWar {
contextPath = ""
webDefaultXml = file("src/main/resources/web.xml")
configFile = file("src/main/etc/embedded-context.xml")
}
tomcatRunWar has slf4j errors - it seems like an incorrect version of slf4j is being loaded instead of 1.5.8, as is configured in upstream projects (I have compile project(":server") dependency, and the server module uses slf4j 1.5.8). I have tried manually adding slf4j 1.5.8 to the tomcat configuration, and get the same error:
:web:war
:web:tomcatRunWar
Error configuring application listener of class org.jboss.weld.environment.servlet.Listener
java.lang.NoSuchMethodError: org.slf4j.spi.LocationAwareLogger.log(Lorg/slf4j/Marker;Ljava/lang/String;ILjava/lang/String;Ljava/lang/Throwable;)V
... stacktrace...
Skipped installing application listeners due to previous error(s)
Error listenerStart
Context [/] startup failed due to previous errors
Started Tomcat Server
The Server is running at http://localhost:8080/
tomcatRun seems to initialize find, but no webapp is available:
:artemis-web:war
:artemis-web:tomcatRun
SLF4J: Class path contains multiple SLF4J bindings.
SLF4J: Found binding in [jar:file:/usr/local/gradle/gradle-1.0-milestone-7/lib/logback-classic-1.0.0.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: Found binding in [jar:file:/home/brett/.gradle/caches/artifacts-7/artifacts/30e551990fc3185e7269f863a1c1b023/org.jboss.weld.servlet/weld-servlet/1.1.3.Final/jar/weld-servlet-1.1.3.Final.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: Found binding in [jar:file:/home/brett/.gradle/caches/artifacts-7/artifacts/30e551990fc3185e7269f863a1c1b023/org.jboss.weld.servlet/weld-servlet/1.1.3.Final/jar/weld-servlet-1.1.3.Final.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: Found binding in [jar:file:/home/brett/.gradle/caches/artifacts-7/artifacts/30e551990fc3185e7269f863a1c1b023/org.slf4j/slf4j-log4j12/1.5.8/jar/slf4j-log4j12-1.5.8.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: See http://www.slf4j.org/codes.html#multiple_bindings for an explanation.
Class 'javax.ejb.PostActivate' not found, interception based on it is not enabled
Class 'javax.ejb.PrePassivate' not found, interception based on it is not enabled
Started Tomcat Server
The Server is running at http://localhost:8080/
startup above looks fine, but when I try access the webapp, I get:
Exception in thread "http-8080-1" java.lang.NullPointerException
at java.util.concurrent.ConcurrentLinkedQueue.offer(ConcurrentLinkedQueue.java:190)
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler$1.offer(Http11Protocol.java:551)
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler$1.offer(Http11Protocol.java:568)
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:632)
at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:489)
at java.lang.Thread.run(Thread.java:619)
Any suggestions on where I am going wrong?