Grails error unable to create bean, only with scaffolding - grails

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.

Related

Error creating bean with name 'statelessInvalidateTokenFilter

I am trying to use Grails Spring Security Stateless Plugin but I am getting below exception. I have done exactly same as documentation but I am unable to start the application.
Grails version 2.4.4
jdk1.7.0_79
Configuring Spring Security Stateless ...
... finished configuring Spring Security Stateless
| Error 2017-02-24 12:24:36,402 [localhost-startStop-1] ERROR context.GrailsContextLoaderListener - Error initializing the application: Error creating bean with name 'statelessInvalidateTokenFilter': Initialization of bean failed; nested exception is org.springframework.beans.ConversionNotSupportedException: Failed to convert property value of type 'groovy.util.ConfigObject' to required type 'java.lang.String' for property 'endpointUrl'; nested exception is java.lang.IllegalStateException: Cannot convert value of type [groovy.util.ConfigObject] to required type [java.lang.String] for property 'endpointUrl': no matching editors or conversion strategy found
Message: Error creating bean with name 'statelessInvalidateTokenFilter': Initialization of bean failed; nested exception is org.springframework.beans.ConversionNotSupportedException: Failed to convert property value of type 'groovy.util.ConfigObject' to required type 'java.lang.String' for property 'endpointUrl'; nested exception is java.lang.IllegalStateException: Cannot convert value of type [groovy.util.ConfigObject] to required type [java.lang.String] for property 'endpointUrl': no matching editors or conversion strategy found
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 ConversionNotSupportedException: Failed to convert property value of type 'groovy.util.ConfigObject' to required type 'java.lang.String' for property 'endpointUrl'; nested exception is java.lang.IllegalStateException: Cannot convert value of type [groovy.util.ConfigObject] to required type [java.lang.String] for property 'endpointUrl': no matching editors or conversion strategy found
->> 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 IllegalStateException: Cannot convert value of type [groovy.util.ConfigObject] to required type [java.lang.String] for property 'endpointUrl': no matching editors or conversion strategy found
->> 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
|Server running. Browse to http://localhost:8080/security244
The config property was not named correctly. Check the exact name and then define it in application.groovy/.yml file. The issue was of plugin as plugin do not define any default value so if property was not defined in application.groovy it throws this exception
You are probably missing these properties:
grails.plugin.security.stateless.springsecurity.invalidate.active=false
grails.plugin.security.stateless.springsecurity.invalidate.endpointUrl="/stateless/yourinvalidateurl"
Add these to Config.groovy and it should work

Error creating bean with name 'grailsEvents'

I'm trying to migrate grails to 2.4.4 version and I'm getting this error: No idea what could be the problem.
Some suggestion is welcome, thanks in advance.
Error |
2015-12-15 10:45:47,097 [localhost-startStop-1] ERROR context.GrailsContextLoaderListener - Error initializing the application: Error creating bean with name 'grailsEvents': Cannot resolve reference to bean 'grailsEventsPublisher' while setting bean property 'grailsEventsPublisher'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'grailsEventsPublisher': Cannot resolve reference to bean 'persistenceInterceptor' while setting bean property 'persistenceInterceptor'; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No bean named 'persistenceInterceptor' is defined
Message: Error creating bean with name 'grailsEvents': Cannot resolve reference to bean 'grailsEventsPublisher' while setting bean property 'grailsEventsPublisher'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'grailsEventsPublisher': Cannot resolve reference to bean 'persistenceInterceptor' while setting bean property 'persistenceInterceptor'; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No bean named 'persistenceInterceptor' is defined
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 BeanCreationException: Error creating bean with name 'grailsEventsPublisher': Cannot resolve reference to bean 'persistenceInterceptor' while setting bean property 'persistenceInterceptor'; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No bean named 'persistenceInterceptor' is defined
->> 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 NoSuchBeanDefinitionException: No bean named 'persistenceInterceptor' is defined
->> 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

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.

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.

Connection with Grails to DB2 database

I'm trying to connect my grails application to a DB2 database that is running locally. When I want to launch my app, I get multiples errors? I'm only getting started on grails and even more on DB2 database management. Can someone help me out ?
Here's the error trails
Message: Error creating bean with name 'transactionManagerPostProcessor': Initialization of bean failed; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'transactionManager': Cannot resolve reference to bean 'sessionFactory' while setting bean property 'sessionFactory'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sessionFactory': Cannot resolve reference to bean 'hibernateProperties' while setting bean property 'hibernateProperties'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'hibernateProperties': Cannot resolve reference to bean 'dialectDetector' while setting bean property 'properties' with key [hibernate.dialect]; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'dialectDetector': Invocation of init method failed; nested exception is org.springframework.jdbc.support.MetaDataAccessException: Error while extracting DatabaseMetaData; nested exception is org.apache.commons.dbcp.SQLNestedException: Cannot create JDBC driver of class 'org.h2.Driver' for connect URL 'jdbc:db2://localhost:50000/DTH3_E:currentSchema=DFP_V115'
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 ''
^ 662 | run . . in java.lang.Thread
Caused by BeanCreationException: Error creating bean with name 'transactionManager': Cannot resolve reference to bean 'sessionFactory' while setting bean property 'sessionFactory'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sessionFactory': Cannot resolve reference to bean 'hibernateProperties' while setting bean property 'hibernateProperties'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'hibernateProperties': Cannot resolve reference to bean 'dialectDetector' while setting bean property 'properties' with key [hibernate.dialect]; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'dialectDetector': Invocation of init method failed; nested exception is org.springframework.jdbc.support.MetaDataAccessException: Error while extracting DatabaseMetaData; nested exception is org.apache.commons.dbcp.SQLNestedException: Cannot create JDBC driver of class 'org.h2.Driver' for connect URL 'jdbc:db2://localhost:50000/DTH3_E:currentSchema=DFP_V115'
->> 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 ''
^ 662 | run . . in java.lang.Thread
Caused by BeanCreationException: Error creating bean with name 'sessionFactory': Cannot resolve reference to bean 'hibernateProperties' while setting bean property 'hibernateProperties'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'hibernateProperties': Cannot resolve reference to bean 'dialectDetector' while setting bean property 'properties' with key [hibernate.dialect]; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'dialectDetector': Invocation of init method failed; nested exception is org.springframework.jdbc.support.MetaDataAccessException: Error while extracting DatabaseMetaData; nested exception is org.apache.commons.dbcp.SQLNestedException: Cannot create JDBC driver of class 'org.h2.Driver' for connect URL 'jdbc:db2://localhost:50000/DTH3_E:currentSchema=DFP_V115'
->> 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 ''
^ 662 | run . . in java.lang.Thread
Caused by BeanCreationException: Error creating bean with name 'hibernateProperties': Cannot resolve reference to bean 'dialectDetector' while setting bean property 'properties' with key [hibernate.dialect]; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'dialectDetector': Invocation of init method failed; nested exception is org.springframework.jdbc.support.MetaDataAccessException: Error while extracting DatabaseMetaData; nested exception is org.apache.commons.dbcp.SQLNestedException: Cannot create JDBC driver of class 'org.h2.Driver' for connect URL 'jdbc:db2://localhost:50000/DTH3_E:currentSchema=DFP_V115'
->> 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 ''
^ 662 | run . . in java.lang.Thread
Caused by BeanCreationException: Error creating bean with name 'dialectDetector': Invocation of init method failed; nested exception is org.springframework.jdbc.support.MetaDataAccessException: Error while extracting DatabaseMetaData; nested exception is org.apache.commons.dbcp.SQLNestedException: Cannot create JDBC driver of class 'org.h2.Driver' for connect URL 'jdbc:db2://localhost:50000/DTH3_E:currentSchema=DFP_V115'
->> 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 ''
^ 662 | run . . in java.lang.Thread
Caused by MetaDataAccessException: Error while extracting DatabaseMetaData; nested exception is org.apache.commons.dbcp.SQLNestedException: Cannot create JDBC driver of class 'org.h2.Driver' for connect URL 'jdbc:db2://localhost:50000/DTH3_E:currentSchema=DFP_V115'
->> 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 ''
^ 662 | run . . in java.lang.Thread
Caused by SQLNestedException: Cannot create JDBC driver of class 'org.h2.Driver' for connect URL 'jdbc:db2://localhost:50000/DTH3_E:currentSchema=DFP_V115'
->> 1452 | createConnectionFactory in org.apache.commons.dbcp.BasicDataSource
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
| 1371 | createDataSource in ''
| 1044 | getConnection in ''
| 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 ''
^ 662 | run in java.lang.Thread
Caused by SQLException: No suitable driver
->> 264 | getDriver in java.sql.DriverManager
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
| 1437 | createConnectionFactory in org.apache.commons.dbcp.BasicDataSource
| 1371 | createDataSource in ''
| 1044 | getConnection in ''
| 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 ''
^ 662 | run . . in java.lang.Thread
and in my datasource.groovy file, here's what I changed :
environments {
development {
dataSource {
dbCreate = "create-drop" // one of 'create', 'create-drop', 'update', 'validate', ''
//url = "jdbc:h2:mem:devDb;MVCC=TRUE;LOCK_TIMEOUT=10000"
url = "jdbc:db2://localhost:50000/DTH3_E:currentSchema=DFP_V115"
}
}
....
With some research, I understood that it was my hibernate config. Can anyone (in)validate ? And where do I go next...pretty lost to say the least
If wondering, the database is up and running and I'm able to connect to it using DbVisualizer.
Thanks in advance for the help ! If more details are needed, ask :) I'll try to clarify as much as possible the problem.
From your Exception, Grails is trying to use the H2 JDBC driver to connect to your DB2 database. Try specifying the DB2 Hibernate dialect in your dataSource declaration to see if it will use the correct driver:
dataSource {
dialect="org.hibernate.dialect.DB2Dialect"
}
Also make sure you have the necessary DB2 jar in you Grails project.

Resources