From davidmichaelkarr at gmail.com Fri May 22 22:57:38 2020 From: davidmichaelkarr at gmail.com (David Karr) Date: Fri, 22 May 2020 15:57:38 -0700 Subject: Get NoClassDefFoundError for commons-lang StringUtils creating archetype Message-ID: 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. From henri.tremblay at gmail.com Sat May 23 01:23:24 2020 From: henri.tremblay at gmail.com (Henri Tremblay) Date: Fri, 22 May 2020 21:23:24 -0400 Subject: Get NoClassDefFoundError for commons-lang StringUtils creating archetype In-Reply-To: References: Message-ID: 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 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. > From davidmichaelkarr at gmail.com Sat May 23 06:45:54 2020 From: davidmichaelkarr at gmail.com (David Karr) Date: Fri, 22 May 2020 23:45:54 -0700 Subject: Get NoClassDefFoundError for commons-lang StringUtils creating archetype In-Reply-To: References: Message-ID: 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 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 > 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. >> > From henri.tremblay at gmail.com Sat May 23 10:08:47 2020 From: henri.tremblay at gmail.com (Henri Tremblay) Date: Sat, 23 May 2020 06:08:47 -0400 Subject: Get NoClassDefFoundError for commons-lang StringUtils creating archetype In-Reply-To: References: Message-ID: 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? On Sat, 23 May 2020 at 02:46, David Karr 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 > 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 >> 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. >>> >> From davidmichaelkarr at gmail.com Sat May 23 16:09:15 2020 From: davidmichaelkarr at gmail.com (David Karr) Date: Sat, 23 May 2020 09:09:15 -0700 Subject: Get NoClassDefFoundError for commons-lang StringUtils creating archetype In-Reply-To: References: Message-ID: On Sat, May 23, 2020 at 3:08 AM Henri Tremblay 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 > 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 >> 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 >>> 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. >>>> >>> From davidmichaelkarr at gmail.com Sat May 23 16:18:57 2020 From: davidmichaelkarr at gmail.com (David Karr) Date: Sat, 23 May 2020 09:18:57 -0700 Subject: Get NoClassDefFoundError for commons-lang StringUtils creating archetype In-Reply-To: References: Message-ID: 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 wrote: > > > On Sat, May 23, 2020 at 3:08 AM Henri Tremblay > 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 >> 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 >>> 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 >>>> 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. >>>>> >>>> From davidmichaelkarr at gmail.com Sat May 23 18:48:23 2020 From: davidmichaelkarr at gmail.com (David Karr) Date: Sat, 23 May 2020 11:48:23 -0700 Subject: Get NoClassDefFoundError for commons-lang StringUtils creating archetype In-Reply-To: References: Message-ID: In any case, I guess I'm going to ignore this problem for now. I had an existing jmh benchmark project that I had created before, so I'm just modifying that for the new benchmarks I want to run. I guess I'm going to assume the archetype isn't going to work for the near future. On Sat, May 23, 2020 at 9:18 AM David Karr wrote: > 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 > wrote: > >> >> >> On Sat, May 23, 2020 at 3:08 AM Henri Tremblay >> 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 >>> 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 >>>>> 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. >>>>>> >>>>> From davidmichaelkarr at gmail.com Sat May 23 18:57:13 2020 From: davidmichaelkarr at gmail.com (David Karr) Date: Sat, 23 May 2020 11:57:13 -0700 Subject: How to measure a method multiple times with different parameter values Message-ID: I want to benchmark the performance of a method that takes a parameter, a list of objects to be more specific. I can easily write a benchmark that creates a static list and write a benchmark that takes the body of the original method and references the static list. Instead of benchmarking a void method, I'd really like to benchmark the method that takes the list parameter, keeping the signature, and having it return the value. I would also like to run multiple benchmarks of the same method, but with different values sent to the method, mostly to test it with different list lengths. From laksvij at hawk.iit.edu Sun May 24 01:16:07 2020 From: laksvij at hawk.iit.edu (Vijay Lakshminarayanan) Date: Sun, 24 May 2020 06:46:07 +0530 Subject: [Ext] How to measure a method multiple times with different parameter values In-Reply-To: References: Message-ID: Hi David Is this what you're looking for: https://hg.openjdk.java.net/code-tools/jmh/file/b6f87aa2a687/jmh-samples/src/main/java/org/openjdk/jmh/samples/JMHSample_27_Params.java More examples available at https://hg.openjdk.java.net/code-tools/jmh/file/tip/jmh-samples/src/main/java/org/openjdk/jmh/samples/. Thanks Vijay On Sun, May 24, 2020 at 12:29 AM David Karr wrote: > > I want to benchmark the performance of a method that takes a parameter, a > list of objects to be more specific. I can easily write a benchmark that > creates a static list and write a benchmark that takes the body of the > original method and references the static list. > > Instead of benchmarking a void method, I'd really like to benchmark the > method that takes the list parameter, keeping the signature, and having it > return the value. > > I would also like to run multiple benchmarks of the same method, but with > different values sent to the method, mostly to test it with different list > lengths. From henri.tremblay at gmail.com Sun May 24 19:03:06 2020 From: henri.tremblay at gmail.com (Henri Tremblay) Date: Sun, 24 May 2020 15:03:06 -0400 Subject: Get NoClassDefFoundError for commons-lang StringUtils creating archetype In-Reply-To: References: Message-ID: Have you tried without using a mirror? Directly from central. I've quite frequent that mirrors in the middle are not making the archetype plugin happy. Also, a print out using -X would be interesting. On Sat, 23 May 2020 at 14:48, David Karr wrote: > In any case, I guess I'm going to ignore this problem for now. I had an > existing jmh benchmark project that I had created before, so I'm just > modifying that for the new benchmarks I want to run. I guess I'm going to > assume the archetype isn't going to work for the near future. > > On Sat, May 23, 2020 at 9:18 AM David Karr > wrote: > >> 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 >> wrote: >> >>> >>> >>> On Sat, May 23, 2020 at 3:08 AM Henri Tremblay >>> 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 >>>> 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 >>>>>> 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. >>>>>>> >>>>>> From ckozak at ckozak.net Tue May 26 16:40:51 2020 From: ckozak at ckozak.net (Carter Kozak) Date: Tue, 26 May 2020 12:40:51 -0400 Subject: perf c2c jmh profiler Message-ID: <862986c7-6ecd-44a5-95b9-a0bda6678905@www.fastmail.com> Hi All, Recently I found myself deep in a rabbit hole where I ended up putting together a simple perf-c2c jmh profiler. I'd like to contribute the code upstream if there's interest so others don't have to reinvent this particular wheel. Is this something you would be interested in? Thanks, Carter Kozak From shade at redhat.com Tue May 26 16:43:50 2020 From: shade at redhat.com (Aleksey Shipilev) Date: Tue, 26 May 2020 18:43:50 +0200 Subject: perf c2c jmh profiler In-Reply-To: <862986c7-6ecd-44a5-95b9-a0bda6678905@www.fastmail.com> References: <862986c7-6ecd-44a5-95b9-a0bda6678905@www.fastmail.com> Message-ID: <03f587dd-663d-2d67-815a-6315a4ccccdc@redhat.com> On 5/26/20 6:40 PM, Carter Kozak wrote: > Recently I found myself deep in a rabbit hole where I ended up putting together a simple > perf-c2c jmh profiler. I'd like to contribute the code upstream if there's interest so others > don't have to reinvent this particular wheel. Is this something you would be interested in? Yes, please. Follow the same process as for the rest of OpenJDK: http://openjdk.java.net/contribute/ -- Thanks, -Aleksey From ckozak at ckozak.net Tue May 26 18:22:19 2020 From: ckozak at ckozak.net (Carter Kozak) Date: Tue, 26 May 2020 14:22:19 -0400 Subject: [PATCH] perf c2c jmh profiler Message-ID: <333f47d8-c224-409b-bee0-f5393a92666b@www.fastmail.com> My OCA has been submitted and successfully processed. I can add additional configuration flags matching the perf profiler if you like, or we can improve later. I defer to your judgement. I didn't see any unit testing for other perf profilers, so I haven't added anything for this one as perf requires system configuration that may not be enabled on test instances. Feedback is appreciated, thanks! # HG changeset patch # User Carter Kozak # Date 1590515846 14400 # Tue May 26 13:57:26 2020 -0400 # Node ID 81ede3eec17301b0f7684e66c5614e92f1925219 # Parent b6f87aa2a687549200ee54ff0840622787fd2aed Implement LinuxPerfCacheToCacheProfiler wrapper around perf c2c Perf c2c is a relatively new perf component which provides a means to analyze cache contention. This is a simple implementation with limited configurability in the initial version. diff -r b6f87aa2a687 -r 81ede3eec173 jmh-core/src/main/java/org/openjdk/jmh/profile/LinuxPerfCacheToCacheProfiler.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/jmh-core/src/main/java/org/openjdk/jmh/profile/LinuxPerfCacheToCacheProfiler.java Tue May 26 13:57:26 2020 -0400 @@ -0,0 +1,173 @@ +/* + * Copyright (c) 2020, 2020, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. Oracle designates this + * particular file as subject to the "Classpath" exception as provided + * by Oracle in the LICENSE file that accompanied this code. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +package org.openjdk.jmh.profile; + +import org.openjdk.jmh.infra.BenchmarkParams; +import org.openjdk.jmh.results.AggregationPolicy; +import org.openjdk.jmh.results.Aggregator; +import org.openjdk.jmh.results.BenchmarkResult; +import org.openjdk.jmh.results.Defaults; +import org.openjdk.jmh.results.Result; +import org.openjdk.jmh.results.ResultRole; +import org.openjdk.jmh.util.FileUtils; +import org.openjdk.jmh.util.TempFile; + +import java.io.BufferedReader; +import java.io.File; +import java.io.IOException; +import java.io.InputStream; +import java.io.InputStreamReader; +import java.io.Reader; +import java.nio.charset.StandardCharsets; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Collection; +import java.util.Collections; +import java.util.Iterator; +import java.util.concurrent.TimeUnit; + +public final class LinuxPerfCacheToCacheProfiler implements ExternalProfiler { + + protected final TempFile perfBinData; + + public LinuxPerfCacheToCacheProfiler() throws ProfilerException { + try { + perfBinData = FileUtils.weakTempFile("perf-c2c-bin"); + } catch (IOException e) { + throw new ProfilerException(e); + } + } + + @Override + public Collection addJVMInvokeOptions(BenchmarkParams params) { + long delay = TimeUnit.NANOSECONDS.toMillis(params.getWarmup().getCount() * + params.getWarmup().getTime().convertTo(TimeUnit.NANOSECONDS)) + + TimeUnit.SECONDS.toMillis(1); // loosely account for the JVM lag + return new ArrayList<>(Arrays.asList( + "perf", "c2c", "record", "-o", perfBinData.getAbsolutePath(), "--", "--delay", String.valueOf(delay))); + } + + @Override + public Collection addJVMOptions(BenchmarkParams params) { + return Collections.emptyList(); + } + + @Override + public void beforeTrial(BenchmarkParams _params) {} + + @Override + public Collection afterTrial(BenchmarkResult br, long pid, File stdOut, File stdErr) { + try { + Process process = new ProcessBuilder("perf", "c2c", "report", "--stats", "-i", perfBinData.getAbsolutePath()) + .redirectErrorStream(true) + .start(); + try (InputStream stream = process.getInputStream(); + Reader isReader = new InputStreamReader(stream, StandardCharsets.UTF_8); + BufferedReader reader = new BufferedReader(isReader)) { + StringBuilder output = new StringBuilder(); + String line; + while ((line = reader.readLine()) != null) { + output.append(line).append('\n'); + } + return Collections.singleton(new PerfCacheToCaceResult(output.toString())); + } + } catch (IOException e) { + throw new RuntimeException(e); + } + } + + @Override + public boolean allowPrintOut() { + return false; + } + + @Override + public boolean allowPrintErr() { + return false; + } + + @Override + public String getDescription() { + return "Linux perf cache to cache (c2c) statistics"; + } + + static class PerfCacheToCaceResult extends Result { + private static final long serialVersionUID = 1L; + + private final String output; + + public PerfCacheToCaceResult(String output) { + super(ResultRole.SECONDARY, Defaults.PREFIX + "perf-c2c", of(Double.NaN), "---", AggregationPolicy.AVG); + this.output = output; + } + + @Override + protected Aggregator getThreadAggregator() { + return new PerfResultAggregator(); + } + + @Override + protected Aggregator getIterationAggregator() { + return new PerfResultAggregator(); + } + + @Override + protected Collection getDerivativeResults() { + return Collections.emptyList(); + } + + @Override + public String toString() { + return "perf c2c"; + } + + @Override + public String extendedInfo() { + return "Perf C2C report (stats):\n--------------------------------------------------\n" + output; + } + } + + static class PerfResultAggregator implements Aggregator { + + @Override + public PerfCacheToCaceResult aggregate(Collection results) { + return new PerfCacheToCaceResult(joinOutput(results)); + } + + private static String joinOutput(Collection results) { + StringBuilder buf = new StringBuilder(); + Iterator resultIterator = results.iterator(); + while (resultIterator.hasNext()) { + buf.append(resultIterator.next().output); + if (resultIterator.hasNext()) { + buf.append("\n========================================\n"); + } + } + return buf.toString(); + } + } + +} +