Andrew is right.
GlassFish is built on an OSGi architecture, try modifying the file :
Modifying configuration osgi.properties :
There are 2 modifications ( in red color) to do in file :
<GLASSFISH_ROOT>/glassfish/config/osgi.properties
# There is no need to use bootdelegation except for the following issues:
# 1. EclipseLink
# 4. NetBeans profiler packages exist in parent class loader (see issue #8612)
# 5. BTrace exists in bootclasspath.
org.osgi.framework.bootdelegation=${eclipselink.bootdelegation}, \
com.sun.btrace, com.sun.btrace.*, \
org.netbeans.lib.profiler, org.netbeans.lib.profiler.*, \
org.aspectj, org.aspectj.*, \
<yourpackageeAspect>, <yourpackageAspect>.*
# The OSGi R4.2 spec says boot delegation uses the boot class loader by default. We need
# to configure it to use the framework class loader because that class loader is
# configured with extra classes like jdk tools.jar, derby jars, etc. that must be
# made available in GlassFish to work.
# framework is the original value.
# org.osgi.framework.bundle.parent=framework
org.osgi.framework.bundle.parent=app
Cordialement / Best regards
Jean-Louis Pasturel
De : aspectj-users-bounces@xxxxxxxxxxx [mailto:aspectj-users-bounces@xxxxxxxxxxx]
De la part de Andy Clement
Envoyé : mardi 21 janvier 2014 00:35
À : aspectj-users@xxxxxxxxxxx
Objet : Re: [aspectj-users] Use Aspectj during web services invocation
-------------------------------------------------------------------------------------------------------------------------------------------------------
------
Oups, votre interlocuteur continue de vous ecrire a votre ancienne adresse email : @orange-ftgroup.com. Veuillez lui demander de mettre a jour son
carnet d'adresses. Vous pouvez le faire en utilisant ce modele d'email. Merci
Oops, your contact is still using your old email address @orange-ftgroup.com. Please could you tell them to update their address book details for you?
You can use this email template if you like. Thanks
-------------------------------------------------------------------------------------------------------------------------------------------------------
------
The aspectjrt.jar file needs to be added such that the same classloader that sees your app can see the file. I'm not sure how to do that on a glassfish server. Can you put it alongside
the aspects?
On 19 January 2014 19:17, Shanmuga Priya R <shanmugapriya1228@xxxxxxxxxxxxxx> wrote:
Hi,
I added aspectjrt.jar to my project through "Add Library". But it throws same error.
On Sat, Jan 18, 2014 at 10:25 AM, Shanmuga Priya R <shanmugapriya1228@xxxxxxxxxxxxxx> wrote:
Hi,
I added aspectjrt.jar to my project through "Add Library". But it throws same error.
On Sat, Jan 18, 2014 at 10:19 AM, Shanmuga Priya R <shanmugapriya1228@xxxxxxxxxxxxxx> wrote:
Hi,
I'm not aware about aspectjrt.jar. How can i add this jar file to my project? Is it external jar file?
On Sat, Jan 18, 2014 at 3:59 AM, Andy Clement <andrew.clement@xxxxxxxxx> wrote:
> Caused by: java.lang.NoClassDefFoundError: org/aspectj/lang/NoAspectBoundException
That suggests you did not have the aspectjrt.jar file accessible to the running app code.
The support classes for AspectJ woven code are in the small aspectjrt.jar file.
On 17 January 2014 01:44, Shanmuga Priya R <shanmugapriya1228@xxxxxxxxxxxxxx> wrote:
Hi,
I change my aspect based on your information. Aspect weaved to the web services properly. But during execution time it throws exeception on Glassfish server.
import org.apache.axis2.AxisFault;
import org.apache.axis2.addressing.EndpointReference;
import org.apache.axis2.client.Options;
import org.apache.axis2.client.ServiceClient;
import org.apache.axiom.om.OMAbstractFactory;
import org.apache.axiom.om.OMElement;
import org.apache.axiom.om.OMFactory;
import org.apache.axiom.om.OMNamespace;
public class SimpleInterestMidleware
public void invokeService() throws AxisFault
ServiceClient client = new ServiceClient();
Options opts = new Options();
opts.setAction("urn:findInterest");
System.out.println("Function calling sendReceive");
OMElement res = client.sendReceive(createPayLoad());
private static OMElement createPayLoad()
OMFactory fac = OMAbstractFactory.getOMFactory();
OMElement method = fac.createOMElement("findInterest", omNs);
OMElement value = fac.createOMElement("p", omNs);
public aspect SimpleInterestAspect
pointcut beforeaspect():call(* sendReceive(..));
System.out.println("~~~~~~~~~~~~~~~~~~~~~~");
System.out.println("====Before aspect=====");
System.out.println("~~~~~~~~~~~~~~~~~~~~~~");
Error:(During execution it throws following exception)
Function calling sendReceive
[ERROR] org/aspectj/lang/NoAspectBoundException
java.lang.reflect.InvocationTargetException
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.apache.axis2.rpc.receivers.RPCUtil.invokeServiceClass(RPCUtil.java:212)
at org.apache.axis2.rpc.receivers.RPCMessageReceiver.invokeBusinessLogic(RPCMessageReceiver.java:117)
at org.apache.axis2.receivers.AbstractInOutMessageReceiver.invokeBusinessLogic(AbstractInOutMessageReceiver.java:40)
at org.apache.axis2.receivers.AbstractMessageReceiver.receive(AbstractMessageReceiver.java:114)
at org.apache.axis2.engine.AxisEngine.receive(AxisEngine.java:181)
at org.apache.axis2.transport.http.HTTPTransportUtils.processHTTPPostRequest(HTTPTransportUtils.java:172)
at org.apache.axis2.transport.http.AxisServlet.doPost(AxisServlet.java:146)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:754)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:847)
at org.apache.catalina.core.ApplicationFilterChain.servletService(ApplicationFilterChain.java:427)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:315)
at org.apache.catalina.core.StandardContextValve.invokeInternal(StandardContextValve.java:287)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:218)
at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:648)
at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:593)
at com.sun.enterprise.web.WebPipeline.invoke(WebPipeline.java:94)
at com.sun.enterprise.web.PESessionLockingStandardPipeline.invoke(PESessionLockingStandardPipeline.java:98)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:222)
at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:648)
at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:593)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:587)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:1096)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:166)
at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:648)
at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:593)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:587)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:1096)
at org.apache.coyote.tomcat5.CoyoteAdapter.service(CoyoteAdapter.java:288)
at com.sun.enterprise.web.connector.grizzly.DefaultProcessorTask.invokeAdapter(DefaultProcessorTask.java:647)
at com.sun.enterprise.web.connector.grizzly.DefaultProcessorTask.doProcess(DefaultProcessorTask.java:579)
at com.sun.enterprise.web.connector.grizzly.DefaultProcessorTask.process(DefaultProcessorTask.java:831)
at com.sun.enterprise.web.connector.grizzly.DefaultReadTask.executeProcessorTask(DefaultReadTask.java:341)
at com.sun.enterprise.web.connector.grizzly.DefaultReadTask.doTask(DefaultReadTask.java:263)
at com.sun.enterprise.web.connector.grizzly.DefaultReadTask.doTask(DefaultReadTask.java:214)
at com.sun.enterprise.web.portunif.PortUnificationPipeline$PUTask.doTask(PortUnificationPipeline.java:380)
at com.sun.enterprise.web.connector.grizzly.TaskBase.run(TaskBase.java:265)
at com.sun.enterprise.web.connector.grizzly.ssl.SSLWorkerThread.run(SSLWorkerThread.java:106)
Caused by: java.lang.NoClassDefFoundError: org/aspectj/lang/NoAspectBoundException
How can i solve this problem?
On Fri, Jan 10, 2014 at 1:46 AM, Andy Clement <andrew.clement@xxxxxxxxx> wrote:
For the constructor joinpoint you want this signature:
execution(EndpointReference.new(..))
For the sendReceive you have the signature right but that will only apply if you weave *into* the jar containing the implementation of sendReceive. If you are weaving into the caller
of sendReceive you need:
call(* sendReceive(..))
(And if using call() there, maybe you also want call(EndpointReference.new(..)) for the constructor)
cheers,
Andy
Hi,
I wanted to use aspectj during invocation of web service from other service. For that i wanted to know how to specify the jointpoint.
import org.apache.axis2.AxisFault;
import org.apache.axis2.addressing.EndpointReference;
import org.apache.axis2.client.Options;
import org.apache.axis2.client.ServiceClient;
import org.apache.axiom.om.OMAbstractFactory;
import org.apache.axiom.om.OMElement;
import org.apache.axiom.om.OMFactory;
import org.apache.axiom.om.OMNamespace;
public class MiddleSimpleInterest
public static void main(String[] args) throws AxisFault
ServiceClient client = new ServiceClient();
Options opts = new Options();
opts.setAction("urn:findInterest");
OMElement res = client.sendReceive(createPayLoad());
private static OMElement createPayLoad()
OMFactory fac = OMAbstractFactory.getOMFactory();
OMElement method = fac.createOMElement("findInterest", omNs);
OMElement value = fac.createOMElement("p", omNs);
Corresponding Aspectj code:
public aspect MiddlewareAspect
pointcut beforeaspect():execution(* *.sendReceive(..));
pointcut beforeexeaspect():execution(* EndpointReference(..));
System.out.println("~~~~~~~~~~~~~~~~~~~~~~");
System.out.println("====Before sendReceive=====");
System.out.println("~~~~~~~~~~~~~~~~~~~~~~");
before():beforeexeaspect()
System.out.println("~~~~~~~~~~~~~~~~~~~~~~");
System.out.println("====Before EndpointReference=====");
System.out.println("~~~~~~~~~~~~~~~~~~~~~~");
For the above aspectj code i got the exception "Advice didn't match".
How can i specify those 2 join points? Is it possible in aspectj?
_______________________________________________
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
_______________________________________________
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
_______________________________________________
aspectj-users mailing list
aspectj-users@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/aspectj-users