You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@cxf.apache.org by "Nitin Bhardwaj (JIRA)" <ji...@apache.org> on 2018/07/09 12:50:00 UTC

[jira] [Created] (CXF-7785) org.springframework.beans.factory.NoSuchBeanDefinitionException: No bean named 'cxf' available

Nitin Bhardwaj created CXF-7785:
-----------------------------------

             Summary: org.springframework.beans.factory.NoSuchBeanDefinitionException: No bean named 'cxf' available
                 Key: CXF-7785
                 URL: https://issues.apache.org/jira/browse/CXF-7785
             Project: CXF
          Issue Type: Bug
          Components: Bus, Integration
    Affects Versions: 3.2.5
         Environment: I am using JDK 1.8.0_144, Apache CXF 3.2.5, Tomcat 8.0.5, and Spring 5.0.4 for this sample project.
            Reporter: Nitin Bhardwaj
         Attachments: application-context.xml, cxf-beans.xml, cxf-beans_BUS.xml, dispatcher-servlet.xml, web.xml

I successfully published a simple JAX-WS web-service using Apache CXF Spring configuration. I am now trying to configure an inbound interceptor for that service. The Interceptor works fine when I use the following configuration:

{color:#205081} <jaxws:endpoint id="helloWorld-ws" {color}
{color:#205081} implementor="com.nit.ws.service.impl.HelloWorldServiceImpl" address="/HelloWorldService">{color}
{color:#205081} <jaxws:inInterceptors>{color}
{color:#205081} <ref bean="httpAuthHeaderInterceptor" />{color}
{color:#205081} </jaxws:inInterceptors>{color}
{color:#205081} </jaxws:endpoint>{color}
 
{color:#205081} <bean id="httpAuthHeaderInterceptor" class="com.nit.ws.security.HttpAuthHeaderInterceptor" />{color}

However, if I try to configure the interceptor using a CXF Bus instead of above configuration like below:

{color:#205081} <jaxws:endpoint id="helloWorld-ws" bus="serverBus" {color}
{color:#205081} implementor="com.nit.ws.service.impl.HelloWorldServiceImpl" address="/HelloWorldService"/>{color}
 
 
{color:#205081} <cxf:bus name="serverBus">{color}
{color:#205081} <cxf:inInterceptors>{color}
{color:#205081} <ref bean="httpAuthHeaderInterceptor" />{color}
{color:#205081} </cxf:inInterceptors>{color}
{color:#205081} </cxf:bus>{color}
 
{color:#205081} <bean id="httpAuthHeaderInterceptor" class="com.nit.ws.security.HttpAuthHeaderInterceptor" />{color}

*Then it throws the following exception in Tomcat 8 server when I hit the WSDL(http://localhost:8080/springcxfserver/services/HelloWorldService?wsdl):*

{color:#FF0000}*org.springframework.beans.factory.NoSuchBeanDefinitionException: No bean named 'cxf' available* org.springframework.beans.factory.support.DefaultListableBeanFactory.getBeanDefinition(DefaultListableBeanFactory.java:686) org.springframework.beans.factory.support.AbstractBeanFactory.getMergedLocalBeanDefinition(AbstractBeanFactory.java:1205) org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:292) org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:205) org.springframework.context.support.AbstractApplicationContext.getBean(AbstractApplicationContext.java:1091) org.apache.cxf.transport.servlet.CXFServlet.loadBus(CXFServlet.java:80) org.apache.cxf.transport.servlet.CXFNonSpringServlet.init(CXFNonSpringServlet.java:83) org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:503) org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:74){color}

The *HttpAuthHeaderInterceptor* extends {color:#205081}org.apache.cxf.binding.soap.interceptor.AbstractSoapInterceptor{color} and it just prints "Hello World" on the console in case of successful execution as defined above.

I am trying to use Bus configuration so that all the JAX-WS endpoints can be configured using the same bus configuration to allow applying common interceptors to all of them without duplicating the configuration in each element.

I've attached the web.xml, application-context.xml, cxf-beans.xml, and dispatcher-servlet.xml with this ticket for ready reference. The configurations described above have been defined inside cxf-beans.xml which is imported by application-context.xml.[^application-context.xml]

I am using JDK 1.8.0_144, Apache CXF 3.2.5, Tomcat 8.0.5, and Spring 5.0.4 for this sample project.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)