Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [aspectj-dev] issues using advice with a web service method call.

Thanks Andy for your reply.
That's a mess-up from my side, the logs were of another Class.

Now let me put my issues again.

1. I have an aspect that's LogViewer.as

here I am using an around advice to mesure the time taken by echho(..) method .

2.ContactObjectSoapHttpPortImpl.java is my web service class which holds echo(..) method.

3.aop.xml

now as per the log attached below, its weaving both the web service class and aspect class (If I understand it correct, which is doubtful)
even its displaying the message in before advice but, its not doing any thing in around or after advice.

But I need any of this around or after advice to work, to get my work done.

/////////////////////////logs//////////////////////////

[GenericClassLoader@197bc2a] info AspectJ Weaver Version 1.7.0 built on Tuesday Jul 3, 2012 at 22:30:30 GMT
[GenericClassLoader@197bc2a] info register classloader weblogic.utils.classloaders.GenericClassLoader@197bc2a
[GenericClassLoader@197bc2a] info using configuration C:/bea/user_projects/domains/aspectjtest/servers/AdminServer/tmp/.appmergegen_1352986804546/gcp_g
db.ear/h3p2qc/WEB-INF/lib/gcpAspectLog.jar!/META-INF/aop.xml
[GenericClassLoader@197bc2a] info register aspect com.att.gcp.aspectj.LogViewer
[GenericClassLoader@197bc2a] debug weaving 'com.att.gcp.gdb.contact.v1.ContactObjectSoapHttpPortImpl'
[GenericClassLoader@197bc2a] debug generating class 'com.att.gcp.gdb.contact.v1.ContactObjectSoapHttpPortImpl$AjcClosure1'
[ChangeAwareClassLoader@c3f861] debug weaving 'com.att.gcp.aspectj.LogViewer'
About to call ContactObjectSoapHttpPortImpl.echo(..), args:[com.att.gcp.gdb.contact.v1.EchoRequest@101386f]

Attaching codes again for reference.

////////////////////////////////////LogViewer.as//////////////////////
public aspect LogViewer 
{
private long time;
before(): execution(public * com.att.gcp.gdb.contact..ContactObjectSoapHttpPortImpl.echo(..) ) 
{
time=System.currentTimeMillis();
System.err.println("About to call " + thisJoinPoint.getSignature().toShortString() + ", args:" + Arrays.toString(thisJoinPoint.getArgs()) );
}
Object around() : execution( * com.att.gcp.gdb.contact..ContactObjectSoapHttpPortImpl.echo(..)) 
{
System.out.println("Entering Around Advice");
final long startTimeMs = System.currentTimeMillis();
Object result = proceed();
final long endTimeMs = System.currentTimeMillis();
final long execTimeMs = endTimeMs - startTimeMs;
System.out.println(getClass().getName() + ": time taken is :" +execTimeMs );
return result;
 
}
after(): execution(public * com.att.gcp.gdb.contact..ContactObjectSoapHttpPortImpl.echo(..))
{
long endTime=System.currentTimeMillis();
long timeTaken=endTime-time;
System.err.println("After calling " + thisJoinPoint.getSignature().toShortString() + ": time taken : : "+timeTaken );
 
}

}

////////////////////////////////////////aop.xml//////////////////////

<aspectj>

<aspects options="-verbose">
<aspect name="com.att.gcp.aspectj.LogViewer" />
</aspects>

        <weaver options="-verbose -debug">
    <include within="com.att.gcp.gdb.contact.v1.ContactObjectSoapHttpPortImpl" />
   <include within="com.att.gcp.aspectj.LogViewer"/>
</weaver>

</aspectj>

Thanks in advance.
Smrutiranjan





On Thu, Nov 15, 2012 at 6:26 AM, Andy Clement <andrew.clement@xxxxxxxxx> wrote:
I'm a bit confused why the log messages refer to LogFormattingAspect
but your attached code and aop.xml talk about LogViewer - are they the
same thing? (did you do some renaming?)

I don't see any weave info messages in your output - that suggests
your pointcut did not match.  The clue may be in the warning:

> [GenericClassLoader@1a0fd6d] warning at com\app\test\aspect\log\LogFormattingAspect.java::0 no match for this type
> name: com.gcp.gdb.contact.v1.ContactObjectSoapHttpPortImpl [Xlint:invalidAbsoluteTypeName]

If you are expecting it to weave into

> [GenericClassLoader@1a0fd6d] debug weaving
> 'com.gcp.gdb.geoaddr.v1.GeographicAddressObjectSoapHttpPortImpl'

then it will be trying to load ContactObjectSoapHttpPortImpl (parent
of Geo*?) to determine the relationship with the Geographic* type.  Is
that type available on the classpath?

cheers,
Andy



On 14 November 2012 11:41, Smrutiranjan Samantara
<smruti.photo@xxxxxxxxx> wrote:
> Hi,
>  I am trying to use around advice for a particular webservice method. I have
> written a aspect class with advice with point cut.
> even I have written an aop.xml file specifying aspect and weaver elements.
> Kept this available to webservice's class path.
> while running I can see the message of weaving the calss, but not able to
> get the the message which I want to be printed during advice execution.
>
> My code is as follow
>
>
> /////////////aspect class///////////////////////
> public aspect LogViewer
> {
>     before(): execution(public *
> com.gcp.gdb.contact..ContactObjectSoapHttpPortImpl.*(..) ) //this is my web
> service call
>     {
>               System.err.println("About to call " +
> thisJoinPoint.getSignature().toShortString() + ", args:" +
> Arrays.toString(thisJoinPoint.getArgs()) );
>     }
>
>      Object around() : execution( *
> com.att.gcp.gdb.contact..ContactObjectSoapHttpPortImpl.echo(..))
>      {
>          final long startTimeMs = System.currentTimeMillis();
>          Object result = proceed();
>          final long endTimeMs = System.currentTimeMillis();
>          final long execTimeMs = endTimeMs - startTimeMs;
>          System.out.println(getClass().getName() + ": time taken is :"
> +execTimeMs );
>          return result;
>
>      }
>
> }
> ////////////////////aop.xml/////////////////////////
>
> <aspectj>
>
>     <aspects options="-verbose">
>
>         <aspect name="com.gcp.aspectj.LogViewer" />
>     </aspects>
>
>     <weaver options="-verbose, -showWeaveInfo">
>
>         <include within="com.gcp.gdb.contact.v1.*" />
>
>
>        <include within="com.gcp.aspectj.LogViewer"/>
>     </weaver>
>
> </aspectj>
>
>
> ///////////////////webservice console log//////
>
> [ChangeAwareClassLoader@129d101] debug weaving
> 'com.att.gcp.gdb.geoaddr.v1.GeographicAddressObjectSoapHttpPortImpl'
> [GenericClassLoader@1a0fd6d] info AspectJ Weaver Version 1.6.8 built on
> Friday Jan 8, 2010 at 21:53:37 GMT
> [GenericClassLoader@1a0fd6d] info register classloader
> weblogic.utils.classloaders.GenericClassLoader@1a0fd6d
> [GenericClassLoader@1a0fd6d] info using configuration
> C:/bea/user_projects/domains/aspectjtest/servers/AdminServer/tmp/.appmergegen_1352907090515/gcp_gdb.ear/yfkpbj/WEB-I
> NF/lib/gdbAspectLog.jar!/META-INF/aop.xml
> [GenericClassLoader@1a0fd6d] info register aspect
> com.app.test.aspect.log.LogFormattingAspect
> [GenericClassLoader@1a0fd6d] warning at
> com\app\test\aspect\log\LogFormattingAspect.java::0 no match for this type
> name: com.gcp.gdb.contact.v1.ContactObjectSoapHttpP
> ortImpl [Xlint:invalidAbsoluteTypeName]
> [GenericClassLoader@1a0fd6d] debug weaving
> 'com.gcp.gdb.geoaddr.v1.GeographicAddressObjectSoapHttpPortImpl'
>
>
>
>
>
> Thanks,
> Smrutiranjan
>
>
> _______________________________________________
> aspectj-dev mailing list
> aspectj-dev@xxxxxxxxxxx
> https://dev.eclipse.org/mailman/listinfo/aspectj-dev
>
_______________________________________________
aspectj-dev mailing list
aspectj-dev@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/aspectj-dev


Back to the top