I am facing issue in upgrading camel 3.7.0 to 3.15.0. I am getting below error:
nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.apache.camel.spring.xml.handler.CamelNamespaceHandler]: Unresolvable class definition; nested exception is java.lang.NoClassDefFoundError: Could not initialize class org.apache.camel.spring.xml.handler.CamelNamespaceHandler
2875Caused by: org.springframework.beans.factory.BeanDefinitionStoreException: Unexpected exception parsing XML document from class path resource [producer-camel-core-context.xml];
Any help is highly appreciated.
BeanDefinitionStoreException
If you use ActiveMQ 5.x that ships with Camel 1.x and you upgrade it to use Camel 2.0 you can get an exception while starting.
ERROR: java.lang.RuntimeException: Failed to execute start task. Reason:
org.springframework.beans.factory.BeanDefinitionStoreException:
Unrecognized xbean namespace mapping: http://activemq.apache.org/camel/schema/spring
The reason is basically that the XML namespace changed in Camel 2.0 as explained below.
When Camel went from an activemq subproject to a top level apache project, they changed the URIs for their xml schemas to reflect this in Camel 2.0.
To fix this, in activemq.xml change all occurrences of:
http://activemq.apache.org/camel/schema/spring
to
http://camel.apache.org/schema/spring
and
http://activemq.apache.org/camel/schema/spring/camel-spring.xsd
to
http://camel.apache.org/schema/spring/camel-spring.xsd
Refer:
(http://people.apache.org/~dkulp/camel/exception-beandefinitionstoreexception.html)
Related
I'm trying to build a RESTful web service using the "org.apache.cxf.archetype:cxf-jaxrs-service" maven archetype. When I deploy it on Apache Tomee I get the following error:
SEVERE: Context initialization failed
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'services': Invocation of init method failed; nested exception is org.apache.cxf.service.factory.ServiceConstructionException
...
...
Caused by: org.apache.cxf.service.factory.ServiceConstructionException
at org.apache.cxf.jaxrs.JAXRSServerFactoryBean.create(JAXRSServerFactoryBean.java:219)
...
...
Caused by: java.lang.ClassCastException: Cannot cast org.apache.cxf.management.jmx.InstrumentationManagerImpl to org.apache.cxf.management.InstrumentationManager*
My guess is I'm missing some configuration but I thought the archetype would 'just work'.
Any ideas?
this error means you have a conflict between cxf in the webapp (WEB-INF/lib) and tomee. You either have to configure the classloading to do that or (recommanded and expected by EE) just remove CXF from the webapp since it is in tomee and tomee does the job for you.
Side note: you will also likely need to clean up the web.xml since tomee will handle the deployment without the need to register a servlet.
I have a curious behavior when I start my Karaf.
My JAR bundle contains a simple camel spring xml route that transforms an incoming xml fragment to text with an xslt. I use a BridgePropertyPlaceholderConfigurer to externalize my properties into {karaf.base}/etc/karaf-invalid-bundle.cfg.
To illustrate my post, I created a github repository https://github.com/johanlelan/Karaf-invalid-bundle-example.
Occasionally, my bundle fails to start for a strange cause:
karaf#root> log:display-exception
org.apache.camel.RuntimeCamelException: org.apache.camel.FailedToCreateRouteException: Failed to create route error.sample at: >>> To[xslt:xslt/template.xslt] <
<< in route: Route(error.sample)[[From[ref:incoming.endpoint]] -> [SetHea... because of java.lang.IllegalStateException: Invalid BundleContext.
at org.apache.camel.util.ObjectHelper.wrapRuntimeCamelException(ObjectHelper.java:1352)[113:org.apache.camel.camel-core:2.12.2]
at org.apache.camel.spring.SpringCamelContext.onApplicationEvent(SpringCamelContext.java:120)[121:org.apache.camel.camel-spring:2.12.2]
at org.apache.camel.spring.CamelContextFactoryBean.onApplicationEvent(CamelContextFactoryBean.java:301)[121:org.apache.camel.camel-spring:2.12.2]
at org.springframework.context.event.SimpleApplicationEventMulticaster.multicastEvent(SimpleApplicationEventMulticaster.java:96)[78:org.springframework.context:3.2.4.RELEASE]
at org.springframework.context.support.AbstractApplicationContext.publishEvent(AbstractApplicationContext.java:334)[78:org.springframework.context:3.2.4.RELEASE]
at org.springframework.context.support.AbstractApplicationContext.finishRefresh(AbstractApplicationContext.java:948)[78:org.springframework.context:3.2.4.RELEASE]
at org.springframework.osgi.context.support.AbstractOsgiBundleApplicationContext.finishRefresh(AbstractOsgiBundleApplicationContext.java:235)[117:org.springframework.osgi.core:1.2.1]
at org.springframework.osgi.context.support.AbstractDelegatedExecutionApplicationContext$4.run(AbstractDelegatedExecutionApplicationContext.java:358)[117:org.springframework.osgi.core:1.2.1]
at org.springframework.osgi.util.internal.PrivilegedUtils.executeWithCustomTCCL(PrivilegedUtils.java:85)[117:org.springframework.osgi.core:1.2.1]
at org.springframework.osgi.context.support.AbstractDelegatedExecutionApplicationContext.completeRefresh(AbstractDelegatedExecutionApplicationContext.java:320)[117:org.springframework.osgi.core:1.2.1]
at org.springframework.osgi.extender.internal.dependencies.startup.DependencyWaiterApplicationContextExecutor$CompleteRefreshTask.run(DependencyWaiterApplicationContextExecutor.java:132)[118:org.springframework.osgi.extender:1.2.1]
at java.lang.Thread.run(Thread.java:662)[:1.6.0_45]
Caused by: org.apache.camel.FailedToCreateRouteException: Failed to create route error.sample at: >>> To[xslt:xslt/template.xslt] <<< in route: Route(error.sample)[[From[ref:incoming.endpoint]] -> [SetHea... because of java.lang.IllegalStateException: Invalid BundleContext.
at org.apache.camel.model.RouteDefinition.addRoutes(RouteDefinition.java:912)[113:org.apache.camel.camel-core:2.12.2]
at org.apache.camel.model.RouteDefinition.addRoutes(RouteDefinition.java:177)[113:org.apache.camel.camel-core:2.12.2]
at org.apache.camel.impl.DefaultCamelContext.startRoute(DefaultCamelContext.java:770)[113:org.apache.camel.camel-core:2.12.2]
at org.apache.camel.impl.DefaultCamelContext.startRouteDefinitions(DefaultCamelContext.java:1914)[113:org.apache.camel.camel-core:2.12.2]
at org.apache.camel.impl.DefaultCamelContext.doStartCamel(DefaultCamelContext.java:1670)[113:org.apache.camel.camel-core:2.12.2]
at org.apache.camel.impl.DefaultCamelContext.doStart(DefaultCamelContext.java:1544)[113:org.apache.camel.camel-core:2.12.2]
at org.apache.camel.spring.SpringCamelContext.doStart(SpringCamelContext.java:179)[121:org.apache.camel.camel-spring:2.12.2]
at org.apache.camel.support.ServiceSupport.start(ServiceSupport.java:61)[113:org.apache.camel.camel-core:2.12.2]
at org.apache.camel.impl.DefaultCamelContext.start(DefaultCamelContext.java:1512)[113:org.apache.camel.camel-core:2.12.2]
at org.apache.camel.spring.SpringCamelContext.maybeStart(SpringCamelContext.java:228)[121:org.apache.camel.camel-spring:2.12.2]
at org.apache.camel.spring.SpringCamelContext.onApplicationEvent(SpringCamelContext.java:118)[121:org.apache.camel.camel-spring:2.12.2]
... 10 more
Caused by: org.apache.camel.RuntimeCamelException: java.lang.IllegalStateException: Invalid BundleContext.
at org.apache.camel.util.ObjectHelper.wrapRuntimeCamelException(ObjectHelper.java:1352)[113:org.apache.camel.camel-core:2.12.2]
at org.apache.camel.core.osgi.OsgiServiceRegistry.findByTypeWithName(OsgiServiceRegistry.java:110)[121:org.apache.camel.camel-spring:2.12.2]
at org.apache.camel.impl.CompositeRegistry.findByTypeWithName(CompositeRegistry.java:87)[113:org.apache.camel.camel-core:2.12.2]
at org.apache.camel.impl.PropertyPlaceholderDelegateRegistry.findByTypeWithName(PropertyPlaceholderDelegateRegistry.java:70)[113:org.apache.camel.camel-core:2.12.2]
at org.apache.camel.processor.interceptor.DefaultChannel.getOrCreateBacklogTracer(DefaultChannel.java:339)[113:org.apache.camel.camel-core:2.12.2]
at org.apache.camel.processor.interceptor.DefaultChannel.initChannel(DefaultChannel.java:202)[113:org.apache.camel.camel-core:2.12.2]
at org.apache.camel.model.ProcessorDefinition.wrapChannel(ProcessorDefinition.java:269)[113:org.apache.camel.camel-core:2.12.2]
at org.apache.camel.model.ProcessorDefinition.wrapProcessor(ProcessorDefinition.java:251)[113:org.apache.camel.camel-core:2.12.2]
at org.apache.camel.model.ProcessorDefinition.makeProcessor(ProcessorDefinition.java:507)[113:org.apache.camel.camel-core:2.12.2]
at org.apache.camel.model.ProcessorDefinition.addRoutes(ProcessorDefinition.java:213)[113:org.apache.camel.camel-core:2.12.2]
at org.apache.camel.model.RouteDefinition.addRoutes(RouteDefinition.java:909)[113:org.apache.camel.camel-core:2.12.2]
... 20 more
Caused by: java.lang.IllegalStateException: Invalid BundleContext.
at org.apache.felix.framework.BundleContextImpl.checkValidity(BundleContextImpl.java:514)[org.apache.felix.framework-4.0.3.jar:]
at org.apache.felix.framework.BundleContextImpl.getAllServiceReferences(BundleContextImpl.java:411)[org.apache.felix.framework-4.0.3.jar:]
at org.apache.camel.core.osgi.OsgiServiceRegistry.findByTypeWithName(OsgiServiceRegistry.java:94)[121:org.apache.camel.camel-spring:2.12.2]
... 29 more
karaf#root>
I think that this error is linked to my properties or to my BundleActivator class.
Any ideas on the way to stop this behavior?
Johan
Not sure about your concrete problem in spring. I stopped using spring on OSGi a long time ago.
A much easier solution would be to just use blueprint instead of spring. You can then use the config admin support of blueprint to attach to the config file in etc. BLueprint runs much smoother in OSGi than spring dm.
You also have the advantage that config admin properties configured by blueprint are automatically available as camel properties.
I am trying to use swagger-springmvc 0.6.6 in a Spring 3.1.2 project. But when I deploy the application to Tomcat it's failing with an exception.
There seems to be a problem with versions I am using. swagger-springmvc also brings in Spring 3.2.4 jars which are conflicting with Spring 3.1.2 jars.
Error:
org.springframework.beans.factory.BeanCreationException: Error creating bean with name
'org.springframework.security.filterChains': Cannot resolve reference to bean
'org.springframework.security.web.DefaultSecurityFilterChain#2'
while setting bean property 'sourceList' with key [2]; nested exception is
org.springframework.beans.factory.BeanCreationException: Error creating bean with name
'org.springframework.security.web.DefaultSecurityFilterChain#2
.......
....nested exception is java.lang.ClassNotFoundException:
org.springframework.cache.ehcache.EhCacheFactoryBean
The org.springframework.cache.ehcache.EhCacheFactoryBean class is found in both Spring 3.1.2 and Spring 3.2.4.
When I try to run the app in my Local smachine its running without issues.
Could someone help me to resolve the issue?
Please refer to this sample configuration. It is a very plain vanilla setup which shows the bare minimum configuration required.
JDK 6
Tomcat 7
Spring 3.2.4
https://github.com/varoonverma/Swagger.git
Cheers,
So, i have a problem that can't solve.
I have a multi module gradle project with spring boot runners. With Jpa, Elastic, OrientDb and another configurations provided by spring-data and spring-integration. And i try to start my web application! Write web starter, make annotation scan, so when I use task 'gradle bootRun' - everything start perfectly - app works, all contexts up and life is good.BUT, when i try use my favorite IDE like Intellij idea, or colleague use Eclipse - get an error :
org.springframework.beans.factory.BeanCreationExce ption: Error creating bean with
name 'org.springframework.integration.config.IdGenerato rConfigurer#0':
BeanPostProcessor before instantiation of bean failed; nested exception is
org.springframework.beans.factory.BeanCreationExce ption: Error creating bean with
name org.springframework.transaction.annotation.ProxyTransactionManagementConfiguration':
Initialization of bean failed; nested exception is java.lang.NoSuchMethodError:
org.springframework.transaction.annotation.ProxyTransactionManagementConfiguration.setBeanFactory(Lo rg/springframework/beans/factory/BeanFactoryV
That cause by (projectName - is fake):
java.lang.RuntimeException: error trying to scan <jar-file>:
file:/home/<user>/project/<projectName>/classes/production/<projectName>-system-webapp/
But i have NO /projectName/classes/production/ folder! Anyway - with gradle it's work fine.
And to be honestly, before this another error catched:
Error creating bean with name 'entityManagerFactory' defined in class com.project.system.jpa.PepperJpaConfiguration: Invocation of init method failed
caused by:
error trying to scan <jar-file>: file:/home/<user>/project/<projectName>/classes/production/<projectName>-system-webapp/
Thank you for advice! Can give additional info.
P.S : Edited
So, the problem was solved:
I do not provide important error stacktrace like:
at org.hibernate.ejb.packaging.NativeScanner.getFilesInJar(NativeScanner.java:195)
at org.hibernate.ejb.Ejb3Configuration.addScannedEntries(Ejb3Configuration.java:506)
at org.hibernate.ejb.Ejb3Configuration.scanForClasses(Ejb3Configuration.java:861)
... 21 more
Caused by: java.io.IOException: invalid constant type: 18 at 50
And this was and JDK8-Hibernate-javassist problem https://hibernate.atlassian.net/browse/HHH-8286
When upgrade javassist version to 3.18.1-GA - all problems was solved(but why run through gradle worked perfectly...)
I am getting the below error when I try to configure a spring-hibernate application:
org.springframework.beans.factory.BeanDefinitionStoreException:
Unexpected exception parsing XML document from ServletContext resource
[/WEB-INF/spring-servlet.xml]; nested exception is
java.lang.NoSuchMethodError:
org.springframework.beans.MutablePropertyValues.add(Ljava/lang/String;Ljava/lang/Object;)Lorg/springframework/beans/MutablePropertyValues;
I have org.springframework.beans-3.0.0.M3.jar in the build path.
Please help.
Thanks in advance!
See java.lang.NoSuchMethodError: org.springframework.beans.MutablePropertyValues.add
Why you are using 3.0.0.M3 ?
Try to upgrade your spring version to 3.0.0.RELEASE.
add method was added in
Changes in version 3.0.0.RC3 (2009-12-01)
added chaining-capable "add" method to MutablePropertyValues