Grails 3.2.0 new dependency causes deploy to Tomcat to give 404 #10196

Closed
jknudsen opened this Issue Sep 30, 2016 · 6 comments

Projects

None yet

3 participants

@jknudsen
jknudsen commented Sep 30, 2016 edited

Task List

  • During the process of upgrading from 3.2.0.RC2 to 3.2.0 I added a new dependency [ ] provided "org.codehaus.groovy:groovy-ant based on what the create-app generated now.
  • After making merging the other changes for 3.2.0 the application ran using run-app
  • I then deployed the war to a Tomcat 7 (and Tomcat 8.5) container running Java 8 and all I would get is a 404 error from the application.

Steps to Reproduce

  1. add the dependency provided "org.codehaus.groovy:groovy-ant
  2. run war on Tomcat

Expected Behaviour

Tell us what should happen

Actual Behaviour

Get a 404 error

Environment Information

  • Operating System: Windoze 7
  • Grails Version: 3.2.0
  • JDK Version: 1.8.0_101
  • Container Version (If Applicable): Both Tomcat 7.0.64 and Tomcat 8.5.5

Example Application

  • TODO: link to github repository with example that reproduces the issue
@jeffbrown
Member

groovy-ant is a dependency by default. Since you made it provided, it won't be included in your war file. Are you making the library available by installing it into your Tomcat ahead of time?

@jeffbrown
Member

Never mind my last comment. I think I misunderstood the original description. Sorry for the noise.

@jeffbrown
Member

I have confirmed this behavior locally. The app at https://github.com/grails-samples/music has been upgraded to 3.2.0 and does have the groovy-ant dependency at https://github.com/grails-samples/music/blob/329b160108b51ebef6abbd6f55dab70149edb15b/build.gradle#L45.

provided "org.codehaus.groovy:groovy-ant"

When I deploy the app to Tomcat 8.5.5 something is wrong with the deployment and the app will not respond. When I remove the groovy-ant dependency and redeploy, things appear to work as expected.

@jeffbrown
Member
jeffbrown commented Oct 1, 2016 edited

This is likely relevant:

$ diff noant.txt ant.txt 
16d15
<   4550894  08-03-16 13:52   WEB-INF/lib/groovy-2.4.7.jar
52,53d50
<    215463  08-03-16 13:52   WEB-INF/lib/groovy-xml-2.4.7.jar
<     97862  08-03-16 13:52   WEB-INF/lib/groovy-templates-2.4.7.jar
118a116,124
>     69674  06-03-16 18:50   WEB-INF/lib-provided/groovy-ant-2.4.7.jar
>   2019274  04-29-14 23:14   WEB-INF/lib-provided/ant-1.9.4.jar
>     11612  04-29-14 23:01   WEB-INF/lib-provided/ant-antlr-1.9.4.jar
>   4550894  06-03-16 18:50   WEB-INF/lib-provided/groovy-2.4.7.jar
>     18381  04-29-14 23:01   WEB-INF/lib-provided/ant-launcher-1.9.4.jar
>    135183  06-03-16 18:50   WEB-INF/lib-provided/groovy-groovydoc-2.4.7.jar
>    117783  04-29-14 23:01   WEB-INF/lib-provided/ant-junit-1.9.4.jar
>     97862  06-03-16 18:50   WEB-INF/lib-provided/groovy-templates-2.4.7.jar
>    215463  06-03-16 18:50   WEB-INF/lib-provided/groovy-xml-2.4.7.jar

noant.txt is the listing of the all of the .jar files in the .war file when the provided "org.codehaus.groovy:groovy-ant" dependency is not in build.gradle. ant.txt is the listing of all of the .jar files in the .war file when the groovy-ant dependency is in build.gradle. Notice that groovy-2.4.7.jar is not in WEB-INF/lib/ when the provided groovy-ant dependency is present. groovy-2.4.7 is in WEB-INF/lib-provided/, which I think is only used by the embedded Tomcat, not when deploying to a real Tomcat.

@graemerocher graemerocher added this to the grails-3.2.1 milestone Oct 3, 2016
@graemerocher graemerocher added the Blocker label Oct 3, 2016
@jeffbrown
Member

One way to deal with this is to replace provided "org.codehaus.groovy:groovy-ant" with something like this:

provided("org.codehaus.groovy:groovy-ant") {
    exclude module: 'groovy'
    exclude module: 'groovy-xml'
    exclude module: 'groovy-templates'
}

Another option is to remove the groovy-ant dependency altogether. The consequence of that would be that i18n message reloading won't work in the development environment.

We will have a real solution for 3.2.1 but the above options should fix the deployment problem for 3.2.0.

@jeffbrown
Member

Another option is to turn the groovy-ant dependency into a runtime dependency. The consequence of that is that there will be several jar files in the generated .war that aren't actually needed at runtime.

@graemerocher graemerocher added a commit that referenced this issue Oct 4, 2016
@graemerocher graemerocher Partial fix for #10196 - Remove dependency on groovy-ant for reloadin…
…g of messages.properties
312bcdf
@graemerocher graemerocher added a commit to grails-profiles/web that closed this issue Oct 4, 2016
@graemerocher graemerocher Remove groovy-ant dependency. Fixes grails/grails-core#10196
The dependency can be safely removed because reloading of message bundles no longer depends on Ant grails/grails-core@312bcdf
25af79c
@graemerocher graemerocher self-assigned this Oct 4, 2016
@jeffbrown jeffbrown added a commit to grails-samples/music that referenced this issue Oct 10, 2016
@jeffbrown jeffbrown remove groovy-ant dependency
This is related to grails/grails-core#10196.  For now, reloading of
i18n messages in the development environment will not work.  Grails
3.2.1 contains a fix that supports message reloading and does not rely
on groovy-ant.
b286605
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment