I am upgrading an existing Grails 2.2.4 app to 2.5.0.
For some reason, endpoints whose URLs included the app context in 2.2.4 no longer include the app context in 2.5.0.
e.g., for app context = app, old endpoint in 2.2.4 was:
/app/a/b/c
but in 2.5.0 is now:
/a/b/c
I have tried many things to fix this, including:
in application.properties:
app.name=app
app.context=/app
in Config.groovy, for testing on localhost:8080:
grails.app.context = "/${appName}"
grails.serverURL = http://localhost:8080 and grails.serverURL = http://localhost:8080/${appName}, at different times
app.grails.serverURL = http://localhost:8080 and app.grails.serverURL = http://localhost:8080/${appName}, at different times
I've verified that "${appName}" == 'app'.
I have upgraded all of the plugins to the newest version, but I'm continuing to use the resources plugin instead of the asset-pipeline plugin.
I am not using scaffolding.
Any suggestions?
UrlMappings.groovy contained some mappings with (parseRequest:true), which is no longer supported by Grails. Removing that fixed it.
Related
I am running a Grails 2.4.2 app in a Tomcat 7 for ubuntu.
I have the problem that after login, page is redirected to IP.
Before login
www.app.com/login
After login
104.21.22.23/login
I tried to configure grails.serverURL but that did not make any difference. My current value for grails.serverURL is "www.app.com"
in answer, I am considering you are using grails 2.4.2
In your BuildConfig.groovy file add following:
grails.plugin.springsecurity.successHandler.alwaysUseDefault = true
grails.plugin.springsecurity.successHandler.defaultTargetUrl = '/YOUR_APP__URL'
above will work with latest version of grails also.
You can check all options here
Ever since about a week ago after doing a prod dbm-update I started getting this error when deploying the WAR-file to EB (run-app works fine both in dev and prod setting):
Caused by: org.hibernate.cache.CacheException: net.sf.ehcache.CacheException: Another unnamed CacheManager already exists in the same VM. Please provide unique names for each CacheManager in the config or do one of following: 1. Use one of the CacheManager.create() static factory methods to reuse same CacheManager with same name or create one if necessary 2. Shutdown the earlier cacheManager before creating new one with same name.
Grails 2.5.0 release notes suggested setting beans.cacheManager.shared to true. Didn't help.
Other people facing similar issues suggested replacing Hibernate cache factory_class from org.hibernate.cache.ehcache.EhCacheRegionFactory to org.hibernate.cache.ehcache.SingletonEhCacheRegionFactory - this post. I think it eliminated the unnamed cacheManager issue, but created another one:
Caused by: java.io.FileNotFoundException: class path resource [db/changelog/db.changelog-master.yaml] cannot be resolved to URL because it does not exist
Setting "liquibase.checkChangeLogLocation = false" and "liquibase.enabled = false" triggers yet another:
Caused by: org.grails.core.exceptions.GrailsConfigurationException: Error configuring dynamic methods for plugin [springSecurityCore:3.0.4]: null
I'm using: Grails 3.1.4 with the AngularJS profile, Spring Security 3.0.4, Spring Security Rest 2.0.0.M2, Database Migration 2.0.0.RC4
I've also tried:
switching to Spring Security 3.0.2, 3.0.3
termimating the EC2 instance
re-building the entire EB environment and creating a new database
setting hibernate use_second_level_cache to false
downgrading to Grails 3.1.0
setting sourceSets { main { resources { srcDir 'grails-app/migrations'}}}
I'm running out of ideas and nothing has helped so far. Does anyone have an idea? Or is facing similar problems?
Did you recently upgrade to Hibernate 5.1.0.Final ? If so, then you might have the same issue as this one. No solution seems to have been found, but you might want to downgrade to Hibernate 5.0.9.Final to avoid this issue for now.
It turned out to be an issue with the Grails 3 AWS SDK plugin. I reverted all my changes and just replaced the plugin with the AWS SDK for Java through Gradle.
You can see from the plugin page that it supports Grails up to 3.1.1, but downgrading from 3.1.4 to 3.1.1 didn't make any difference either. But yes, using AWS SDK without the plugin worked. Woo!
I used Spring Security Core plugin v3.0.4 and got this error too on Grails v3.1.4. Upgrading the SSC pluign to v3.1.1. fixed the issue for me.
If I create a new web profile app, and generate-all, it runs fine in my local and deploys without error to JBoss. But when I try to access the app all URLs return 404. I know the app started up successfully, because it created tables in the database.
Here's what I'm doing.
grails 3.1.4> create-app demo
create-domain-class Book
create-domain-class Author
Edit domain classes
generate-all *
change tomcat dependency from compile to provided in build.gradle
change dataSource in application.yml to use my JNDI Oracle connection
Add server: contextPath: /demo to application.yml
run-app -> Works
gradle war
Deploy to JBoss EAP 6.4.0.GA
JBoss says deployment and activation of the app was successful. There are no errors of any sort in any JBoss log file. And dbCreate: update made the DDL changes to my Oracle database, so I know it got that far. But all URLs for the app return 404.
This is a known bug: Issue-9481
It has been added to grails 3.1.5 milestone.
I am unable to get auto-reloading working on newly created controllers. My application starts correctly but whenever i do grails create-controller <controller-name> the controller is created and i see that the new controller is compiled.
When i try to access the newly generated controller I always get a "Page not Found (404)". After restarting the Grails application, the newly created controller works correctly.
I am using Grails 3.0.1 on OSX Yosimite and Java 1.8.0_31-b13. Any clue on how to fix this?
I am starting the application using the following combinations:
grails run-app
grails -reloading run-app
grails run-app -reloading
None of these worked reloading the new created controller
Grails introduced what I'd consider a bug in version 2.4.4 and still present in at least 3.0.4, where automatic reloading doesn't work if you have space anywhere in the file's (in this case the controller's) path.
See this post for more details.
what worked for grails 2.x must be working for 3.x as well.
Try below command, setting this to false must allow reloading.
grails -Ddisable.auto.recompile=false run-app
I tried to deploy my app to cloudfoundry, everything goes smooth however none of my static resources that use the resources plugin can be found.
In the logs i get lots of errors like the below
2012-01-31 13:36:41,352 [http-46220-3] WARN util.ResourceMetaStore -
Cannot locate resource [/static/css/jquery-ui-1.8.17.custom.css]
I first thought that this is due to cloudfoundry not having any disk space allocated but based on this thread it should work out of the box
http://grails.1312388.n4.nabble.com/Cloud-foundry-and-resources-plugin-with-js-css-td4243619.html
The test application i am running is running on one instance and i am using version 1.1.6 of the resources plugin.
Anybody else experiencing similar problems?
Make sure you are not missing the following line in your Config.groovy
grails.resources.adhoc.patterns = ['/images/*', '/css/*', '/js/*', '/plugins/*']
I had the similar problem on heroku platform. It seems that problem is related with resources plugin and load balancing. My be the following will be useful:
Heroku, Grails: Missing resources if using multiple web dynos
Can you confirm 100% that this works in "production" environment locally?
I have a Grails 2.0 application on Cloud Foundry (http://tripplanner-ali.cloudfoundry.com/trip/create). It is using the resources plugin (1.1.5) along with cloud-support and cloud-foundry and jquery of course. I would suggest you to have your STS setup with Grails 2.0 if you haven't done so and try to create a sample application and deploy it to CF. Here is where you can get STS with Grails 2.0 working (http://static.springsource.org/sts/docs/2.7.0/reference/html/grails/grails20.html).
Once you have this setup, All you have to do is create a new Grails project and you will get the resources plugin along with jquery by default.