Alfred’s Computing Weblog

Alfred Java-cored Computing Weblog

Archive for the ‘maven’ Category

java.lang.NoClassDefFoundError: org/aspectj/lang/annotation/Aspect

leave a comment »

ERROR:
Hits the error java.lang.NoClassDefFoundError: org/aspectj/lang/annotation/Aspect when I try to start a webapp in tomcat.

STORY:
I was trying to add AOP to an existing web application. The AOP configuration I added is:

<aop:aspectj-autoproxy />

SOLUTION:
Add the AspectJ library to the classpath. The required AspectJ library are:
1. aspectjrt
2. aspectjweaver

My webapps is using Maven, so I added the dependencies to pom.xml as below:

<!-- AspectJ -->
<dependency>
    <groupId>org.aspectj</groupId>
    <artifactId>aspectjrt</artifactId>
    <version>1.6.11</version>
</dependency>
<dependency>
    <groupId>org.aspectj</groupId>
    <artifactId>aspectjweaver</artifactId>
    <version>1.6.11</version>
</dependency>
Advertisements

Written by Alfred

September 14, 2011 at 10:41

The absolute uri: http://java.sun.com/jsp/jstl/core cannot be resolved

with 3 comments

Error:
Hit this error while deploying webapps in Tomcat. “The absolute uri: http://java.sun.com/jsp/jstl/core cannot be resolved …”

Story:
I’m trying to include JSTL in JSP pages. I get the above error while starting up the webapp in Tomcat.

Solution:
The jstl.jar is missing from the web deployment package (.war) file. Add in jstl.jar in /WEB-INF/lib/ is the most directive way to solve this problem. If maven is used in the project, we can include the xml code below and let maven do the JAR file searching and packing for us.

<dependency>
    <groupId>javax.servlet</groupId>
    <artifactId>jstl</artifactId>
    <version>1.1.2</version>
</dependency>

Thanks for godbiest’s update 🙂

Written by Alfred

December 22, 2008 at 17:04

Posted in Java, maven

Tagged with ,