PDA

View Full Version : NamespaceHandlerResolver is not visible


doinotlikeit
May 22nd, 2008, 05:57 PM
Hi,

We're tying to get Spring DM, CFX, and Equinox working. So far everything looks good except the classloader problem encountered when trying to configure CFX using Spring config file.

We're trying to import the CXF bean configuration file into our main application context configuration file read by Spring DM. How to configure CFX using Spring is described here http://cwiki.apache.org/CXF20DOC/configuration.html. We're trying to import the cxf.xml file as below:

<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:http-conf="http://cxf.apache.org/transports/http/configuration"
xsi:schemaLocation="http://cxf.apache.org/transports/http/configuration
http://cxf.apache.org/schemas/configuration/http-conf.xsd
http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans.xsd">

<import resource="classpath:META-INF/cxf/cxf.xml" />
...
</beans>


The Spring-enabled application bundle contains the cxf-2.1.jar and that jar contains the cxf.xml. When Equinox starts up, here's what we get:

Starting Service Container ...

osgi> May 22, 2008 5:28:31 PM org.springframework.osgi.extender.internal.activat or.ContextLoaderListener start
INFO: Starting [org.springframework.bundle.osgi.extender] bundle v.[1.1.0.m2]
May 22, 2008 5:28:32 PM org.springframework.osgi.extender.internal.support .NamespaceManager hasCompatibleNamespaceType
WARNING: Bundle spring-aop (org.springframework.bundle.spring.aop) cannot see org.springframework.beans.factory.xml.NamespaceHan dlerResolver; ignoring its namespace handle
rs
May 22, 2008 5:28:32 PM org.springframework.osgi.extender.internal.support .ExtenderConfiguration <init>
INFO: No custom configuration detected; using defaults
May 22, 2008 5:28:32 PM org.springframework.osgi.extender.internal.activat or.ContextLoaderListener addDefaultPostProcessors
INFO: Disabled automatic Spring-DM annotation processing; [ org.springframework.osgi.extender.annotation.auto. processing=null]
May 22, 2008 5:28:32 PM org.springframework.context.support.AbstractApplic ationContext prepareRefresh
INFO: Refreshing org.springframework.osgi.context.support.OsgiBundl eXmlApplicationContext@1e2670b: display name [OsgiBundleXmlApplicationContext(bundle=com.ihg.ser vice.res
ervation.web, config=osgibundle:/META-INF/spring/*.xml)]; startup date [Thu May 22 17:28:32 EDT 2008]; root of context hierarchy
May 22, 2008 5:28:32 PM org.springframework.osgi.context.support.AbstractD elegatedExecutionApplicationContext startRefresh
SEVERE: Pre refresh error
java.lang.IllegalArgumentException: interface org.springframework.beans.factory.xml.NamespaceHan dlerResolver is not visible from class loader
at java.lang.reflect.Proxy.getProxyClass(Proxy.java:3 53)
at java.lang.reflect.Proxy.newProxyInstance(Proxy.jav a:581)
at org.springframework.aop.framework.JdkDynamicAopPro xy.getProxy(JdkDynamicAopProxy.java:117)
at org.springframework.aop.framework.ProxyFactory.get Proxy(ProxyFactory.java:110)
at org.springframework.osgi.context.support.TrackingU til.getService(TrackingUtil.java:127)
at org.springframework.osgi.context.support.OsgiBundl eXmlApplicationContext.lookupNamespaceHandlerResol ver(OsgiBundleXmlApplicationContext.java:260)
at org.springframework.osgi.context.support.OsgiBundl eXmlApplicationContext.createNamespaceHandlerResol ver(OsgiBundleXmlApplicationContext.java:214)
at org.springframework.osgi.context.support.OsgiBundl eXmlApplicationContext.loadBeanDefinitions(OsgiBun dleXmlApplicationContext.java:129)
at org.springframework.context.support.AbstractRefres hableApplicationContext.refreshBeanFactory(Abstrac tRefreshableApplicationContext.java:123)
at org.springframework.context.support.AbstractApplic ationContext.obtainFreshBeanFactory(AbstractApplic ationContext.java:423)
at org.springframework.osgi.context.support.AbstractD elegatedExecutionApplicationContext.startRefresh(A bstractDelegatedExecutionApplicationContext.java:2 06)
at org.springframework.osgi.extender.internal.depende ncies.startup.DependencyWaiterApplicationContextEx ecutor.stageOne(DependencyWaiterApplicationContext Executor.j
ava:218)
at org.springframework.osgi.extender.internal.depende ncies.startup.DependencyWaiterApplicationContextEx ecutor.refresh(DependencyWaiterApplicationContextE xecutor.ja
va:169)
at org.springframework.osgi.context.support.AbstractD elegatedExecutionApplicationContext.refresh(Abstra ctDelegatedExecutionApplicationContext.java:131)
at org.springframework.osgi.extender.internal.activat or.ContextLoaderListener$2.run(ContextLoaderListen er.java:674)
at java.lang.Thread.run(Thread.java:619)
May 22, 2008 5:28:32 PM org.springframework.osgi.extender.internal.depende ncies.startup.DependencyWaiterApplicationContextEx ecutor fail
SEVERE: Unable to create application context for [com.ihg.service.reservation.web], unsatisfied dependencies: none
java.lang.IllegalArgumentException: interface org.springframework.beans.factory.xml.NamespaceHan dlerResolver is not visible from class loader
at java.lang.reflect.Proxy.getProxyClass(Proxy.java:3 53)
at java.lang.reflect.Proxy.newProxyInstance(Proxy.jav a:581)
at org.springframework.aop.framework.JdkDynamicAopPro xy.getProxy(JdkDynamicAopProxy.java:117)
at org.springframework.aop.framework.ProxyFactory.get Proxy(ProxyFactory.java:110)
at org.springframework.osgi.context.support.TrackingU til.getService(TrackingUtil.java:127)
at org.springframework.osgi.context.support.OsgiBundl eXmlApplicationContext.lookupNamespaceHandlerResol ver(OsgiBundleXmlApplicationContext.java:260)
at org.springframework.osgi.context.support.OsgiBundl eXmlApplicationContext.createNamespaceHandlerResol ver(OsgiBundleXmlApplicationContext.java:214)
at org.springframework.osgi.context.support.OsgiBundl eXmlApplicationContext.loadBeanDefinitions(OsgiBun dleXmlApplicationContext.java:129)
at org.springframework.context.support.AbstractRefres hableApplicationContext.refreshBeanFactory(Abstrac tRefreshableApplicationContext.java:123)
at org.springframework.context.support.AbstractApplic ationContext.obtainFreshBeanFactory(AbstractApplic ationContext.java:423)
at org.springframework.osgi.context.support.AbstractD elegatedExecutionApplicationContext.startRefresh(A bstractDelegatedExecutionApplicationContext.java:2 06)
at org.springframework.osgi.extender.internal.depende ncies.startup.DependencyWaiterApplicationContextEx ecutor.stageOne(DependencyWaiterApplicationContext Executor.j
ava:218)
at org.springframework.osgi.extender.internal.depende ncies.startup.DependencyWaiterApplicationContextEx ecutor.refresh(DependencyWaiterApplicationContextE xecutor.ja
va:169)
at org.springframework.osgi.context.support.AbstractD elegatedExecutionApplicationContext.refresh(Abstra ctDelegatedExecutionApplicationContext.java:131)
at org.springframework.osgi.extender.internal.activat or.ContextLoaderListener$2.run(ContextLoaderListen er.java:674)
at java.lang.Thread.run(Thread.java:619)

We suspect this is due to the warning message below:
WARNING: Bundle spring-aop (org.springframework.bundle.spring.aop) cannot see org.springframework.beans.factory.xml.NamespaceHan dlerResolver; ignoring its namespace handle

Any help on resolving this is much appreciated.

Thanks,
Ron

Costin Leau
May 24th, 2008, 05:49 AM
Make sure you don't have multiple versions of Spring or Spring modules installed first. It seems that the Spring bundles are wired to different versions of Spring and thus the aop namespace for example is using type A while Spring-DM is wired to type B.
see if there isn't any spring library embedded somewhere or use equinox console (or PackageAdmin) to figure out the wiring between the bundles.

P.S. Please use the [ c o d e ] tags next time as it makes the posts much more readable.

doinotlikeit
May 28th, 2008, 06:04 AM
Costin,

Thanks so much for taking the time to reply. As you hinted, there was another spring-beans-2.5.4.jar inside the bundle. Once we removed it and added the Import-Package = org.springframework* to the menifest everything was okay.

We appreciate all you hard work with Spring DM, keep it up!
Thanks,
Ron