facebook

AspectJ compatibility

  1. MyEclipse IDE
  2.  > 
  3. Feature Requests
Viewing 8 posts - 1 through 8 (of 8 total)
  • Author
    Posts
  • #198850 Reply

    mathis
    Member

    I am trying to work out how to combine AspectJ and MyEclipse in a project. The first, naive approach to just declare a web-project as AspectJ-project failed because AJDE and MyEcplise have different opinions which builder to use.

    The second approach, using a separate AspectJ project and supplying its output as jar to the web project has its own problems on my Windows box: Tomcat locks the open jar files and redeploy fails.

    Has anybody similar requirements or a solution?

    #198855 Reply

    Scott Anderson
    Participant

    mathis,

    We’re very interested in the topic of using Aspect/J with MyEclipse. In fact, if you’re interested in doing the research and don’t mind writing it all down as a tutorial this particular topic would be an excellent idea for entry into our ongoing contest:
    http://myeclipseide.com/index.php?module=ContentExpress&func=display&ceid=26

    As far as your approaches go, I’d suggest the second one. However, there’s a little confusion between redeploying an application and reloading. If you’d really like to have Tomcat ‘reload’ your application, you should be able to touch the web.xml file in your project, assuming you’re using exploded deployement. Once you touch the web.xml file, our sync-on-demand deployer will copy it to the Tomcat deployment and when Tomcat detects the change it should properly unload and reload your application.

    As another alternative, instead of generating a jar and placing it in the lib directory of your web project, you could have your Aspect/J project compile its classes directly into the ‘classes’ folder of your web project. To set that up, you’ll need to use the ‘Advanced…’ button and create a link from the build output folder of your Aspect/J project to the classes directory in your web project.

    Please let us know if we can help further in any way.

    –Scott
    MyEclipse Support

    #200019 Reply

    Has anyone done anything in this space as I am trying to do the same thing? IF not then I will try to do it myself and document it.

    #200021 Reply

    All, I got this working. The steps I performed were as follows:

    1) Created the web project.

    2) Place the aspectjrt.jar in the WEB-INF\lib folder

    3) Created the aspectj based project with my source

    4) In aspectj based project, set the build output to a directory that was linked to the classes folder of the web folder. DO NOT set this project up to build a jar as aspect will not emit the class files.

    5) Compiled aspectj project and magically all the output classes were there and could be compiled into the jsp’s.

    This was with Eclipse M4.

    One thing I found was that it does not work if you set the aspectj project to output a jar and copy it to the WEB-INF\lib folder as there is a resource sharing problem when you try to copy it in.

    I hope this helps.

    #200025 Reply

    Scott Anderson
    Participant

    It helps quite a bit! Thanks for taking the time to post this. Just out of curiosity, what are you primarily programming in your Aspects?

    –Scott
    MyEclipse Support

    #200031 Reply

    Scott,

    I currently, have aspects that perform the following functions:

    1) Exception logging – Instead of writing a logging statement within every catch block within my application I aspect it it. This allows for less mainteneance.

    2) Transaction control – When using Entity Beans on JBoss, you have to start and commit/rollback a transaction so I aspect it in.

    3) I am in the process of re-writing a JSP/JDBC application and one of the problems with the current app is that it opens a connection for every database transaction. Because of the tight coupling between the JSP’s and the underlying Database mechanism, I am going to aspect in the usage of a connection pool.

    4) If I care to, I will be aspecting in performance monitoring.

    Does this help?

    Thanks,

    Ron

    #200038 Reply

    Scott Anderson
    Participant

    Ron,

    That helps alot. This is just an area I’ve become personally interested in lately. If you ever feel the need to write a tutorial or article to get folks started we’d certainly be interested in hosting it on the site. A magazine like JDJ might be interested also since Aspects and J2EE are starting to become a hot topic. Just a thought. 🙂

    –Scott
    MyEclipse Support

    #264869 Reply

    vinnyny
    Member

    I have an aspectJ java package that I built using eclipse…. build fine and operates correctly… I want to open the same project using myeclipse … the aspectJ component is not recognized… can anyone help???

Viewing 8 posts - 1 through 8 (of 8 total)
Reply To: AspectJ compatibility

You must be logged in to post in the forum log in