Aether ClassNotFound when building Policy Agents and OpenAM 13 from source
The purpose of this article is to provide assistance if you receive a java.lang.NoClassDefFoundError: org/sonatype/aether/* when building Policy Agents and OpenAM from source using Apache Maven™ 3.1.0.
Archived
This article has been archived and is no longer maintained by ForgeRock.
Warning
ForgeRock support covers the use of the official binary builds made available and downloaded from our customer portal: BackStage. We will support builds made from source providing no changes have been made to the core code of the product, the product was built from a tag that matches an official release, for example, 13 and said product was built using the ForgeRock build scripts provided as part of the source. In the event that a customer experiences an issue with a ForgeRock product built from source where ForgeRock believe the issue is as a result of the build process, ForgeRock reserves the right to ask the customer to attempt to reproduce the issue on an official ForgeRock binary build. Customers who are running custom builds or who need further clarification should contact their ForgeRock sales representative.
Symptoms
You will see errors that refer to:
java.lang.NoClassDefFoundError: org/sonatype/aether/* Caused by: java.lang.ClassNotFoundException: org.sonatype.aether.*An example error could be as follows when attempting to build from source:
[INFO] Dependency-reduced POM written at: /home/ArchiSecu/temp/openam-agents/jee-agents/jee-agents-jboss/jee-agents-jboss-v40/dependency-reduced-pom.xml [WARNING] Error injecting: org.apache.maven.shared.dependency.graph.internal.Maven3DependencyGraphBuilder java.lang.NoClassDefFoundError: org/sonatype/aether/version/VersionConstraint at java.lang.Class.getDeclaredMethods0(Native Method) at java.lang.Class.privateGetDeclaredMethods(Class.java:2427) at java.lang.Class.getDeclaredMethods(Class.java:1791) at com.google.inject.spi.InjectionPoint.getInjectionPoints(InjectionPoint.java:674) at com.google.inject.spi.InjectionPoint.forInstanceMethodsAndFields(InjectionPoint.java:366) at com.google.inject.internal.ConstructorBindingImpl.getInternalDependencies(ConstructorBindingImpl.java:165) ... Caused by: java.lang.ClassNotFoundException: org.sonatype.aether.version.VersionConstraint at org.codehaus.plexus.classworlds.strategy.SelfFirstStrategy.loadClass(SelfFirstStrategy.java:50) at org.codehaus.plexus.classworlds.realm.ClassRealm.unsynchronizedLoadClass(ClassRealm.java:259) at org.codehaus.plexus.classworlds.realm.ClassRealm.loadClass(ClassRealm.java:242) at org.codehaus.plexus.classworlds.realm.ClassRealm.loadClass(ClassRealm.java:227) ...Recent Changes
N/A
Causes
This is a known issue that exists in Maven 3.1.0. This error is caused by the Maven 3.1-alpha-1 migration from Sonatype Aether to Eclipse Aether, which is an incompatible change for some plugins. You can use this link AetherClassNotFound to check the current status of this issue from Apache.
Solution
This issue can be resolved by upgrading the affected plugins if you use Maven 3.0.x or 3.1.x. AetherClassNotFound lists the affected plugins and the corresponding minimum needed version.
Alternatively, you can downgrade to Maven 3.0.5. You can download Maven from: Download Apache Maven.
See Also
Source code in ForgeRock products
Related Training
N/A
Related Issue Tracker IDs
OPENAM-2834 (Build issues with Maven 3.1.0)
OPENAM-4451 (Java EE agents can't be compiled using Maven 3.1.0+)