Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
1 of 5 tasks
jknudsen opened this issue Sep 30, 2016 · 6 comments
Closed
1 of 5 tasks

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

jknudsen opened this issue Sep 30, 2016 · 6 comments

Comments

@jknudsen
Copy link

jknudsen commented Sep 30, 2016

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
@osscontributor
Copy link
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?

@osscontributor
Copy link
Member

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

@osscontributor
Copy link
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.

@osscontributor
Copy link
Member

osscontributor commented Oct 1, 2016

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.

@osscontributor
Copy link
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.

@osscontributor
Copy link
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 added a commit that referenced this issue Oct 4, 2016
@graemerocher graemerocher self-assigned this Oct 4, 2016
osscontributor pushed a commit to grails-samples/music that referenced this issue Oct 10, 2016
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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants