Hi Dan,
The txAdvice is looking for a transaction manager. Since the spring.xml
doesn't give the txAdvice a reference to a transaction manager, it
defaults to looking for a bean with id "transactionManager"-- which your
spring.xml does not have.
Spring can allow your transactions to be managed by JTA, Hibernate,
JDBC, etc. The transaction manager you configure tells it which to use.
If you're running this in an app server that supports JTA, then you can
add this to the spring.xml:
<bean id="transactionManager"
class="org.springframework.transaction.jta.JtaTransactionManager"/>
I think you can also just create a stub that implements
org.springframework.transaction.PlatformTransactionManager and use that
instead:
<bean id="transactionManager"
class="org.apache.cxf.test.MockTransactionManager"/>
You can check out the Spring docs for more info:
http://static.springframework.org/spring/docs/2.0.x/reference/transactio
n.html
-Chris
-----Original Message-----
From: Daniel Kulp [mailto:[EMAIL PROTECTED]
Sent: Tuesday, August 07, 2007 10:17 AM
To: [email protected]
Cc: Brad Harper
Subject: Re: cxf-spring-transactions anybody get it working?
On Tuesday 07 August 2007 08:57, Brad Harper wrote:
> I'll be glad to write a testcase for you.. .problem is, I don't know
> what format you need?
A standalone "main" method thing is perfectly OK as well. The issue
will
probably "what other jars do I need?"
> Are you talking about a JUnit testcase?
> Really, all you have to do to duplicate the issue is write any Spring
> based JAXws service:
I tried doing this to our
systests/src/test/java/org/apache/cxf/systest/servlet/spring.xml
as well as changed the pom.xml to grab the spring everything jar
as well as aspectjweaver. That now yields:
org.springframework.beans.factory.BeanCreationException: Error creating
bean with name 'txAdvice':
Cannot resolve reference to bean 'transactionManager' while setting bean
property 'transactionManager';
nested exception is
org.springframework.beans.factory.NoSuchBeanDefinitionException: No bean
named 'transactionManager' is defined
Caused by:
org.springframework.beans.factory.NoSuchBeanDefinitionException: No bean
named 'transactionManager' is defined
I'm probably missing a jar or something. Not really sure. Any ideas?
Dan
>
> <!-- Local -->
> <bean id="TestServiceImpl" class="
> com.gdservices.service.thirdparty.TestServiceImpl">
> <property name="daoFactory">
> <ref bean="hibernateDAOFactory"/>
> </property>
> </bean>
> <!-- SOAP -->
> <jaxws:endpoint
> id="testServiceSoap"
> implementor="#TestServiceImpl"
> address="/testService" />
>
> And add this snippet to your config:
>
> <aop:config>
> <aop:advisor id="serviceTx" advice-ref="txAdvice"
> pointcut="execution(* *..thirdparty..*.*(..))" order="0"/>
> </aop:config>
>
> <tx:advice id="txAdvice">
> <tx:attributes>
> <tx:method name="find*" read-only="true"/>
> <tx:method name="get*" read-only="true"/>
> <tx:method name="*"/>
> </tx:attributes>
> </tx:advice>
>
> Note the pointcut reference to 'thirdparty'... just replace that with
> whatever package your service is in. Additionally, you'll need to add
> the aop schema refs to your beans tag. Here they are if you need
> them:
>
> <beans xmlns="http://www.springframework.org/schema/beans"
> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
> xmlns:aop="http://www.springframework.org/schema/aop"
> xmlns:tx="http://www.springframework.org/schema/tx"
> xmlns:jaxws="http://cxf.apache.org/jaxws"
>
> xsi:schemaLocation="http://www.springframework.org/schema/beans
> http://www.springframework.org/schema/beans/spring-beans-2.0.xsd
> http://www.springframework.org/schema/aop
> http://www.springframework.org/schema/aop/spring-aop-2.0.xsd
> http://www.springframework.org/schema/tx
> http://www.springframework.org/schema/tx/spring-tx-2.0.xsd
> http://cxf.apache.org/jaxws
> http://cxf.apache.org/schemas/jaxws.xsd">
>
> Once you add the AOP config snippet above, your services will fail
> because CXF is attempting to generate the wsdl off the proxied class..
> .not the real impl or service. I think Dan pointed out that the
> annotations get lost...
>
> Regards,
> Brad
>
> On 8/6/07, Daniel Kulp <[EMAIL PROTECTED]> wrote:
> > Could one of you send me a simple testcase again? I think I had
> > one at one point (from Brad maybe?) but I cannot seem to find it
> > now.
> >
> > I should have a little time tomorrow or Wednesday to look into it if
> > I can get a simple testcase. I'm not at all familiar with the
> > spring transaction stuff. Actualy, if a testcase could be
> > attached to CXF-874 for tracking purposes, that would be great.
> >
> > Thanks!
> > Dan
> >
> > On Monday 06 August 2007 18:27, Brad Harper wrote:
> > > No. Neither work for me.
> > >
> > > On 8/6/07, Jeremy Isikoff <[EMAIL PROTECTED]> wrote:
> > > > sorry to ask again but did anybody get either of those fixes for
> > > > the spring transactions working on an jaxws:endpoint or
> > > > jaxws:server?
> > > >
> > > >
> > > >
> > > > Jeremy Isikoff
> > > >
> > > >
> > > >
> > > >
> > > > ________________________________________________________________
> > > >____ ________________ Got a little couch potato?
> > > > Check out fun summer activities for kids.
> > > >
> > > > http://search.yahoo.com/search?fr=oni_on_mail&p=summer+activitie
> > > >s+fo r+kids&cs=bz
> >
> > --
> > J. Daniel Kulp
> > Principal Engineer
> > IONA
> > P: 781-902-8727 C: 508-380-7194
> > [EMAIL PROTECTED]
> > http://www.dankulp.com/blog
--
J. Daniel Kulp
Principal Engineer
IONA
P: 781-902-8727 C: 508-380-7194
[EMAIL PROTECTED]
http://www.dankulp.com/blog