Grails JMS Plugin - Unable to resolve classes - grails

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.

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

How to Import existing Grails app into Intellij

I'm having a hard time importing an existing Grails 3 application into Intellij, in what feels like the "right way". I have the looked through the official intellij documentation but haven't found much to help me (what I have found hasn't fixed any of my issues). It's possible that I simply didn't find what I needed. This post here doesn't quite help me out either.
Here's what I've tried:
Note: The application I'm importing is grails 3.1.9 and works fine using the Grails CLI.
Import the project on build.gradle
I get the following errors/warnings:
Warning:<i><b>root project 'app': Unable to build Grails project configuration</b>
Details: org.gradle.api.artifacts.ResolveException: Could not resolve all dependencies for configuration ':compileCopy'.
Caused by: java.lang.RuntimeException: A conflict was found between the following modules:
- jline:jline:2.12
- jline:jline:2.11</i>
Warning:<i><b>root project 'app': Unable to build Grails project configuration</b>
Details: org.gradle.api.artifacts.ResolveException: Could not resolve all dependencies for configuration ':compileCopy'.
Caused by: java.lang.RuntimeException: A conflict was found between the following modules:
- jline:jline:2.12
- jline:jline:2.11</i>
However if I ignore those warnings, I can get the application to run by using a gradle run/debug configuration, using bootRun. If I try to setup a run/debug with Grails, intellij doesn't let me pick an "application". Adding Grails as a framework does not change this behavior. I'm also missing some of the grails specific features that Intellij gives you.
Create the project from existing sources
Following this series of menu's, I have no idea what to pick. With the defaults that Intellij selects, I am still unable to set a Grails run/debug configuration. I assume I just have to select the right sources, but I have no idea what I should be selecting.
If someone could give me a list of steps to perform, or point out exactly where I need to go in the documentation, that would be very helpful and appreciated.

Grails Geocode plugin dependency injection issue

Grails Version: 3.0.7
Groovy Version: 2.4.4
JVM Version: 1.8.0_51
I must be missing something really simple here.
I've added a grails plugin to my project as defined in the read me :
compile 'org.grails.plugins:geocode:0.3'
I can see the relevant dependencies have been pulled down from the repository.
However, when trying to inject the service within my controller using :
def geocodingService
I receive the following error upon execution :
Caused by: java.lang.NullPointerException: Cannot invoke method getPoint() on null object
The relevant line of code is :
Point location = geocodingService.getPoint('XXX XXX, UK')
My guess is the dependancy injection is failing but can anybody please tell me the mistake I am making?
Note : Copied my answer from another almost identical questions ...
OK, this seems to be down to me stupidly trying to use a grails 2.x plugin in a grails 3.x plugin.
There are various steps to go through to upgrade a plugin from 2.x to 3.x all detailed within the grails documentation.
My immediate solution was to simply create a new service and copy the code from the plugin into my application. Worked just fine.
Grails 3.x plugins : https://bintray.com/grails/plugins
Grails 2.x plugins : https://grails.org/plugins/
It's not obvious unless you navigate via the grails site. If you come in for example from Google directly to a plugin page, compatibility is shown as 2.5.x >
However, this actually seems to mean greater than 2.5.x but less than 3.x
Hope this helps should anyone else encounter this.

Grails run-app 'Application metadata not found'

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)

Grails: server crashes when I recompile a file (when using datasources)

I'm using datasources in my Grails project.
When I edit a groovy file with server running I get the following error:
Running Grails application.. java.lang.IllegalArgumentException: Must
supply a resource type for JNDI configuration
How can I configure grails.naming.entries in Config.groovy to fix this?
Note: I'm using grails 1.3.6
Tks
I'm using 1.3.7 and hit the same issue. There's a couple bugs in the JIRA about this, looks like they were finally fixed in 2.0-M1. There's a patch for 1.3.1+ versions here, but I haven't tested that yet.
Link to possible patch: http://jira.grails.org/browse/GRAILS-7021

Resources