Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7745869
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T10:07:54+00:00 2026-06-01T10:07:54+00:00

I’m having a problem trying to make eclipse and aspectj work for Dynamic Web

  • 0

I’m having a problem trying to make eclipse and aspectj work for Dynamic Web Projects. I’m looking for compile time weaving so I can use the Eclipse Visualisation features.

I’ve followed the steps given here:

https://forums.oracle.com/forums/thread.jspa?messageID=8591748

using Eclipse Indigo (3.7) with the latest Aspectj eclipse plugin (2.1.3).

The steps were as follows:

[1] Create basic servlet

//imports omitted
public class MyServlet extends HttpServlet{

public void doGet(HttpServletRequest request, HttpServletResponse response){
   PrintWriter out= null;
   try {
      out = response.getWriter();
      out.write("hello from MyServlet");    
   } catch (IOException e) {
      e.printStackTrace();
   } finally {
      if(out!=null)
      out.close();
   }
}
}

[2] Add servlet to deployment discriptor (web.xml)

<?xml version="1.0" encoding="ISO-8859-1"?>
<web-app xmlns="http://java.sun.com/xml/ns/j2ee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee      
http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd"
version="2.4">

    <servlet>
       <servlet-name>MyServlet</servlet-name>
       <servlet-class>com.myCompany.MyServlet</servlet-class>
    </servlet>

    <servlet-mapping>
       <servlet-name>MyServlet</servlet-name>
       <url-pattern>/MyServlet/*</url-pattern>
    </servlet-mapping>

</web-app>

[3] Create aspect

package com.myCompany;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

public aspect MyServletAspect {

  pointcut doGet() :
     execution(public void MyServlet.doGet(HttpServletRequest,HttpServletResponse));

  after() returning : doGet() {
     System.out.println("Hello from doGet (via aspectj)");
  }
}

However when I run this no dice – the aspect just doesn’t run (servlet writes to response, aspect to console). I did something similar for a regular java project and that works fine.

I note there are guidelines for adding aop.xml into the web app’s META-INF directory, however this didn’t work for me.

Our goal is to run aspectj non-invasively in development via eclipse for a non-Spring framework (or Maven) project – this should be easy.. but I haven’t been able to make it work.

Any suggestions / reference to tutorial for compile-time weaving for web apps in eclipse would be useful. The app server is embedded Tomcat 6 (but can be upgraded to tomcat 7 if required).

The ability to tweak the development environment at runtime without impacting the production code would be great – if it can be made to work.
Responses much appreciated.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-01T10:07:55+00:00Added an answer on June 1, 2026 at 10:07 am

    I recommend you just download and use Spring STS (Spring’s Eclipse) and download/create a Spring Roo project.

    Your just going to use the Roo project to boostrap your own project with the correct AspectJ libraries. That is you’ll just use its pom file that it generates. You can try to use plain Eclipse and download all the plugins (which is what I do) but its PITA to get everything setup correctly.

    The key thing is to get the AspectJ compiler to run instead of the regular Java compiler. This requires a special Maven plugin or Ant plugin. Also you do not need the aop.xml file.

    If your using Eclipse you need to make sure that the AspectJ nature is added to the project (usually you right click on the project and select “add natures” “Or convert to…”.)

    You’ll also in Eclipse need to add the Spring Aspects jar to the “Aspect Libraries” which is not the classpath/buildpath.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

link Im having trouble converting the html entites into html characters, (&# 8217;) i
That's pretty much it. I'm using Nokogiri to scrape a web page what has
I am trying to understand how to use SyndicationItem to display feed which is
I have a jquery bug and I've been looking for hours now, I can't
Basically, what I'm trying to create is a page of div tags, each has
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
I am trying to render a haml file in a javascript response like so:
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
We're building an app, our first using Rails 3, and we're having to build
Seemingly simple, but I cannot find anything relevant on the web. What is the

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.