kuceram
kuceram

Reputation: 3885

Grails 2.0 Externalized Config in Production, cannot access application - HTTP 404

when I've upgraded my Grails app to Grails 2.0.3, the application isn't accessible in production Tomcat.

When I run the app in development or even using "grails prod run-war", the application works properly. But when I move this app to Tomcat (tested on Tomcat 6 and 7), the app is not accessible anymore. It loads properly but when I go to http://localhost:8080/appName I receive HTTP 404.

The logs are empty, therefore I cannot find out where is the problem. When I remove externalized config loading from Config.groovy, the application works! Really weird. Config.groovy:

grails.config.locations = ["file:/home/user/application_homes/app_home/app-config.properties"]

Did you faced same issue? Or were there any changes from Grails 1.3.7 to Grails 2.0.3 which could affect this?

Thanks for any advice!

Upvotes: 0

Views: 651

Answers (2)

Gavin Bunney
Gavin Bunney

Reputation: 1240

Also experiencing the same problems. We actually have two methods for specifying the grails.configuration.locations, using System/Env Variables or a -Dconfig.file= definition. Using the environment variable load, this causes a line of

classpath:the-config-file.properties

If a -Dconfig.file is specified, it uses the file based evaluator:

file:/full-path/the-config.file.properties

When using the System/Env method, the configuration loads fine! As soon as we shift to using the 'file' lookup, Tomcat fails to start.

It looks to be failing just after creating the internalConfigurationAnnotationProcessor bean:

2012-04-22 22:35:53,514 (main) DEBUG [org.codehaus.groovy.grails.commons.spring.GrailsWebApplicationContext] - <Bean factory for org.codehaus.groovy.grails.commons.spring.GrailsWebApplicationContext@17bcd4: org.codehaus.groovy.grails.commons.spring.ReloadAwareAutowireCapableBeanFactory@752144: defining beans [org.springframework.context.annotation.internalConfigurationAnnotationProcessor,org.springframework.context.annotation.internalAutowiredAnnotationProcessor,....<--- (left out the big list of others)
2012-04-22 22:35:53,538 (main) DEBUG [org.codehaus.groovy.grails.commons.spring.ReloadAwareAutowireCapableBeanFactory] - <Creating shared instance of singleton bean 'org.springframework.context.annotation.internalConfigurationAnnotationProcessor'>
2012-04-22 22:35:53,538 (main) DEBUG [org.codehaus.groovy.grails.commons.spring.ReloadAwareAutowireCapableBeanFactory] - <Creating instance of bean 'org.springframework.context.annotation.internalConfigurationAnnotationProcessor'>
2012-04-22 22:35:53,547 (main) DEBUG [org.springframework.beans.factory.support.DefaultListableBeanFactory] - <Returning cached instance of singleton bean 'grailsApplication'>
2012-04-22 22:35:53,547 (main) DEBUG [org.codehaus.groovy.grails.commons.spring.ReloadAwareAutowireCapableBeanFactory] - <Eagerly caching bean 'org.springframework.context.annotation.internalConfigurationAnnotationProcessor' to allow for resolving potential circular references>
2012-04-22 22:35:53,548 (main) DEBUG [org.codehaus.groovy.grails.commons.spring.ReloadAwareAutowireCapableBeanFactory] - <Finished creating instance of bean 'org.springframework.context.annotation.internalConfigurationAnnotationProcessor'>
2012-04-22 22:35:53,667 (main) INFO [org.codehaus.groovy.grails.commons.spring.ReloadAwareAutowireCapableBeanFactory] - <Destroying singletons in org.codehaus.groovy.grails.commons.spring.ReloadAwareAutowireCapableBeanFactory@752144
22/04/2012 10:35:53 PM org.apache.catalina.core.StandardContext start
SEVERE: Error listenerStart

The oddest part is just changing from a classpath:<> definition to a file:<> is causing this problem. I have put in debug statements into the grails Config.groovy file and the contents of the files are read ok.

Upvotes: 0

dawogfather
dawogfather

Reputation: 654

i'm having the exact same issue as you it would appear...

I get nothing in the logs...

It just doesn't start up... fails with:

0/04/2012 2:17:36 PM org.apache.catalina.core.StandardContext start
SEVERE: Error listenerStart
20/04/2012 2:17:36 PM org.apache.catalina.core.StandardContext start
SEVERE: Context [/abcd] startup failed due to previous errors

Seems to work when we use a classpath spring format in the grails.config.locations section.

we have also just gone to grails 2.0.3, could it be a bug?

Upvotes: 0

Related Questions