I think you should try turning off cxf support in var/config/ config.xml by adding load="false" to the module for cxf-builder. That ought to eliminate cxf from your classpath.

Not an ideal solution but it should work.

cxf is producing new snapshots every day or two so if you build trunk you may also find this problem solved.

You might be able to use hidden-classes to get around this problem.

thanks
david jencks

On Apr 11, 2007, at 9:40 AM, Richard Wallace wrote:

Hello again,

I've decided to try a completely different tact than what I was trying
before. Rather than try and create a bunch of special GBeans I noticed
from a couple of places
(http://forum.springframework.org/showthread.php? t=14200&highlight=locatorFactorySelector
mainly) that Spring has support for this sort of thing sorta baked in.
The only trick is to get that global context in a root classloader so
that it can be shared.

I tried this by putting the jars in a classpath entry in the ear
MANIFEST.MF file as mentioned here
http://mail-archives.apache.org/mod_mbox/geronimo-user/200701.mbox/% [EMAIL PROTECTED]
But as mentioned in another post
(http://mail-archives.apache.org/mod_mbox/geronimo-user/200612.mbox/ [EMAIL PROTECTED]), this leads to everything being loaded in separate classloaders per webapp.

So, this lead me to the discovery of the JEE5 support for the /lib
directory inside an EAR that will load all the jars into a parent
classpath that all modules can use.  I downloaded
geronimo-jetty6-jee5-2.0-M3, started it up, and deployed my EAR with the
spring and all my application code in the root lib directory.

Spring failed to load.  Here's the stack trace.

09:04:55,548 WARN  [JettyModuleBuilder] Web application
example-webapp-0.1-SNAPSHOT.war does not contain a
WEB-INF/geronimo-web.xml deployment plan.  This may or may not be a
problem, depending on whether you have things like resource references
that need to be resolved.  You can also give the deployer a separate
deployment plan file on the command line.
09:04:55,615 WARN  [JettyModuleBuilder] Web application
example-webapp2.war does not contain a WEB-INF/geronimo-web.xml
deployment plan. This may or may not be a problem, depending on whether you have things like resource references that need to be resolved. You
can also give the deployer a separate deployment plan file on the
command line.
2007-04-11 09:04:56.535:/example:INFO:  Initializing Spring root
WebApplicationContext
09:04:56,535 INFO  [ContextLoader] Root WebApplicationContext:
initialization started
09:04:56,592 INFO  [ClassPathXmlApplicationContext] Refreshing
[EMAIL PROTECTED] 45d:
display name
[EMAIL PROTECTED] e45d];
startup date [Wed Apr 11 09:04:56 MST 2007]; root of context hierarchy
09:04:56,725 INFO  [XmlBeanDefinitionReader] Loading XML bean
definitions from class path resource [shared-context.xml]
09:04:58,850 ERROR [ContextLoader] Context initialization failed
org.springframework.beans.factory.access.BootstrapException: Unable to
initialize group definition. Group resource name
[classpath:/shared-context.xml], factory key [shared-context]; nested
exception is
org.springframework.beans.factory.BeanDefinitionStoreException:
Unexpected exception parsing XML document from class path resource
[shared-context.xml]; nested exception is
java.lang.IllegalArgumentException: Class
[org.apache.cxf.transport.http.spring.NamespaceHandler] does not
implement the NamespaceHandler interface
Caused by:
org.springframework.beans.factory.BeanDefinitionStoreException:
Unexpected exception parsing XML document from class path resource
[shared-context.xml]; nested exception is
java.lang.IllegalArgumentException: Class
[org.apache.cxf.transport.http.spring.NamespaceHandler] does not
implement the NamespaceHandler interface
Caused by:
java.lang.IllegalArgumentException: Class
[org.apache.cxf.transport.http.spring.NamespaceHandler] does not
implement the NamespaceHandler interface
        at
org.springframework.beans.factory.xml.DefaultNamespaceHandlerResolver. initHandlerMappings(DefaultNamespaceHandlerResolver.java:119)
        at
org.springframework.beans.factory.xml.DefaultNamespaceHandlerResolver. <init>(DefaultNamespaceHandlerResolver.java:96)
        at
org.springframework.beans.factory.xml.DefaultNamespaceHandlerResolver. <init>(DefaultNamespaceHandlerResolver.java:82)
        at
org.springframework.beans.factory.xml.XmlBeanDefinitionReader.createDe faultNamespaceHandlerResolver(XmlBeanDefinitionReader.java:489)
        at
org.springframework.beans.factory.xml.XmlBeanDefinitionReader.createRe aderContext(XmlBeanDefinitionReader.java:478)
        at
org.springframework.beans.factory.xml.XmlBeanDefinitionReader.register BeanDefinitions(XmlBeanDefinitionReader.java:458)
        at
org.springframework.beans.factory.xml.XmlBeanDefinitionReader.doLoadBe anDefinitions(XmlBeanDefinitionReader.java:353)
        at
org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBean Definitions(XmlBeanDefinitionReader.java:303)
        at
org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBean Definitions(XmlBeanDefinitionReader.java:280)
        at
org.springframework.beans.factory.support.AbstractBeanDefinitionReader .loadBeanDefinitions(AbstractBeanDefinitionReader.java:131)
        at
org.springframework.beans.factory.support.AbstractBeanDefinitionReader .loadBeanDefinitions(AbstractBeanDefinitionReader.java:147)
        at
org.springframework.beans.factory.support.AbstractBeanDefinitionReader .loadBeanDefinitions(AbstractBeanDefinitionReader.java:173)
        at
org.springframework.context.support.AbstractXmlApplicationContext.load BeanDefinitions(AbstractXmlApplicationContext.java:112)
        at
org.springframework.context.support.AbstractXmlApplicationContext.load BeanDefinitions(AbstractXmlApplicationContext.java:79)
        at
org.springframework.context.support.AbstractRefreshableApplicationCont ext.refreshBeanFactory(AbstractRefreshableApplicationContext.java:100)
        at
org.springframework.context.support.AbstractApplicationContext.refresh (AbstractApplicationContext.java:313)
        at
org.springframework.context.access.ContextSingletonBeanFactoryLocator. initializeDefinition(ContextSingletonBeanFactoryLocator.java:137)
        at
org.springframework.beans.factory.access.SingletonBeanFactoryLocator.u seBeanFactory(SingletonBeanFactoryLocator.java:381)
        at
org.springframework.web.context.ContextLoader.loadParentContext (ContextLoader.java:311)
        at
org.springframework.web.context.ContextLoader.initWebApplicationContex t(ContextLoader.java:180)
        at
org.springframework.web.context.ContextLoaderListener.contextInitializ ed(ContextLoaderListener.java:49)
        at
org.mortbay.jetty.handler.ContextHandler.startContext (ContextHandler.java:511) at org.mortbay.jetty.servlet.Context.startContext (Context.java:135)
        at
org.mortbay.jetty.webapp.WebAppContext.startContext (WebAppContext.java:1191)
        at
org.mortbay.jetty.handler.ContextHandler.doStart (ContextHandler.java:481)
        at
org.mortbay.jetty.webapp.WebAppContext.doStart(WebAppContext.java:434)
        at
org.mortbay.component.AbstractLifeCycle.start (AbstractLifeCycle.java:40)
        at
org.apache.geronimo.jetty6.JettyWebAppContext $StartCommand.lifecycleMethod(JettyWebAppContext.java:355)
        at
org.apache.geronimo.jetty6.handler.AbstractImmutableHandler.lifecycleC ommand(AbstractImmutableHandler.java:52)
        at
org.apache.geronimo.jetty6.handler.ThreadClassloaderHandler.lifecycleC ommand(ThreadClassloaderHandler.java:57)
        at
org.apache.geronimo.jetty6.handler.AbstractImmutableHandler.lifecycleC ommand(AbstractImmutableHandler.java:50)
        at
org.apache.geronimo.jetty6.handler.ComponentContextHandler.lifecycleCo mmand(ComponentContextHandler.java:57)
        at
org.apache.geronimo.jetty6.handler.AbstractImmutableHandler.lifecycleC ommand(AbstractImmutableHandler.java:50)
        at
org.apache.geronimo.jetty6.handler.InstanceContextHandler.lifecycleCom mand(InstanceContextHandler.java:81)

The problem seems to be that the class
org.apache.cxf.transport.http.spring.NamespaceHandler doesn't implement
the Spring NamespaceHandler interface.  Having no idea where that even
came from I google'd "cxf apache" and found the Apache CXF project in
the incubator.  I browsed the SVN repo and  eventually found this,
http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/transports/http/ src/main/java/org/apache/cxf/transport/http/spring/ NamespaceHandler.java?revision=501982&view=markup.

It looks like they have recently moved to supporting Spring more
directly/easily, at least that's what I infer from the comment.  So my
hope is that a new milestone of Geronimo would include a newer version
of the CXF library and would fix this issue.  Do you guys think that
might to be the case?  If so, in the meantime, is there anything I can
do that would allow me to workaround this issue? If not, I'll fall back and try the dummy ejb method that was mentioned in one of the threads I
linked to.

Thanks,
Rich

Reply via email to