Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Language IDEs » AJDT » eclipse-maven-plugin 2.6 and AJDT
eclipse-maven-plugin 2.6 and AJDT [message #599876] Tue, 05 May 2009 12:00
Kaj Hejer is currently offline Kaj HejerFriend
Messages: 8
Registered: July 2009
Junior Member
Hi!

I'm not sure if this is the right forum to ask this question, but I give
it a try :)

After upgrading to eclipse-maven-plugin version 2.6 I get a
"java.lang.NoClassDefFoundError: org/aspectj/weaver/BCException" when
running my unittests from inside eclipse. I have tried to turn on JDT
weaving but get the same exception. I'm on MacOS X 10.5.6 with java
1.6.0_07

When trying to use the new support for AJDT as described on
http://jira.codehaus.org/browse/MECLIPSE-200 and
http://maven.apache.org/plugins/maven-eclipse-plugin/example s/ajdt-projects.html
by using

 
<ajdtVersion>1.6</ajdtVersion>


I don't get aspectjweaver.jar included in my .classpath file and I get the
stacktrace bellow.

If I use

<ajdtVersion>none</ajdtVersion>


I get spectjweaver.jar included in my .classpath file but then I have to
add the following manually for spring-aspects after running mvn
eclipse:eclipse:

<attributes>
<attribute name="org.eclipse.ajdt.aspectpath" value="true" />
</attributes>


That is why I would like to get the new ajdt support in
eclipse-maven-plugin to work.

The stacktrace I get with eclipse eclipse-jee-ganymede-SR2 (3.4.2) is:


java.lang.IllegalStateException: Failed to load ApplicationContext
at
org.springframework.test.context.TestContext.getApplicationC ontext(TestContext.java:201)
at
org.springframework.test.context.support.DependencyInjection TestExecutionListener.injectDependencies(DependencyInjection TestExecutionListener.java:109)
at
org.springframework.test.context.support.DependencyInjection TestExecutionListener.prepareTestInstance(DependencyInjectio nTestExecutionListener.java:75)
at
org.springframework.test.context.TestContextManager.prepareT estInstance(TestContextManager.java:255)
at
org.springframework.test.context.junit4.SpringJUnit4ClassRun ner.createTest(SpringJUnit4ClassRunner.java:111)
at
org.springframework.test.context.junit4.SpringJUnit4ClassRun ner.invokeTestMethod(SpringJUnit4ClassRunner.java:148)
at
org.junit.internal.runners.JUnit4ClassRunner.runMethods(JUni t4ClassRunner.java:51)
at
org.junit.internal.runners.JUnit4ClassRunner$1.run(JUnit4Cla ssRunner.java:44)
at
org.junit.internal.runners.ClassRoadie.runUnprotected(ClassR oadie.java:27)
at
org.junit.internal.runners.ClassRoadie.runProtected(ClassRoa die.java:37)
at
org.junit.internal.runners.JUnit4ClassRunner.run(JUnit4Class Runner.java:42)
at
org.springframework.test.context.junit4.SpringJUnit4ClassRun ner.run(SpringJUnit4ClassRunner.java:97)
at
org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.r un(JUnit4TestReference.java:45)
at
org.eclipse.jdt.internal.junit.runner.TestExecution.run(Test Execution.java:38)
at
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTe sts(RemoteTestRunner.java:460)
at
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTe sts(RemoteTestRunner.java:673)
at
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(R emoteTestRunner.java:386)
at
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main( RemoteTestRunner.java:196)
Caused by: org.springframework.beans.factory.BeanDefinitionStoreExcepti on:
Unexpected exception parsing XML document from URL
[file:src/main/webapp/WEB-INF/applicationContext.xml]; nested exception is
java.lang.NoClassDefFoundError: org/aspectj/weaver/BCException
at
org.springframework.beans.factory.xml.XmlBeanDefinitionReade r.doLoadBeanDefinitions(XmlBeanDefinitionReader.java:420)
at
org.springframework.beans.factory.xml.XmlBeanDefinitionReade r.loadBeanDefinitions(XmlBeanDefinitionReader.java:342)
at
org.springframework.beans.factory.xml.XmlBeanDefinitionReade r.loadBeanDefinitions(XmlBeanDefinitionReader.java:310)
at
org.springframework.beans.factory.support.AbstractBeanDefini tionReader.loadBeanDefinitions(AbstractBeanDefinitionReader. java:143)
at
org.springframework.beans.factory.support.AbstractBeanDefini tionReader.loadBeanDefinitions(AbstractBeanDefinitionReader. java:178)
at
org.springframework.beans.factory.support.AbstractBeanDefini tionReader.loadBeanDefinitions(AbstractBeanDefinitionReader. java:149)
at
org.springframework.beans.factory.support.AbstractBeanDefini tionReader.loadBeanDefinitions(AbstractBeanDefinitionReader. java:212)
at
org.springframework.test.context.support.AbstractGenericCont extLoader.loadContext(AbstractGenericContextLoader.java:81)
at
org.springframework.test.context.support.AbstractGenericCont extLoader.loadContext(AbstractGenericContextLoader.java:42)
at
org.springframework.test.context.TestContext.loadApplication Context(TestContext.java:173)
at
org.springframework.test.context.TestContext.getApplicationC ontext(TestContext.java:197)
... 17 more
Caused by: java.lang.NoClassDefFoundError: org/aspectj/weaver/BCException
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:164)
at
org.springframework.aop.config.ConfigBeanDefinitionParser.cl ass$(ConfigBeanDefinitionParser.java:208)
at
org.springframework.aop.config.ConfigBeanDefinitionParser.cr eatePointcutDefinition(ConfigBeanDefinitionParser.java:539)
at
org.springframework.aop.config.ConfigBeanDefinitionParser.pa rsePointcut(ConfigBeanDefinitionParser.java:476)
at
org.springframework.aop.config.ConfigBeanDefinitionParser.pa rse(ConfigBeanDefinitionParser.java:142)
at
org.springframework.beans.factory.xml.NamespaceHandlerSuppor t.parse(NamespaceHandlerSupport.java:69)
at
org.springframework.beans.factory.xml.BeanDefinitionParserDe legate.parseCustomElement(BeanDefinitionParserDelegate.java: 1297)
at
org.springframework.beans.factory.xml.BeanDefinitionParserDe legate.parseCustomElement(BeanDefinitionParserDelegate.java: 1287)
at
org.springframework.beans.factory.xml.DefaultBeanDefinitionD ocumentReader.parseBeanDefinitions(DefaultBeanDefinitionDocu mentReader.java:135)
at
org.springframework.beans.factory.xml.DefaultBeanDefinitionD ocumentReader.registerBeanDefinitions(DefaultBeanDefinitionD ocumentReader.java:92)
at
org.springframework.beans.factory.xml.XmlBeanDefinitionReade r.registerBeanDefinitions(XmlBeanDefinitionReader.java:507)
at
org.springframework.beans.factory.xml.XmlBeanDefinitionReade r.doLoadBeanDefinitions(XmlBeanDefinitionReader.java:398)
... 27 more



The stacktrace I get with eclipse 3.5M7 is:


java.lang.IllegalStateException: Failed to load ApplicationContext
at
org.springframework.test.context.TestContext.getApplicationC ontext(TestContext.java:201)
at
org.springframework.test.context.support.DependencyInjection TestExecutionListener.injectDependencies(DependencyInjection TestExecutionListener.java:109)
at
org.springframework.test.context.support.DependencyInjection TestExecutionListener.prepareTestInstance(DependencyInjectio nTestExecutionListener.java:75)
at
org.springframework.test.context.TestContextManager.prepareT estInstance(TestContextManager.java:255)
at
org.springframework.test.context.junit4.SpringJUnit4ClassRun ner.createTest(SpringJUnit4ClassRunner.java:111)
at
org.springframework.test.context.junit4.SpringJUnit4ClassRun ner.invokeTestMethod(SpringJUnit4ClassRunner.java:148)
at
org.junit.internal.runners.JUnit4ClassRunner.runMethods(JUni t4ClassRunner.java:51)
at
org.junit.internal.runners.JUnit4ClassRunner$1.run(JUnit4Cla ssRunner.java:44)
at
org.junit.internal.runners.ClassRoadie.runUnprotected(ClassR oadie.java:27)
at
org.junit.internal.runners.ClassRoadie.runProtected(ClassRoa die.java:37)
at
org.junit.internal.runners.JUnit4ClassRunner.run(JUnit4Class Runner.java:42)
at
org.springframework.test.context.junit4.SpringJUnit4ClassRun ner.run(SpringJUnit4ClassRunner.java:97)
at
org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.r un(JUnit4TestReference.java:46)
at
org.eclipse.jdt.internal.junit.runner.TestExecution.run(Test Execution.java:38)
at
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTe sts(RemoteTestRunner.java:467)
at
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTe sts(RemoteTestRunner.java:683)
at
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(R emoteTestRunner.java:390)
at
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main( RemoteTestRunner.java:197)
Caused by: org.springframework.beans.factory.BeanDefinitionStoreExcepti on:
Unexpected exception parsing XML document from URL
[file:src/main/webapp/WEB-INF/applicationContext.xml]; nested exception is
java.lang.NoClassDefFoundError:
org/aspectj/weaver/reflect/ReflectionWorld$ReflectionWorldEx ception
at
org.springframework.beans.factory.xml.XmlBeanDefinitionReade r.doLoadBeanDefinitions(XmlBeanDefinitionReader.java:420)
at
org.springframework.beans.factory.xml.XmlBeanDefinitionReade r.loadBeanDefinitions(XmlBeanDefinitionReader.java:342)
at
org.springframework.beans.factory.xml.XmlBeanDefinitionReade r.loadBeanDefinitions(XmlBeanDefinitionReader.java:310)
at
org.springframework.beans.factory.support.AbstractBeanDefini tionReader.loadBeanDefinitions(AbstractBeanDefinitionReader. java:143)
at
org.springframework.beans.factory.support.AbstractBeanDefini tionReader.loadBeanDefinitions(AbstractBeanDefinitionReader. java:178)
at
org.springframework.beans.factory.support.AbstractBeanDefini tionReader.loadBeanDefinitions(AbstractBeanDefinitionReader. java:149)
at
org.springframework.beans.factory.support.AbstractBeanDefini tionReader.loadBeanDefinitions(AbstractBeanDefinitionReader. java:212)
at
org.springframework.test.context.support.AbstractGenericCont extLoader.loadContext(AbstractGenericContextLoader.java:81)
at
org.springframework.test.context.support.AbstractGenericCont extLoader.loadContext(AbstractGenericContextLoader.java:42)
at
org.springframework.test.context.TestContext.loadApplication Context(TestContext.java:173)
at
org.springframework.test.context.TestContext.getApplicationC ontext(TestContext.java:197)
... 17 more
Caused by: java.lang.NoClassDefFoundError:
org/aspectj/weaver/reflect/ReflectionWorld$ReflectionWorldEx ception
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:169)
at
org.springframework.aop.config.ConfigBeanDefinitionParser.cl ass$(ConfigBeanDefinitionParser.java:208)
at
org.springframework.aop.config.ConfigBeanDefinitionParser.cr eatePointcutDefinition(ConfigBeanDefinitionParser.java:539)
at
org.springframework.aop.config.ConfigBeanDefinitionParser.pa rsePointcut(ConfigBeanDefinitionParser.java:476)
at
org.springframework.aop.config.ConfigBeanDefinitionParser.pa rse(ConfigBeanDefinitionParser.java:142)
at
org.springframework.beans.factory.xml.NamespaceHandlerSuppor t.parse(NamespaceHandlerSupport.java:69)
at
org.springframework.beans.factory.xml.BeanDefinitionParserDe legate.parseCustomElement(BeanDefinitionParserDelegate.java: 1297)
at
org.springframework.beans.factory.xml.BeanDefinitionParserDe legate.parseCustomElement(BeanDefinitionParserDelegate.java: 1287)
at
org.springframework.beans.factory.xml.DefaultBeanDefinitionD ocumentReader.parseBeanDefinitions(DefaultBeanDefinitionDocu mentReader.java:135)
at
org.springframework.beans.factory.xml.DefaultBeanDefinitionD ocumentReader.registerBeanDefinitions(DefaultBeanDefinitionD ocumentReader.java:92)
at
org.springframework.beans.factory.xml.XmlBeanDefinitionReade r.registerBeanDefinitions(XmlBeanDefinitionReader.java:507)
at
org.springframework.beans.factory.xml.XmlBeanDefinitionReade r.doLoadBeanDefinitions(XmlBeanDefinitionReader.java:398)
... 27 more
Caused by: java.lang.ClassNotFoundException:
org.aspectj.weaver.reflect.ReflectionWorld$ReflectionWorldEx ception
at java.net.URLClassLoader$1.run(URLClassLoader.java:200)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:188)
at java.lang.ClassLoader.loadClass(ClassLoader.java:316)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:288 )
at java.lang.ClassLoader.loadClass(ClassLoader.java:251)
at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:374 )
... 40 more



From my pom.xml:


<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>aspectj-maven-plugin</artifactId>
<executions>
<execution>
<goals>
<goal>compile</goal>
<goal>test-compile</goal>
</goals>
</execution>
</executions>
<dependencies>
<dependency>
<groupId>org.aspectj</groupId>
<artifactId>aspectjrt</artifactId>
<version>${aspectj.version}</version>
</dependency>
<dependency>
<groupId>org.aspectj</groupId>
<artifactId>aspectjtools</artifactId>
<version>${aspectj.version}</version>
</dependency>
</dependencies>

<configuration>
<source>1.5</source>
<target>1.5</target>
<encoding>utf-8</encoding>
<verbose>true</verbose>
<outxml>false</outxml>

<showWeaveInfo>false</showWeaveInfo>
<proceedOnError>true</proceedOnError>

<aspectLibraries>
<aspectLibrary>
<groupId>org.springframework</groupId>
<artifactId>spring-aspects</artifactId>
</aspectLibrary>
</aspectLibraries>

<weaveDependencies>
<weaveDependency>
<groupId>org.springframework</groupId>
<artifactId>spring-aspects</artifactId>
</weaveDependency>
</weaveDependencies>

</configuration>
</plugin>


<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-eclipse-plugin</artifactId>
<version>2.6</version>
<configuration>

<ajdtVersion>1.6</ajdtVersion>

<downloadSources>true</downloadSources>
<downloadJavadocs>true</downloadJavadocs>

<projectnatures>

<java.lang.String>org.eclipse.ajdt.ui.ajnature</java.lang.String >

<java.lang.String>org.springframework.ide.eclipse.core.springnature </java.lang.String>

<java.lang.String>org.eclipse.jdt.core.javanature</java.lang.String >
</projectnatures>
<buildcommands>

<buildcommand>org.eclipse.ajdt.core.ajbuilder</buildcommand >
</buildcommands>
</configuration>
</plugin>



-Kaj :)
Previous Topic:AspectJ Log4J and log4j.appender.dest1.layout.ConversionPattern= %l%n%m%n
Next Topic:AspectJ Runtime in its own feature?
Goto Forum:
  


Current Time: Sun Dec 21 03:26:42 GMT 2014

Powered by FUDForum. Page generated in 0.01566 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software