Grails run-app 'Application metadata not found' - grails

I downloaded a serverpush example called GrailsChat and trying to run is on grails 2.4.4.
I had some issues with dependencies missing that took me a while to figure out (don't think it's related but just mentioning it).
When I run grails run-app I get:
| Application metadata not found, please run: grails upgrade
When I run grails upgrade I get
| Script 'Upgrade' not found, did you mean:
1) MigrateDocs
2) IntegrateWith
3) SetGrailsVersion
4) InstallDependency
5) DependencyReport
> Please make a selection or enter Q to quit:
I figure the issue is probably to do with the grails version I have being newer than the grails version that the sample app was targetting but I don't want to move back version simply to run an example (I'd rather understand the underlying issue).
Can anyone point me to some documentation that will help me understand what the application metadata is and how to move forward please?

Grails Upgrade command is removed in 2.4. You might have to upgrade the app manually following the guide.
Or you can just run the service wrapper which will download the grails version automatically base on the app.
./grailsw run-app

It seems like you have missed any one of mentioned
Not set grails proper Version
Missing application.properties file (with proper grails version)

Related

Grails - Message bundles (i18n) broken for war build only

After upgrading from 2.5.5 to 3.1.1, when I build my application as an executable war (or deploy to tomcat container), messages cannot be resolved from message.properties or any i18n properties files.
org.springframework.context.NoSuchMessageException: No message found under code 'timeZoneId' for locale 'en_US'.
When run in IntelliJ, it all works fine.
In terms of configuration, I’ve tried to make my build as close to the “out of box” Grails app as possible.
I’m wondering if anyone could provide a hint or suggestion as an avenue of investigation I could travel down as I’m just about out of ideas. Happy to add configuration detail as requested.
I'm using a multi-module build with a plugin as a dependency.
I suspect that maybe you have done some modification on your Grails project (2.5.5) that cant be support on the newest grails 3.3.0.
I would suggest you to check 3.3.0 documentation on how to customise your msg.
You can refer to https://docs.grails.org/latest/guide/validation.html. There is an example of how to modify your own label or msg.
In the case of the blank constraint this would be user.login.blank so you would need a message such as the following in your grails-app/i18n/messages.properties file:
user.login.blank=Your login name must be specified!
Hope it helps. Cheers

ggts null pointer "Retrieving available scripts"

I installed a fresh copy of GGTS on a fresh copy of windows 8 with JDK 1.7 installed.
I tried to get it to compile my existing project which was based on 2.3.6 and it failed miserably as GGTS comes with grails 2.4.2.
I know serveral people who had problems with 2.4.x so decided to stick with 2.3.
So I downloaded 2.3.11 (latest 2.3) and created a GRAILS_HOME pointing to 2.3.11 dir, and JAVA_HOME pointing to the root of the JDK.
On command line, I can now type grails - version and get back 2.3.11.
I restarted GGTS, and deleted the project and createde it again, adding 2.3.11 as a new Grails version, and set the project to use that.
It fails to compile, saying version is wrong. Fair enough. But when I try to launch the command line from GGTS using the gree circular button at the top which looks like 3 cups, it says:
Retrieving available scripts
Retrieving available scripts
An internal error occurred during: "Retrieving available scripts".
java.lang.NullPointerException
Any ideas?
In my case the problem was, that I had moved grails to a different folder. I just had to change the location of grails in the settings. Hope that helps somebody.
check all grails-project's 'app.grails.version' in application.properties, then open window - preferences - groovy -grails, make sure that all VERSIONs were defined ( I use sts, maybe a little difference ).
alternatively
update all application.properties set app.grails.version=2.3.11 ( the version your ggts defined )
Check if your environment variable of GRAILS_HOME is set to the right version of Grails.
I ran into this same issue, and the problem was caused by the Grails installation it was trying to use. It wanted to use the default version that comes with GGTS rather than the one I installed myself.
To fix, go to Window > Preferences > Groovy > Grails, then "Edit" the Grails installation it shows. I had to switch mine from C:\ggts-bundle\grails-2.4.4\ to C:\grails-2.4.2\.

Grails JMS Plugin - Unable to resolve classes

I'm pretty new to grails so it's possible that i've missed something obvious, but I am trying to utilise the JMS plugin. I've included the following within the plugins section of my BuildConfig.groovy
compile ":jms:1.2"
However when I compile the app I get lots of "unable to resolve class" exceptions for imports within the jms plugin (40 in total, javax.jms.* and org.springframework.jms.* mostly).
e.g.
| Error Compilation error: startup failed:
C:\dev\prj\grails\tApp\target\work\plugins\jms-1.2\grails-app\utils\DefaultJmsBe
ans.groovy: 16: unable to resolve class org.springframework.jms.listener.Default
MessageListenerContainer
# line 16, column 1.
import org.springframework.jms.listener.DefaultMessageListenerContainer
^
C:\dev\prj\grails\tApp\target\work\plugins\jms-1.2\grails-app\services\grails\pl
ugin\jms\JmsService.groovy: 22: unable to resolve class javax.jms.Message
# line 22, column 1.
import javax.jms.Message
Is anyone able to point me in the right direction? The issue can be reproduced just by adding the plugin to the BuildConfig.groovy as mentioned above to a new grails project .
Grails version 2.3.3
Many thanks
Tom
While doing a Grails 2.2 -> 2.3.4 upgrade I ran into a similar issue and was able to get things working by manually adding spring-jms to my dependencies in BuildConfig.groovy:
compile 'org.springframework:spring-jms:3.2.5.RELEASE'
It's odd that this would stop working now of course, since the jms plugin hasn't changed in a very long time. My guess is that it depends on the spring-jms lib, but didn't have it listed as a dependency, instead relying on grails to bring it in. According to the 2.3.x upgrade guide, there have been changes to what grails brings in now, so perhaps spring-jms stopped getting a free ride.
The Grails MX website has a write-up that might help; it's built using 2.3.4:
http://grails.org.mx/2013/12/20/quickstart-jms-en-grails/
It was pretty helpful to me in getting a sample application up and running. It's in Spanish though, so may need to have Google translate it for you...
Have you tried executing the command grails refresh-dependencies before running grails run-app?
I wrote a blog post on installing a Grails plugin if you need more details.

How do I upgrade the Grails version for an existing application?

I have an example Grails application (from Grails in Action) that was created a while ago under version 1.1.1 on a different PC.
I am now loading Grails 1.2.0 and want to revisit the app. However, when I try to run it I get this message:
Application expects grails version [1.1.1], but GRAILS_HOME is version [1.2.0] - use the correct Grails version or run 'grails upgrade' if this Grails version is newer than the version your application expects.
After reading around a bit I cleared out the 1.2.0 folder under .grails in my home directory (from previous attempts while exploring the issue), ran "grails clean" and "grails upgrade" (answering "y" where prompted).
However, I consistently get "Invalid duplicate class definition" conflicts between classes in \grails\qotd\src\java and \grails\qotd\grails-app{controllers,services,conf}.
Are there any additional manual steps that I need to perform?
I understood your problem.
The solution is just modify the grails vesion to 1.2.0 in application.properties file in your application
If, as you pointed out in the comments, your /src/java contains .groovy files - that could definitely cause unexpected behavior. I haven't hit your particular issue, but any time I had a .groovy file mismatched with the class name inside it, I'd get strange compilation issues - so I guess you could be having a similar issue.
If you have files / classes with the same names in two locations, that's the likely culprit. If you have .groovy files in /src/java, that's another potential source.
Also, putting BootStrap, Config, DataSource and URLMappings into /src/java, that's another potential source of issues. I'd clear out your /src/java by making sure all the files are in their appropriate places under grails-app.
You can upgrade grails version with 5 steps
Project -> Clean
application.properties -> Change app.grails.version
Your project -> Properties -> Grails -> Change grails installation
to new grails version.
Your project -> Grails tools -> Refresh Dependencies
I think this may be help you

Error in Grails

Anyone knows how to fix this ?
It works fine on my env (Me being the developer) and doesn't work on my colleagues machine who unzips the whole
Welcome to Grails null - http://grails.org/
Licensed under Apache Standard License 2.0
Grails home is set to: C:\abc\products\grails-1.1
Base Directory: C:\abc\products\foo\bar
Running script C:\abc\products\grails-1.1\scripts\RunApp.groovy
Environment set to development
Application expects grails version [1.1], but GRAILS_HOME is version [null] - us
e the correct Grails version or run 'grails upgrade' if this Grails version is n
ewer than the version your application expects.
Some clarifications
1) There has been no Grails version change , either on my machine or my colleagues machine. In fact some of them are installing for the first time
2) Under C:\Documents and Settings\myfriend.grails I can see a folder called 'null'
I tried removing this folder - but it gets created he runs my application
3) The way I am giving him the release is- I unzip the whole folder and he unzips it
SO there are three steps
A_ grails create-app to create the APp
B_ Unzip my folder to replace the generated folder
C_ Grails run-app
Things are fine after the step A- but degenerate after Step C
It appears that his Grails installation is corrupted or not set up correctly. I would have him reinstall a fresh copy of Grails - http://www.grails.org/Installation and try again.
The error that you are getting is telling us that the application that you are trying to run is identified as version 1.1 and I assume that this is correct. The fact that Grails is not able to identify what version is installed makes me point to a corrupted or mis-configured Grails installation
If he types 'grails' at the command line what does he see?
I found the problem.
This was because I had added a file- build.properties
And since the file was there- it was expecting it to have certain properties defined in it
Once I renamed it to something else- it started to work

Resources