I built a simple Java web application with a Web Service interface and added to it some simple aspects. When running the application as an aspectJ application it does exactly what it should, but when I run it as a web application and test it through the Web Services explorer I get strange exceptions. I isolated a line using the 'thisJoinPoint' command as the cause for the exception - commenting this line all works well also as a web application. (exception described below)
Platform:
Rational Software Architect 7.0
WebSphere 6.1
AspectJ Runtime 1.5.2
Thanks for anyone who can help me out here.
Ouri.
a sample exception (but I get different exceptions when using 'thisJoinPoint' in different places):
[6/21/07 17:52:54:953 IDT] 0000001c PivotHandlerW W com.ibm.ws.webservices.engine.PivotHandlerWrapper invoke WSWS3734W: Warning: Exception caught from invocation to com.ibm.ws.webservices.engine.dispatchers.java.JavaBeanDispatcher:
java.lang.NoClassDefFoundError: iSeller.Seller (initialization failure)
at java.lang.J9VMInternals.initialize(J9VMInternals.java:123)
at java.lang.Class.forNameImpl(Native Method)
at java.lang.Class.forName(Class.java:164)
at com.ibm.ws.webservices.engine.utils.ClassUtils$2.run(ClassUtils.java:234)
at com.ibm.ws.security.util.AccessController.doPrivileged(AccessController.java:63)
looks like a classloader/classpath issues.
However, I read somewhere that I should add the aspectjrt.jar file to either the WEB-INF/lib folder in my project, or to the corresponding EAR project. in order to add it to the right class path. Both ways did not solve (nor changed) my problem. What should be the correct way to add the aspectj library to a web application?
Thanks,
Ouri.
Now if that works then you know it was a classpath issue. I would then remove it from that location and create or add to the this variable: ws.ext.dirs in the JVM directory. See this handy document from IBM at: http://publib.boulder.ibm.com/infocenter/wasinfo/v6r1/index.jsp?topic=/com.ibm.websphere.base.doc/info/aes/ae/crun_classload.html If that link does not work then search for ws.ext.dirs on google and it should come up as one of the top results.
The better way to test this by modifying the classpath of the application might be to use a "shared library". You can link a shared library to a server or individual applications. You can find more info here:
[http://publib.boulder.ibm.com/infocenter/wasinfo/v6r1/topic/com.ibm.websphere.nd.doc/info/ae/ae/tcws_sharedlib.html]
If you put something in the WebSphere root classpaths you may be impacting something WebSphere needs to run. The shared library gives you the proper flexibility for classpath configuration. A shared library can also let you link a JAR file to multiple applications if needed without needing to package with each one.
Gook luck,
Stuart Smith
Administration Lead
Web Age Solutions
IBM Certified Advanced System Administrator WAS ND 6.1
www.webagesolutions.com