i'm using the searchable 0.6.9 plugin with grails 2.4.4 and on my development machine (Windows/IntelliJ IDEA) everything works fine. Deploying it on my Tomcat on linux, however, gives me the following error:
...
2014-12-01 10:20:46,066 [localhost-startStop-1] ERROR StackTrace - Full Stack Trace:
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'grails.plugin.searchable.SearchableController': Initialization of bean failed; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'searchableService': Initialization of bean failed; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'compass': FactoryBean threw exception on object creation; nested exception is java.lang.NoClassDefFoundError: org/apache/lucene/analysis/Analyzer$TokenStreamComponents
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471)
at java.util.concurrent.FutureTask.run(FutureTask.java:262)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
at java.lang.Thread.run(Thread.java:744)
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'searchableService': Initialization of bean failed; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'compass': FactoryBean threw exception on object creation; nested exception is java.lang.NoClassDefFoundError: org/apache/lucene/analysis/Analyzer$TokenStreamComponents
... 5 more
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'compass': FactoryBean threw exception on object creation; nested exception is java.lang.NoClassDefFoundError: org/apache/lucene/analysis/Analyzer$TokenStreamComponents
... 5 more
Caused by: java.lang.NoClassDefFoundError: org/apache/lucene/analysis/Analyzer$TokenStreamComponents
at org.compass.core.lucene.engine.analyzer.CoreAnalyzerBuilderDelegate.buildAnalyzer(CoreAnalyzerBuilderDelegate.java:47)
at org.compass.core.lucene.engine.analyzer.DefaultLuceneAnalyzerFactory.createAnalyzer(DefaultLuceneAnalyzerFactory.java:81)
at org.compass.core.lucene.engine.analyzer.LuceneAnalyzerManager.buildAnalyzer(LuceneAnalyzerManager.java:225)
at org.compass.core.lucene.engine.analyzer.LuceneAnalyzerManager.buildAnalyzers(LuceneAnalyzerManager.java:133)
at org.compass.core.lucene.engine.analyzer.LuceneAnalyzerManager.<init>(LuceneAnalyzerManager.java:67)
at org.compass.core.lucene.engine.LuceneSearchEngineFactory.<init>(LuceneSearchEngineFactory.java:119)
at org.compass.core.impl.DefaultCompass.<init>(DefaultCompass.java:124)
at org.compass.core.impl.DefaultCompass.<init>(DefaultCompass.java:117)
at org.compass.core.config.CompassConfiguration.buildCompass(CompassConfiguration.java:288)
at grails.plugin.searchable.internal.compass.spring.SearchableCompassFactoryBean.buildCompass(SearchableCompassFactoryBean.java:95)
at grails.plugin.searchable.internal.compass.spring.SearchableCompassFactoryBean.getObject(SearchableCompassFactoryBean.java:58)
at grails.plugin.searchable.internal.compass.spring.SearchableCompassFactoryBean.getObject(SearchableCompassFactoryBean.java:41)
... 5 more
Caused by: java.lang.ClassNotFoundException: org.apache.lucene.analysis.Analyzer$TokenStreamComponents
... 17 more
It seems as if the org.apache.lucene.analysis.Analyzer class does not contain TokenStreamComponents in lucene 2.4.1 (which is a dependency of searchable 0.6.9). But as I wrote, it works fine on my development machine.
PS: On Linux the war file is built by hudson.
UPDATE:
On my dev machine it does not run as war either but run-app does. I have no clue why it tries to use a method that is not present when running as a war file.
Thanks for your help in advance.
SOLVED:
Unfortunately the solution was simple: I had the Jasper plugin installed as well and it loads lucene 4.5.1 as dependency.
By excluding it with
compile (":jasper:1.10.0") {
excludes 'org.apache.lucene:lucene-core:4.5.1'
excludes 'org.apache.lucene:lucene-analyzers-common:4.5.1'
excludes 'org.apache.lucene:lucene-queryparser:4.5.1'
}
everything works as expected.
Related
The following error I am getting when deploying the application on AWS. This is working fine when the application is deployed on in house tomcat server. The location of path where it is unable to get byte contains file with proper read permisson. I am using grails drools 1.1.1 plugin with tomcat 7 and grails 2.4.4
Any help will be appreciated.
ERROR context.GrailsContextLoaderListener - Error initializing the application: Error creating bean with name 'defaultKieStatelessSession': Cannot resolve reference to bean 'defaultKieBase' while setting bean property 'kBase'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'defaultKieBase': Invocation of init method failed; nested exception is java.lang.RuntimeException: Unable to get bytes for: /var/lib/tomcat7/webapps/ROOT/WEB-INF/classes/ScaffoldingGrailsPlugin$_closure2.class
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'defaultKieStatelessSession': Cannot resolve reference to bean 'defaultKieBase' while setting bean property 'kBase'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'defaultKieBase': Invocation of init method failed; nested exception is java.lang.RuntimeException: Unable to get bytes for: /var/lib/tomcat7/webapps/ROOT/WEB-INF/classes/ScaffoldingGrailsPlugin$_closure2.class
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:473)
at java.util.concurrent.FutureTask.run(FutureTask.java:262)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
at java.lang.Thread.run(Thread.java:748)
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'defaultKieBase': Invocation of init method failed; nested exception is java.lang.RuntimeException: Unable to get bytes for: /var/lib/tomcat7/webapps/ROOT/WEB-INF/classes/ScaffoldingGrailsPlugin$_closure2.class
... 5 more
Instead of using grails drools plugin, used directly drools package through maven, which took care of this issue.
I was testing a helloworld quartz job. I copied an existing job and pasted it in grails-app/jobs folder. I named it TestJob.groovy. I simply made it to fire every minute with a println message. I had made a mistake in the cron expression. I deleted this job and restarted the app and i get the following error message. The strange thing is looks like the file still exists since the error mentions the error was in the file TestJob.groovy but i had already removed this file. I tried cleaning the project and rebuilding it and i still get the error. I appreciate any help in resolving this error and restarting back the app normally. Thanks!
| Loading Grails 2.2.0
| Configuring classpath.
| Environment set to development.....
| Packaging Grails application.....
| Compiling 1 source files.....
| Running Grails application
ERROR context.ContextLoader: Context initialization failed
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'pluginManager' defined in ServletContext resource [/WEB-INF/applicationContext.xml]: Invocation of init method failed; nested exception is java.lang.RuntimeException: Unable to locate constructor with Class parameter for class grails.plugins.quartz.DefaultGrailsJobClass
at java.util.concurrent.FutureTask.run(FutureTask.java:262)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
at java.lang.Thread.run(Thread.java:745)
Caused by: java.lang.RuntimeException: Unable to locate constructor with Class parameter for class grails.plugins.quartz.DefaultGrailsJobClass
... 4 more
Caused by: java.lang.reflect.InvocationTargetException
... 4 more
Caused by: java.lang.IllegalArgumentException: Cron expression '0 * * * * *' in the job class com.runnercard.RemoveUserCodeJob is not a valid cron expression
at grails.plugins.quartz.config.TriggersConfigBuilder$_prepareCronTriggerAttributes_closure5.doCall(TriggersConfigBuilder.groovy:204)
at grails.plugins.quartz.config.TriggersConfigBuilder$_closure1.doCall(TriggersConfigBuilder.groovy:216)
at grails.plugins.quartz.config.TriggersConfigBuilder.prepareCronTriggerAttributes(TriggersConfigBuilder.groovy:198)
at grails.plugins.quartz.config.TriggersConfigBuilder.createTrigger(TriggersConfigBuilder.groovy:78)
at grails.plugins.quartz.config.TriggersConfigBuilder.createNode(TriggersConfigBuilder.groovy:251)
at grails.plugins.quartz.config.TriggersConfigBuilder.createNode(TriggersConfigBuilder.groovy:244)
at com.runnercard.RemoveUserCodeJob$__clinit__closure1.doCall(TestJob.groovy:14)
at grails.plugins.quartz.config.TriggersConfigBuilder.build(TriggersConfigBuilder.groovy:51)
at grails.plugins.quartz.DefaultGrailsJobClass.evaluateTriggers(DefaultGrailsJobClass.java:57)
at grails.plugins.quartz.DefaultGrailsJobClass.<init>(DefaultGrailsJobClass.java:47)
... 4 more
ERROR context.GrailsContextLoader: Error initializing the application: Error creating bean with name 'pluginManager' defined in ServletContext resource [/WEB-INF/applicationContext.xml]: Invocation of init method failed; nested exception is java.lang.RuntimeException: Unable to locate constructor with Class parameter for class grails.plugins.quartz.DefaultGrailsJobClass
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'pluginManager' defined in ServletContext resource [/WEB-INF/applicationContext.xml]: Invocation of init method failed; nested exception is java.lang.RuntimeException: Unable to locate constructor with Class parameter for class grails.plugins.quartz.DefaultGrailsJobClass
at java.util.concurrent.FutureTask.run(FutureTask.java:262)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
at java.lang.Thread.run(Thread.java:745)
Caused by: java.lang.RuntimeException: Unable to locate constructor with Class parameter for class grails.plugins.quartz.DefaultGrailsJobClass
... 4 more
Caused by: java.lang.reflect.InvocationTargetException
... 4 more
Caused by: java.lang.IllegalArgumentException: Cron expression '0 * * * * *' in the job class com.runnercard.RemoveUserCodeJob is not a valid cron expression
at grails.plugins.quartz.config.TriggersConfigBuilder$_prepareCronTriggerAttributes_closure5.doCall(TriggersConfigBuilder.groovy:204)
at grails.plugins.quartz.config.TriggersConfigBuilder$_closure1.doCall(TriggersConfigBuilder.groovy:216)
at grails.plugins.quartz.config.TriggersConfigBuilder.prepareCronTriggerAttributes(TriggersConfigBuilder.groovy:198)
at grails.plugins.quartz.config.TriggersConfigBuilder.createTrigger(TriggersConfigBuilder.groovy:78)
at grails.plugins.quartz.config.TriggersConfigBuilder.createNode(TriggersConfigBuilder.groovy:251)
at grails.plugins.quartz.config.TriggersConfigBuilder.createNode(TriggersConfigBuilder.groovy:244)
at com.runnercard.RemoveUserCodeJob$__clinit__closure1.doCall(TestJob.groovy:14)
at grails.plugins.quartz.config.TriggersConfigBuilder.build(TriggersConfigBuilder.groovy:51)
at grails.plugins.quartz.DefaultGrailsJobClass.evaluateTriggers(DefaultGrailsJobClass.java:57)
at grails.plugins.quartz.DefaultGrailsJobClass.<init>(DefaultGrailsJobClass.java:47)
... 4 more
doing a grails clean and clearing .slcache did it. Maybe the cache is the culprit.
I am trying to add the auditlog plugin but when server stars I get the error Cant find configured Auditlog domain and the server shuts down.
[ERROR] 2015-11-10 15:22:04,561 org.codehaus.groovy.grails.web.context.GrailsContextLoaderListener - Error initializing the application: Error creating bean with name 'org.codehaus.groovy.grails.plugins.orm.auditable.AuditLogEventController': Instantiation of bean failed; nested exception is org.springframework.beans.BeanInstantiationException: Could not instantiate bean class [org.codehaus.groovy.grails.plugins.orm.auditable.AuditLogEventController]: Constructor threw exception; nested exception is java.lang.IllegalStateException: Can't find configured AuditLog domain: groovy.util.ConfigObject#5bb5d623
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.codehaus.groovy.grails.plugins.orm.auditable.AuditLogEventController': Instantiation of bean failed; nested exception is org.springframework.beans.BeanInstantiationException: Could not instantiate bean class [org.codehaus.groovy.grails.plugins.orm.auditable.AuditLogEventController]: Constructor threw exception; nested exception is java.lang.IllegalStateException: Can't find configured AuditLog domain: groovy.util.ConfigObject#5bb5d623
at java.util.concurrent.FutureTask.run(FutureTask.java:262)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
at java.lang.Thread.run(Thread.java:745)
Caused by: org.springframework.beans.BeanInstantiationException: Could not instantiate bean class [org.codehaus.groovy.grails.plugins.orm.auditable.AuditLogEventController]: Constructor threw exception; nested exception is java.lang.IllegalStateException: Can't find configured AuditLog domain: groovy.util.ConfigObject#5bb5d623
And this is how I added in the my buildconfig.groovy
plugins {
// plugins for the build system only
build ":tomcat:7.0.55"
compile ":audit-logging:1.1.0-SNAPSHOT"
As described in the docs (http://plugins.grails.org/plugin/audit-logging), you must perform
grails audit-quickstart your.package.YourAuditLogEvent>
to create the audit-log Domain class in your project and to configure this class in Config.groovy.
BTW: 1.1.0 is released, already.
We've started getting the following exception when deploying to Weblogic:
org.springframework.beans.factory.BeanCreationException: Error creating bean with name
'alertService': Initialization of bean failed; nested exception is
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'mailService': Initialization of bean failed; nested exception is
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'mailMessageBuilderFactory': Initialization of bean failed; nested exception is
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'mailMessageContentRenderer': Initialization of bean failed; nested exception is
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'groovyPagesTemplateEngine': Cannot resolve reference to bean 'gspTagLibraryLookup' while setting bean property 'tagLibraryLookup'; nested exception is
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'gspTagLibraryLookup': Invocation of init method failed; nested exception is
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'grails.plugin.springsecurity.SecurityTagLib': Initialization of bean failed; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'webInvocationPrivilegeEvaluator': Cannot resolve reference to bean 'filterInvocationInterceptor' while setting constructor argument; nested exception is
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'filterInvocationInterceptor': Invocation of init method failed; nested exception is
java.lang.NoSuchMethodError: org.slf4j.helpers.MessageFormatter.arrayFormat(Ljava/lang/String;
[Ljava/lang/Object;)Lorg/slf4j/helpers/FormattingTuple;
I've tried removing the slf4j jar from my ear. I've also tried putting the following in my weblogic-appliction.xml:
<prefer-application-packages>
<package-name>org.slf4j.*</package-name>
</prefer-application-packages>
<prefer-application-resources>
<resource-name>org/slf4j/impl/StaticLoggerBinder.class</resource-name>
</prefer-application-resources>
Nothing has worked thus far. Basically, I've tried all of the different things that I've found online. Usually, when I have a conflict with a jar that I'm providing myself and that Weblogic is also providing, just using the prefer-application-packages does the trick.
I'm using Grails 2.3.6 with Weblogic 10.3.6.
In case anyone comes across this issue, this is what my problem ended up being:
What was happening is that we were including the activemq-all artifact for JMS stuff, and this artifact is what they call an "uber" jar. It as a ton of dependencies baked into it that cannot be excluded via maven – one of those dependencies was an old version of slf4j. So, even though I had the "prefer-application-packages" set in Weblogic for slf4j, it wasn't using the Grails provided version, but rather the activemq one. Rather than using the activemq-all dependency, I switched to use individual components from activemq and was able to at that point exclude slf4j. This solved my issue.
When starting my grails 2.2.0 app, I am randomly getting the error message as below, but it also randomly succeeds starting the up without an error.
No changes to the code, I just try to run the grails dev run-app multiple times.
$ grails dev run-app
I also tried a grails clean before, but that makes no difference; the error still randomly occurs.
Errors on startup:
| Packaging Grails application.....
webxml.WebxmlGrailsPlugin Loading default config file: class DefaultWebXmlConfig
webxml.WebxmlGrailsPlugin Did not find application config file: WebXmlConfig
webxml.WebxmlGrailsPlugin Loading default config file: class DefaultWebXmlConfig
| Running Grails application
context.GrailsContextLoader [GrailsContextLoader] Loading context. Creating parent application context
context.ContextLoader Context initialization failed
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'pluginManager' defined in ServletContext resource [/WEB-INF/applicationContext.xml]: Invocation of init method failed; nested exception is java.lang.RuntimeException: Unable to locate constructor with Class parameter for class org.codehaus.groovy.grails.commons.DefaultGrailsControllerClass
at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)
at java.util.concurrent.FutureTask.run(FutureTask.java:138)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
at java.lang.Thread.run(Thread.java:680)
Caused by: java.lang.RuntimeException: Unable to locate constructor with Class parameter for class org.codehaus.groovy.grails.commons.DefaultGrailsControllerClass
... 5 more
Caused by: java.lang.reflect.InvocationTargetException
... 5 more
Caused by: java.lang.NoClassDefFoundError: Lorg/codehaus/groovy/grails/plugins/web/async/api/ControllersAsyncApi;
at java.lang.Class.privateGetDeclaredFields(Class.java:2291)
at java.lang.Class.getDeclaredFields(Class.java:1743)
... 5 more
Caused by: java.lang.ClassNotFoundException: org.codehaus.groovy.grails.plugins.web.async.api.ControllersAsyncApi
at java.net.URLClassLoader$1.run(URLClassLoader.java:202)
at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
at java.lang.ClassLoader.loadClass(ClassLoader.java:247)
... 7 more
context.GrailsContextLoader Error initializing the application: Error creating bean with name 'pluginManager' defined in ServletContext resource [/WEB-INF/applicationContext.xml]: Invocation of init method failed; nested exception is java.lang.RuntimeException: Unable to locate constructor with Class parameter for class org.codehaus.groovy.grails.commons.DefaultGrailsControllerClass
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'pluginManager' defined in ServletContext resource [/WEB-INF/applicationContext.xml]: Invocation of init method failed; nested exception is java.lang.RuntimeException: Unable to locate constructor with Class parameter for class org.codehaus.groovy.grails.commons.DefaultGrailsControllerClass
at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)
at java.util.concurrent.FutureTask.run(FutureTask.java:138)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
at java.lang.Thread.run(Thread.java:680)
Caused by: java.lang.RuntimeException: Unable to locate constructor with Class parameter for class org.codehaus.groovy.grails.commons.DefaultGrailsControllerClass
... 5 more
Caused by: java.lang.reflect.InvocationTargetException
... 5 more
Caused by: java.lang.NoClassDefFoundError: Lorg/codehaus/groovy/grails/plugins/web/async/api/ControllersAsyncApi;
at java.lang.Class.privateGetDeclaredFields(Class.java:2291)
at java.lang.Class.getDeclaredFields(Class.java:1743)
... 5 more
Caused by: java.lang.ClassNotFoundException: org.codehaus.groovy.grails.plugins.web.async.api.ControllersAsyncApi
at java.net.URLClassLoader$1.run(URLClassLoader.java:202)
at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
at java.lang.ClassLoader.loadClass(ClassLoader.java:247)
... 7 more
Environment:
Mac OS X Lion
JDK 1.6.0_31
Similar post, but still different, as I'm not running Tomcat:
Grails application running on Tomcat6 - Context initialization failed
After changing servlets version from 3.0 to 2.5 (and vice versa) and this exception appeared.
I have resolved this problem by typing:
grails clean
grails clean-all
The dependencies has been fetched again and application began running.
Try to mark your servlet version as v3.0. I had the same sporadic issue and solved it by moving to v.3.0
File: BuildConfig.groovy
grails.servlet.version = "3.0" // Change depending on target container compliance (2.5 or 3.0)
After that grails-plugin-async-2.2.0.jar appeared on classpath:
%HOME%.grails\ivy-cache\org.grails\grails-plugin-async\jars\
Try to remove target manually in case the clean do not work.