I am trying to upgrade from Spring 3 to 4 and I stumbled upon an issue. We use spring-ws and I have updated to the latest release (2.2.0). I am getting a java.lang.NoSuchMethodError exception
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'reportWebServiceTemplate' defined in class path resource [config/report_ws_context.xml]: Instantiation of bean failed; nested exception is org.springframework.beans.BeanInstantiationException: Could not instantiate bean class [org.springframework.ws.client.core.WebServiceTemplate]: Constructor threw exception; nested exception is java.lang.NoSuchMethodError: org/springframework/util/ClassUtils.forName(Ljava/lang/String;)Ljava/lang/Class;
at org.springframework.beans.factory.support.ConstructorResolver.autowireConstructor(ConstructorResolver.java:278)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.autowireConstructor(AbstractAutowireCapableBeanFactory.java:1114)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1017)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:504)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:475)
at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:302)
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:228)
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:298)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:193)
at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveReference(BeanDefinitionValueResolver.java:328)
... 40 more
Caused by: org.springframework.beans.BeanInstantiationException: Could not instantiate bean class [org.springframework.ws.client.core.WebServiceTemplate]: Constructor threw exception; nested exception is java.lang.NoSuchMethodError: org/springframework/util/ClassUtils.forName(Ljava/lang/String;)Ljava/lang/Class;
at org.springframework.beans.BeanUtils.instantiateClass(BeanUtils.java:164)
at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:125)
at org.springframework.beans.factory.support.ConstructorResolver.autowireConstructor(ConstructorResolver.java:270)
... 49 more
Caused by: java.lang.NoSuchMethodError: org/springframework/util/ClassUtils.forName(Ljava/lang/String;)Ljava/lang/Class;
at org.springframework.ws.support.DefaultStrategiesHelper.getDefaultStrategies(DefaultStrategiesHelper.java:114)
at org.springframework.ws.support.DefaultStrategiesHelper.getDefaultStrategies(DefaultStrategiesHelper.java:90)
at org.springframework.ws.client.core.WebServiceTemplate.initMessageSenders(WebServiceTemplate.java:321)
at org.springframework.ws.client.core.WebServiceTemplate.initDefaultStrategies(WebServiceTemplate.java:307)
at org.springframework.ws.client.core.WebServiceTemplate.<init>(WebServiceTemplate.java:143)
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:56)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:39)
at java.lang.reflect.Constructor.newInstance(Constructor.java:527)
at org.springframework.beans.BeanUtils.instantiateClass(BeanUtils.java:148)
report_ws_context.xml has this:
<bean id="reportWebServiceTemplate" class="org.springframework.ws.client.core.WebServiceTemplate">
<constructor-arg ref="messageFactory" />
<property name="messageSender" ref="messageSender" />
<property name="marshaller" ref="getReportInfoMarshaller" />
<property name="unmarshaller" ref="getReportInfoUnmarshaller" />
<property name="defaultUri" ref="reportingServiceUri" />
<property name="interceptors" ref="securityInterceptor"/>
It appears that a spring-ws class is trying to call a method in spring-core-4 that no longer exists. I was under the impression that spring-ws 2.2.0 was compatible with spring 4.
To be precise I have Spring 4.0.6.
for spring-ws I am using spring-ws-core-2.2.0.RELEASE.jar
Any insight would be appreciated
Yes, it is compatible.
From other side Spring Integration uses Spring WS 2.2 as well and already without any issue during upgrade roadmap up to Spring Framework 4.2.
Please, be sure that you really don't have old versions of those frameworks in the classpath.
Related
In my Spring Boot 1.5.2 / Neo4j 3.1.2 / SDN 4 application I'm trying to use Neo4j OGM 3.0.0-M1
Right now the application fails with a following exception:
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.springframework.data.neo4j.transaction.SharedSessionCreator#0': Cannot resolve reference to bean 'sessionFactory' while setting constructor argument; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sessionFactory' defined in com.example.domain.configuration.Neo4jTestConfig: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.neo4j.ogm.session.SessionFactory]: Factory method 'sessionFactory' threw exception; nested exception is java.lang.NullPointerException
at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveReference(BeanDefinitionValueResolver.java:359)
at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveValueIfNecessary(BeanDefinitionValueResolver.java:108)
at org.springframework.beans.factory.support.ConstructorResolver.resolveConstructorArguments(ConstructorResolver.java:634)
at org.springframework.beans.factory.support.ConstructorResolver.instantiateUsingFactoryMethod(ConstructorResolver.java:448)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateUsingFactoryMethod(AbstractAutowireCapableBeanFactory.java:1173)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1067)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:513)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:483)
at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:306)
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:230)
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:302)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:202)
at org.springframework.beans.factory.config.DependencyDescriptor.resolveCandidate(DependencyDescriptor.java:208)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.doResolveDependency(DefaultListableBeanFactory.java:1138)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency(DefaultListableBeanFactory.java:1066)
at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredMethodElement.inject(AutowiredAnnotationBeanPostProcessor.java:659)
... 56 common frames omitted
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sessionFactory' defined in com.example.domain.configuration.Neo4jTestConfig: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.neo4j.ogm.session.SessionFactory]: Factory method 'sessionFactory' threw exception; nested exception is java.lang.NullPointerException
at org.springframework.beans.factory.support.ConstructorResolver.instantiateUsingFactoryMethod(ConstructorResolver.java:599)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateUsingFactoryMethod(AbstractAutowireCapableBeanFactory.java:1173)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1067)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:513)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:483)
at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:306)
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:230)
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:302)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:197)
at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveReference(BeanDefinitionValueResolver.java:351)
... 71 common frames omitted
Caused by: org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.neo4j.ogm.session.SessionFactory]: Factory method 'sessionFactory' threw exception; nested exception is java.lang.NullPointerException
at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:189)
at org.springframework.beans.factory.support.ConstructorResolver.instantiateUsingFactoryMethod(ConstructorResolver.java:588)
... 80 common frames omitted
Caused by: java.lang.NullPointerException: null
at org.neo4j.ogm.config.Configuration.equals(Configuration.java:159)
at org.neo4j.ogm.session.SessionFactory.<init>(SessionFactory.java:72)
at org.neo4j.ogm.session.SessionFactory.<init>(SessionFactory.java:52)
at com.example.domain.configuration.Neo4jTestConfig.sessionFactory(Neo4jTestConfig.java:22)
at com.example.domain.configuration.Neo4jTestConfig$$EnhancerBySpringCGLIB$$a7edbc94.CGLIB$sessionFactory$0(<generated>)
at com.example.domain.configuration.Neo4jTestConfig$$EnhancerBySpringCGLIB$$a7edbc94$$FastClassBySpringCGLIB$$ffac7974.invoke(<generated>)
at org.springframework.cglib.proxy.MethodProxy.invokeSuper(MethodProxy.java:228)
at org.springframework.context.annotation.ConfigurationClassEnhancer$BeanMethodInterceptor.intercept(ConfigurationClassEnhancer.java:358)
at com.example.domain.configuration.Neo4jTestConfig$$EnhancerBySpringCGLIB$$a7edbc94.sessionFactory(<generated>)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:162)
... 81 common frames omitted
This is my Neo4jConfig:
#Configuration
#EnableNeo4jRepositories(basePackages = "com.example.domain.repository.neo4j")
#EnableTransactionManagement
public class Neo4jTestConfig {
#Bean
public Neo4jTransactionManager transactionManager() throws Exception {
return new Neo4jTransactionManager(sessionFactory());
}
#Bean
public SessionFactory sessionFactory() {
return new SessionFactory("com.example");
}
}
What can be a reason of this issue and how to solve it ?
There are significant changes in OGM 3.0 that are not backwards compatible with the Spring 4.x, Spring Boot 1.x and Spring Data Neo4J 4.x family.
If you want to use the new OGM 3.0 please use the Spring 5.x, Spring Boot 2.x and Spring Data Neo4J 5.x family. Note that all these projects are currently under active development and may not be 100% stable.
Have a spring bean that is not able to be created from a JNDI lookup. Exception is:
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'beanRefFactoryEjb' defined in URL [vfs:/C:/work/wildfly-10.0.0.Final/bin/content/authorization-service-1.1.1.ear/authorization-service-core-1.1.1.jar/beanRefFactory.xml]: Instantiation of bean failed; nested exception is org.springframework.beans.BeanInstantiationException: Could not instantiate bean class [org.springframework.context.support.ClassPathXmlApplicationContext]: Constructor threw exception; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'authorizationService' defined in class path resource [applicationContext-localEjb.xml]: Invocation of init method failed; nested exception is javax.naming.NameNotFoundException: authorization-service-1.1.1/ejb/org.drake.authorization.AuthorizationService -- service jboss.naming.context.java.global."authorization-service-1.1.1".ejb."org.drake.authorization.AuthorizationService"
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:451)
at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:249)
... 38 more
Caused by: org.springframework.beans.BeanInstantiationException: Could not instantiate bean class [org.springframework.context.support.ClassPathXmlApplicationContext]: Constructor threw exception; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'authorizationService' defined in class path resource [applicationContext-localEjb.xml]: Invocation of init method failed; nested exception is javax.naming.NameNotFoundException: authorization-service-1.1.1/ejb/org.drake.authorization.AuthorizationService -- service jboss.naming.context.java.global."authorization-service-1.1.1".ejb."org.drake.authorization.AuthorizationService"
at org.springframework.beans.BeanUtils.instantiateClass(BeanUtils.java:100)
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'authorizationService' defined in class path resource [applicationContext-localEjb.xml]: Invocation of init method failed; nested exception is javax.naming.NameNotFoundException: authorization-service-1.1.1/ejb/org.drake.authorization.AuthorizationService -- service jboss.naming.context.java.global."authorization-service-1.1.1".ejb."org.drake.authorization.AuthorizationService"
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1175)
... 51 more
Caused by: javax.naming.NameNotFoundException: authorization-service-1.1.1/ejb/org.drake.authorization.AuthorizationService -- service jboss.naming.context.java.global."authorization-service-1.1.1".ejb."org.drake.authorization.AuthorizationService"
at org.jboss.as.naming.ServiceBasedNamingStore.lookup(ServiceBasedNamingStore.java:106)
Here is my applicationContext-localEJB.xml file:
<bean id="authorizationService" class="org.springframework.ejb.access.LocalStatelessSessionProxyFactoryBean">
<property name="jndiName"><value>java:global/authorization-service-1.1.1/ejb/org.dcri.authorization.AuthorizationService</value></property>
<property name="businessInterface"><value>org.dcri.authorization.AuthorizationService</value></property>
</bean>
<!-- AuthorizationAdminService -->
<bean id="authorizationAdminService" class="org.springframework.ejb.access.LocalStatelessSessionProxyFactoryBean">
<property name="jndiName"><value>java:global/authorization-service-1.1.1/ejb/org.dcri.authorization.AuthorizationAdminService</value></property>
<property name="businessInterface"><value>org.dcri.authorization.AuthorizationAdminService</value></property>
</bean>
<!-- AccountService -->
<bean id="accountService" class="org.springframework.ejb.access.LocalStatelessSessionProxyFactoryBean">
<property name="jndiName"><value>java:global/authorization-service-1.1.1/ejb/org.dcri.authorization.AccountService</value></property>
<property name="businessInterface"><value>org.dcri.authorization.AccountService</value></property>
</bean>
And when Wildfly starts up, these are the JNDI names:
19:13:01,117 INFO [org.jboss.as.ejb3.deployment] (MSC service thread 1-5) WFLYEJB0473: JNDI bindings for session bean named 'AuthorizationService' in deployment unit 'subdeployment "authorization-service-core-1.1.1.jar" of deployment "authorization-service-1.1.1.ear"' are as follows:
java:global/authorization-service-1.1.1/authorization-service-core-1.1.1/AuthorizationService!org.drake.authorization.ejb.AuthorizationService
java:app/authorization-service-core-1.1.1/AuthorizationService!org.drake.authorization.ejb.AuthorizationService
java:module/AuthorizationService!org.drake.authorization.ejb.AuthorizationService
java:global/authorization-service-1.1.1/authorization-service-core-1.1.1/AuthorizationService!org.drake.authorization.ejb.AuthorizationServiceHome
java:app/authorization-service-core-1.1.1/AuthorizationService!org.drake.authorization.ejb.AuthorizationServiceHome
java:module/AuthorizationService!org.drake.authorization.ejb.AuthorizationServiceHome
19:13:01,119 INFO [org.jboss.as.ejb3.deployment] (MSC service thread 1-5) WFLYEJB0473: JNDI bindings for session bean named 'AuthorizationAdminService' in deployment unit 'subdeployment "authorization-service-core-1.1.1.jar" of deployment "authorization-service-1.1.1.ear"' are as follows:
java:global/authorization-service-1.1.1/authorization-service-core-1.1.1/AuthorizationAdminService!org.drake.authorization.ejb.AuthorizationAdminService
java:app/authorization-service-core-1.1.1/AuthorizationAdminService!org.drake.authorization.ejb.AuthorizationAdminService
java:module/AuthorizationAdminService!org.drake.authorization.ejb.AuthorizationAdminService
java:global/authorization-service-1.1.1/authorization-service-core-1.1.1/AuthorizationAdminService!org.drake.authorization.ejb.AuthorizationAdminServiceHome
java:app/authorization-service-core-1.1.1/AuthorizationAdminService!org.drake.authorization.ejb.AuthorizationAdminServiceHome
java:module/AuthorizationAdminService!org.drake.authorization.ejb.AuthorizationAdminServiceHome
19:13:01,124 INFO [org.jboss.as.ejb3.deployment] (MSC service thread 1-5) WFLYEJB0473: JNDI bindings for session bean named 'AccountService' in deployment unit 'subdeployment "authorization-service-core-1.1.1.jar" of deployment "authorization-service-1.1.1.ear"' are as follows:
java:global/authorization-service-1.3.3/authorization-service-core-1.1.1/AccountService!org.drake.authorization.ejb.AccountService
java:app/authorization-service-core-1.1.1/AccountService!org.drake.authorization.ejb.AccountService
java:module/AccountService!org.drake.authorization.ejb.AccountService
java:global/authorization-service-1.3.3/authorization-service-core-1.1.1/AccountService!org.drake.authorization.ejb.AccountServiceHome
java:app/authorization-service-core-1.1.1/AccountService!org.drake.authorization.ejb.AccountServiceHome
java:module/AccountService!org.drake.authorization.ejb.AccountServiceHome
Any help would be greatly appreciated. I've tried to change the JNDI name to be java:/global.
Set the JNDI name to be:
java:app/authorization-service-core-1.1.1/AuthorizationService!org.drake.authorization.ejb.AuthorizationServiceHome
Finds the name now.
Spring websocket run smooth on Jetty 9.1.1+
But run error on Tomcat 7.0.63 and Tomcat 8.0.24
Tomcat error log
Caused by: org.springframework.beans.BeanInstantiationException: Could
not instantiate bean class
[org.springframework.web.socket.messaging.WebSocketAnnotationMethodMessageHandler]:
Constructor threw exception; nested exception is
java.lang.NoSuchMethodError:
org.springframework.core.convert.converter.ConverterRegistry.addConverter(Ljava/lang/Class;Ljava/lang/Class;Lorg/springframework/core/convert/converter/Converter;)V
at
org.springframework.beans.BeanUtils.instantiateClass(BeanUtils.java:141)
at
org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:108)
at
org.springframework.beans.factory.support.ConstructorResolver.autowireConstructor(ConstructorResolver.java:280)
... 27 more Caused by: java.lang.NoSuchMethodError:
org.springframework.core.convert.converter.ConverterRegistry.addConverter(Ljava/lang/Class;Ljava/lang/Class;Lorg/springframework/core/convert/converter/Converter;)V
at
org.springframework.core.convert.support.DefaultConversionService.addScalarConverters(DefaultConversionService.java:132)
at
org.springframework.core.convert.support.DefaultConversionService.addDefaultConverters(DefaultConversionService.java:75)
at
org.springframework.format.support.DefaultFormattingConversionService.(DefaultFormattingConversionService.java:90)
at
org.springframework.format.support.DefaultFormattingConversionService.(DefaultFormattingConversionService.java:65)
at
org.springframework.messaging.simp.annotation.support.SimpAnnotationMethodMessageHandler.(SimpAnnotationMethodMessageHandler.java:102)
at
org.springframework.web.socket.messaging.WebSocketAnnotationMethodMessageHandler.(WebSocketAnnotationMethodMessageHandler.java:44)
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native
Method) at
sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
at
sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.lang.reflect.Constructor.newInstance(Constructor.java:422)
at
org.springframework.beans.BeanUtils.instantiateClass(BeanUtils.java:126)
... 29 more
App-config.xml
<mvc:annotation-driven />
<context:annotation-config />
<mvc:resources mapping="/static/**" location="/" />
<context:component-scan base-package="com.websocket.config" />
<websocket:message-broker
application-destination-prefix="/cqp">
<websocket:stomp-endpoint path="/connect/sockjs">
<websocket:sockjs />
</websocket:stomp-endpoint>
<websocket:simple-broker prefix="/topic" />
</websocket:message-broker>
Constructor threw exception; nested exception is java.lang.NoSuchMethodError: org.springframework.core.convert.converter.ConverterRegistry.addConverter(Ljava/lang/Class;Ljava/lang/Class;Lorg/springframework/core/convert/converter/Converter;)
Looks like you have there some old spring-core jar in the classpath, which is loaded before your own dependencies:
ConverterRegistry
/**
* Add a plain converter to this registry.
* The convertible sourceType/targetType pair is specified explicitly.
* Allows for a Converter to be reused for multiple distinct pairs without having to create a Converter class for each pair.
* #since 3.1
*/
void addConverter(Class<?> sourceType, Class<?> targetType, Converter<?, ?> converter);
Pay attention to the #since 3.1. So you should clean Tomcat classpath from those pre-3.1 Spring jars.
UPDATE
Try to use -verbose:class for the JVM (Tomcat) run to determine which version and from where the ConverterRegistry class is loaded: https://dzone.com/articles/how-use-verbose-options-java
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.
After installing the Shiro plugin (v 1.1.3) in a Grails (v 1.3.7) application and using grails shiro-quick-start --prefix="Sec" to bootstrap the different Shiro classes grails run-app fails with the stack trace shown below.
Anybody got an idea what exactly is going wrong?
When staring the application the following exception is shown:
Running Grails application..
2011-05-09 16:14:31,209 [main] ERROR
context.GrailsContextLoader - Error
executing bootstraps: Error creating
bean with name
'org.apache.shiro.grails.ShiroFilters':
Initialization of bean failed; nested
exception is
org.springframework.beans.factory.BeanCreationException:
Error creating bean with name
'shiroAnnotationHandlerService':
Cannot resolve reference to bean
'transactionManager' while setting
bean property 'transactionManager';
nested exception is
org.springframework.beans.factory.NoSuchBeanDefinitionException:
No bean named 'transactionManager' is
defined
org.springframework.beans.factory.BeanCreationException:
Error creating bean with name
'org.apache.shiro.grails.ShiroFilters':
Initialization of bean failed; nested
exception is
org.springframework.beans.factory.BeanCreationException:
Error creating bean with name
'shiroAnnotationHandlerService':
Cannot resolve reference to bean
'transactionManager' while setting
bean property 'transactionManager';
nested exception is
org.springframework.beans.factory.NoSuchBeanDefinitionException:
No bean named 'transactionManager' is
defined at
org.grails.tomcat.TomcatServer.start(TomcatServer.groovy:212)
at
grails.web.container.EmbeddableServer$start.call(Unknown
Source) at
_GrailsRun_groovy$_run_closure5_closure12.doCall(_GrailsRun_groovy:158)
at
_GrailsRun_groovy$_run_closure5_closure12.doCall(_GrailsRun_groovy)
at
_GrailsSettings_groovy$_run_closure10.doCall(_GrailsSettings_groovy:280)
at
_GrailsSettings_groovy$_run_closure10.call(_GrailsSettings_groovy)
at
_GrailsRun_groovy$_run_closure5.doCall(_GrailsRun_groovy:149)
at
_GrailsRun_groovy$_run_closure5.call(_GrailsRun_groovy)
at
_GrailsRun_groovy.runInline(_GrailsRun_groovy:116)
at
_GrailsRun_groovy.this$4$runInline(_GrailsRun_groovy)
at
_GrailsRun_groovy$_run_closure1.doCall(_GrailsRun_groovy:59) at
RunApp$_run_closure1.doCall(RunApp.groovy:33) at
gant.Gant$_dispatch_closure5.doCall(Gant.groovy:381)
at
gant.Gant$_dispatch_closure7.doCall(Gant.groovy:415)
at
gant.Gant$_dispatch_closure7.doCall(Gant.groovy) at
gant.Gant.withBuildListeners(Gant.groovy:427)
at
gant.Gant.this$2$withBuildListeners(Gant.groovy)
at
gant.Gant$this$2$withBuildListeners.callCurrent(Unknown
Source) at
gant.Gant.dispatch(Gant.groovy:415)
at
gant.Gant.this$2$dispatch(Gant.groovy)
at
gant.Gant.invokeMethod(Gant.groovy)
at
gant.Gant.executeTargets(Gant.groovy:590)
at
gant.Gant.executeTargets(Gant.groovy:589)
Caused by:
org.springframework.beans.factory.BeanCreationException:
Error creating bean with name
'shiroAnnotationHandlerService':
Cannot resolve reference to bean
'transactionManager' while setting
bean property 'transactionManager';
nested exception is
org.springframework.beans.factory.NoSuchBeanDefinitionException:
No bean named 'transactionManager' is
defined ... 23 more Caused by:
org.springframework.beans.factory.NoSuchBeanDefinitionException:
No bean named 'transactionManager' is
defined ... 23 more
First install the Hibernate plugin, and only then the Shiro plugin.
The transactionManager bean is defined by the Hibernate plugin, so it was quite normal that the Shiro plugin classes could not reference the transactionManager bean.
Shame on me!