You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cxf.apache.org by tijsrademakers <ti...@gmail.com> on 2010/12/20 15:09:13 UTC

Problem with Apache CXF and Spring Security

Hi,

In a project I'm working on we use Spring Security and Spring Flex to
communicate between the Flex application and the Spring service layer. Now
we want to add some Apache CXF web services and we receive the following
stacktrace:

2010-12-20 14:47:17.529 ERROR [main] 
ContextLoader.initWebApplicationContext:(220) Context initialization failed
org.springframework.beans.factory.BeanCreationException: Error creating bean
with name 'testWS': Could not resolve matching constructor (hint: specify
index/type/name arguments for simple parameters to avoid type ambiguities)
        at
org.springframework.beans.factory.support.ConstructorResolver.autowireConstructor(ConstructorResolver.java:250)
        at
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.autowireConstructor(AbstractAutowireCapableBeanFactory.java:1003)
        at
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:907)
        at
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:485)
        at
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:456)
        at
org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:291)
        at
org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222)
        at
org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:288)
        at
org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:190)
        at
org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:580)
        at
org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:895)
        at
org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:425)
        at
org.springframework.web.context.ContextLoader.createWebApplicationContext(ContextLoader.java:276)
        at
org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:197)
        at
org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:47)
        at
org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4135)
        at
org.apache.catalina.core.StandardContext.start(StandardContext.java:4630)
        at
org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:791)
        at
org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:771)
        at
org.apache.catalina.core.StandardHost.addChild(StandardHost.java:546)
        at
org.apache.catalina.startup.HostConfig.deployWAR(HostConfig.java:905)
        at
org.apache.catalina.startup.HostConfig.deployWARs(HostConfig.java:740)
        at
org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:500)
        at
org.apache.catalina.startup.HostConfig.start(HostConfig.java:1277)
        at
org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java:321)
        at
org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:119)
        at
org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1053)
        at
org.apache.catalina.core.StandardHost.start(StandardHost.java:785)
        at
org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1045)
        at
org.apache.catalina.core.StandardEngine.start(StandardEngine.java:445)
        at
org.apache.catalina.core.StandardService.start(StandardService.java:519)
        at
org.apache.catalina.core.StandardServer.start(StandardServer.java:710)
        at org.apache.catalina.startup.Catalina.start(Catalina.java:581)
        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:597)
        at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:289)
        at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:414)
20-dec-2010 14:47:17 org.apache.catalina.core.StandardContext start
SEVERE: Error listenerStart

If I remove the Spring Security configuration, the same web service runs
fine. BTW, there's nothing special about the Spring Security configuration,
it uses the default specified in the Spring Flex user guide. The web service
configuration is very standard and looks like this:

<jaxws:endpoint 
    id="testWS"
    implementor="com.anonymous.TestWS" 
    address="/test" />

Did anyone experience such a problem or can provide any guidance on how to
solve this, because we obviously can't just disable the Spring Security
configuration.

Best regards,

Tijs
-- 
View this message in context: http://cxf.547215.n5.nabble.com/Problem-with-Apache-CXF-and-Spring-Security-tp3312010p3312010.html
Sent from the cxf-user mailing list archive at Nabble.com.

Re: Problem with Apache CXF and Spring Security

Posted by Tijs Rademakers <ti...@gmail.com>.
Hi,

I removed my post on nabble, so i don't know why it is posted twice. Sorry.

Tijs

Op 21 dec. 2010 om 03:04 heeft Freeman Fang <fr...@gmail.com> het volgende geschreven:

> Hi,
> 
> Not sure why you ask same question twice, I believe you've already asked same questions early today in another thread and Sergey already answer you there[1].
> 
> Did you post same question on mailling list and on nabble forum separately?
> 
> [1]http://cxf.547215.n5.nabble.com/Problem-with-Apache-CXF-in-combination-with-Spring-Security-td3312054.html
> 
> Freeman
> On 2010-12-20, at 下午10:09, tijsrademakers wrote:
> 
>> 
>> Hi,
>> 
>> In a project I'm working on we use Spring Security and Spring Flex to
>> communicate between the Flex application and the Spring service layer. Now
>> we want to add some Apache CXF web services and we receive the following
>> stacktrace:
>> 
>> 2010-12-20 14:47:17.529 ERROR [main]
>> ContextLoader.initWebApplicationContext:(220) Context initialization failed
>> org.springframework.beans.factory.BeanCreationException: Error creating bean
>> with name 'testWS': Could not resolve matching constructor (hint: specify
>> index/type/name arguments for simple parameters to avoid type ambiguities)
>>       at
>> org.springframework.beans.factory.support.ConstructorResolver.autowireConstructor(ConstructorResolver.java:250)
>>       at
>> org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.autowireConstructor(AbstractAutowireCapableBeanFactory.java:1003)
>>       at
>> org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:907)
>>       at
>> org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:485)
>>       at
>> org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:456)
>>       at
>> org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:291)
>>       at
>> org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222)
>>       at
>> org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:288)
>>       at
>> org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:190)
>>       at
>> org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:580)
>>       at
>> org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:895)
>>       at
>> org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:425)
>>       at
>> org.springframework.web.context.ContextLoader.createWebApplicationContext(ContextLoader.java:276)
>>       at
>> org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:197)
>>       at
>> org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:47)
>>       at
>> org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4135)
>>       at
>> org.apache.catalina.core.StandardContext.start(StandardContext.java:4630)
>>       at
>> org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:791)
>>       at
>> org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:771)
>>       at
>> org.apache.catalina.core.StandardHost.addChild(StandardHost.java:546)
>>       at
>> org.apache.catalina.startup.HostConfig.deployWAR(HostConfig.java:905)
>>       at
>> org.apache.catalina.startup.HostConfig.deployWARs(HostConfig.java:740)
>>       at
>> org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:500)
>>       at
>> org.apache.catalina.startup.HostConfig.start(HostConfig.java:1277)
>>       at
>> org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java:321)
>>       at
>> org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:119)
>>       at
>> org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1053)
>>       at
>> org.apache.catalina.core.StandardHost.start(StandardHost.java:785)
>>       at
>> org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1045)
>>       at
>> org.apache.catalina.core.StandardEngine.start(StandardEngine.java:445)
>>       at
>> org.apache.catalina.core.StandardService.start(StandardService.java:519)
>>       at
>> org.apache.catalina.core.StandardServer.start(StandardServer.java:710)
>>       at org.apache.catalina.startup.Catalina.start(Catalina.java:581)
>>       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:597)
>>       at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:289)
>>       at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:414)
>> 20-dec-2010 14:47:17 org.apache.catalina.core.StandardContext start
>> SEVERE: Error listenerStart
>> 
>> If I remove the Spring Security configuration, the same web service runs
>> fine. BTW, there's nothing special about the Spring Security configuration,
>> it uses the default specified in the Spring Flex user guide. The web service
>> configuration is very standard and looks like this:
>> 
>> <jaxws:endpoint
>>   id="testWS"
>>   implementor="com.anonymous.TestWS"
>>   address="/test" />
>> 
>> Did anyone experience such a problem or can provide any guidance on how to
>> solve this, because we obviously can't just disable the Spring Security
>> configuration.
>> 
>> Best regards,
>> 
>> Tijs
>> -- 
>> View this message in context: http://cxf.547215.n5.nabble.com/Problem-with-Apache-CXF-and-Spring-Security-tp3312010p3312010.html
>> Sent from the cxf-user mailing list archive at Nabble.com.
> 
> 
> -- 
> Freeman Fang
> 
> ------------------------
> 
> FuseSource: http://fusesource.com
> blog: http://freemanfang.blogspot.com
> twitter: http://twitter.com/freemanfang
> Apache Servicemix:http://servicemix.apache.org
> Apache Cxf: http://cxf.apache.org
> Apache Karaf: http://karaf.apache.org
> Apache Felix: http://felix.apache.org
> 

Re: Problem with Apache CXF and Spring Security

Posted by Freeman Fang <fr...@gmail.com>.
Hi,

Not sure why you ask same question twice, I believe you've already  
asked same questions early today in another thread and Sergey already  
answer you there[1].

Did you post same question on mailling list and on nabble forum  
separately?

[1]http://cxf.547215.n5.nabble.com/Problem-with-Apache-CXF-in-combination-with-Spring-Security-td3312054.html

Freeman
On 2010-12-20, at 下午10:09, tijsrademakers wrote:

>
> Hi,
>
> In a project I'm working on we use Spring Security and Spring Flex to
> communicate between the Flex application and the Spring service  
> layer. Now
> we want to add some Apache CXF web services and we receive the  
> following
> stacktrace:
>
> 2010-12-20 14:47:17.529 ERROR [main]
> ContextLoader.initWebApplicationContext:(220) Context initialization  
> failed
> org.springframework.beans.factory.BeanCreationException: Error  
> creating bean
> with name 'testWS': Could not resolve matching constructor (hint:  
> specify
> index/type/name arguments for simple parameters to avoid type  
> ambiguities)
>        at
> org 
> .springframework 
> .beans 
> .factory 
> .support 
> .ConstructorResolver.autowireConstructor(ConstructorResolver.java:250)
>        at
> org 
> .springframework 
> .beans 
> .factory 
> .support 
> .AbstractAutowireCapableBeanFactory 
> .autowireConstructor(AbstractAutowireCapableBeanFactory.java:1003)
>        at
> org 
> .springframework 
> .beans 
> .factory 
> .support 
> .AbstractAutowireCapableBeanFactory 
> .createBeanInstance(AbstractAutowireCapableBeanFactory.java:907)
>        at
> org 
> .springframework 
> .beans 
> .factory 
> .support 
> .AbstractAutowireCapableBeanFactory 
> .doCreateBean(AbstractAutowireCapableBeanFactory.java:485)
>        at
> org 
> .springframework 
> .beans 
> .factory 
> .support 
> .AbstractAutowireCapableBeanFactory 
> .createBean(AbstractAutowireCapableBeanFactory.java:456)
>        at
> org.springframework.beans.factory.support.AbstractBeanFactory 
> $1.getObject(AbstractBeanFactory.java:291)
>        at
> org 
> .springframework 
> .beans 
> .factory 
> .support 
> .DefaultSingletonBeanRegistry 
> .getSingleton(DefaultSingletonBeanRegistry.java:222)
>        at
> org 
> .springframework 
> .beans 
> .factory 
> .support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:288)
>        at
> org 
> .springframework 
> .beans 
> .factory 
> .support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:190)
>        at
> org 
> .springframework 
> .beans 
> .factory 
> .support 
> .DefaultListableBeanFactory 
> .preInstantiateSingletons(DefaultListableBeanFactory.java:580)
>        at
> org 
> .springframework 
> .context 
> .support 
> .AbstractApplicationContext 
> .finishBeanFactoryInitialization(AbstractApplicationContext.java:895)
>        at
> org 
> .springframework 
> .context 
> .support 
> .AbstractApplicationContext.refresh(AbstractApplicationContext.java: 
> 425)
>        at
> org.springframework.web.context.ContextLoader.createWebApplicationContext 
> (ContextLoader.java:276)
>        at
> org.springframework.web.context.ContextLoader.initWebApplicationContext 
> (ContextLoader.java:197)
>        at
> org.springframework.web.context.ContextLoaderListener.contextInitialized 
> (ContextLoaderListener.java:47)
>        at
> org 
> .apache 
> .catalina.core.StandardContext.listenerStart(StandardContext.java: 
> 4135)
>        at
> org.apache.catalina.core.StandardContext.start(StandardContext.java: 
> 4630)
>        at
> org 
> .apache 
> .catalina.core.ContainerBase.addChildInternal(ContainerBase.java:791)
>        at
> org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java: 
> 771)
>        at
> org.apache.catalina.core.StandardHost.addChild(StandardHost.java:546)
>        at
> org.apache.catalina.startup.HostConfig.deployWAR(HostConfig.java:905)
>        at
> org.apache.catalina.startup.HostConfig.deployWARs(HostConfig.java:740)
>        at
> org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:500)
>        at
> org.apache.catalina.startup.HostConfig.start(HostConfig.java:1277)
>        at
> org 
> .apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java: 
> 321)
>        at
> org 
> .apache 
> .catalina 
> .util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:119)
>        at
> org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1053)
>        at
> org.apache.catalina.core.StandardHost.start(StandardHost.java:785)
>        at
> org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1045)
>        at
> org.apache.catalina.core.StandardEngine.start(StandardEngine.java:445)
>        at
> org.apache.catalina.core.StandardService.start(StandardService.java: 
> 519)
>        at
> org.apache.catalina.core.StandardServer.start(StandardServer.java:710)
>        at org.apache.catalina.startup.Catalina.start(Catalina.java: 
> 581)
>        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:597)
>        at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java: 
> 289)
>        at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java: 
> 414)
> 20-dec-2010 14:47:17 org.apache.catalina.core.StandardContext start
> SEVERE: Error listenerStart
>
> If I remove the Spring Security configuration, the same web service  
> runs
> fine. BTW, there's nothing special about the Spring Security  
> configuration,
> it uses the default specified in the Spring Flex user guide. The web  
> service
> configuration is very standard and looks like this:
>
> <jaxws:endpoint
>    id="testWS"
>    implementor="com.anonymous.TestWS"
>    address="/test" />
>
> Did anyone experience such a problem or can provide any guidance on  
> how to
> solve this, because we obviously can't just disable the Spring  
> Security
> configuration.
>
> Best regards,
>
> Tijs
> -- 
> View this message in context: http://cxf.547215.n5.nabble.com/Problem-with-Apache-CXF-and-Spring-Security-tp3312010p3312010.html
> Sent from the cxf-user mailing list archive at Nabble.com.


-- 
Freeman Fang

------------------------

FuseSource: http://fusesource.com
blog: http://freemanfang.blogspot.com
twitter: http://twitter.com/freemanfang
Apache Servicemix:http://servicemix.apache.org
Apache Cxf: http://cxf.apache.org
Apache Karaf: http://karaf.apache.org
Apache Felix: http://felix.apache.org