Get NoClassDefFoundError for commons-lang StringUtils creating archetype

David Karr davidmichaelkarr at gmail.com
Sat May 23 16:18:57 UTC 2020


Just to remove a possible cause, I wondered whether the fact that I don't
have a commons-lang jar in my local repo could be the cause. I went through
the trouble of creating a sample project that references that artifact and
built it, to get it into my local repo. This was another small challenge,
as our intranet repo doesn't even have that artifact anymore, considering
commons-lang3 has been out for quite a while.  I had to manually download
that artifact from the public mavencentral and manually dump it into my
local repo.  I verified I put it in the right place, because my sample
project referencing that artifact now doesn't have a build error trying to
find that artifact.

Unfortunately, this was a red herring, as my maven archetype command line
still fails the same way.

On Sat, May 23, 2020 at 9:09 AM David Karr <davidmichaelkarr at gmail.com>
wrote:

>
>
> On Sat, May 23, 2020 at 3:08 AM Henri Tremblay <henri.tremblay at gmail.com>
> wrote:
>
>> It runs flawlessly on my machine (with Maven 3.6.3).
>>
>> Version 3.1.2 of the maven-archetype-plugin is used.
>>
>> Can you please upgrade Maven just in case?
>>
>
> I just installed maven 3.6.3, verified that's what I have on the command
> line, ran the same mvn archetype command line. No difference.  I'll include
> more of the output here.
>
> -------------------------------
> [INFO] Scanning for projects...
> Downloading from public:
> http://mavencentral.it.att.com:8081/nexus/content/groups/public/org/codehaus/mojo/maven-metadata.xml
> Downloading from att-repository-releases:
> http://mavencentral.it.att.com:8081/nexus/content/repositories/att-repository-releases/org/codehaus/mojo/maven-metadata.xml
> Downloading from public:
> http://mavencentral.it.att.com:8081/nexus/content/groups/public/org/apache/maven/plugins/maven-metadata.xml
> Downloading from att-repository-releases:
> http://mavencentral.it.att.com:8081/nexus/content/repositories/att-repository-releases/org/apache/maven/plugins/maven-metadata.xml
> Downloading from att-repository-releases:
> http://mavencentral.it.att.com:8081/nexus/content/repositories/att-repository-releases/org/apache/maven/plugins/maven-archetype-plugin/maven-metadata.xml
> Downloading from public:
> http://mavencentral.it.att.com:8081/nexus/content/groups/public/org/apache/maven/plugins/maven-archetype-plugin/maven-metadata.xml
> [INFO]
> [INFO] ------------------< org.apache.maven:standalone-pom
> >-------------------
> [INFO] Building Maven Stub Project (No POM) 1
> [INFO] --------------------------------[ pom
> ]---------------------------------
> [INFO]
> [INFO] >>> maven-archetype-plugin:3.1.2:generate (default-cli) >
> generate-sources @ standalone-pom >>>
> [INFO]
> [INFO] <<< maven-archetype-plugin:3.1.2:generate (default-cli) <
> generate-sources @ standalone-pom <<<
> [INFO]
> [INFO]
> [INFO] --- maven-archetype-plugin:3.1.2:generate (default-cli) @
> standalone-pom ---
> [WARNING] Error initializing:
> org.codehaus.plexus.velocity.DefaultVelocityComponent at 3569edd5
> java.lang.NoClassDefFoundError: org/apache/commons/lang/StringUtils
>     at org.apache.velocity.runtime.resource.ResourceManagerImpl.initialize
> (ResourceManagerImpl.java:161)
>     at
> org.apache.velocity.runtime.RuntimeInstance.initializeResourceManager
> (RuntimeInstance.java:730)
>     at org.apache.velocity.runtime.RuntimeInstance.init
> (RuntimeInstance.java:263)
>     at org.apache.velocity.app.VelocityEngine.init (VelocityEngine.java:93)
>     at org.codehaus.plexus.velocity.DefaultVelocityComponent.initialize
> (DefaultVelocityComponent.java:95)
> ----------------------------
>
>>
>> On Sat, 23 May 2020 at 02:46, David Karr <davidmichaelkarr at gmail.com>
>> wrote:
>>
>>> Maven 3.5.2, Java 8.
>>>
>>> This is my command line (copied directly from the docs, just changing
>>> the artifactId):
>>>
>>>     mvn archetype:generate -DinteractiveMode=false
>>> -DarchetypeGroupId=org.openjdk.jmh
>>> -DarchetypeArtifactId=jmh-java-benchmark-archetype
>>> -DgroupId=com.att.example -DartifactId=jmhBenchmarks -Dversion=1.0
>>>
>>> On Fri, May 22, 2020 at 6:23 PM Henri Tremblay <henri.tremblay at gmail.com>
>>> wrote:
>>>
>>>> It should work.
>>>>
>>>> We need some details.
>>>>
>>>> Maven version? 3.6.3?
>>>> Archetype? jmh-java-benchmark-archetype:1.23
>>>> Java 8?
>>>>
>>>>
>>>> On Fri, 22 May 2020 at 18:58, David Karr <davidmichaelkarr at gmail.com>
>>>> wrote:
>>>>
>>>>> I've used JMH in the past, and I've always started by creating an
>>>>> archetype.  Today I tried it, only changing the artifact id from the
>>>>> command line in the docs.  It ran for quite a while, downloading
>>>>> artifacts,
>>>>> and then I saw this:
>>>>>
>>>>> [WARNING] Error initializing:
>>>>> org.codehaus.plexus.velocity.DefaultVelocityComponent at 57d0fc89
>>>>> java.lang.NoClassDefFoundError: org/apache/commons/lang/StringUtils
>>>>>     at
>>>>> org.apache.velocity.runtime.resource.ResourceManagerImpl.initialize
>>>>> (ResourceManagerImpl.java:161)
>>>>>
>>>>> followed by just about the longest stack trace I've ever seen.  This
>>>>> was
>>>>> followed by many copies of the same trace.
>>>>>
>>>>> I also checked my local .m2 repository, and I don't have this jar
>>>>> installed
>>>>> (I have lang3). I searched in the maven output for a reference to that
>>>>> library. It showed attempts to download other commons libraries, but
>>>>> not
>>>>> commons-lang.
>>>>>
>>>>


More information about the jmh-dev mailing list