Uploaded image for project: 'CXF'
  1. CXF
  2. CXF-4470

Unable to configure cxf:bus with Spring 2.5.6-SEC03

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Blocker
    • Resolution: Fixed
    • 2.6.1
    • 2.4.9, 2.5.5, 2.6.2
    • Bus
    • None
    • Ubuntu Linux 12.04, Oracle Java 6 1.6.0_30, apache-tomcat-6.0.35, spring-2.5.6-SEC03, apache-cxf-2.6.1

    • Unknown

    Description

      Spring bean initialization fails to create the 'cxf' bean when configuring the cxf bus as documented in tutorials. To reproduce, configure a bare-bones webapp in Apache Tomcat using Spring 2.5.6-SEC03 libraries, along with CXF 2.6.1. Here is the web.xml I used:

      <?xml version="1.0" encoding="ISO-8859-1"?>
      <!--
       Licensed to the Apache Software Foundation (ASF) under one or more
        contributor license agreements.  See the NOTICE file distributed with
        this work for additional information regarding copyright ownership.
        The ASF licenses this file to You under the Apache License, Version 2.0
        (the "License"); you may not use this file except in compliance with
        the License.  You may obtain a copy of the License at
      
            http://www.apache.org/licenses/LICENSE-2.0
      
        Unless required by applicable law or agreed to in writing, software
        distributed under the License is distributed on an "AS IS" BASIS,
        WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
        See the License for the specific language governing permissions and
        limitations under the License.
      -->
      
      <web-app xmlns="http://java.sun.com/xml/ns/javaee"
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
         version="2.5">
      
        <display-name>Welcome to Tomcat</display-name>
        <description>
           Welcome to Tomcat
        </description>
      
          <context-param>
              <param-name>contextConfigLocation</param-name>
              <param-value>
                  classpath:com/awarepoint/ws/services.xml
              </param-value>
          </context-param>
      
          <listener>
              <listener-class>
                  org.springframework.web.context.ContextLoaderListener
              </listener-class>
          </listener>
      
      
          <servlet>
              <servlet-name>CXFServlet</servlet-name>
              <display-name>CXF Servlet</display-name>
              <servlet-class>
                 org.apache.cxf.transport.servlet.CXFServlet
              </servlet-class>
              <load-on-startup>1</load-on-startup>
          </servlet>
          <servlet-mapping>
              <servlet-name>CXFServlet</servlet-name>
              <url-pattern>/services/*</url-pattern>
          </servlet-mapping>
      
      </web-app>
      

      And the contents of the spring config:

      <beans xmlns="http://www.springframework.org/schema/beans"
            xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
            xmlns:cxf="http://cxf.apache.org/core"
            xmlns:jaxws="http://cxf.apache.org/jaxws"
            xmlns:jaxrs="http://cxf.apache.org/jaxrs"
            xsi:schemaLocation="
               http://www.springframework.org/schema/beans
               http://www.springframework.org/schema/beans/spring-beans-2.0.xsd
               http://cxf.apache.org/core
               http://cxf.apache.org/schemas/core.xsd
               http://cxf.apache.org/jaxws
               http://cxf.apache.org/schemas/jaxws.xsd
               http://cxf.apache.org/jaxrs
               http://cxf.apache.org/schemas/jaxrs.xsd">
      
          <import resource="classpath:META-INF/cxf/cxf.xml"/>
      
          <bean id="logOutbound" class="org.apache.cxf.interceptor.LoggingOutInterceptor"/>
      
          <cxf:bus>
              <cxf:outInterceptors>
                  <ref bean="logOutbound"/>
              </cxf:outInterceptors>
          </cxf:bus>
      
      </beans>
      

      Here is the resulting stacktrace:

      INFO: Bean factory for application context [org.springframework.web.context.support.XmlWebApplicationContext@344e17f9]: org.springframework.beans.factory.support.DefaultListableBeanFactory@6b11ae04
      Aug 13, 2012 2:25:23 PM org.springframework.beans.factory.support.DefaultSingletonBeanRegistry destroySingletons
      INFO: Destroying singletons in org.springframework.beans.factory.support.DefaultListableBeanFactory@6b11ae04: defining beans [cxf,org.apache.cxf.bus.spring.BusWiringBeanFactoryPostProcessor,org.apache.cxf.bus.spring.Jsr250BeanPostProcessor,org.apache.cxf.bus.spring.BusExtensionPostProcessor,logOutbound,cxf.config0]; root of factory hierarchy
      Aug 13, 2012 2:25:23 PM org.springframework.web.context.ContextLoader initWebApplicationContext
      SEVERE: Context initialization failed
      org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'cxf' defined in class path resource [META-INF/cxf/cxf.xml]: Initialization of bean failed; nested exception is java.lang.reflect.MalformedParameterizedTypeException
      	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:480)
      	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory$1.run(AbstractAutowireCapableBeanFactory.java:409)
      	at java.security.AccessController.doPrivileged(Native Method)
      	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:380)
      	at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:264)
      	at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222)
      	at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:261)
      	at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:185)
      	at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:164)
      	at org.springframework.beans.factory.support.DefaultListableBeanFactory.getBeansOfType(DefaultListableBeanFactory.java:308)
      	at org.springframework.context.support.AbstractApplicationContext.getBeansOfType(AbstractApplicationContext.java:947)
      	at org.springframework.context.support.AbstractApplicationContext.registerListeners(AbstractApplicationContext.java:701)
      	at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:377)
      	at org.springframework.web.context.ContextLoader.createWebApplicationContext(ContextLoader.java:255)
      	at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:199)
      	at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:45)
      	at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4206)
      	at org.apache.catalina.core.StandardContext.start(StandardContext.java:4705)
      	at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:799)
      	at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:779)
      	at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:601)
      	at org.apache.catalina.startup.HostConfig.deployDirectory(HostConfig.java:1079)
      	at org.apache.catalina.startup.HostConfig.deployDirectories(HostConfig.java:1002)
      	at org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:506)
      	at org.apache.catalina.startup.HostConfig.start(HostConfig.java:1317)
      	at org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java:324)
      	at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:142)
      	at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1065)
      	at org.apache.catalina.core.StandardHost.start(StandardHost.java:840)
      	at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1057)
      	at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:463)
      	at org.apache.catalina.core.StandardService.start(StandardService.java:525)
      	at org.apache.catalina.core.StandardServer.start(StandardServer.java:754)
      	at org.apache.catalina.startup.Catalina.start(Catalina.java:595)
      	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)
      Caused by: java.lang.reflect.MalformedParameterizedTypeException
      	at sun.reflect.generics.reflectiveObjects.ParameterizedTypeImpl.validateConstructorArguments(ParameterizedTypeImpl.java:42)
      	at sun.reflect.generics.reflectiveObjects.ParameterizedTypeImpl.<init>(ParameterizedTypeImpl.java:35)
      	at sun.reflect.generics.reflectiveObjects.ParameterizedTypeImpl.make(ParameterizedTypeImpl.java:77)
      	at sun.reflect.generics.factory.CoreReflectionFactory.makeParameterizedType(CoreReflectionFactory.java:86)
      	at sun.reflect.generics.visitor.Reifier.visitClassTypeSignature(Reifier.java:122)
      	at sun.reflect.generics.tree.ClassTypeSignature.accept(ClassTypeSignature.java:31)
      	at sun.reflect.generics.repository.ClassRepository.getSuperInterfaces(ClassRepository.java:82)
      	at java.lang.Class.getGenericInterfaces(Class.java:794)
      	at org.springframework.core.GenericTypeResolver.getTypeVariableMap(GenericTypeResolver.java:154)
      	at org.springframework.core.GenericTypeResolver.resolveReturnType(GenericTypeResolver.java:101)
      	at org.springframework.beans.GenericTypeAwarePropertyDescriptor.getPropertyType(GenericTypeAwarePropertyDescriptor.java:88)
      	at org.springframework.beans.TypeConverterDelegate.convertIfNecessary(TypeConverterDelegate.java:138)
      	at org.springframework.beans.BeanWrapperImpl.convertForProperty(BeanWrapperImpl.java:386)
      	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.convertForProperty(AbstractAutowireCapableBeanFactory.java:1289)
      	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyPropertyValues(AbstractAutowireCapableBeanFactory.java:1250)
      	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1010)
      	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:472)
      	... 39 more
      Aug 13, 2012 2:25:23 PM org.apache.catalina.core.StandardContext start
      SEVERE: Error listenerStart
      Aug 13, 2012 2:25:23 PM org.apache.catalina.core.StandardContext start
      SEVERE: Context [] startup failed due to previous errors
      

      Attachments

        Activity

          People

            dkulp Daniel Kulp
            rnideffer Ryan Nideffer
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: