Grails 2 app deployed twice on tomcat7 - grails

I'm having trouble with my grails app. For some reason when I deploy it on a standalone tomcat7 instance it seems to deploy the app twice. e.g. when I run a quartz job, it calls the job twice, when I run a controller method, it's run twice.
This happens in the following cases:
1. adding the war into the webapps folder
2. manually unpacking the war into the webapps folder
3. adding a context line such as <Context path="/process" docBase="C:\apache-tomcat-7.0.27-windows-x64\apache-tomcat-7.0.27\process.war" reloadable="true" /> into the server.xml file and have the actual war file outside of the webapps folder. I've also set unpackWARs="false" autoDeploy="false" for the HOST parameter where the context parameter is added to.
I'm running out of ideas on what else to test.
This bug/feature does not occur when launching the app with the run-app command line and using the tomcat plugin.
Any ideas anyone?

Related

How to edit and replace jar (war-Files) in tomcat7 using ansible playbook and Grails applications

The directory to the .war files is ~/tomcat7/webapps-server/
but when i replace the files the changes don't get applied regradless
of beeing updated.
Can you help me in that?
where is the origin of the deploy chain using ansible scripts and war archives in general?

Grails "war" command, how to set system property

I'm running grails prod war to create my app's .war file. The problem is, I need to somehow set a system property that can be accessed in grails-app/conf/Config.groovy when that .war is being built.
How can I do this? Grails version 2.1.0
You need to set this property when the war is being launched, not when it's being built. If the app is being hosted by Tomcat (or similar) you would typically adds this as a parameter to the java command that launches Tomcat.
grails -Dproperty=value prod war

Doesn't grails run-app create a war?

Doesn't a grails run-app create a WAR file(exploded) in the embedded Tomcat Container? If so what is the difference between grails run-app and grails run-war command?
Is it possible to view the web app directory under the embedded Tomcat Directory after the execution of grails run-app command?
The grails-app command starts an embedded Tomcat server and configures its context paths so that it can look up everything it needs from their original filesystem paths. Therefore there is no single place where everything would be gathered as would be when running an exploded web application archive.
No, run-app doesn't create a war. It starts the Tomcat server and configures it programmatically as an exploded war.

Grails + Tomcat6 + Multiple Instances + Shared Lib Folder

I've got a Tomcat6 server that runs multiple Instances for two separate grail apps.
When I compile my WAR file for deployment normally
run-app -Dgrails.env=production war test.war
It deploys correctly and everything works as it is suppose too.
The problem is, I don't want the JAR files included in my WAR.
So I use the following command line instead
run-app -Dgrails.env=production war test.war --nojars
Now when my grails app deploys (it doesn't) I get a java.lang.NoSuchMethodError
I have copied the lib folder (from my initial test.war) to the following locations
${catalina.base}/shared/lib
${catalina.home}/shared/lib
${catalina.home}/lib
None of these work.
My catalina.properties all point to the correct locations.
Any ideas?
A few ideas:
BuildConfig.groovy has inherits global, which has the app inherit all of the grails/plugins dependencies. If you change this, it may affect both your build and packaging - plus I have yet to encounter any documentation on what type of other things you can do with the inherits DSL
Grails deployment documentation suggests there is a way to customize which dependencies make it into the war file: http://grails.org/doc/latest/guide/17.%20Deployment.html
Event hooks give you access to provide a closure routine into various stages of the grails lifecycle. Can it strip out framework jars from the final war? Haven't tried that either - only using it to re-write various config files for additional envrionment configuration. However it does look like packaging events are exposed to this API:
http://grails.org/doc/latest/guide/4.%20The%20Command%20Line.html

Grails War and deploy

I am using grails 1.3.4 on windows xp and centos. Tomcat 5 on centos.
I do a 'grails dev war' and 'grails prod war' on an app (as well as a test app I've put together). I take the war file on xp and expand it in another dir. On the centos I can put the war file in tomcat and also in it's own dir. But when I go to run-war or run-app the unpacked war files, I am told my app is pre-0.5 grails. I do a grails upgrade. But then when I go to run-app or run-war again I get 0 domains 0 controllers and nothing is available.
My app before I war the files is 1.3.4 and it's runs, passes tests and full functions, but not once I war it. Any ideas?
You can't use run-app or run-war on unpacked war files. Both are meant to be used from the source project itself. run-app runs directly with an embedded Tomcat (or Jetty if you switch to that plugin) and run-war builds a war and deploys it into an embedded Tomcat.
When you build a war (whether you unpack it or not) it's to be used by Tomcat or another servlet container directly, not as a 'Grails war' but as a war like any other.
Basically your options are:
'grails run-app' from the project root to test in dev mode
'grails prod run-war' from the project root to test a war in prod mode
'grails war' to deploy to a standalone container and run as a deployed application
If you are using datasource check that your username and password are correct for database connections

Resources