|
From: <jue...@we...> - 2004-10-28 15:34:30
|
I guess all you're missing here is an interface that ProxyFactoryBean =
should you use for the proxy: This will also remove the implicit CGLIB =
dependency, automatically using a JDK dynamic proxy instead.
<bean id=3D"pooledEchoBean" =
class=3D"org.springframework.aop.framework.ProxyFactoryBean">
<property name=3D"proxyInterfaces">
<value>javax.jms.MessageListener</value>
</property>
<property name=3D"targetSource">
<ref local=3D"pooledEchoBeanTargetSource"/>
</property>
</bean>
ProxyFactoryBean can work without explicitly specified =
"proxyInterfaces", but just if there's a direct target object to =
analyze: It will proxy all interfaces implemented by the target then, or =
create a CGLIB proxy for the target if there are no interfaces.
Juergen
-----Original Message-----
From: spr...@li...
[mailto:spr...@li...]On Behalf
Of jas...@ma...
Sent: Thursday, October 28, 2004 4:37 PM
To: spr...@li...
Subject: Re: [Springframework-developer] message driven POJOs, a
lightweight JCA container available
On 28 Oct 2004, at 09:52, j=FCrgen h=F6ller [werk3AT] wrote:
> If there's an actual need to pool those target listeners, this could =20
> always be achieved through a ProxyFactoryBean with a pooling =20
> TargetSource, with the proxy implementing the MessageListener =20
> interface: From the point of view of the ActiveMQ message dispatcher, =
> it would simply keep calling the shared MessageListener onMessage =20
> method, but this time on the proxy which will delegate to one of the =20
> instances in its backend pool.
I went a head and refactored to just use a MessageListener and so then =20
its up to the MessageListener instance to handle pooling - if its =20
needed. This makes the code much cleaner - great suggestion j=FCrgen.
I tried using the ProxyFactoryBean. Firstly this introduced a new =20
runtime dependency on cglib. Secondly it created this exception..
org.springframework.beans.factory.BeanCreationException: Error creating =
bean with name 'inboundMessageB' defined in class path resource =20
[spring-with-proxyfactory.xml]: Can't resolve reference to bean =20
'pooledEchoBean' while setting property 'messageListener'; nested =20
exception is org.springframework.beans.factory.BeanCreationException: =20
Error creating bean with name 'pooledEchoBean' defined in class path =20
resource [spring-with-proxyfactory.xml]: Initialization of bean failed; =
nested exception is org.aopalliance.aop.AspectException: null
org.springframework.beans.factory.BeanCreationException: Error creating =
bean with name 'pooledEchoBean' defined in class path resource =20
[spring-with-proxyfactory.xml]: Initialization of bean failed; nested =20
exception is org.aopalliance.aop.AspectException: null
java.lang.IllegalStateException: Unknown callback class =20
org.springframework.aop.framework.Cglib2AopProxy$DynamicAdvisedIntercept =
or
at =20
net.sf.cglib.proxy.CallbackUtils.getGenerator(CallbackUtils.java:102)
The XML config file I was using is here...
http://cvs.activemq.codehaus.org/viewrep/activemq/activemq/modules/=20
container/src/test/org/codehaus/activemq/jca/spring-with-=20
proxyfactory.xml?r=3D1.1
and the test case is JCAContainerWithProxyFactoryTest.
Any ideas why I get this error? Its OK to use a ProxyFactoryBean with a =
pooled TargetSource without using any AOP advice right?
As a work around and to avoid the cglib dependency, I've added a little =
TargetSourceMessageListener helper class which works in a similar =20
way...
http://cvs.activemq.codehaus.org/viewrep/activemq/activemq/modules/=20
container/src/test/org/codehaus/activemq/jca/spring.xml?r=3D1.3
In terms of simplicity in the XML configuration file they're of similar =
order.
Incidentally there's also an XA based test case to show how to use XA =20
based message consumption; you basically just ocnfigure the =20
TransactionManager to use.
http://cvs.activemq.codehaus.org/viewrep/activemq/activemq/modules/=20
container/src/test/org/codehaus/activemq/jca/spring-with-xa.xml?r=3D1.1
In this particular test case, JCAContainerUsingXATest we just use =20
JOTM directly.
James
-------
http://radio.weblogs.com/0112098/
-------------------------------------------------------
This SF.Net email is sponsored by:
Sybase ASE Linux Express Edition - download now for FREE
LinuxWorld Reader's Choice Award Winner for best database on Linux.
http://ads.osdn.com/?ad_idU88&alloc_id=12065&op=3Dick
_______________________________________________
Springframework-developer mailing list
Spr...@li...
https://lists.sourceforge.net/lists/listinfo/springframework-developer
|