geronimo-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Richard Wallace <rwall...@thewallacepack.net>
Subject Re: Global Spring ApplicationContext
Date Wed, 11 Apr 2007 16:40:04 GMT
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/%3C21c9d60d0701300301s6ece788bm2431eb6278956b0f@mail.gmail.com%3E.

But as mentioned in another post
(http://mail-archives.apache.org/mod_mbox/geronimo-user/200612.mbox/%3cA99F00E9A39CF5428039DE37B2069B2107D280E5@atlmaiexcp02.iss.net%3e),
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
org.springframework.context.support.ClassPathXmlApplicationContext@6be45d:
display name
[org.springframework.context.support.ClassPathXmlApplicationContext@6be45d];
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.createDefaultNamespaceHandlerResolver(XmlBeanDefinitionReader.java:489)
        at
org.springframework.beans.factory.xml.XmlBeanDefinitionReader.createReaderContext(XmlBeanDefinitionReader.java:478)
        at
org.springframework.beans.factory.xml.XmlBeanDefinitionReader.registerBeanDefinitions(XmlBeanDefinitionReader.java:458)
        at
org.springframework.beans.factory.xml.XmlBeanDefinitionReader.doLoadBeanDefinitions(XmlBeanDefinitionReader.java:353)
        at
org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:303)
        at
org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(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.loadBeanDefinitions(AbstractXmlApplicationContext.java:112)
        at
org.springframework.context.support.AbstractXmlApplicationContext.loadBeanDefinitions(AbstractXmlApplicationContext.java:79)
        at
org.springframework.context.support.AbstractRefreshableApplicationContext.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.useBeanFactory(SingletonBeanFactoryLocator.java:381)
        at
org.springframework.web.context.ContextLoader.loadParentContext(ContextLoader.java:311)
        at
org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:180)
        at
org.springframework.web.context.ContextLoaderListener.contextInitialized(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.lifecycleCommand(AbstractImmutableHandler.java:52)
        at
org.apache.geronimo.jetty6.handler.ThreadClassloaderHandler.lifecycleCommand(ThreadClassloaderHandler.java:57)
        at
org.apache.geronimo.jetty6.handler.AbstractImmutableHandler.lifecycleCommand(AbstractImmutableHandler.java:50)
        at
org.apache.geronimo.jetty6.handler.ComponentContextHandler.lifecycleCommand(ComponentContextHandler.java:57)
        at
org.apache.geronimo.jetty6.handler.AbstractImmutableHandler.lifecycleCommand(AbstractImmutableHandler.java:50)
        at
org.apache.geronimo.jetty6.handler.InstanceContextHandler.lifecycleCommand(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

Mime
View raw message