Comments (13)
Thanks, I am glad you find the plugin useful. It's good you are letting me know about this issue.
I personally haven't used the new Spring 3.1 MVC features yet but based on the documentation it looks like they do some special things with the default web.xml
.
The caveat to overriding the "/" Servlet mapping is that the RequestDispatcher for the default Servlet must be retrieved by name rather than by path. The DefaultServletHttpRequestHandler will attempt to auto-detect the default Servlet for the container at startup time, using a list of known names for most of the major Servlet containers (including Tomcat, Jetty, Glassfish, JBoss, Resin, WebLogic, and WebSphere). If the default Servlet has been custom configured with a different name, or if a different Servlet container is being used where the default Servlet name is unknown, then the default Servlet's name must be explicitly provided.
I guess this works fine if you deploy it to an installed container because it provides its default web.xml
. The Tomcat Gradle plugin uses an embedded Tomcat container implementation instead. I'd have to check both Tomcat and Spring implementations to see what the default Servlet gets registered with and see if I can make this work. I already have a convention property in place that lets you set the default web.xml
so I guess that will be the key to making it work.
FYI: I tried out the Gradle Jetty plugin and couldn't get it running right away as well.
from gradle-tomcat-plugin.
I want to add some more details to this issue with my findings on version 0.8.1.
My Spring MVC 3.1 web app does not have web.xml file (Servlet 3.0). I can tomcatRunWar (@RequestMapping work perfectly) with my application but cannot with tomcatRun (the behavior is the same as djKianoosh described).
from gradle-tomcat-plugin.
Thanks for your feedback @tinhtruong. Unfortunately, I couldn't get @djKianoosh's application running with tomcatRunWar
either. The console output is certainly different though. I will have to further investigate on this.
@tinhtruong: Do you have your app publicly available?
from gradle-tomcat-plugin.
Same issue here, also on spring-backbone example application.
What is strange is that classpath scanning occured (typical stratup lag) but I got the following message :
No global web.xml found
No Spring WebApplicationInitializer types detected on classpath
I hope somebody will be able to fix this bug ...
from gradle-tomcat-plugin.
I believe this to be a bug in the embedded Tomcat container implementation. Please check this issue I created. Looks like I need to provide a test case. I will try to set up a test project for them soon.
from gradle-tomcat-plugin.
Perhaps an information that can help : it works with t7mp Maven plugin (http://t7mp.github.com/) with the Spring 3.1 Backbone example application https://github.com/sdeleuze/spring-backbone-todo. I think it use also the embedded Tomcat, but perhaps in another way ...
from gradle-tomcat-plugin.
See my comments on the bugzilla issue: https://issues.apache.org/bugzilla/show_bug.cgi?id=52853#c11
They basically echo @sdeleuze, giving a different working example of the tomcat7-maven-plugin deploying a web.xml-free Spring 3.1 app without any problem.
from gradle-tomcat-plugin.
I have updated the sample yesterday in order to make it work also is Maven Jetty plugin. I think it could make it work also with the Gradle Tomcat plugin, I will test and send a feedback shortly.
For information, I had to provide a custom empty web.xml in order to override Jetty webdefault.xml that contained a dispatcher that conflicted with the one declared in Java code + a fix in the WebApplicationInitializer.
Related changeset is here : sdeleuze/spring-backbone-todo@9e4d65c
from gradle-tomcat-plugin.
It would be great if you could provide a pull request. As far as I understood the spec you don't need to provide an empty web.xml
. But if that's what it takes to make it work for now I'd be happy with it. I think this empty web.xml
would have to be generated on-the-fly. Thanks for the pointer. I won't have time this weekend to have a look at it but I might have some room next week.
from gradle-tomcat-plugin.
I tried to use an empty web.xml
but that doesn't seem to make it work. Apparently, the behavior is different from Jetty. This is what I tried:
tomcatRun.webDefaultXml = file('web.xml')
After checked the Maven plugin I found this patch. I played around with this a bit but couldn't achieve the result we are aiming for. However, I finished up my test cases for the Tomcat guys so hopefully they will have a look at this issue now and give me the correct advice to make it work.
from gradle-tomcat-plugin.
This is fixed with version 0.9.2.
from gradle-tomcat-plugin.
That's great news, Benjamin. Thanks!
from gradle-tomcat-plugin.
Thanks !
from gradle-tomcat-plugin.
Related Issues (20)
- Daemon does not stop HOT 4
- Define which war to use HOT 9
- Gradle Daemon - Caused by: java.lang.Error: factory already defined HOT 2
- Can I tell `TomcatRun` where is the exploded web directory? HOT 1
- Documentation - add example to compile translated jsps HOT 1
- Setting default jsp package name from org.apache.jsp to your choice HOT 2
- Acessing environment variables with the plugin HOT 1
- Gradle 6.2.2 shows deprecation warning regarding jasperAttributes HOT 3
- IllegalArgumentException: The AJP Connector is configured with secretRequired="true" but the secret attribute is either null or "". HOT 7
- How to run the Tomcat server at http://localhost:8080 instead of http://localhost:8080/ProjectName? HOT 2
- Skip Jar Scanning for Annotations HOT 1
- tomcatRun fails with Gradle 7.0 due to @Internal annotation on private getter HOT 11
- 2.6 Release HOT 3
- How to configure environment variables when calling tomcatRun? HOT 1
- Tomcat 10 support
- HTTP2 support
- does this can do like maven tomcat plugin which can build jar not war HOT 1
- Remove usage of WarPluginConvention
- Getting groovy.lang.MissingMethodException after upgrading to tomcat plugin 2.7.0, was using 2.5 before HOT 1
- The AJP Connector is configured with secretRequired="true"
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from gradle-tomcat-plugin.