Announcement Announcement Module
Collapse
No announcement yet.
Spring 2.0 and XFire 1.2.4 Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Spring 2.0 and XFire 1.2.4

    I have a problem regarding spring 2.0 and XFire 1.2.4.
    Here is a part of my config file:

    <aop:aspectj-autoproxy />

    <aop:config>
    <aop:advisor id="managerTx" advice-ref="txAdvice" pointcut="execution(* org.appfuse.service.*Manager.*(..))"/>
    </aop:config>

    <tx:advice id="txAdvice">
    <tx:attributes>
    <tx:method name="get*" read-only="true"/>
    <tx:method name="*"/>
    </tx:attributes>
    </tx:advice>

    <tx:annotation-driven/>
    <bean name="echoService" class="org.codehaus.xfire.spring.ServiceBean">
    <property name="serviceBean" ref="echo"/>
    <property name="serviceClass" value="org.appfuse.xfire.Echo"/>
    <property name="inHandlers">
    <list>
    <ref bean="addressingHandler"/>
    </list>
    </property>
    </bean>

    <bean id="echo" class="org.appfuse.xfire.EchoImpl"/>

    <bean id="addressingHandler" class="org.codehaus.xfire.addressing.AddressingInH andler"/>
    <bean id="xfire.serviceRegistry" class="org.codehaus.xfire.service.DefaultServiceRe gistry" />
    <bean id="xfire.transportManager" class="org.codehaus.xfire.transport.DefaultTranspo rtManager" />

    <bean id="xfire" class="org.codehaus.xfire.DefaultXFire">
    <constructor-arg index="0">
    <ref bean="xfire.serviceRegistry" />
    </constructor-arg>
    <constructor-arg index="1">
    <ref bean="xfire.transportManager" />
    </constructor-arg>
    </bean>

    The problem is that at deploy time i get following error:
    org.springframework.beans.factory.BeanCreationExce ption: Error creating bean with name 'echoService' defined in ServletContext resource [/WEB-INF/applicationContext.xml]: Invocation of init method failed; nested exception is java.lang.ClassCastException: $Proxy20
    Caused by:
    java.lang.ClassCastException: $Proxy20
    at org.codehaus.xfire.spring.ServiceBean.afterPropert iesSet(ServiceBean.java:116)
    at org.springframework.beans.factory.support.Abstract AutowireCapableBeanFactory.invokeInitMethods(Abstr actAutowireCapableBeanFactory.java:1143)
    at org.springframework.beans.factory.support.Abstract AutowireCapableBeanFactory.initializeBean(Abstract AutowireCapableBeanFactory.java:1110)
    at org.springframework.beans.factory.support.Abstract AutowireCapableBeanFactory.createBean(AbstractAuto wireCapableBeanFactory.java:431)
    at org.springframework.beans.factory.support.Abstract BeanFactory$1.getObject(AbstractBeanFactory.java:2 54)
    at org.springframework.beans.factory.support.DefaultS ingletonBeanRegistry.getSingleton(DefaultSingleton BeanRegistry.java:144)
    at org.springframework.beans.factory.support.Abstract BeanFactory.getBean(AbstractBeanFactory.java:251)
    at org.springframework.beans.factory.support.Abstract BeanFactory.getBean(AbstractBeanFactory.java:163)
    at org.springframework.beans.factory.support.DefaultL istableBeanFactory.preInstantiateSingletons(Defaul tListableBeanFactory.java:284)
    at org.springframework.context.support.AbstractApplic ationContext.refresh(AbstractApplicationContext.ja va:352)
    at org.springframework.web.context.ContextLoader.crea teWebApplicationContext(ContextLoader.java:241)
    at org.springframework.web.context.ContextLoader.init WebApplicationContext(ContextLoader.java:184)
    at org.springframework.web.context.ContextLoaderListe ner.contextInitialized(ContextLoaderListener.java: 49)
    at org.apache.catalina.core.StandardContext.listenerS tart(StandardContext.java:3631)
    at org.apache.catalina.core.StandardContext.start(Sta ndardContext.java:4065)
    at org.apache.catalina.core.ContainerBase.addChildInt ernal(ContainerBase.java:755)
    at org.apache.catalina.core.ContainerBase.addChild(Co ntainerBase.java:739)
    at org.apache.catalina.core.StandardHost.addChild(Sta ndardHost.java:525)
    at org.apache.catalina.startup.HostConfig.deployWAR(H ostConfig.java:777)
    at org.apache.catalina.startup.HostConfig.deployWARs( HostConfig.java:672)
    at org.apache.catalina.startup.HostConfig.deployApps( HostConfig.java:472)
    at org.apache.catalina.startup.HostConfig.start(HostC onfig.java:1079)
    at org.apache.catalina.startup.HostConfig.lifecycleEv ent(HostConfig.java:310)
    at org.apache.catalina.util.LifecycleSupport.fireLife cycleEvent(LifecycleSupport.java:119)
    at org.apache.catalina.core.ContainerBase.start(Conta inerBase.java:1011)
    at org.apache.catalina.core.StandardHost.start(Standa rdHost.java:718)
    at org.apache.catalina.core.ContainerBase.start(Conta inerBase.java:1003)
    at org.apache.catalina.core.StandardEngine.start(Stan dardEngine.java:437)
    at org.apache.catalina.core.StandardService.start(Sta ndardService.java:450)
    at org.apache.catalina.core.StandardServer.start(Stan dardServer.java:2010)
    at org.apache.catalina.startup.Catalina.start(Catalin a.java:537)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Nativ e 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:585)
    at org.apache.catalina.startup.Bootstrap.start(Bootst rap.java:271)
    at org.apache.catalina.startup.Bootstrap.main(Bootstr ap.java:409)

    But, when I remove following block from config file everything is OK:
    <aop:aspectj-autoproxy />

    <aop:config>
    <aop:advisor id="managerTx" advice-ref="txAdvice" pointcut="execution(* org.appfuse.service.*Manager.*(..))"/>
    </aop:config>

    <tx:advice id="txAdvice">
    <tx:attributes>
    <tx:method name="get*" read-only="true"/>
    <tx:method name="*"/>
    </tx:attributes>
    </tx:advice>

    <tx:annotation-driven/>

  • #2
    Looks like XFire doesn't support proxied objects well ( ServiceFactory in this case ) . You can create jira issue ( http://jira.codehaus.org/secure/Brow....jspa?id=10750 ) with this problem ( and plz attach testcase or simple project which can reproduce this ).

    I don't much about Spring aop, but maybe there is some way to tell aspectj to not put proxy on object from xfire.codehaus.*.

    Comment

    Working...
    X