tags:

views:

251

answers:

2

Hi everyone,

I'm trying to create a standalone app using JBoss Microcontainer for IoC and JBoss AOP for, well, AOP. I've boot-strapped, deployed a descriptor with AOP XML, so far so good. But the aspect is not performed. Do I need to enable AOP plugin or something? Note that I don't want to add a build step - I want it to work like Spring AOP.

Please check the code below.

Thanks for help.

<deployment xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
            xsi:schemaLocation="urn:jboss:bean-deployer:2.0 bean-deployer_2_0.xsd"
            xmlns="urn:jboss:bean-deployer:2.0"
            xmlns:aop="urn:jboss:aop-beans:1.0">

  <bean name="myGarage" class="jbmctest.Garage">
    <property name="car">
      <bean name="myCar" class="jbmctest.Car">
        <property name="name">Red Devil</property>
      </bean>
    </property>
  </bean>

  <aop:interceptor name="FuelInterceptor" class="jbmctest.FuelInterceptor"/>

  <aop:bind pointcut="execution(* *->*(..)">
    <aop:interceptor-ref name="FuelInterceptor"/>
  </aop:bind>

</deployment>
A: 

You're missing the pieces that are in aop.xml in JBossAS5 -> conf/bootstrap/aop.xml.

alesj
Thanks Ales.Now I am deploying classloader.xml, then aop.xml, then my jboss-beans.xml. But the line with classloader causes an error:org.jboss.xb.binding.JBossXBRuntimeException: {urn:jboss:classloader:1.0}classloader cannot appear in this position.classloader.xml@27,121<classloader name="bootstrap-classloader" xmlns="urn:jboss:classloader:1.0" export-all="NON_EMPTY" import-all="true">
Ondra Žižka
(I have reverse-engineered the AS 5.1 bootstrap :)So, what next?
Ondra Žižka
A: 

I've eventually solved this, and wrote an article for those who will try the same.

http://ondra.zizka.cz/stranky/programovani/java/jboss-aop-howto-example-standalone-app.texy

Ondra Žižka