Looking at
http://static.springframework.org/spring/docs/2.5.x/reference/aop.html,
it seems that using
<aop:aspectj-autoproxy proxy-target-class="true"/>
may work, but you need to have aspect jars in the classpath.
On Wed, Oct 8, 2008 at 2:37 PM, Guillaume Nodet <[EMAIL PROTECTED]> wrote:
> The reason is that spring creates a proxy for the bean, so the fields
> are not defined anymore on the proxy class, hence no injection
> happens.
> There may be a way to tell spring to use a different proxy mechanism
> so that the generated class inherits from your bean class instead of a
> simple proxy that only implements the interface's methods.
>
> On Wed, Oct 8, 2008 at 1:24 PM, Sebastian Gomez <[EMAIL PROTECTED]> wrote:
>> Hi, thanks for the quick answer. The code is quite simple, it just has
>> a few "if"s and I don't touch the channel during the method until the
>> "send" call. I've pasted underneath the important parts. As I said,
>> the implementation works perfectly until the @Transactional annotation
>> is put into its interface, so I believe it can't have nothing to do
>> with the code. Hope you can get something out of it. What do you think
>> could be the problem?
>>
>> Implementation:
>>
>> ... //package, other imports
>> import javax.annotation.Resource;
>> import xxx.yyy.services.PersistenceService;
>>
>> public class PersistenceServiceImpl implements PersistenceService,
>> MessageExchangeListener {
>>
>> @Resource
>> private DeliveryChannel channel;
>>
>> public void onMessageExchange(MessageExchange exchange)
>> throws MessagingException {
>> ...
>> ... //channel never used here
>> ...
>> channel.send(exchange); // throws NPE
>> }
>>
>>
>> Interface:
>>
>> import org.springframework.transaction.annotation.Transactional;
>>
>> @Transactional
>> public interface PersistenceService {
>> ...
>> }
>>
>> xbean.xml:
>>
>> ...
>> <bean id="xxx.yyy.services.persistenceService"
>> class="xxx.yyy.services.impl.PersistenceServiceImpl" />
>>
>> <bean:endpoint service="ns:persistenceService"
>> endpoint="persistenceService"
>> bean="#xxx.yyy.services.persistenceService" />
>>
>>
>>
>>
>>
>> On Wed, Oct 8, 2008 at 1:01 PM, Guillaume Nodet <[EMAIL PROTECTED]> wrote:
>>> Could you paste the full source code and xml config please ?
>>>
>>> On Wed, Oct 8, 2008 at 12:45 PM, Sebastian Gomez <[EMAIL PROTECTED]> wrote:
>>>> Hi everyone.
>>>>
>>>> I've got a servicemix-bean endpoint annotated with @Resource to obtain
>>>> the DeliveryChannel. It's been working perfectly until I added the
>>>> @Transactional annotation to it's interface. Now I keep getting a
>>>> NullPointerException everytime I try to access the DeliveryChannel.
>>>> Has someone had any similar problem? I guess it must be because of the
>>>> proxy created to allow the transactability. Will I have to create the
>>>> transactions explicitly in the code or is there any way to let both of
>>>> these annotations live together?
>>>>
>>>> I guess someone must have come across this issue before, because I
>>>> consider transactions to be a quite common part of any real-life
>>>> application.
>>>>
>>>> Thanks in advance.
>>>>
>>>> Sebastian Gomez.
>>>>
>>>
>>>
>>>
>>> --
>>> Cheers,
>>> Guillaume Nodet
>>> ------------------------
>>> Blog: http://gnodet.blogspot.com/
>>> ------------------------
>>> Open Source SOA
>>> http://open.iona.com
>>>
>>
>
>
>
> --
> Cheers,
> Guillaume Nodet
> ------------------------
> Blog: http://gnodet.blogspot.com/
> ------------------------
> Open Source SOA
> http://open.iona.com
>
--
Cheers,
Guillaume Nodet
------------------------
Blog: http://gnodet.blogspot.com/
------------------------
Open Source SOA
http://open.iona.com