Adds support for Tomcat and Servlet API to a Grails application.
Requires cache plugin 1.1.6 or above.
This project forked from burtbeckwith/grails-tomcat-plugin
Adds support for Tomcat and Servlet API to a Grails application.
Requires cache plugin 1.1.6 or above.
I am working on a Grails 2.5.4 application and I just tried upgrading to tomcat plugin version 7.0.52
and now every URL is giving out 404
. What is going on?
In my fork I have a working plugin with Tomcat 9.0.X, you can download, compare and build yourself.
Run-app fails on Tomcat8 when JNDI resources are defined in Config.groovy (grails.naming.entries
) with the message below.
It appears InlineExplodedTomcatServer.groovy tries to load a org.apache.catalina.deploy.ContextResource
(in line 191) which is nowhere to be found in Tomcat 8.
The problem does not occur using Tomcat 7 in which this class is present.
The stacktrace is:
| Running Grails application
| Error Server failed to start: org.apache.catalina.deploy.ContextResource (NOTE: Stack trace has been filtered. Use --verbose to see entire trace.)
java.lang.ClassNotFoundException: org.apache.catalina.deploy.ContextResource
at org.grails.plugins.tomcat.InlineExplodedTomcatServer.loadInstance(InlineExplodedTomcatServer.groovy:168)
at org.grails.plugins.tomcat.InlineExplodedTomcatServer$_preStart_closure2.doCall(InlineExplodedTomcatServer.groovy:191)
at org.grails.plugins.tomcat.InlineExplodedTomcatServer.preStart(InlineExplodedTomcatServer.groovy:182)
at org.grails.plugins.tomcat.InlineExplodedTomcatServer.doStart(InlineExplodedTomcatServer.groovy:107)
at org.grails.plugins.tomcat.TomcatServer.start(TomcatServer.groovy:146)
at grails.web.container.EmbeddableServer$start.call(Unknown Source)
at _GrailsRun$_run_closure1.doCall(_GrailsRun.groovy:60)
at org.codehaus.gant.GantMetaClass.invokeMethod(GantMetaClass.java:133)
at org.codehaus.gant.GantBinding$_initializeGantBinding_closure5_closure16_closure18.doCall(GantBinding.groovy:185)
at org.codehaus.gant.GantBinding$_initializeGantBinding_closure5_closure16_closure18.doCall(GantBinding.groovy)
at org.codehaus.gant.GantBinding.withTargetEvent(GantBinding.groovy:90)
at org.codehaus.gant.GantBinding.this$4$withTargetEvent(GantBinding.groovy)
at org.codehaus.gant.GantBinding$_initializeGantBinding_closure5_closure16.doCall(GantBinding.groovy:185)
at org.codehaus.gant.GantBinding$_initializeGantBinding_closure5_closure16.doCall(GantBinding.groovy)
at org.codehaus.gant.GantMetaClass.invokeMethod(GantMetaClass.java:133)
at RunApp$_run_closure1.doCall(RunApp:33)
at org.codehaus.gant.GantMetaClass.invokeMethod(GantMetaClass.java:133)
at org.codehaus.gant.GantBinding$_initializeGantBinding_closure5_closure16_closure18.doCall(GantBinding.groovy:185)
at org.codehaus.gant.GantBinding$_initializeGantBinding_closure5_closure16_closure18.doCall(GantBinding.groovy)
at org.codehaus.gant.GantBinding.withTargetEvent(GantBinding.groovy:90)
at org.codehaus.gant.GantBinding.this$4$withTargetEvent(GantBinding.groovy)
at org.codehaus.gant.GantBinding$_initializeGantBinding_closure5_closure16.doCall(GantBinding.groovy:185)
at org.codehaus.gant.GantBinding$_initializeGantBinding_closure5_closure16.doCall(GantBinding.groovy)
at gant.Gant$_dispatch_closure5.doCall(Gant.groovy:381)
at gant.Gant$_dispatch_closure7.doCall(Gant.groovy:415)
at gant.Gant$_dispatch_closure7.doCall(Gant.groovy)
at gant.Gant.withBuildListeners(Gant.groovy:427)
at gant.Gant.this$2$withBuildListeners(Gant.groovy)
at gant.Gant.dispatch(Gant.groovy:415)
at gant.Gant.this$2$dispatch(Gant.groovy)
at gant.Gant.invokeMethod(Gant.groovy)
at gant.Gant.executeTargets(Gant.groovy:591)
at gant.Gant.executeTargets(Gant.groovy:590)
| Error Server failed to start: org.apache.catalina.deploy.ContextResource
https://grails.org/plugin/tomcat
Under 'Configuration Options'
Wrong:
tomcat.keystorePath - The path to the Tomcat keystore for HTTPS
tomcat.keystorePassword - The password for the keystore for HTTPS
Should be:
grails.tomcat.keystorePath - The path to the Tomcat keystore for HTTPS
grails.tomcat.keystorePassword - The password for the keystore for HTTPS
Branch 8.x
org.grails.plugins.tomcat.TomcatServer#getConfigParam
@CompileStatic(TypeCheckingMode.SKIP)
protected getConfigParam(String name) {
buildSettings.config.grails.tomcat[name]
}
The rest of the property names on that doc that skipped the 'grails' prefix are probably also wrong.
https://stackoverflow.com/questions/72791126/tomcat-grails-plugin-8-0-50-java-lang-classnotfoundexception-org-apache-catalin
I have a Grails 2.4.5 application that has the tomcat grails plugin 8.0.50 as a dependency in the pom.xml with the provided scope.
<dependency>
<groupId>org.grails.plugins</groupId>
<artifactId>tomcat</artifactId>
<version>8.0.50</version>
<scope>provided</scope>
<type>zip</type>
</dependency>
Everything works fine locally, however, during the deployment, it fails to start on the server that has Tomcat 8.5.76 and jdk 1.8.0_321.
The exception stacktrace is below (@jeffbrown @graemerocher):
Jun 28, 2022 12:48:00 PM org.apache.tomcat.util.digester.Digester startElement
SEVERE: Begin event threw exception
java.lang.ClassNotFoundException: org.apache.catalina.core.JasperListener
at java.net.URLClassLoader.findClass(URLClassLoader.java:387)
at java.lang.ClassLoader.loadClass(ClassLoader.java:418)
at java.lang.ClassLoader.loadClass(ClassLoader.java:351)
at org.apache.tomcat.util.digester.ObjectCreateRule.begin(ObjectCreateRule.java:114)
at org.apache.tomcat.util.digester.Digester.startElement(Digester.java:1235)
at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.startElement(AbstractSAXParser.java:510)
at com.sun.org.apache.xerces.internal.parsers.AbstractXMLDocumentParser.emptyElement(AbstractXMLDocumentParser.java:183)
at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanStartElement(XMLDocumentFragmentScannerImpl.java:1341)
at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl$FragmentContentDriver.next(XMLDocumentFragmentScannerImpl.java:2786)
at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl.next(XMLDocumentScannerImpl.java:605)
at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanDocument(XMLDocumentFragmentScannerImpl.java:507)
at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:867)
at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:796)
at com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(XMLParser.java:142)
at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.parse(AbstractSAXParser.java:1216)
at com.sun.org.apache.xerces.internal.jaxp.SAXParserImpl$JAXPSAXParser.parse(SAXParserImpl.java:644)
at org.apache.tomcat.util.digester.Digester.parse(Digester.java:1496)
at org.apache.catalina.startup.Catalina.load(Catalina.java:618)
at org.apache.catalina.startup.Catalina.load(Catalina.java:669)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.apache.catalina.startup.Bootstrap.load(Bootstrap.java:305)
at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:475)
Jun 28, 2022 12:48:00 PM org.apache.catalina.startup.Catalina load
WARNING: Catalina.start using conf/server.xml: Error at (29, 67) : org.apache.catalina.core.JasperListener
Jun 28, 2022 12:48:00 PM org.apache.catalina.startup.Catalina start
SEVERE: Cannot start server. Server instance is not configured.
build ":tomcat:8.0.30"
grails 2.5.4
Java 8.77
Ubuntu 14.04 LTS
I configured Buildconfig.groovy to point to my own openssl self signed cert and key within my directory structure.
grails.tomcat.certificateFile="test/test_data/self_signed_ssl_cert_for_dev/development.crt"
grails.tomcat.certificateKeyFile="test/test_data/self_signed_ssl_cert_for_dev/development.key"
However, grails creates a different cert to use. It doesn't use the configured one with the tomcat plugin.
./grailsw run-app -https
Creating SSL Certificate...
Created SSL Certificate.
This causes my selenium tests to fail on my continuous integration server. I need to provide my own credentials.
I've used this crt and key in gunicorn before, and need to use them in this project as well.
(They are only used for development and continuous integration, not production.)
Ideas?
Please add support for Tomcat 8.5.5 since this is the "latest stable".
As it can be seen here:
http://tomcat.apache.org/whichversion.html
the 9M is "alpha", and the specs aren't even final yet.
(for Grails 2.5.x)
I recently updated a grails app from tomcat 7 to 8 and discovered that my ForkedTomcatCustomizer was no longer getting loaded by the TomcatDevelopmentRunner.
After some debugging, I discovered that the forkedClassLoader property was moved from the InlineExplodedTomcatServer to the TomcatDevelopmentRunner during 8.x development but it is used before it is assigned due to the TomcatDevelopmentRunner calling super which then invokes the InlineExplodedTomcatServer constructor which then call invokeCustomizer which then tries to load the ForkedTomcatCustomizer class with a null forkedClassLoader.
I fixed it locally by moving the forkedClassLoader property back to the InlineExplodedTomcatServer.
If my fix seems appropriate I can submit a pull request.
there is a bug in WebSocket in version 8.0.30 and later
https://bz.apache.org/bugzilla/show_bug.cgi?id=59014
which breaks Spring WebSocket support
https://jira.spring.io/browse/INT-3909
would be nice if I can use the version one before the bug was introduced (8.0.29)
8.x branch
build ":tomcat:8.0.30"
org.grails.plugins.tomcat.TomcatServer#TomcatServer
The truststore tries to configure itself if 'userKeystore' is set.
So, that looks wrong. (see below in the snippet)
def userTruststore = getConfigParam("truststorePath")
if (userKeystore) {
If by chance it's right to check that variable, then the bug becomes the missing system property documentation for the truststorePath and truststorePassword.
End result. Cannot use your own cert or jks with the tomcat plugin. Server just times out with no error message.
The automatic one works, and the other methods to bring your own credentials fail.
```
def userKeystore = getConfigParam("keystorePath")
if (userKeystore) {
usingUserKeystore = true
keystoreFile = new File(userKeystore.toString())
keyPassword = getConfigParam("keystorePassword") ?: "changeit" // changeit is the keystore default
}
else {
usingUserKeystore = false
keystoreFile = getWorkDirFile("ssl/keystore")
keyPassword = "123456"
}
def userTruststore = getConfigParam("truststorePath")
if (userKeystore) {
truststore = userTruststore
trustPassword = getConfigParam("truststorePassword") ?: "changeit"
}
else {
truststore = "${buildSettings.grailsWorkDir}/ssl/truststore"
trustPassword = "123456"
}
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.