On 6/26/07, oliver kuntze <[EMAIL PROTECTED]> wrote:


Ok, I think I got it.

When a SU is deployed to a ServiceMix component, the component creates a
Spring application context and configures the app according to the
xbean.xml. I.e. every SU is in fact a Spring application.
That means out of the box one is able to use Spring AOP aspects per SU. If
one would like to have aspects for his/her "eai application", that is for
a
whole bunch of SAs, than one should extend ServiceMix / Xbean  somehow so
that a "global" xbean config containing the aspects is added to the
ApplicationContext when the XBean SpringLoader has loaded the xbean.xml.
Correct?


Exactly !

I tried to deploy a SU with an aspect but received the following exception:
BeanDefinitionStoreException: Unrecognized xbean namespace mapping:
http://www.springframework.org/schema/aop

My xbean.xml looks like this:
<code>
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans";
        xmlns:jsr181="http://servicemix.apache.org/jsr181/1.0";
        xmlns:swifttransformation="http://mycompany/swifttransformation";
        xmlns:aop="http://www.springframework.org/schema/aop";>

        <aop:aspectj-autoproxy/>
        <bean class="
mycompany.playground.swifttransformation.MonitoringAspect"
id="swiftTransformationMonitoringAspect"/>

        <jsr181:endpoint endpoint="swift2xml"
                service="swifttransformation:iso15022-transformation"

serviceInterface="
mycompany.playground.swifttransformation.SwiftToXmlTransformer"
                typeMapping="xmlbeans">
                <jsr181:pojo>
                        <bean
class="mycompany.playground.swifttransformation.SwiftToXmlTransformerImpl"
/>
                </jsr181:pojo>
        </jsr181:endpoint>
</beans>
</code>

The spring.handler file in the spring-beans-2.0.1.jar of my ServiceMix
distribution contains the following line:
http\://www.springframework.org/schema/aop=
org.springframework.aop.config.AopNamespaceHandler

So everything seems to be in place.

Any ideas why I get the exception?


I don't know why the handler is defined in spring-beans while the associated
class is not.
You should put spring-aop in the SU by adding it to your pom.xml.
It should do the trick.

Thanks a lot for helping a newbie out!

Cheers,

Oliver.


gnodet wrote:
>
> I'm not sure to understand all the problems.
> If I had to do AOP inside a SU, I would just consider the SU as a spring
> application (even if it has to contain a JBI endpoint).
> You can put additional jars needed in the SU and you should be able to
use
> AOP.  You don't really need to hack the components
> or the main configuration file.
>
> Or maybe you want to do AOP without configuring it explicitely ? This is
> currently not possible.  I think it should be doable by extending
> the components somehow so that they always load other spring
configuration
> files: for example when a component creates a spring
> ApplicationContext when loading a xbean.xml, it could be configured to
> always load an aop.xml configuration file that you would provide
> and which would add all the needed definitions.
>

--
View this message in context:
http://www.nabble.com/Spring-AOP-integration-in-ServiceMix-tf3975690s12049.html#a11303312
Sent from the ServiceMix - User mailing list archive at Nabble.com.




--
Cheers,
Guillaume Nodet
------------------------
Principal Engineer, IONA
Blog: http://gnodet.blogspot.com/

Reply via email to