How to fix a not refreshed GrailsWebApplicationContext? - grails

I'm upgrading my project from java 6 to java 8 and grails 2.1.3 to grails 2.3.9 and during the process I had to update some dependencies as well.
Now when I try to run grails run-app I'm getting this error but I don't know exactly where to look for to solve this one.
| Error 2016-05-03 14:39:10,507 [localhost-startStop-1] ERROR context.GrailsContextLoader - Error initializing the application: org.codehaus.groovy.grails.commons.spring.GrailsWebApplicationContext#79418b69 has not been refreshed yet
Message: org.codehaus.groovy.grails.commons.spring.GrailsWebApplicationContext#79418b69 has not been refreshed yet
Line | Method
->> 266 | run in java.util.concurrent.FutureTask
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
| 1142 | runWorker in java.util.concurrent.ThreadPoolExecutor
| 617 | run . . . in java.util.concurrent.ThreadPoolExecutor$Worker
^ 745 | run in java.lang.Thread
Did someone face an error like this one? Or if you have some direction about what can I look for to solve it.
Thanks

This looks like a dependency problem on two different versions of spring or some other underlying frame work. See here: https://groups.google.com/a/cloudfoundry.org/forum/#!msg/vcap-dev/ixuMoCT2tlM/aLtEdZhRPTEJ

Related

NoNodeAvailableException when installing elasticsearch plugin in grails

I'm developing a grails web-app (currently on my local machine) that needs to query elasticsearch on a server on my network.
I have taken the following steps:
Added the following line in BuildConfig.groovy
plugins {
...
runtime ":elasticsearch:0.0.3.4"
...
}
I have also added the following to Config.groovy:
elasticSearch {
client.mode = 'transport'
client.hosts = [
[host:'xxx.xxx.xxx.xxx', port:9200]
]
disableAutoIndex = 'true'
}
To eliminate firewall issues etc have run the query using curl and it works fine:
curl -XGET 'http://xxx.xxx.xxx.xxx:9200/_search?pretty' -d '{...}
But I am getting the following:
|Running Grails application
Error |
2014-10-23 09:17:52,278 [localhost-startStop-1] ERROR context.GrailsContextLoaderListener - Error initializing the application: Error creating bean with name 'searchableClassMappingConfigurator': Invocation of init method failed; nested exception is org.elasticsearch.client.transport.NoNodeAvailableException: None of the configured nodes are available: []
Message: Error creating bean with name 'searchableClassMappingConfigurator': Invocation of init method failed; nested exception is org.elasticsearch.client.transport.NoNodeAvailableException: None of the configured nodes are available: []
Line | Method
->> 262 | run in java.util.concurrent.FutureTask
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
| 1145 | runWorker in java.util.concurrent.ThreadPoolExecutor
| 615 | run . . . in java.util.concurrent.ThreadPoolExecutor$Worker
^ 745 | run in java.lang.Thread
Caused by NoNodeAvailableException: None of the configured nodes are available: []
->> 273 | ensureNodesAreAvailable in org.elasticsearch.client.transport.TransportClientNodesService
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
| 192 | execute in ''
| 81 | execute . in org.elasticsearch.client.transport.support.InternalTransportClusterAdminClient
| 73 | execute in ''
| 118 | health . in org.elasticsearch.client.support.AbstractClusterAdminClient
| 154 | installMappings in org.grails.plugins.elasticsearch.mapping.SearchableClassMappingConfigurator
| 51 | configureAndInstallMappings in ''
| 262 | run in java.util.concurrent.FutureTask
| 1145 | runWorker in java.util.concurrent.ThreadPoolExecutor
| 615 | run in java.util.concurrent.ThreadPoolExecutor$Worker
^ 745 | run . . . in java.lang.Thread
Error |
Forked Grails VM exited with error
I've read numerous other answers on here for similar errors but nothing I've tried is working. Any ideas?
Transport is done on port 9300 (not on the HTTP port 9200). Also check this port to be open then.
If it still fails, check also to use the right cluster.name. It is elasticsearch by default, so if you have not changed it in your server/cluster, there is no need for it.
Otherwise please add the new insights on your question.

Grails error unable to create bean, only with scaffolding

Grails : 2.4
Java : Oracle 1.7
OS : Ubuntu 14.04
Hello Friends,
I am working on a sample project to improve my knowledge in grails. For the controller file, when I replace def index() { } with
def scaffold = EventManagment, I get an error of which the log is mentioned below. If I dont add that line, and I go on localhost page, then I don't see the web-app in action. Kindly let me know what to do. Thank you.
Controller file is /grails-2.4.0/EventMg/grails-app/controllers/com/Evenmgmt.groovy.
Log :
| Running Grails application
| Error 2014-06-15 16:47:52,353 [localhost-startStop-1] ERROR context.GrailsContextLoaderListener - Error initializing the application: Error creating bean with name 'com.tekdays.TekEventController': Instantiation of bean failed; nested exception is org.springframework.beans.BeanInstantiationException: Could not instantiate bean class [com.tekdays.TekEventController]: Constructor threw exception; nested exception is java.lang.NullPointerException
Message: Error creating bean with name 'com.tekdays.TekEventController': Instantiation of bean failed; nested exception is org.springframework.beans.BeanInstantiationException: Could not instantiate bean class [com.tekdays.TekEventController]: Constructor threw exception; nested exception is java.lang.NullPointerException
Line | Method
->> 266 | run in java.util.concurrent.FutureTask
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
| 1142 | runWorker in java.util.concurrent.ThreadPoolExecutor
| 617 | run . . . in java.util.concurrent.ThreadPoolExecutor$Worker
^ 745 | run in java.lang.Thread
Caused by BeanInstantiationException: Could not instantiate bean class [com.tekdays.TekEventController]: Constructor threw exception; nested exception is java.lang.NullPointerException
->> 266 | run in java.util.concurrent.FutureTask
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
| 1142 | runWorker in java.util.concurrent.ThreadPoolExecutor
| 617 | run . . . in java.util.concurrent.ThreadPoolExecutor$Worker
^ 745 | run in java.lang.Thread
Caused by NullPointerException: null
->> 266 | run in java.util.concurrent.FutureTask
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
| 1142 | runWorker in java.util.concurrent.ThreadPoolExecutor
| 617 | run . . . in java.util.concurrent.ThreadPoolExecutor$Worker
^ 745 | run in java.lang.Thread
| Error Forked Grails VM exited with error
I was able to fix the problem by a clean installation of old version of Ubuntu. Same code worked. This question for me marks as answered.

Vaadin Grails: Can not process requests before init() has been called

I'm trying to setup the Vaadin Grails plugin, but when following the instructions from here I run into the following error when actually running the app:
| Error 2014-03-05 14:03:14,922 [http-bio-8080-exec-5] ERROR [/ria-app].[VaadinServlet 0] - Servlet.service() for servlet [VaadinServlet 0] in context with path [/ria-app] threw exception
Message: Can not process requests before init() has been called
Line | Method
->> 1292 | requestStart in com.vaadin.server.VaadinService
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
| 1371 | handleRequest in ''
| 238 | service . . . in com.vaadin.server.VaadinServlet
| 1145 | runWorker in java.util.concurrent.ThreadPoolExecutor
| 615 | run . . . . . in java.util.concurrent.ThreadPoolExecutor$Worker
^ 744 | run in java.lang.Thread
The full stack trace is available here.
The issue is fixed in 7.1.10.2 or if you want also update Vaadin version then 7.1.11.

Does the Searchable plugin work with Grails 2.0.0? (I argue no)

When I upgrade to the project to grails 2.0 (with a fresh install of the searchable plugin), I get a Hibernate class cast exception. Does anybody else get this problem?
http://grails.org/ uses the Searchable plugin and it works with Grails 2.0.3. What issue are you running into?
Searchable is based on Compass which is being rewritten as ElasticSearch.
The ElasticSearch plugin works with Grails 2.0.
For more information see The Future of Compass & ElasticSearch.
Migrating my app from Grails 1.3.7 to 2.1.1 ran into a similar issue. I was able to resolve it by updating the Searchable plugin from 0.5.5 to 0.6.4.
Here's what the stacktrace looked like:
| Error 2012-10-05 19:02:18,691 [localhost-startStop-1] ERROR context.GrailsContextLoader - Error executing bootstraps: org.codehaus.groovy.grails.orm.hibernate.SessionFactoryProxy cannot be cast to org.hibernate.impl.SessionFactoryImpl
Message: org.codehaus.groovy.grails.orm.hibernate.SessionFactoryProxy cannot be cast to org.hibernate.impl.SessionFactoryImpl
Line
| Method
->> 95 | injectLifecycle in org.compass.gps.device.hibernate.lifecycle.DefaultHibernateEntityLifecycleInjector
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
| 46 | injectLifecycle in org.compass.gps.device.hibernate.lifecycle.DefaultHibernateEntityCollectionLifecycleInjector
| 149 | doStart . . . . in org.compass.gps.device.hibernate.HibernateGpsDevice
| 125 | start in org.compass.gps.device.AbstractGpsDevice
| 73 | start . . . . . in org.compass.gps.device.support.parallel.AbstractParallelGpsDevice
| 166 | start in org.compass.gps.impl.AbstractCompassGps
| 144 | doCall . . . . in SearchableGrailsPlugin$_closure3
| 303 | innerRun in java.util.concurrent.FutureTask$Sync
| 138 | run . . . . . . in java.util.concurrent.FutureTask
| 886 | runTask in java.util.concurrent.ThreadPoolExecutor$Worker
| 908 | run . . . . . . in ''
^ 680 | run in java.lang.Thread
| Error 2012-10-05 19:02:18,715 [localhost-startStop-1] ERROR [localhost].[/myApp] - Exception sending context initialized event to listener instance of class org.codehaus.groovy.grails.web.context.GrailsContextLoaderListener
Message: Error executing bootstraps; nested exception is java.lang.ClassCastException: org.codehaus.groovy.grails.orm.hibernate.SessionFactoryProxy cannot be cast to org.hibernate.impl.SessionFactoryImpl
Line | Method
->> 303 | innerRun in java.util.concurrent.FutureTask$Sync
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
| 138 | run in java.util.concurrent.FutureTask
| 886 | runTask in java.util.concurrent.ThreadPoolExecutor$Worker
| 908 | run in ''
^ 680 | run . . in java.lang.Thread
Caused by ClassCastException: org.codehaus.groovy.grails.orm.hibernate.SessionFactoryProxy cannot be cast to org.hibernate.impl.SessionFactoryImpl
->> 95 | injectLifecycle in org.compass.gps.device.hibernate.lifecycle.DefaultHibernateEntityLifecycleInjector
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
| 46 | injectLifecycle in org.compass.gps.device.hibernate.lifecycle.DefaultHibernateEntityCollectionLifecycleInjector
| 149 | doStart in org.compass.gps.device.hibernate.HibernateGpsDevice
| 125 | start in org.compass.gps.device.AbstractGpsDevice
| 73 | start . in org.compass.gps.device.support.parallel.AbstractParallelGpsDevice
| 166 | start in org.compass.gps.impl.AbstractCompassGps
| 144 | doCall . in SearchableGrailsPlugin$_closure3
| 303 | innerRun in java.util.concurrent.FutureTask$Sync
| 138 | run . . in java.util.concurrent.FutureTask
| 886 | runTask in java.util.concurrent.ThreadPoolExecutor$Worker
| 908 | run . . in ''
^ 680 | run in java.lang.Thread
Yes me too used searchable on grails 1.3.7 , 2.0.3 and now using on 2.1.1
All i have to do was upgrade my searchable plugin to the latest one. Though I had to made some tweaks in the code but every thing was mentioned in the plugin documentation
link to documentation
Mind the imports in the controllers. As I guess the class path has been changed. And this was the only change I made.
This happends because when you upgrade to a Grails version that uses Hibernate 4.X.
This happends because there were several package and class name changes between Hiberate 3.x and 4.x, so code that works with Hibernate 3.x won't work with 4.x except in rare cases. Beyond the name changes, there were big internal changes in how things work, so code that compiles won't necessarily run. App option #1 is to downgrade to Hibernate 3.x. The config settings for that are included and commented out (BuildConfig.groovy, DataSource.groovy), so this a very quick option. Obviously not an option if you depend on a feature added in 4.x, and this just delays the real problem until you have to upgrade Hibernate.

Grails 2.0, Atmosphere-Plugin and WebSockets

I am trying to get a sample WebSocket app running on grails 2.0 with jetty 7.5 in dev mode. I generated a simple AtmosphereHandler, but whenever I try to connect via a WebSocket I get the following error message:
E
rror 2011-11-24 17:18:32,075 ["http-bio-8080"-exec-4] ERROR [/jet2].[StratosphereServlet] - Servlet.service() for servlet [StratosphereServlet] in context with path [/jet2] threw exception
Message: null
Line | Method
->> 197 | upgrade in org.eclipse.jetty.websocket.WebSocketFactory
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
| 320 | acceptWebSocket in ''
| 78 | service . . . . in org.eclipse.jetty.websocket.WebSocketServlet
| 26 | doFilter in org.grails.plugin.resource.DevModeSanityFilter
| 886 | runTask . . . . in java.util.concurrent.ThreadPoolExecutor$Worker
| 908 | run in ''
^ 619 | run . . . . . . in java.lang.Thread
Any suggestions as to what might be the rpoblem are highly appreciated. Best wishes Peter, Switzerland
it seems the issue is with the Grails Plug In as I don't see Atmosphere classes in the stack trace. Thanks for filling the issue
https://bitbucket.org/bgoetzmann/grails-atmosphere-plugin/issue/4/grails-20-atmosphere-and-websockets

Resources