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

Problem with Apache CXF in combination with 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.BeanCreationExce ption: 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.Abstract AutowireCapableBeanFactory.autowireConstructor(Abs tractAutowireCapableBeanFactory.java:1003) 
at org.springframework.beans.factory.support.Abstract AutowireCapableBeanFactory.createBeanInstance(Abst ractAutowireCapableBeanFactory.java:907) 
at org.springframework.beans.factory.support.Abstract AutowireCapableBeanFactory.doCreateBean(AbstractAu towireCapableBeanFactory.java:485) 
at org.springframework.beans.factory.support.Abstract AutowireCapableBeanFactory.createBean(AbstractAuto wireCapableBeanFactory.java:456) 
at org.springframework.beans.factory.support.Abstract BeanFactory$1.getObject(AbstractBeanFactory.java:2 91) 
at org.springframework.beans.factory.support.DefaultS ingletonBeanRegistry.getSingleton(DefaultSingleton BeanRegistry.java:222) 
at org.springframework.beans.factory.support.Abstract BeanFactory.doGetBean(AbstractBeanFactory.java:288 ) 
at org.springframework.beans.factory.support.Abstract BeanFactory.getBean(AbstractBeanFactory.java:190) 
at org.springframework.beans.factory.support.DefaultL istableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:580) 
at org.springframework.context.support.AbstractApplic ationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:895) 
at org.springframework.context.support.AbstractApplic ationContext.refresh(AbstractApplicationContext.java:425) 
at org.springframework.web.context.ContextLoader.crea teWebApplicationContext(ContextLoader.java:276) 
at org.springframework.web.context.ContextLoader.init WebApplicationContext(ContextLoader.java:197) 
at org.springframework.web.context.ContextLoaderListe ner.contextInitialized(ContextLoaderListener.java:47) 
at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4135) 
at org.apache.catalina.core.StandardContext.start(Sta ndardContext.java:4630) 
at org.apache.catalina.core.ContainerBase.addChildInt ernal(ContainerBase.java:791) 
at org.apache.catalina.core.ContainerBase.addChild(Co ntainerBase.java:771) 
at org.apache.catalina.core.StandardHost.addChild(Sta ndardHost.java:546) 
at org.apache.catalina.startup.HostConfig.deployWAR(H ostConfig.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(HostC onfig.java:1277) 
at org.apache.catalina.startup.HostConfig.lifecycleEv ent(HostConfig.java:321) 
at org.apache.catalina.util.LifecycleSupport.fireLife cycleEvent(LifecycleSupport.java:119) 
at org.apache.catalina.core.ContainerBase.start(Conta inerBase.java:1053) 
at org.apache.catalina.core.StandardHost.start(Standa rdHost.java:785) 
at org.apache.catalina.core.ContainerBase.start(Conta inerBase.java:1045) 
at org.apache.catalina.core.StandardEngine.start(Stan dardEngine.java:445) 
at org.apache.catalina.core.StandardService.start(Sta ndardService.java:519) 
at org.apache.catalina.core.StandardServer.start(Stan dardServer.java:710) 
at org.apache.catalina.startup.Catalina.start(Catalina.java:581) 
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) 
at sun.reflect.NativeMethodAccessorImpl.invoke(Native MethodAccessorImpl.java:39) 
at sun.reflect.DelegatingMethodAccessorImpl.invoke(De legatingMethodAccessorImpl.java:25) 
at java.lang.reflect.Method.invoke(Method.java:597) 
at org.apache.catalina.startup.Bootstrap.start(Bootst rap.java:289) 
at org.apache.catalina.startup.Bootstrap.main(Bootstr ap.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

Re: Problem with Apache CXF in combination with Spring Security

Posted by Sergey Beryozkin <sb...@gmail.com>.
Hi

I suspect it is something that you may also want to explore further by
checking Spring Security or Spring AOP forums.
I'm looking at the stack trace and it seems CXF is not even 'reached', i.e,
the JAXWS layer has not been given a chance to handle the proxy and thus the
@implementorClass attribute has no effect...

cheers, Sergey

On Thu, Dec 23, 2010 at 11:32 AM, Tijs Rademakers <tijs.rademakers@gmail.com
> wrote:

> Hi,
>
> I don't do any constructor injection myself, so this has something to do
> with the generated proxy in Spring.
> The TestWsServiceImpl is already implementing a TestWsService interface.
> I think the CGLIB proxified service bean comes from Spring Security.
> Because when I remove the Spring Security config it all works immediately.
> But we don't do any strange stuff in our Spring Security configuration, I
> included the configuration below:
>
> <beans xmlns="http://www.springframework.org/schema/beans"
>        xmlns:s="http://www.springframework.org/schema/security"
> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
>        xsi:schemaLocation="http://www.springframework.org/schema/beans
> http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
>                        http://www.springframework.org/schema/security
> http://www.springframework.org/schema/security/spring-security-3.0.xsd">
>
>        <s:http entry-point-ref="entryPoint">
>                <s:anonymous enabled="false" />
>        </s:http>
>
>        <bean id="entryPoint"
>
>  class="org.springframework.security.web.authentication.Http403ForbiddenEntryPoint"
> />
>
>        <s:ldap-server url="${ldap.url}" manager-dn="${ldap.username}"
>                manager-password="${ldap.password}" />
>
>        <s:authentication-manager>
>                <s:ldap-authentication-provider
>                        user-search-base="cn=users"
> user-search-filter="(uid={0})"
>                        group-search-filter="(member={0})"
> group-role-attribute="cn"
>                        group-search-base="ou=test" role-prefix="ROLE_" />
>        </s:authentication-manager>
>
> </beans>
>
> This Spring Security config is standard for Spring Flex applications.
> Any thoughts?
>
> Thanks,
>
> Tijs
>
> On Dec 23, 2010, at 11:09 AM, Sergey Beryozkin wrote:
>
> > Hi
> >
> > May be this information can help ?
> >
> >
> http://www.mkyong.com/spring/constructor-injection-type-ambiguities-in-spring/
> >
> > It also seems like your service bean is CGLIB proxified by Spring. If you
> > introduce at least interface, ex, have your
> > TestWsServiceImpl implementing TestWsService then you should have a JDK
> > proxy instead and it might help to resolve the issue
> >
> > cheers, Sergey
> >
> > On Thu, Dec 23, 2010 at 8:30 AM, Tijs Rademakers
> > <ti...@gmail.com>wrote:
> >
> >> Hi,
> >>
> >> Thanks for the reply Sergey. I just tried your suggestion of adding the
> >> implementorClass like it's also mentioned in the
> >> http://cxf.apache.org/faq.html.
> >> But no luck there, still the same error message. Are there more options
> I
> >> can try?
> >>
> >> Best regards,
> >>
> >> Tijs
> >>
> >> On Dec 20, 2010, at 17:58 PM, Sergey Beryozkin wrote:
> >>
> >>> Hi
> >>> You may also need to add an implementorClass attribute to the
> >> jaxws:endpoint
> >>>
> >>> cheers, Sergey
> >>>
> >>>
> >>>
> >>> On Mon, Dec 20, 2010 at 2:27 PM, Tijs Rademakers
> >>> <ti...@gmail.com>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.BeanCreationExce ption: 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.Abstract
> >>>> AutowireCapableBeanFactory.autowireConstructor(Abs
> >>>> tractAutowireCapableBeanFactory.java:1003)
> >>>> at org.springframework.beans.factory.support.Abstract
> >>>> AutowireCapableBeanFactory.createBeanInstance(Abst
> >>>> ractAutowireCapableBeanFactory.java:907)
> >>>> at org.springframework.beans.factory.support.Abstract
> >>>> AutowireCapableBeanFactory.doCreateBean(AbstractAu
> >>>> towireCapableBeanFactory.java:485)
> >>>> at org.springframework.beans.factory.support.Abstract
> >>>> AutowireCapableBeanFactory.createBean(AbstractAuto
> >>>> wireCapableBeanFactory.java:456)
> >>>> at org.springframework.beans.factory.support.Abstract
> >>>> BeanFactory$1.getObject(AbstractBeanFactory.java:2 91)
> >>>> at org.springframework.beans.factory.support.DefaultS
> >>>> ingletonBeanRegistry.getSingleton(DefaultSingleton
> >> BeanRegistry.java:222)
> >>>> at org.springframework.beans.factory.support.Abstract
> >>>> BeanFactory.doGetBean(AbstractBeanFactory.java:288 )
> >>>> at org.springframework.beans.factory.support.Abstract
> >>>> BeanFactory.getBean(AbstractBeanFactory.java:190)
> >>>> at org.springframework.beans.factory.support.DefaultL
> >>>>
> >>
> istableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:580)
> >>>> at org.springframework.context.support.AbstractApplic
> >>>>
> >>
> ationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:895)
> >>>> at org.springframework.context.support.AbstractApplic
> >>>> ationContext.refresh(AbstractApplicationContext.java:425)
> >>>> at org.springframework.web.context.ContextLoader.crea
> >>>> teWebApplicationContext(ContextLoader.java:276)
> >>>> at org.springframework.web.context.ContextLoader.init
> >>>> WebApplicationContext(ContextLoader.java:197)
> >>>> at org.springframework.web.context.ContextLoaderListe
> >>>> ner.contextInitialized(ContextLoaderListener.java:47)
> >>>> at
> >>>>
> >>
> org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4135)
> >>>> at org.apache.catalina.core.StandardContext.start(Sta
> >>>> ndardContext.java:4630)
> >>>> at org.apache.catalina.core.ContainerBase.addChildInt
> >>>> ernal(ContainerBase.java:791)
> >>>> at org.apache.catalina.core.ContainerBase.addChild(Co
> >> ntainerBase.java:771)
> >>>> at org.apache.catalina.core.StandardHost.addChild(Sta
> >> ndardHost.java:546)
> >>>> at org.apache.catalina.startup.HostConfig.deployWAR(H
> >> ostConfig.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(HostC onfig.java:1277)
> >>>> at org.apache.catalina.startup.HostConfig.lifecycleEv
> >>>> ent(HostConfig.java:321)
> >>>> at org.apache.catalina.util.LifecycleSupport.fireLife
> >>>> cycleEvent(LifecycleSupport.java:119)
> >>>> at org.apache.catalina.core.ContainerBase.start(Conta
> >> inerBase.java:1053)
> >>>> at org.apache.catalina.core.StandardHost.start(Standa rdHost.java:785)
> >>>> at org.apache.catalina.core.ContainerBase.start(Conta
> >> inerBase.java:1045)
> >>>> at org.apache.catalina.core.StandardEngine.start(Stan
> >> dardEngine.java:445)
> >>>> at org.apache.catalina.core.StandardService.start(Sta
> >>>> ndardService.java:519)
> >>>> at org.apache.catalina.core.StandardServer.start(Stan
> >> dardServer.java:710)
> >>>> at org.apache.catalina.startup.Catalina.start(Catalina.java:581)
> >>>> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> >>>> at sun.reflect.NativeMethodAccessorImpl.invoke(Native
> >>>> MethodAccessorImpl.java:39)
> >>>> at sun.reflect.DelegatingMethodAccessorImpl.invoke(De
> >>>> legatingMethodAccessorImpl.java:25)
> >>>> at java.lang.reflect.Method.invoke(Method.java:597)
> >>>> at org.apache.catalina.startup.Bootstrap.start(Bootst rap.java:289)
> >>>> at org.apache.catalina.startup.Bootstrap.main(Bootstr ap.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
> >>
> >>
>
>

Re: Problem with Apache CXF in combination with Spring Security

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

I don't do any constructor injection myself, so this has something to do with the generated proxy in Spring.
The TestWsServiceImpl is already implementing a TestWsService interface.
I think the CGLIB proxified service bean comes from Spring Security.
Because when I remove the Spring Security config it all works immediately.
But we don't do any strange stuff in our Spring Security configuration, I included the configuration below:

<beans xmlns="http://www.springframework.org/schema/beans"
	xmlns:s="http://www.springframework.org/schema/security" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
	xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
                        http://www.springframework.org/schema/security http://www.springframework.org/schema/security/spring-security-3.0.xsd">

	<s:http entry-point-ref="entryPoint">
		<s:anonymous enabled="false" />
	</s:http>

	<bean id="entryPoint"
		class="org.springframework.security.web.authentication.Http403ForbiddenEntryPoint" />

	<s:ldap-server url="${ldap.url}" manager-dn="${ldap.username}"
		manager-password="${ldap.password}" />

	<s:authentication-manager>
		<s:ldap-authentication-provider
			user-search-base="cn=users" user-search-filter="(uid={0})"
			group-search-filter="(member={0})" group-role-attribute="cn"
			group-search-base="ou=test" role-prefix="ROLE_" />
	</s:authentication-manager>

</beans>

This Spring Security config is standard for Spring Flex applications.
Any thoughts?

Thanks,

Tijs

On Dec 23, 2010, at 11:09 AM, Sergey Beryozkin wrote:

> Hi
> 
> May be this information can help ?
> 
> http://www.mkyong.com/spring/constructor-injection-type-ambiguities-in-spring/
> 
> It also seems like your service bean is CGLIB proxified by Spring. If you
> introduce at least interface, ex, have your
> TestWsServiceImpl implementing TestWsService then you should have a JDK
> proxy instead and it might help to resolve the issue
> 
> cheers, Sergey
> 
> On Thu, Dec 23, 2010 at 8:30 AM, Tijs Rademakers
> <ti...@gmail.com>wrote:
> 
>> Hi,
>> 
>> Thanks for the reply Sergey. I just tried your suggestion of adding the
>> implementorClass like it's also mentioned in the
>> http://cxf.apache.org/faq.html.
>> But no luck there, still the same error message. Are there more options I
>> can try?
>> 
>> Best regards,
>> 
>> Tijs
>> 
>> On Dec 20, 2010, at 17:58 PM, Sergey Beryozkin wrote:
>> 
>>> Hi
>>> You may also need to add an implementorClass attribute to the
>> jaxws:endpoint
>>> 
>>> cheers, Sergey
>>> 
>>> 
>>> 
>>> On Mon, Dec 20, 2010 at 2:27 PM, Tijs Rademakers
>>> <ti...@gmail.com>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.BeanCreationExce ption: 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.Abstract
>>>> AutowireCapableBeanFactory.autowireConstructor(Abs
>>>> tractAutowireCapableBeanFactory.java:1003)
>>>> at org.springframework.beans.factory.support.Abstract
>>>> AutowireCapableBeanFactory.createBeanInstance(Abst
>>>> ractAutowireCapableBeanFactory.java:907)
>>>> at org.springframework.beans.factory.support.Abstract
>>>> AutowireCapableBeanFactory.doCreateBean(AbstractAu
>>>> towireCapableBeanFactory.java:485)
>>>> at org.springframework.beans.factory.support.Abstract
>>>> AutowireCapableBeanFactory.createBean(AbstractAuto
>>>> wireCapableBeanFactory.java:456)
>>>> at org.springframework.beans.factory.support.Abstract
>>>> BeanFactory$1.getObject(AbstractBeanFactory.java:2 91)
>>>> at org.springframework.beans.factory.support.DefaultS
>>>> ingletonBeanRegistry.getSingleton(DefaultSingleton
>> BeanRegistry.java:222)
>>>> at org.springframework.beans.factory.support.Abstract
>>>> BeanFactory.doGetBean(AbstractBeanFactory.java:288 )
>>>> at org.springframework.beans.factory.support.Abstract
>>>> BeanFactory.getBean(AbstractBeanFactory.java:190)
>>>> at org.springframework.beans.factory.support.DefaultL
>>>> 
>> istableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:580)
>>>> at org.springframework.context.support.AbstractApplic
>>>> 
>> ationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:895)
>>>> at org.springframework.context.support.AbstractApplic
>>>> ationContext.refresh(AbstractApplicationContext.java:425)
>>>> at org.springframework.web.context.ContextLoader.crea
>>>> teWebApplicationContext(ContextLoader.java:276)
>>>> at org.springframework.web.context.ContextLoader.init
>>>> WebApplicationContext(ContextLoader.java:197)
>>>> at org.springframework.web.context.ContextLoaderListe
>>>> ner.contextInitialized(ContextLoaderListener.java:47)
>>>> at
>>>> 
>> org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4135)
>>>> at org.apache.catalina.core.StandardContext.start(Sta
>>>> ndardContext.java:4630)
>>>> at org.apache.catalina.core.ContainerBase.addChildInt
>>>> ernal(ContainerBase.java:791)
>>>> at org.apache.catalina.core.ContainerBase.addChild(Co
>> ntainerBase.java:771)
>>>> at org.apache.catalina.core.StandardHost.addChild(Sta
>> ndardHost.java:546)
>>>> at org.apache.catalina.startup.HostConfig.deployWAR(H
>> ostConfig.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(HostC onfig.java:1277)
>>>> at org.apache.catalina.startup.HostConfig.lifecycleEv
>>>> ent(HostConfig.java:321)
>>>> at org.apache.catalina.util.LifecycleSupport.fireLife
>>>> cycleEvent(LifecycleSupport.java:119)
>>>> at org.apache.catalina.core.ContainerBase.start(Conta
>> inerBase.java:1053)
>>>> at org.apache.catalina.core.StandardHost.start(Standa rdHost.java:785)
>>>> at org.apache.catalina.core.ContainerBase.start(Conta
>> inerBase.java:1045)
>>>> at org.apache.catalina.core.StandardEngine.start(Stan
>> dardEngine.java:445)
>>>> at org.apache.catalina.core.StandardService.start(Sta
>>>> ndardService.java:519)
>>>> at org.apache.catalina.core.StandardServer.start(Stan
>> dardServer.java:710)
>>>> at org.apache.catalina.startup.Catalina.start(Catalina.java:581)
>>>> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>>>> at sun.reflect.NativeMethodAccessorImpl.invoke(Native
>>>> MethodAccessorImpl.java:39)
>>>> at sun.reflect.DelegatingMethodAccessorImpl.invoke(De
>>>> legatingMethodAccessorImpl.java:25)
>>>> at java.lang.reflect.Method.invoke(Method.java:597)
>>>> at org.apache.catalina.startup.Bootstrap.start(Bootst rap.java:289)
>>>> at org.apache.catalina.startup.Bootstrap.main(Bootstr ap.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
>> 
>> 


Re: Problem with Apache CXF in combination with Spring Security

Posted by Sergey Beryozkin <sb...@gmail.com>.
Hi

May be this information can help ?

http://www.mkyong.com/spring/constructor-injection-type-ambiguities-in-spring/

It also seems like your service bean is CGLIB proxified by Spring. If you
introduce at least interface, ex, have your
TestWsServiceImpl implementing TestWsService then you should have a JDK
proxy instead and it might help to resolve the issue

cheers, Sergey

On Thu, Dec 23, 2010 at 8:30 AM, Tijs Rademakers
<ti...@gmail.com>wrote:

> Hi,
>
> Thanks for the reply Sergey. I just tried your suggestion of adding the
> implementorClass like it's also mentioned in the
> http://cxf.apache.org/faq.html.
> But no luck there, still the same error message. Are there more options I
> can try?
>
> Best regards,
>
> Tijs
>
> On Dec 20, 2010, at 17:58 PM, Sergey Beryozkin wrote:
>
> > Hi
> > You may also need to add an implementorClass attribute to the
> jaxws:endpoint
> >
> > cheers, Sergey
> >
> >
> >
> > On Mon, Dec 20, 2010 at 2:27 PM, Tijs Rademakers
> > <ti...@gmail.com>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.BeanCreationExce ption: 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.Abstract
> >> AutowireCapableBeanFactory.autowireConstructor(Abs
> >> tractAutowireCapableBeanFactory.java:1003)
> >> at org.springframework.beans.factory.support.Abstract
> >> AutowireCapableBeanFactory.createBeanInstance(Abst
> >> ractAutowireCapableBeanFactory.java:907)
> >> at org.springframework.beans.factory.support.Abstract
> >> AutowireCapableBeanFactory.doCreateBean(AbstractAu
> >> towireCapableBeanFactory.java:485)
> >> at org.springframework.beans.factory.support.Abstract
> >> AutowireCapableBeanFactory.createBean(AbstractAuto
> >> wireCapableBeanFactory.java:456)
> >> at org.springframework.beans.factory.support.Abstract
> >> BeanFactory$1.getObject(AbstractBeanFactory.java:2 91)
> >> at org.springframework.beans.factory.support.DefaultS
> >> ingletonBeanRegistry.getSingleton(DefaultSingleton
> BeanRegistry.java:222)
> >> at org.springframework.beans.factory.support.Abstract
> >> BeanFactory.doGetBean(AbstractBeanFactory.java:288 )
> >> at org.springframework.beans.factory.support.Abstract
> >> BeanFactory.getBean(AbstractBeanFactory.java:190)
> >> at org.springframework.beans.factory.support.DefaultL
> >>
> istableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:580)
> >> at org.springframework.context.support.AbstractApplic
> >>
> ationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:895)
> >> at org.springframework.context.support.AbstractApplic
> >> ationContext.refresh(AbstractApplicationContext.java:425)
> >> at org.springframework.web.context.ContextLoader.crea
> >> teWebApplicationContext(ContextLoader.java:276)
> >> at org.springframework.web.context.ContextLoader.init
> >> WebApplicationContext(ContextLoader.java:197)
> >> at org.springframework.web.context.ContextLoaderListe
> >> ner.contextInitialized(ContextLoaderListener.java:47)
> >> at
> >>
> org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4135)
> >> at org.apache.catalina.core.StandardContext.start(Sta
> >> ndardContext.java:4630)
> >> at org.apache.catalina.core.ContainerBase.addChildInt
> >> ernal(ContainerBase.java:791)
> >> at org.apache.catalina.core.ContainerBase.addChild(Co
> ntainerBase.java:771)
> >> at org.apache.catalina.core.StandardHost.addChild(Sta
> ndardHost.java:546)
> >> at org.apache.catalina.startup.HostConfig.deployWAR(H
> ostConfig.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(HostC onfig.java:1277)
> >> at org.apache.catalina.startup.HostConfig.lifecycleEv
> >> ent(HostConfig.java:321)
> >> at org.apache.catalina.util.LifecycleSupport.fireLife
> >> cycleEvent(LifecycleSupport.java:119)
> >> at org.apache.catalina.core.ContainerBase.start(Conta
> inerBase.java:1053)
> >> at org.apache.catalina.core.StandardHost.start(Standa rdHost.java:785)
> >> at org.apache.catalina.core.ContainerBase.start(Conta
> inerBase.java:1045)
> >> at org.apache.catalina.core.StandardEngine.start(Stan
> dardEngine.java:445)
> >> at org.apache.catalina.core.StandardService.start(Sta
> >> ndardService.java:519)
> >> at org.apache.catalina.core.StandardServer.start(Stan
> dardServer.java:710)
> >> at org.apache.catalina.startup.Catalina.start(Catalina.java:581)
> >> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> >> at sun.reflect.NativeMethodAccessorImpl.invoke(Native
> >> MethodAccessorImpl.java:39)
> >> at sun.reflect.DelegatingMethodAccessorImpl.invoke(De
> >> legatingMethodAccessorImpl.java:25)
> >> at java.lang.reflect.Method.invoke(Method.java:597)
> >> at org.apache.catalina.startup.Bootstrap.start(Bootst rap.java:289)
> >> at org.apache.catalina.startup.Bootstrap.main(Bootstr ap.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
>
>

Re: Problem with Apache CXF in combination with Spring Security

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

Thanks for the reply Sergey. I just tried your suggestion of adding the implementorClass like it's also mentioned in the http://cxf.apache.org/faq.html.
But no luck there, still the same error message. Are there more options I can try?

Best regards,

Tijs

On Dec 20, 2010, at 17:58 PM, Sergey Beryozkin wrote:

> Hi
> You may also need to add an implementorClass attribute to the jaxws:endpoint
> 
> cheers, Sergey
> 
> 
> 
> On Mon, Dec 20, 2010 at 2:27 PM, Tijs Rademakers
> <ti...@gmail.com>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.BeanCreationExce ption: 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.Abstract
>> AutowireCapableBeanFactory.autowireConstructor(Abs
>> tractAutowireCapableBeanFactory.java:1003)
>> at org.springframework.beans.factory.support.Abstract
>> AutowireCapableBeanFactory.createBeanInstance(Abst
>> ractAutowireCapableBeanFactory.java:907)
>> at org.springframework.beans.factory.support.Abstract
>> AutowireCapableBeanFactory.doCreateBean(AbstractAu
>> towireCapableBeanFactory.java:485)
>> at org.springframework.beans.factory.support.Abstract
>> AutowireCapableBeanFactory.createBean(AbstractAuto
>> wireCapableBeanFactory.java:456)
>> at org.springframework.beans.factory.support.Abstract
>> BeanFactory$1.getObject(AbstractBeanFactory.java:2 91)
>> at org.springframework.beans.factory.support.DefaultS
>> ingletonBeanRegistry.getSingleton(DefaultSingleton BeanRegistry.java:222)
>> at org.springframework.beans.factory.support.Abstract
>> BeanFactory.doGetBean(AbstractBeanFactory.java:288 )
>> at org.springframework.beans.factory.support.Abstract
>> BeanFactory.getBean(AbstractBeanFactory.java:190)
>> at org.springframework.beans.factory.support.DefaultL
>> istableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:580)
>> at org.springframework.context.support.AbstractApplic
>> ationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:895)
>> at org.springframework.context.support.AbstractApplic
>> ationContext.refresh(AbstractApplicationContext.java:425)
>> at org.springframework.web.context.ContextLoader.crea
>> teWebApplicationContext(ContextLoader.java:276)
>> at org.springframework.web.context.ContextLoader.init
>> WebApplicationContext(ContextLoader.java:197)
>> at org.springframework.web.context.ContextLoaderListe
>> ner.contextInitialized(ContextLoaderListener.java:47)
>> at
>> org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4135)
>> at org.apache.catalina.core.StandardContext.start(Sta
>> ndardContext.java:4630)
>> at org.apache.catalina.core.ContainerBase.addChildInt
>> ernal(ContainerBase.java:791)
>> at org.apache.catalina.core.ContainerBase.addChild(Co ntainerBase.java:771)
>> at org.apache.catalina.core.StandardHost.addChild(Sta ndardHost.java:546)
>> at org.apache.catalina.startup.HostConfig.deployWAR(H ostConfig.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(HostC onfig.java:1277)
>> at org.apache.catalina.startup.HostConfig.lifecycleEv
>> ent(HostConfig.java:321)
>> at org.apache.catalina.util.LifecycleSupport.fireLife
>> cycleEvent(LifecycleSupport.java:119)
>> at org.apache.catalina.core.ContainerBase.start(Conta inerBase.java:1053)
>> at org.apache.catalina.core.StandardHost.start(Standa rdHost.java:785)
>> at org.apache.catalina.core.ContainerBase.start(Conta inerBase.java:1045)
>> at org.apache.catalina.core.StandardEngine.start(Stan dardEngine.java:445)
>> at org.apache.catalina.core.StandardService.start(Sta
>> ndardService.java:519)
>> at org.apache.catalina.core.StandardServer.start(Stan dardServer.java:710)
>> at org.apache.catalina.startup.Catalina.start(Catalina.java:581)
>> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>> at sun.reflect.NativeMethodAccessorImpl.invoke(Native
>> MethodAccessorImpl.java:39)
>> at sun.reflect.DelegatingMethodAccessorImpl.invoke(De
>> legatingMethodAccessorImpl.java:25)
>> at java.lang.reflect.Method.invoke(Method.java:597)
>> at org.apache.catalina.startup.Bootstrap.start(Bootst rap.java:289)
>> at org.apache.catalina.startup.Bootstrap.main(Bootstr ap.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


Re: Problem with Apache CXF in combination with Spring Security

Posted by Sergey Beryozkin <sb...@gmail.com>.
Hi
You may also need to add an implementorClass attribute to the jaxws:endpoint

cheers, Sergey



On Mon, Dec 20, 2010 at 2:27 PM, Tijs Rademakers
<ti...@gmail.com>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.BeanCreationExce ption: 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.Abstract
> AutowireCapableBeanFactory.autowireConstructor(Abs
> tractAutowireCapableBeanFactory.java:1003)
> at org.springframework.beans.factory.support.Abstract
> AutowireCapableBeanFactory.createBeanInstance(Abst
> ractAutowireCapableBeanFactory.java:907)
> at org.springframework.beans.factory.support.Abstract
> AutowireCapableBeanFactory.doCreateBean(AbstractAu
> towireCapableBeanFactory.java:485)
> at org.springframework.beans.factory.support.Abstract
> AutowireCapableBeanFactory.createBean(AbstractAuto
> wireCapableBeanFactory.java:456)
> at org.springframework.beans.factory.support.Abstract
> BeanFactory$1.getObject(AbstractBeanFactory.java:2 91)
> at org.springframework.beans.factory.support.DefaultS
> ingletonBeanRegistry.getSingleton(DefaultSingleton BeanRegistry.java:222)
> at org.springframework.beans.factory.support.Abstract
> BeanFactory.doGetBean(AbstractBeanFactory.java:288 )
> at org.springframework.beans.factory.support.Abstract
> BeanFactory.getBean(AbstractBeanFactory.java:190)
> at org.springframework.beans.factory.support.DefaultL
> istableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:580)
> at org.springframework.context.support.AbstractApplic
> ationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:895)
> at org.springframework.context.support.AbstractApplic
> ationContext.refresh(AbstractApplicationContext.java:425)
> at org.springframework.web.context.ContextLoader.crea
> teWebApplicationContext(ContextLoader.java:276)
> at org.springframework.web.context.ContextLoader.init
> WebApplicationContext(ContextLoader.java:197)
> at org.springframework.web.context.ContextLoaderListe
> ner.contextInitialized(ContextLoaderListener.java:47)
> at
> org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4135)
> at org.apache.catalina.core.StandardContext.start(Sta
> ndardContext.java:4630)
> at org.apache.catalina.core.ContainerBase.addChildInt
> ernal(ContainerBase.java:791)
> at org.apache.catalina.core.ContainerBase.addChild(Co ntainerBase.java:771)
> at org.apache.catalina.core.StandardHost.addChild(Sta ndardHost.java:546)
> at org.apache.catalina.startup.HostConfig.deployWAR(H ostConfig.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(HostC onfig.java:1277)
> at org.apache.catalina.startup.HostConfig.lifecycleEv
> ent(HostConfig.java:321)
> at org.apache.catalina.util.LifecycleSupport.fireLife
> cycleEvent(LifecycleSupport.java:119)
> at org.apache.catalina.core.ContainerBase.start(Conta inerBase.java:1053)
> at org.apache.catalina.core.StandardHost.start(Standa rdHost.java:785)
> at org.apache.catalina.core.ContainerBase.start(Conta inerBase.java:1045)
> at org.apache.catalina.core.StandardEngine.start(Stan dardEngine.java:445)
> at org.apache.catalina.core.StandardService.start(Sta
> ndardService.java:519)
> at org.apache.catalina.core.StandardServer.start(Stan dardServer.java:710)
> at org.apache.catalina.startup.Catalina.start(Catalina.java:581)
> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> at sun.reflect.NativeMethodAccessorImpl.invoke(Native
> MethodAccessorImpl.java:39)
> at sun.reflect.DelegatingMethodAccessorImpl.invoke(De
> legatingMethodAccessorImpl.java:25)
> at java.lang.reflect.Method.invoke(Method.java:597)
> at org.apache.catalina.startup.Bootstrap.start(Bootst rap.java:289)
> at org.apache.catalina.startup.Bootstrap.main(Bootstr ap.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