[jboss-user] [JBoss AOP] - JBoss AOP ear and maven-jbossaop-plugin

elysch do-not-reply at jboss.com
Sun Dec 2 14:57:06 EST 2007


Hi.

(Sorry for such a long message)

I've been trying for the past few weeks now to add some aspects to my application with no success.

What I want to do, as my first step, to add some interceptors to add functionality to already existing classes.

My questions are:
a) I managed to run the inJbos example (great one, by the way), and it wasn't clear if it's possible to aop the classes of an ear file with a .aop file in it, or if it must wave the classes at runtime. What I mean is: Can I run apoc with the intercepted classes before I pack my .aop file?

b) If I modify some entity classes, how should hibernate configuration files get modified? For instance, if I add a new attribute that should be referred by a database field?  (I'm not sure about how to add completely new functionalities to classes)

c) I managed to create a maven2 structure in order to have my bpm2struts, spring, hibernate, etc added with an “aop” project. I hope someone can help me

What should happen with the example, is that some messages should get printed on the adviced constructor. I could send the sources if needed.

When I deploy the project, nothing get's transformed. I'm sure the jboss-aop.xml is being parsed by JBoss.4.2.1.GA  server because I didn't put all the “ org.andromda.samples.aop.sades.domain.SolicitudProfesorGrupoDaoImpl” name but only the class name (SolicitudProfesorGrupoDaoImpl) and it complained.

Two days ago I discovered an error message on compile, and I can't figure out how to fix it:

[ERROR] java.io.FileNotFoundException: C:\AplicacionTesis\sades-aop\null (El sistema no puede hallar el archivo especificado)
  | [ERROR]         at java.io.FileInputStream.open(Native Method)
  | [ERROR]         at java.io.FileInputStream.<init>(Unknown Source)
  | [ERROR]         at java.io.FileInputStream.<init>(Unknown Source)
  | [ERROR]         at sun.net.www.protocol.file.FileURLConnection.connect(Unknown Source)
  | [ERROR]         at sun.net.www.protocol.file.FileURLConnection.getInputStream(Unknown Source)
  | [ERROR]         at java.net.URL.openStream(Unknown Source)
  | [ERROR]         at org.jboss.aop.AspectXmlLoader.loadURL(AspectXmlLoader.java:1276)
  | [ERROR]         at org.jboss.aop.AspectXmlLoader.deploy(AspectXmlLoader.java:1208)
  | [ERROR]         at org.jboss.aop.AspectXmlLoader.deployXML(AspectXmlLoader.java:1234)
  | [ERROR]         at org.jboss.aop.AspectXmlLoader.deployXML(AspectXmlLoader.java:1219)
  | [ERROR]         at org.jboss.aop.Deployment.deployXmlFile(Deployment.java:179)
  | [ERROR]         at org.jboss.aop.Deployment.preconfigThroughSystemProperty(Deployment.java:161)
  | [ERROR]         at org.jboss.aop.Deployment.deploy(Deployment.java:51)
  | [ERROR]         at org.jboss.aop.AspectManager$1.run(AspectManager.java:281)
  | [ERROR]         at java.security.AccessController.doPrivileged(Native Method)
  | [ERROR]         at org.jboss.aop.AspectManager.instance(AspectManager.java:207)
  | [ERROR]         at org.jboss.aop.AspectManager.instance(AspectManager.java:200)
  | [ERROR]         at org.jboss.aop.standalone.Compiler.compile(Compiler.java:196)
  | [ERROR]         at org.jboss.aop.standalone.Compiler.main(Compiler.java:90)
  | [ERROR] java.lang.RuntimeException: [error] failed to load aop path: null
  | [ERROR]         at org.jboss.aop.Deployment.preconfigThroughSystemProperty(Deployment.java:170)
  | [ERROR]         at org.jboss.aop.Deployment.deploy(Deployment.java:51)
  | [ERROR]         at org.jboss.aop.AspectManager$1.run(AspectManager.java:281)
  | [ERROR]         at java.security.AccessController.doPrivileged(Native Method)
  | [ERROR]         at org.jboss.aop.AspectManager.instance(AspectManager.java:207)
  | [ERROR]         at org.jboss.aop.AspectManager.instance(AspectManager.java:200)
  | [ERROR]         at org.jboss.aop.standalone.Compiler.compile(Compiler.java:196)
  | [ERROR]         at org.jboss.aop.standalone.Compiler.main(Compiler.java:90)
  | [ERROR] Caused by: java.io.FileNotFoundException: C:\AplicacionTesis\sades-aop\null (El sistema no puede hallar el archivo especificado)
  | [ERROR]         at java.io.FileInputStream.open(Native Method)
  | [ERROR]         at java.io.FileInputStream.<init>(Unknown Source)
  | [ERROR]         at java.io.FileInputStream.<init>(Unknown Source)
  | [ERROR]         at sun.net.www.protocol.file.FileURLConnection.connect(Unknown Source)
  | [ERROR]         at sun.net.www.protocol.file.FileURLConnection.getInputStream(Unknown Source)
  | [ERROR]         at java.net.URL.openStream(Unknown Source)
  | [ERROR]         at org.jboss.aop.AspectXmlLoader.loadURL(AspectXmlLoader.java:1276)
  | [ERROR]         at org.jboss.aop.AspectXmlLoader.deploy(AspectXmlLoader.java:1208)
  | [ERROR]         at org.jboss.aop.AspectXmlLoader.deployXML(AspectXmlLoader.java:1234)
  | [ERROR]         at org.jboss.aop.AspectXmlLoader.deployXML(AspectXmlLoader.java:1219)
  | [ERROR]         at org.jboss.aop.Deployment.deployXmlFile(Deployment.java:179)
  | [ERROR]         at org.jboss.aop.Deployment.preconfigThroughSystemProperty(Deployment.java:161)
  | [ERROR]         ... 7 more


The relevant parts of the principal pom.xml:

...
  |     </dependencyManagement>
  | ...
  | <!-- ESL!!! AOP --> <dependency>
  |       <groupId>org.jboss.maven.plugins</groupId>
  |       <artifactId>maven-jbossaop-plugin</artifactId>
  |       <version>1.0-SNAPSHOT</version>
  |     </dependency>
  |         </dependencies>
  | ...
  |     </dependencyManagement>
  | ...
  |     <modules>
  |         <module>mda</module>
  |         <module>common</module>
  |         <module>core</module>
  |         <module>web</module>
  |         <module>aop</module>   <!-- this one was added -->
  |         <module>app</module>
  |     </modules>
  | ...
  |     <repositories>
  | ...
  | <!-- ESL!!! AOP --> <repository>
  |        <id>snapshots.jboss.org</id>
  |        <name>JBoss Maven Snapshot Repository</name>
  |        <url>http://snapshots.jboss.org/maven2</url>
  |       </repository>
  |     </repositories>
  | ...

And my aop module pom.xml is:
...
  |     <dependencies>
  | ...
  | <!-- ESL!!! AOP --> <dependency>
  |       <groupId>org.jboss.maven.plugins</groupId>
  |       <artifactId>maven-jbossaop-plugin</artifactId>
  |     </dependency>
  |     </dependencies>
  |     <build>
  |         <finalName>${application.id}-aop-${pom.version}</finalName>
  |         <plugins>
  |             <plugin>
  |                 <groupId>org.andromda.maven.plugins</groupId>
  |                 <artifactId>andromda-multi-source-plugin</artifactId>
  |             </plugin>
  | <!-- ESL!!! AOP --> <plugin>
  |       <groupId>org.jboss.maven.plugins</groupId>
  |       <artifactId>maven-jbossaop-plugin</artifactId>
  |       <version>1.0-SNAPSHOT</version>
  |       <executions>
  |         <execution>
  |           <id>compile</id>
  |           <configuration>
  |             <aoppaths>
  |               <aoppath path="src/main/resources/META-INF/jboss-aop.xml"/>
  |             </aoppaths>
  |             <includes>
  |               <include>../../../core/target/classes/org/andromda/samples/aop/sades/domain/SolicitudProfesorGrupoDaoImpl.class</include>
  |             </includes>
  |           </configuration>
  |           <goals>
  |             <goal>compile</goal>
  |           </goals>
  |         </execution>
  |       </executions>
  |     </plugin>
  |         </plugins>
  |     </build>
  | </project>

The jboss-aop.xml file:

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
  | <aop>
  | 
  |    <introduction class="org.andromda.samples.aop.sades.domain.SolicitudProfesorGrupoDaoImpl">
  |       <mixin>
  |          <interfaces>
  | 	    org.andromda.samples.aop.sades.useCaseSlices.specific.solicitudProfesorGrupo.IAspectoUnoSolicitudProfesorGrupo
  |          </interfaces>
  |          <class>org.andromda.samples.aop.sades.useCaseSlices.specific.solicitudProfesorGrupo.MixinAspectoUnoSolicitudProfesorGrupo</class>
  |          <construction>new org.andromda.samples.aop.sades.useCaseSlices.specific.solicitudProfesorGrupo.MixinAspectoUnoSolicitudProfesorGrupo(this)</construction>
  |       </mixin>
  |    </introduction>
  | 
  | </aop>

My app pom.xml (is the one that builds the final ear)

...
  |     <dependencies>
  | ..
  |         <!-- ESL!!! AOP --> <dependency>
  |             <groupId>${pom.groupId}</groupId>
  |             <artifactId>sades-aop</artifactId>
  |             <version>${pom.version}</version>            
  |         </dependency>
  | ...
  |     </dependencies>
  | ...
  |         <plugins>
  |             <plugin>
  |                 <groupId>org.apache.maven.plugins</groupId>
  |                 <artifactId>maven-ear-plugin</artifactId>
  |                 <version>2.1</version>
  |                 <configuration>
  |                     <includes>**/*.xml</includes>
  |                     <excludes>**/jboss-app.xml</excludes>
  |                     <version>1.4</version>
  |                     <modules>
  |                         <!-- ESL!!! AOP --> <javaModule>
  |                             <groupId>${pom.groupId}</groupId>
  |                             <artifactId>sades-aop</artifactId>
  |                             <bundleFileName>${application.id}-aop-${pom.version}.aop</bundleFileName>
  |                             <includeInApplicationXml>true</includeInApplicationXml>
  |                         </javaModule>
  | ...


This way I obtain an ear file with the correct structure (as far as I can tell):

anonymous wrote : sades-1.0-SNAPSHOT.ear
  |     META-INF
  |         application.xml
  | ...
  |     sades-aop-1.0-SNAPSHOT.aop
  |         META-INF
  |             jboss-aop.xml
  | ...

And also my regular jar files, and the war file.


Thank you all in advance.

View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4109665#4109665

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4109665




More information about the jboss-user mailing list