Hi,

I am trying to migrate a XFire project to CXF and seem to have fallen quiet
early on.

I have alot of spring configuration that used to get loaded up by
ContextLoaderListener before any of the xfire context were loaded up. I
loaded up my XFire service contexts using the XFireConfigurableServlet. Now
that I am trying to migrate, it appears I have no way to load up CXF after
the all my context have loaded (if I try to do this now using the config
location param for the servlet defintion I get a no bean cxf found
exception).

So I am forced to load my CXF services with my main spring configuration,
but this doesn't work because I have a statically initialized bean - my
problem seems to be with the Jsr250BeanPostProcessor & a bean which is
created using a factory method at startup.

i.e.
<bean id="dummy.factory" class="demo.spring.DummyFactory"
factory-method="createInstance" lazy-init="false">
...

This bean causes a NullPointerException (see below), so any suggestions as
to what to do. I have a attached a source code to recreate this problem.

Thanks

828 [main] ERROR org.springframework.web.context.ContextLoader  - Context
initialization failed
org.springframework.beans.factory.BeanCreationException: Error creating bean
with name 'dummy.factory ' defined in class path resource
[demo/spring/bean-defs.xml]: Initialization of bean failed; nested exception
is java.lang.NullPointerException
Caused by:
java.lang.NullPointerException
    at org.apache.cxf.common.injection.ResourceInjector.getAnnotatedMethods
(ResourceInjector.java:333)
    at
org.apache.cxf.common.injection.ResourceInjector.getPostConstructMethods(ResourceInjector.java:323)
    at
org.apache.cxf.common.injection.ResourceInjector.invokePostConstruct(ResourceInjector.java
:284)
    at
org.apache.cxf.common.injection.ResourceInjector.construct(ResourceInjector.java:84)
    at
org.apache.cxf.bus.spring.Jsr250BeanPostProcessor.postProcessBeforeInitialization(Jsr250BeanPostProcessor.java
:44)
    at
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyBeanPostProcessorsBeforeInitialization(AbstractAutowireCapableBeanFactory.java:301)
    at
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean
(AbstractAutowireCapableBeanFactory.java:1167)
    at
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:425)
    at
org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject
(AbstractBeanFactory.java:251)
    at
org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:156)
    at org.springframework.beans.factory.support.AbstractBeanFactory.getBean
(AbstractBeanFactory.java:248)
    at
org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:160)
    at
org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons
(DefaultListableBeanFactory.java:287)
    at
org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:352)
    at
org.springframework.web.context.ContextLoader.createWebApplicationContext
(ContextLoader.java:244)
    at
org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:187)
    at
org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java
:49)
    at
org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:3764)
    at
org.apache.catalina.core.StandardContext.start(StandardContext.java:4216)
    at org.apache.catalina.core.ContainerBase.addChildInternal
(ContainerBase.java:760)
    at
org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:740)
    at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:544)
    at org.apache.catalina.startup.HostConfig.deployDescriptor
(HostConfig.java:626)
    at
org.apache.catalina.startup.HostConfig.deployDescriptors(HostConfig.java:553)
    at
org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:488)
    at org.apache.catalina.startup.HostConfig.start (HostConfig.java:1138)
    at
org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java:311)
    at
org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:120)
    at org.apache.catalina.core.ContainerBase.start
(ContainerBase.java:1022)
    at org.apache.catalina.core.StandardHost.start(StandardHost.java:736)
    at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1014)
    at org.apache.catalina.core.StandardEngine.start
(StandardEngine.java:443)
    at
org.apache.catalina.core.StandardService.start(StandardService.java:448)
    at
org.apache.catalina.core.StandardServer.start(StandardServer.java:700)
    at org.apache.catalina.startup.Catalina.start (Catalina.java:552)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke
(DelegatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:585)
    at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:295)
    at org.apache.catalina.startup.Bootstrap.main (Bootstrap.java:433)

http://www.nabble.com/file/p13254519/test.zip test.zip 
-- 
View this message in context: 
http://www.nabble.com/ResourceInjector-Jsr250BeanPostProcessor-NPE-tf4640830.html#a13254519
Sent from the cxf-user mailing list archive at Nabble.com.

Reply via email to