Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [aspectj-dev] How to make aop.xml configurable

Many thanks .. Andy. I could achieve making aop.xml configurable by making aop.xml available to the weaver agent after deployment.


Sridhar Thiyagarajan

On Wed, Jun 24, 2015 at 1:13 AM, Andy Clement <andrew.clement@xxxxxxxxx> wrote:
It sounds like you are loading the aspects in the wrong place?

You can’t have the parent class loader define aspects where the abstract aspects come from the children.  In that situation I would either be making the concrete aspects not depend on the abstract aspects or pushing the concrete aspects down to the loader that is loading the children (so the concrete aspects can see the abstract aspects).

If your system is using some kind of child first delegation strategy for class loading and the abstract aspects appear later - you can’t currently configure aspectj to wait on defining the concrete aspects until those children abstract aspects appear.

cheers,
Andy

On Jun 23, 2015, at 3:23 AM, sridhar thiyagarajan <sridharthiyagarajan@xxxxxxxxx> wrote:

Many thanks for the response.. Andy. org.aspectj.weaver.loadtime.configuration VM argument is working fine and earlier, I missed adding file: protocol with the VM argument to access a file that is not exposed to classpath.

-Dorg.aspectj.weaver.loadtime.configuration=file:D:\workspace\test_aop.xml


I am running my application in Wildfly 8.2.0 application server and when I start the server, I am getting the below error mentioning cannot create concrete aspect.

2015-06-23 15:09:05,092 ERROR [stderr] (main) [ModuleClassLoader@871b75] error Cannot find parent aspect for: <concrete-aspect name='com.app.it.aspect.DAOAspectImpl' extends='com.app.it.aspect.DAOAspect' perclause='percflow(readDaoPC() || writeDaoPC())'/> in aop.xml

2015-06-23 15:09:05,092 ERROR [stderr] (main) [ModuleClassLoader@871b75] error Concrete-aspect 'com.app.it.aspect.DAOAspectImpl' could not be registered

2015-06-23 15:09:05,092 ERROR [stderr] (main) [ModuleClassLoader@871b75] warning failure(s) registering aspects. Disabling weaver for class loader org.jboss.modules.ModuleClassLoader@871b75

I understand that weaver reads aop.xml content and it tries to load the aspect but only after deployment of the application during the server start up, the aspect abstract classes will be available.

I tried to exclude weaving for org.jboss  classes by adding the below entry in aop.xml but am still getting the above error.

<exclude within="org.jboss..*"/>

I tried the a similar thing in a java standalone application and same error appears. Could you please help me about why the above error appears and how to avoid the same. This is just to avoid ERRORS during the server start up and application deployment.

Many thanks.

Sridhar Thiyagarajan


On Mon, Jun 22, 2015 at 11:21 PM, Andy Clement <andrew.clement@xxxxxxxxx> wrote:
1. So, does aop.xml need to be packed in a JAR (or any archive) always ?

Nope. By default it just needs to be in a META-INF folder. So META-INF/aop.xml can be just lying around on your filesystem (but the folder containing META-INF needs to be on the class path).


2. Is the below VM argument useful to identify and use aop XML present only in JAR (or any archive) files if there are more than one aop XML files available ?

-Dorg.aspectj.weaver.loadtime.configuration

You could use that. I am not very familiar with it but looking at the code it may work:

-Dorg.aspectj.weaver.loadtime.configuration=aop.xml

That takes a semicolon separated list of candidates to try. If the candidates start file: then we attempt to access directly as a file. If not then we attempt to access it on the class path.

Andy

On Jun 22, 2015, at 3:10 AM, sridhar thiyagarajan <sridharthiyagarajan@xxxxxxxxx> wrote:

Hello,

I am using AspectJ version 1.8.6 in my sample project AopTest (a JAR project) as the project structure is mentioned below:


<image.png>

I have a query on the place of aop.xml. Currently, I am packing aop.xml under resources/META-INF folder of the JAR project and the generated JAR works fine applying desired advices.

I want to move aop.xml out of JAR file to make aop.xml configurable. So, I placed aop.xml in the folder D:\workspacedummy and added the below VM argument to point to aop.xml but the file is not loaded and hence, there are no advices applied.

-Dorg.aspectj.weaver.loadtime.configuration=D:\workspacedummy\aop.xml


1. So, does aop.xml need to be packed in a JAR (or any archive) always ?


2. Is the below VM argument useful to identify and use aop XML present only in JAR (or any archive) files if there are more than one aop XML files available ?

-Dorg.aspectj.weaver.loadtime.configuration


Please help me to achieve making aop.xml configurable.

Many Thanks.

Sridhar Thiyagarajan

_______________________________________________
aspectj-dev mailing list
aspectj-dev@xxxxxxxxxxx
To change your delivery options, retrieve your password, or unsubscribe from this list, visit
https://dev.eclipse.org/mailman/listinfo/aspectj-dev


_______________________________________________
aspectj-dev mailing list
aspectj-dev@xxxxxxxxxxx
To change your delivery options, retrieve your password, or unsubscribe from this list, visit
https://dev.eclipse.org/mailman/listinfo/aspectj-dev

_______________________________________________
aspectj-dev mailing list
aspectj-dev@xxxxxxxxxxx
To change your delivery options, retrieve your password, or unsubscribe from this list, visit
https://dev.eclipse.org/mailman/listinfo/aspectj-dev


_______________________________________________
aspectj-dev mailing list
aspectj-dev@xxxxxxxxxxx
To change your delivery options, retrieve your password, or unsubscribe from this list, visit
https://dev.eclipse.org/mailman/listinfo/aspectj-dev


Back to the top