[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [aspectj-users] How to run compile time weave with ant? Simple case.

This was a bit confusing for me, and may be for others as well.

I am running <iajc> ant with -v (verbose mode). "info woven" is printed. However "weaveinfo" is not printed. This made me think nothing was being woven.

     [iajc] info woven class com.sun.jbi.messaging.util.WSDLHelper (from C:\workspace\new\EnterpriseManager\gui\esbConsole\lib\jbi\jbi_rt.jar)
     [iajc] info woven class com.sun.jbi.messaging.util.OpenBufferOutputStream (from C:\workspace\new\EnterpriseManager\gui\esbConsole\lib\jbi\jbi_rt.jar)
     [iajc] info woven class com.sun.jbi.messaging.MessageFactory (from C:\workspace\new\EnterpriseManager\gui\esbConsole\lib\jbi\jbi_rt.jar)
     [iajc] info woven class com.sun.jbi.messaging.MessageExchangeProxy (from C:\workspace\new\EnterpriseManager\gui\esbConsole\lib\jbi\jbi_rt.jar)
     [iajc] info woven class com.sun.jbi.messaging.MessageService (from C:\workspace\new\EnterpriseManager\gui\esbConsole\lib\jbi\jbi_rt.jar)
     [iajc] info woven class com.sun.jbi.messaging.NMRStatistics (from C:\workspace\new\EnterpriseManager\gui\esbConsole\lib\jbi\jbi_rt.jar)

This only appears after setting showWeaveInfo="true"

     [iajc] weaveinfo Join point 'method-execution(javax.jbi.messaging.MessageExchange com.sun.jbi.messaging.DeliveryChannelImpl.accept())' in Type 'com.sun.jbi.messaging.DeliveryChannelImpl' (DeliveryChannelImpl.java:181) advised by around advice from 'com.sun.esb.console.jbi.aspects.FilterAspect' (aopjbi.jar!FilterAspect.class:236(from FilterAspect.aj))
     [iajc] weaveinfo Join point 'method-execution(javax.jbi.messaging.MessageExchange com.sun.jbi.messaging.DeliveryChannelImpl.accept())' in Type 'com.sun.jbi.messaging.DeliveryChannelImpl' (DeliveryChannelImpl.java:181) advised by around advice from 'com.sun.esb.console.jbi.aspects.TraceAspect' (aopjbi.jar!TraceAspect.class:90(from TraceAspect.aj))


Secondly, after finding this http://www.eclipse.org/aspectj/doc/released/pdguide/messages-xlint.html

In my case this warning appears to mean my <classpath> contains a jar on my <inpath>.
This is actually ok with me..

     [iajc] warning at (no source information available)
     [iajc] C:\workspace\new\EnterpriseManager\gui\esbConsole\lib\jbi\jbi_rt.jar:0::0 this affected type is not exposed to the weaver: com.sun.jbi.framework.ServiceUnitFramework [Xlint:typeNotExposedToWeaver]
     [iajc] warning at (no source information available)
     [iajc] C:\workspace\new\EnterpriseManager\gui\esbConsole\lib\jbi\jbi_rt.jar:0::0 this affected type is not exposed to the weaver: com.sun.jbi.framework.Component [Xlint:typeNotExposedToWeaver]
     [iajc] warning at (no source information available)
     [iajc] C:\workspace\new\EnterpriseManager\gui\esbConsole\lib\jbi\jbi_rt.jar:0::0 this affected type is not exposed to the weaver: com.sun.jbi.framework.ServiceUnit [Xlint:typeNotExposedToWeaver]

The combination of not printing the "weaveinfo" in verbose mode, while printing the "info woven" and the display of this warning message lead me to believe nothing was happening/that i was doing some wrong.
This was not really the case.

1) I would recommend that "weaveinfo" is printed in ant -verbose mode and
2) I might suggest that it is more clear what these arcaic warnings/errors mean

a) You could print a little [key]

e.g.,
typeNotExposedToWeaver="This means that a type which could be affected by an aspect is not available for weaving. This happens when a class on the classpath should be woven."

b) In the doc http://www.eclipse.org/aspectj/doc/next/devguide/antTasks-iajc.html you might provide a reference to http://www.eclipse.org/aspectj/doc/released/pdguide/messages-xlint.html in the appropriate place.

This was the simple solution for me.

        <iajc destdir="${build.dir}/aop"
            debug="true"
            source="1.6"
            target="1.6"
            showWeaveInfo="true">
            <classpath refid="compile.class.path" />
            <inpath>
                <fileset dir="${lib.dir}">
                    <include name="**/jbi_rt.jar" />
                </fileset>
            </inpath>
            <aspectpath>
                <fileset dir="${dist.dir}">
                    <include name="**/aopjbi.jar" />
                </fileset>
            </aspectpath>
        </iajc>


I still don't know what this means though in LTW

Fri Oct 17 11:15:59 PDT 2008 error can't determine modifiers of missing type com.sun.jbi.framework.ServiceUnitFramework
when processing type mungers com.sun.soabi.capsverifier.AppVerifierLifeCycleListener



Jason Weinstein wrote:
I have an aspect

public aspect FilterAspect {

in file FilterAspect.aj

How do i run iajc "ant" task to weave jar xxx.jar that depends on jar yyy.jar and place into file xxx_delta.jar

I know how to do LTW but can't get compile time weave to work.


In my attempts i saw this

     [iajc] warning at (no source information available)
     [iajc] C:\workspace\new\EnterpriseManager\gui\esbConsole\lib\jbi\jbi_rt.jar:0::0 this affected type is not exposed to the weaver: com.sun.jbi.framework.ServiceUnitFramework [Xlint:typeNotExposedToWeaver]
     [iajc] warning at (no source information available)
     [iajc] C:\workspace\new\EnterpriseManager\gui\esbConsole\lib\jbi\jbi_rt.jar:0::0 this affected type is not exposed to the weaver: com.sun.jbi.framework.ServiceUnit [Xlint:typeNotExposedToWeaver]

What does it mean?


I'd like to do something as simple as

<iajc inJar="xxx.jar" classpath="yyy.jar;aspectrt.jar" aspect="FilterAspect.aj" outJar="xxx_delta.jar"/>


I have to ask why is this so hard? I don't get all the options. A few more examples would be awsome.


Thanks much.


Jason Weinstein wrote:
Fri Oct 17 11:15:58 PDT 2008 info AspectJ Weaver Version 1.6.1 built on Thursday Jul 3, 2008 at 18:35:41 GMT
Fri Oct 17 11:15:58 PDT 2008 info register classloader java.net.URLClassLoader@c260c5
Fri Oct 17 11:15:58 PDT 2008 info using configuration file:/C:/JavaCAPS6/appserver/domains/domain1/lib/aopjbi.jar!/META-INF/aop.xml
Fri Oct 17 11:15:58 PDT 2008 info register aspect com.sun.esb.console.jbi.aspects.FilterAspect
Fri Oct 17 11:15:59 PDT 2008 debug weaving 'com.sun.soabi.capsverifier.AppVerifierLifeCycleListener'
Fri Oct 17 11:15:59 PDT 2008 error can't determine modifiers of missing type com.sun.jbi.framework.ServiceUnitFramework
when processing type mungers com.sun.soabi.capsverifier.AppVerifierLifeCycleListener
when processing type mungers
when weaving
 [Xlint:cantFindType]
Fri Oct 17 11:15:59 PDT 2008 error can't determine modifiers of missing type com.sun.jbi.framework.ServiceUnit
when processing type mungers com.sun.soabi.capsverifier.AppVerifierLifeCycleListener
when processing type mungers
when weaving
 [Xlint:cantFindType]


Assuming this is a classloading issue, how does one write an aspect using LTW where the aspect is brought into memory before the actual impl jars are?

I had been intercepting objects in the jar file containing com.sun.jbi.framework with other pointcuts but hadn't been referencing specific classes before.

Now that i have to reference specific classes it is no longer working.


import com.sun.jbi.framework.ServiceUnit;
import com.sun.jbi.framework.ServiceUnitFramework;

public aspect FilterAspect {
...
    public pointcut startServiceUnitJoinPoint(
        ServiceUnitFramework framework,
        Component component,
        ServiceUnitManager manager,
        ServiceUnit unit) :
       
        withinFramework() &&       
        execution(private void startServiceUnit(Component, ServiceUnitManager, ServiceUnit)) &&
        this(framework) &&
        args(component, manager, unit);


Can i change ServiceUnit and ServiceUnitFramework above to Object or something more general so i don't reference them at the time the aspect is loaded? What is best practice here? Note this is occuring in an app server.


_______________________________________________ aspectj-users mailing list aspectj-users@xxxxxxxxxxx https://dev.eclipse.org/mailman/listinfo/aspectj-users

_______________________________________________ aspectj-users mailing list aspectj-users@xxxxxxxxxxx https://dev.eclipse.org/mailman/listinfo/aspectj-users