Deploy Grails 3.1.1 to Heroku - grails

I was using 3.0.14v Grails and I did some deployments to heroku. Everything was working fine, however I wanted to try with Grails 3.1.1 and I'm getting some errors now.
I was following this post https://devcenter.heroku.com/articles/deploying-gradle-apps-on-heroku
I cloned this https://github.com/kissaten/grails3-example
I think it's something about tomcat version but not sure.
Any help?

For your trouble with the compile 'com.github.jsimone:webapp-runner:8.0.30.1', I figured it out by removing the httpclient module from all test* import, and I imported a good version of that module (only for test*).
testCompile ("org.grails.plugins:geb"){
exclude module: 'httpclient'
}
testCompile ('org.seleniumhq.selenium:selenium-firefox-driver:2.48.2'){
exclude module: 'httpclient'
}
testCompile 'org.apache.httpcomponents:httpclient:4.3.5'
Thanks to that, I could import the "last" webapp-runner (directly as a jar)
compile 'com.github.jsimone:webapp-runner:8.0.30.1#jar'
Maybe that version of the webapp-runner will fix the problem, but I'm not sure.
As I saw on your stacktraces, there is a NoClassDefFoundException for org/apache/tomcat/util/descriptor/tld/TldParser.
This class is provided by the tomcat-embed-core artifact. And that artifact comes from spring-boot-starter-tomcat (as a dependency). Change "spring-boot-starter-tomcat" from provided to compiled or try another version (for Grails 3.0.9, the spring-starter-tomcat version is 1.2.6).
Hope it helps ;)

I'm unsure of the specifics, but it looks like Grails 3.1.1 requires some of the classes in the Tomcat 8.x line.
I found a solution
I used a "compile 'com.github.jsimone:webapp-runner:8.0.30.2'" instead '8.0.30.1' and It's working well now.
I think there is an issue with including '8.0.30.1' as a compile time dependency.

Related

Grails 3.0 and Spring Security

I'm using Grails 3.0.1 with IntelliJ Idea and I'm trying to use Spring Security plugin on my project.
I know that old spring-seurity-core plugin is not compatible with Grails 3.0 version. Thus I've tried to follow this tutorial: http://spiesdavid.blogspot.fi/2015/03/grails-3-app-with-security-part-1.html
I've added the compile line in build.gradle file in dependencies. I've also added the logger line in logback.groovy file.
Problems start after that. There is no such file as SecurityConfiguration.groovy and there is no org.springframework.security package so I can't import them and it gives an error. So I can't create the file either.
So I am assuming that your question is: «How do I get this to work?»
spring security plugin 3.0.0 (for grails 3.x) was released just a few days ago. Documentation is quite good. Start here: https://grails-plugins.github.io/grails-spring-security-core/
There are some problems with Intellij. I tried to add spring security to a slightly older grails project (started with intellij 15.0.1 and grails 3.0.9). Adding the dependencies was successful and rebuilding it made the plugin available, also in the grails console. But when I launched a debug instance of the application directly from the IDE, it would not show spring security among the loaded/installed plugins. I made a pristine project with IntelliJ 15.02, grails 3.0.10 and just copied my code over to the new project. Now it works.
Note there are some issue with IntelliJ not major. do the following it will work:
on your build.gradle add compile 'org.grails.plugins:spring-security-core:3.0.0.M2'
run command compile
run comand s2-quickstart yourAppName User Role
now you should see "application.groovy" file under conf folder
as usual use #Secured annotation in your controller

Grails 2.4.0 - Error: ClassNotFoundException: grails.plugin.spock.test.GrailsSpecTestType

Whenever I enter the grails command: test-app I get this error:
Error executing script TestApp: java.lang.ClassNotFoundException: grails.plugin.spock.test.GrailsSpecTestType (Use --stacktrace to see the full trace)
In my BuildConfig.groovy I have:
grails.project.dependency.resolution = {
...
plugins {
...
compile ":spock:0.7"
}
}
I've tried replacing it with test ":spock:0.7" . I've also tried cleaning the application and refreshing the dependencies but no luck.
Any ideas what it could be and how I could fix it?
Thanks
With Grails 2.4.0 you don't need to make any mention of Spock in BuildConfig.groovy. See the sample project at https://github.com/jeffbrown/spockdemo.
When you can, you should look at upgrading to the latest in the 2.4.x line. A number of issues have been addressed since 2.4.0 was released.
I hope that helps.
#zzKozak is correct - you should upgrade. It has no bearing here, but getting to the latest version of Grails within your minor version (in this case 2.4.3) should happen before you ask others for help with issue that could have been fixed youself with a simple upgrade.
In 2.4, Grails switched to Spock tests by default, and you have to uninstall the old plugin since they're incompatible. Delete that line in BuildConfig.groovy and change your base classes to core the new Grails/Spock base classes. For integration queries, use grails.test.spock.IntegrationSpec. For unit tests and more information about this, check out the testing section in the docs: http://grails.org/doc/latest/guide/testing.html

What Grails Version is Needed for WeCeem

I have literally tried every possible combination that I can think of to install weceem as a plugin into an existing sample application that I'm practicing grails development on, nothing has worked. I've tried all the recommended repositories in various combinations and that did not work. I have tried several versions of grails between 2.3.7 to 2.4.2 and cannot get it to work. I followed the documentation on the site for installing the plugin and was not able to get it to successfully work.
Is there another CMS that runs in grails applications that's worth looking at?
Yes, there is one (indeed a new one) called spud cms which can be used. BTW, what was the error you were getting while using weceem plugin?
The plugin should be defined in the plugin section in BuildConfig.groovy as:
plugins {
compile ":weceem:1.2"
}
The plugin should work for version of grails-2.3.x (version 2.3.7 should be ok -- the demo application for weceem you can find there https://github.com/jCatalog/weceem-app ); the version of grails-2.4 is not supported yet in weceem-1.2 (but should be supported in new release that is planned in month or two). Please, provide the error stack-trace, to see the problem.
After some help from July Antonicheva, this is what I did to get it working:
1) Switched to NetBeans IDE
2) I downloaded version 7 of Java (Oracle)
3) Created a brand new project based on Grails 2.3.7
4) Added weceem plugin and made some adjustments to Datasource.groovy to add MySQL support
Everything is working fine now without errors. The current version of weceem needs Grails 2.3.7 and Java 7 in order for it work. I mentioned that I switched to NetBeans IDE, I found it to be a little easier to work with than eclipse and for some reason it seemed to run a little faster.

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.

IntelliJ IDEA/ Grails not resolving plugins

I have been using IntelliJ for almost a year ad I have always been really happy with it. However, yesterday I set it up on my new laptop (Ubuntu 11.04), and haven't seen the plugins module since.. :-(
Ran grails clean, tried to change the project structure/settings to include $HOME/.grails/1.3.x/projects/projectName/plugins, but still nothing. My understanding is that it should pick up the plugins automatically, am I right?
For the record, I am using Grails 1.3.4, IntelliJ IDEA Ultimate 9.0.4.
I'd strongly recommend switching to the latest Intellij version (10.5.1 as of now). Support for Grails has been improved a lot since 9.x. If you don't want to upgrade, check the following areas:
are all used classpath variables set correctly?
are you referencing the correct Grails version?
I'm using IntelliJ 11.1.3 with Grails 2.1.1.
General Issue:
The IDE Build/Make Project/Run Unit-tests sometimes fails to resolve classes referenced as dependencies within Plugins and produces 'no class...' errors. Normal grails targets (compile, run-app, test-app) work without issue!
Workaround:
Restarting IntelliJ 'magically' corrected my Plugin related 'no class...' errors.
What didn't work:
grails resolve-dependencies (makes sense because grails run-app worked fine!)
grails clean (again makes sense this is just purging the output)
Seems like the IDE Build/Make Project/Run Unit-tests uses a stale classpath in some circumstances. Unfortunately I don't have a repeatable test case but noticed that modifying BuildConfig and doing grails refresh-dependencies or compile or run-app doesn't make the IDE update it's list of grailsPlugins!
I've had IDEA do this once in a while to me as well. Even in the latest version (though I do agree you should upgrade, but 9->10 isn't free). For me, I just had to kill IDEA and restarted it.
IMPORTANT UPDATE! It will be fixed in 11.1.2! YEEAAAH!
In my case plugins not resolving because of custom system property 'grails.work.dir'. If your project using default 'grails.work.dir' than OK otherwise plugins won't be resolved. Tested on Idea 10.5.4, 11.1.1 and windows 7.

Resources