You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@logging.apache.org by Kirk Lund <kl...@apache.org> on 2020/07/15 19:43:23 UTC
Build fails to compile StackLocatorUtilTest.java due to sun.reflect
I'm trying to build 2.13.1 from sources using either JDK 8 or 9 on Mac OS
but it keeps failing with:
<kl...@Kirks-MacBook-Pro-2>/Users/klund/dev/logging-log4j2 [518]$ mvn
install
...
[*INFO*]
*------------------------------------------------------------------------*
[*INFO*] *BUILD FAILURE*
[*INFO*]
*------------------------------------------------------------------------*
[*INFO*] Total time: 13.948 s
[*INFO*] Finished at: 2020-07-15T12:36:26-07:00
[*INFO*]
*------------------------------------------------------------------------*
[*ERROR*] Failed to execute goal
org.apache.maven.plugins:maven-compiler-plugin:3.8.1:testCompile
*(default-testCompile)* on project log4j-api: *Compilation failure*
[*ERROR*] */Users/klund/dev/logging-log4j2/log4j-api/src/test/java/org/apache/logging/log4j/util/StackLocatorUtilTest.java:[25,18]
error: cannot find symbol*
[*ERROR*] * symbol: class Reflection*
[*ERROR*] * location: package sun.reflect*
I'm not using JDK 11 -- there are some older emails from last year about
that hitting this same error using JDK 11. I'm trying to build with either
JDK 8 or 9 (using jenv).
Any ideas what I'm doing wrong or what I should change to get the build
past this error? Thanks in advance!
<kl...@Kirks-MacBook-Pro-2>/Users/klund/dev/logging-log4j2 [517]$ java
-version
java version "1.8.0_202"
Java(TM) SE Runtime Environment (build 1.8.0_202-b08)
Java HotSpot(TM) 64-Bit Server VM (build 25.202-b08, mixed mode)
I used 1.8 in this latest build but I've also tried 9. I also created sym
links in /Library/Java/JavaVirtualMachines/ to match the definitions in the
toolchains-sample-mac.xml file (not sure if this is correct or not):
<kl...@Kirks-MacBook-Pro-2>/Users/klund/dev/logging-log4j2 [515]$ ll
/Library/Java/JavaVirtualMachines/
total 0
drwxr-xr-x 17 root wheel 544 Mar 12 14:56 ./
drwxr-xr-x 5 root wheel 160 Jan 3 2019 ../
drwxr-xr-x@ 3 klund staff 96 Nov 27 2018 adoptopenjdk-10.jdk/
drwxr-xr-x@ 3 root wheel 96 Oct 7 2018 adoptopenjdk-9.jdk/
lrwxr-xr-x 1 root wheel 49 Mar 6 11:50 java7@ ->
/Library/Java/JavaVirtualMachines/jdk1.7.0_80.jdk
lrwxr-xr-x 1 root wheel 50 Mar 6 11:52 java8@ ->
/Library/Java/JavaVirtualMachines/jdk1.8.0_202.jdk
lrwxr-xr-x 1 root wheel 47 Mar 6 13:19 java9@ ->
/Library/Java/JavaVirtualMachines/jdk-9.0.4.jdk
drwxr-xr-x 3 root wheel 96 Sep 13 2018 jdk-10.0.2.jdk/
drwxr-xr-x 3 root wheel 96 Mar 6 13:14 jdk-9.0.4.jdk/
drwxr-xr-x 3 root wheel 96 Aug 18 2016 jdk1.7.0_80.jdk/
drwxr-xr-x 3 root wheel 96 Jun 25 2018 jdk1.8.0_172.jdk/
drwxr-xr-x 3 root wheel 96 Sep 13 2018 jdk1.8.0_181.jdk/
drwxr-xr-x 3 root wheel 96 Mar 25 2019 jdk1.8.0_201.jdk/
drwxr-xr-x 3 root wheel 96 Mar 25 2019 jdk1.8.0_202.jdk/
drwxr-xr-x 3 root wheel 96 Feb 12 2016 jdk1.8.0_66.jdk/
drwxr-xr-x@ 3 root wheel 96 Jan 18 2019 openjdk-11.0.2.jdk/
drwxr-xr-x@ 3 root wheel 96 Dec 11 2019 openjdk-13.0.2.jdk/
Re: Build fails to compile StackLocatorUtilTest.java due to sun.reflect
Posted by Matt Sicker <bo...@gmail.com>.
FWIW, that test should probably be updated to stop statically linking to
the internal class since it was eventually removed from the JDK (made
invisible at least).
On Wed, Jul 15, 2020 at 15:45 Kirk Lund <kl...@apache.org> wrote:
> Setting JAVA_HOME to my 1.8 jdk fixed the problem for me. Thank you ck!
>
> PS: My toolchains.xml defines valid paths to jdk 1.7, jdk 1.8, and jdk 9.
> Thanks Ralph!
>
> On Wed, Jul 15, 2020 at 12:51 PM Carter Kozak <ck...@ckozak.net> wrote:
>
> > I ran into a similar issue earlier and resolved it by setting my
> JAVA_HOME
> > to match my java 1.8 jdk from my toolchains.xml:
> > export JAVA_HOME=/usr/lib/jvm/java-8-openjdk-amd64
> >
> > On Wed, Jul 15, 2020, at 15:43, Kirk Lund wrote:
> > > I'm trying to build 2.13.1 from sources using either JDK 8 or 9 on Mac
> OS
> > > but it keeps failing with:
> > >
> > > <kl...@Kirks-MacBook-Pro-2>/Users/klund/dev/logging-log4j2 [518]$ mvn
> > > install
> > > ...
> > >
> > > [*INFO*]
> > >
> >
> *------------------------------------------------------------------------*
> > >
> > > [*INFO*] *BUILD FAILURE*
> > >
> > > [*INFO*]
> > >
> >
> *------------------------------------------------------------------------*
> > >
> > > [*INFO*] Total time: 13.948 s
> > >
> > > [*INFO*] Finished at: 2020-07-15T12:36:26-07:00
> > >
> > > [*INFO*]
> > >
> >
> *------------------------------------------------------------------------*
> > >
> > > [*ERROR*] Failed to execute goal
> > > org.apache.maven.plugins:maven-compiler-plugin:3.8.1:testCompile
> > > *(default-testCompile)* on project log4j-api: *Compilation failure*
> > >
> > > [*ERROR*]
> >
> */Users/klund/dev/logging-log4j2/log4j-api/src/test/java/org/apache/logging/log4j/util/StackLocatorUtilTest.java:[25,18]
> > > error: cannot find symbol*
> > >
> > > [*ERROR*] * symbol: class Reflection*
> > >
> > > [*ERROR*] * location: package sun.reflect*
> > >
> > > I'm not using JDK 11 -- there are some older emails from last year
> about
> > > that hitting this same error using JDK 11. I'm trying to build with
> > either
> > > JDK 8 or 9 (using jenv).
> > >
> > > Any ideas what I'm doing wrong or what I should change to get the build
> > > past this error? Thanks in advance!
> > >
> > > <kl...@Kirks-MacBook-Pro-2>/Users/klund/dev/logging-log4j2 [517]$ java
> > > -version
> > > java version "1.8.0_202"
> > > Java(TM) SE Runtime Environment (build 1.8.0_202-b08)
> > > Java HotSpot(TM) 64-Bit Server VM (build 25.202-b08, mixed mode)
> > >
> > > I used 1.8 in this latest build but I've also tried 9. I also created
> sym
> > > links in /Library/Java/JavaVirtualMachines/ to match the definitions in
> > the
> > > toolchains-sample-mac.xml file (not sure if this is correct or not):
> > >
> > > <kl...@Kirks-MacBook-Pro-2>/Users/klund/dev/logging-log4j2 [515]$ ll
> > > /Library/Java/JavaVirtualMachines/
> > > total 0
> > > drwxr-xr-x 17 root wheel 544 Mar 12 14:56 ./
> > > drwxr-xr-x 5 root wheel 160 Jan 3 2019 ../
> > > drwxr-xr-x@ 3 klund staff 96 Nov 27 2018 adoptopenjdk-10.jdk/
> > > drwxr-xr-x@ 3 root wheel 96 Oct 7 2018 adoptopenjdk-9.jdk/
> > > lrwxr-xr-x 1 root wheel 49 Mar 6 11:50 java7@ ->
> > > /Library/Java/JavaVirtualMachines/jdk1.7.0_80.jdk
> > > lrwxr-xr-x 1 root wheel 50 Mar 6 11:52 java8@ ->
> > > /Library/Java/JavaVirtualMachines/jdk1.8.0_202.jdk
> > > lrwxr-xr-x 1 root wheel 47 Mar 6 13:19 java9@ ->
> > > /Library/Java/JavaVirtualMachines/jdk-9.0.4.jdk
> > > drwxr-xr-x 3 root wheel 96 Sep 13 2018 jdk-10.0.2.jdk/
> > > drwxr-xr-x 3 root wheel 96 Mar 6 13:14 jdk-9.0.4.jdk/
> > > drwxr-xr-x 3 root wheel 96 Aug 18 2016 jdk1.7.0_80.jdk/
> > > drwxr-xr-x 3 root wheel 96 Jun 25 2018 jdk1.8.0_172.jdk/
> > > drwxr-xr-x 3 root wheel 96 Sep 13 2018 jdk1.8.0_181.jdk/
> > > drwxr-xr-x 3 root wheel 96 Mar 25 2019 jdk1.8.0_201.jdk/
> > > drwxr-xr-x 3 root wheel 96 Mar 25 2019 jdk1.8.0_202.jdk/
> > > drwxr-xr-x 3 root wheel 96 Feb 12 2016 jdk1.8.0_66.jdk/
> > > drwxr-xr-x@ 3 root wheel 96 Jan 18 2019 openjdk-11.0.2.jdk/
> > > drwxr-xr-x@ 3 root wheel 96 Dec 11 2019 openjdk-13.0.2.jdk/
> > >
> >
> > -ck
> >
>
--
Matt Sicker <bo...@gmail.com>
Re: Build fails to compile StackLocatorUtilTest.java due to sun.reflect
Posted by Kirk Lund <kl...@apache.org>.
Setting JAVA_HOME to my 1.8 jdk fixed the problem for me. Thank you ck!
PS: My toolchains.xml defines valid paths to jdk 1.7, jdk 1.8, and jdk 9.
Thanks Ralph!
On Wed, Jul 15, 2020 at 12:51 PM Carter Kozak <ck...@ckozak.net> wrote:
> I ran into a similar issue earlier and resolved it by setting my JAVA_HOME
> to match my java 1.8 jdk from my toolchains.xml:
> export JAVA_HOME=/usr/lib/jvm/java-8-openjdk-amd64
>
> On Wed, Jul 15, 2020, at 15:43, Kirk Lund wrote:
> > I'm trying to build 2.13.1 from sources using either JDK 8 or 9 on Mac OS
> > but it keeps failing with:
> >
> > <kl...@Kirks-MacBook-Pro-2>/Users/klund/dev/logging-log4j2 [518]$ mvn
> > install
> > ...
> >
> > [*INFO*]
> >
> *------------------------------------------------------------------------*
> >
> > [*INFO*] *BUILD FAILURE*
> >
> > [*INFO*]
> >
> *------------------------------------------------------------------------*
> >
> > [*INFO*] Total time: 13.948 s
> >
> > [*INFO*] Finished at: 2020-07-15T12:36:26-07:00
> >
> > [*INFO*]
> >
> *------------------------------------------------------------------------*
> >
> > [*ERROR*] Failed to execute goal
> > org.apache.maven.plugins:maven-compiler-plugin:3.8.1:testCompile
> > *(default-testCompile)* on project log4j-api: *Compilation failure*
> >
> > [*ERROR*]
> */Users/klund/dev/logging-log4j2/log4j-api/src/test/java/org/apache/logging/log4j/util/StackLocatorUtilTest.java:[25,18]
> > error: cannot find symbol*
> >
> > [*ERROR*] * symbol: class Reflection*
> >
> > [*ERROR*] * location: package sun.reflect*
> >
> > I'm not using JDK 11 -- there are some older emails from last year about
> > that hitting this same error using JDK 11. I'm trying to build with
> either
> > JDK 8 or 9 (using jenv).
> >
> > Any ideas what I'm doing wrong or what I should change to get the build
> > past this error? Thanks in advance!
> >
> > <kl...@Kirks-MacBook-Pro-2>/Users/klund/dev/logging-log4j2 [517]$ java
> > -version
> > java version "1.8.0_202"
> > Java(TM) SE Runtime Environment (build 1.8.0_202-b08)
> > Java HotSpot(TM) 64-Bit Server VM (build 25.202-b08, mixed mode)
> >
> > I used 1.8 in this latest build but I've also tried 9. I also created sym
> > links in /Library/Java/JavaVirtualMachines/ to match the definitions in
> the
> > toolchains-sample-mac.xml file (not sure if this is correct or not):
> >
> > <kl...@Kirks-MacBook-Pro-2>/Users/klund/dev/logging-log4j2 [515]$ ll
> > /Library/Java/JavaVirtualMachines/
> > total 0
> > drwxr-xr-x 17 root wheel 544 Mar 12 14:56 ./
> > drwxr-xr-x 5 root wheel 160 Jan 3 2019 ../
> > drwxr-xr-x@ 3 klund staff 96 Nov 27 2018 adoptopenjdk-10.jdk/
> > drwxr-xr-x@ 3 root wheel 96 Oct 7 2018 adoptopenjdk-9.jdk/
> > lrwxr-xr-x 1 root wheel 49 Mar 6 11:50 java7@ ->
> > /Library/Java/JavaVirtualMachines/jdk1.7.0_80.jdk
> > lrwxr-xr-x 1 root wheel 50 Mar 6 11:52 java8@ ->
> > /Library/Java/JavaVirtualMachines/jdk1.8.0_202.jdk
> > lrwxr-xr-x 1 root wheel 47 Mar 6 13:19 java9@ ->
> > /Library/Java/JavaVirtualMachines/jdk-9.0.4.jdk
> > drwxr-xr-x 3 root wheel 96 Sep 13 2018 jdk-10.0.2.jdk/
> > drwxr-xr-x 3 root wheel 96 Mar 6 13:14 jdk-9.0.4.jdk/
> > drwxr-xr-x 3 root wheel 96 Aug 18 2016 jdk1.7.0_80.jdk/
> > drwxr-xr-x 3 root wheel 96 Jun 25 2018 jdk1.8.0_172.jdk/
> > drwxr-xr-x 3 root wheel 96 Sep 13 2018 jdk1.8.0_181.jdk/
> > drwxr-xr-x 3 root wheel 96 Mar 25 2019 jdk1.8.0_201.jdk/
> > drwxr-xr-x 3 root wheel 96 Mar 25 2019 jdk1.8.0_202.jdk/
> > drwxr-xr-x 3 root wheel 96 Feb 12 2016 jdk1.8.0_66.jdk/
> > drwxr-xr-x@ 3 root wheel 96 Jan 18 2019 openjdk-11.0.2.jdk/
> > drwxr-xr-x@ 3 root wheel 96 Dec 11 2019 openjdk-13.0.2.jdk/
> >
>
> -ck
>
Re: Build fails to compile StackLocatorUtilTest.java due to
sun.reflect
Posted by Ralph Goers <ra...@dslextreme.com>.
FWIW, here is mine. I use symlinks to point to the versioned number that is actually installed for each JDK.
<?xml version="1.0" encoding="UTF8"?>
<toolchains>
<!-- JDK toolchains -->
<toolchain>
<type>jdk</type>
<provides>
<version>1.7</version>
<vendor>sun</vendor>
</provides>
<configuration>
<jdkHome>/Library/Java/JavaVirtualMachines/java7/Contents/Home</jdkHome>
</configuration>
</toolchain>
<toolchain>
<type>jdk</type>
<provides>
<version>1.8</version>
<vendor>sun</vendor>
</provides>
<configuration>
<jdkHome>/Library/Java/JavaVirtualMachines/java8/Contents/Home</jdkHome>
</configuration>
</toolchain>
<toolchain>
<type>jdk</type>
<provides>
<version>9</version>
<vendor>sun</vendor>
</provides>
<configuration>
<jdkHome>/Library/Java/JavaVirtualMachines/java9/Contents/Home</jdkHome>
</configuration>
</toolchain>
<toolchain>
<type>jdk</type>
<provides>
<version>11</version>
<vendor>sun</vendor>
</provides>
<configuration>
<jdkHome>/Library/Java/JavaVirtualMachines/Java11/Contents/Home</jdkHome>
</configuration>
</toolchain>
<toolchain>
<type>jdk</type>
<provides>
<version>14</version>
<vendor>sun</vendor>
</provides>
<configuration>
<jdkHome>/Library/Java/JavaVirtualMachines/Java14/Contents/Home</jdkHome>
</configuration>
</toolchain>
<!-- other toolchains -->
</toolchains>
> On Jul 15, 2020, at 1:26 PM, Ralph Goers <ra...@dslextreme.com> wrote:
>
> You must have a toolchains.xml that has both Java 8 and Java 9 or above.
>
> Ralph
>
>> On Jul 15, 2020, at 12:50 PM, Carter Kozak <ck...@ckozak.net> wrote:
>>
>> I ran into a similar issue earlier and resolved it by setting my JAVA_HOME to match my java 1.8 jdk from my toolchains.xml:
>> export JAVA_HOME=/usr/lib/jvm/java-8-openjdk-amd64
>>
>> On Wed, Jul 15, 2020, at 15:43, Kirk Lund wrote:
>>> I'm trying to build 2.13.1 from sources using either JDK 8 or 9 on Mac OS
>>> but it keeps failing with:
>>>
>>> <kl...@Kirks-MacBook-Pro-2>/Users/klund/dev/logging-log4j2 [518]$ mvn
>>> install
>>> ...
>>>
>>> [*INFO*]
>>> *------------------------------------------------------------------------*
>>>
>>> [*INFO*] *BUILD FAILURE*
>>>
>>> [*INFO*]
>>> *------------------------------------------------------------------------*
>>>
>>> [*INFO*] Total time: 13.948 s
>>>
>>> [*INFO*] Finished at: 2020-07-15T12:36:26-07:00
>>>
>>> [*INFO*]
>>> *------------------------------------------------------------------------*
>>>
>>> [*ERROR*] Failed to execute goal
>>> org.apache.maven.plugins:maven-compiler-plugin:3.8.1:testCompile
>>> *(default-testCompile)* on project log4j-api: *Compilation failure*
>>>
>>> [*ERROR*] */Users/klund/dev/logging-log4j2/log4j-api/src/test/java/org/apache/logging/log4j/util/StackLocatorUtilTest.java:[25,18]
>>> error: cannot find symbol*
>>>
>>> [*ERROR*] * symbol: class Reflection*
>>>
>>> [*ERROR*] * location: package sun.reflect*
>>>
>>> I'm not using JDK 11 -- there are some older emails from last year about
>>> that hitting this same error using JDK 11. I'm trying to build with either
>>> JDK 8 or 9 (using jenv).
>>>
>>> Any ideas what I'm doing wrong or what I should change to get the build
>>> past this error? Thanks in advance!
>>>
>>> <kl...@Kirks-MacBook-Pro-2>/Users/klund/dev/logging-log4j2 [517]$ java
>>> -version
>>> java version "1.8.0_202"
>>> Java(TM) SE Runtime Environment (build 1.8.0_202-b08)
>>> Java HotSpot(TM) 64-Bit Server VM (build 25.202-b08, mixed mode)
>>>
>>> I used 1.8 in this latest build but I've also tried 9. I also created sym
>>> links in /Library/Java/JavaVirtualMachines/ to match the definitions in the
>>> toolchains-sample-mac.xml file (not sure if this is correct or not):
>>>
>>> <kl...@Kirks-MacBook-Pro-2>/Users/klund/dev/logging-log4j2 [515]$ ll
>>> /Library/Java/JavaVirtualMachines/
>>> total 0
>>> drwxr-xr-x 17 root wheel 544 Mar 12 14:56 ./
>>> drwxr-xr-x 5 root wheel 160 Jan 3 2019 ../
>>> drwxr-xr-x@ 3 klund staff 96 Nov 27 2018 adoptopenjdk-10.jdk/
>>> drwxr-xr-x@ 3 root wheel 96 Oct 7 2018 adoptopenjdk-9.jdk/
>>> lrwxr-xr-x 1 root wheel 49 Mar 6 11:50 java7@ ->
>>> /Library/Java/JavaVirtualMachines/jdk1.7.0_80.jdk
>>> lrwxr-xr-x 1 root wheel 50 Mar 6 11:52 java8@ ->
>>> /Library/Java/JavaVirtualMachines/jdk1.8.0_202.jdk
>>> lrwxr-xr-x 1 root wheel 47 Mar 6 13:19 java9@ ->
>>> /Library/Java/JavaVirtualMachines/jdk-9.0.4.jdk
>>> drwxr-xr-x 3 root wheel 96 Sep 13 2018 jdk-10.0.2.jdk/
>>> drwxr-xr-x 3 root wheel 96 Mar 6 13:14 jdk-9.0.4.jdk/
>>> drwxr-xr-x 3 root wheel 96 Aug 18 2016 jdk1.7.0_80.jdk/
>>> drwxr-xr-x 3 root wheel 96 Jun 25 2018 jdk1.8.0_172.jdk/
>>> drwxr-xr-x 3 root wheel 96 Sep 13 2018 jdk1.8.0_181.jdk/
>>> drwxr-xr-x 3 root wheel 96 Mar 25 2019 jdk1.8.0_201.jdk/
>>> drwxr-xr-x 3 root wheel 96 Mar 25 2019 jdk1.8.0_202.jdk/
>>> drwxr-xr-x 3 root wheel 96 Feb 12 2016 jdk1.8.0_66.jdk/
>>> drwxr-xr-x@ 3 root wheel 96 Jan 18 2019 openjdk-11.0.2.jdk/
>>> drwxr-xr-x@ 3 root wheel 96 Dec 11 2019 openjdk-13.0.2.jdk/
>>>
>>
>> -ck
>
>
>
Re: Build fails to compile StackLocatorUtilTest.java due to
sun.reflect
Posted by Ralph Goers <ra...@dslextreme.com>.
You must have a toolchains.xml that has both Java 8 and Java 9 or above.
Ralph
> On Jul 15, 2020, at 12:50 PM, Carter Kozak <ck...@ckozak.net> wrote:
>
> I ran into a similar issue earlier and resolved it by setting my JAVA_HOME to match my java 1.8 jdk from my toolchains.xml:
> export JAVA_HOME=/usr/lib/jvm/java-8-openjdk-amd64
>
> On Wed, Jul 15, 2020, at 15:43, Kirk Lund wrote:
>> I'm trying to build 2.13.1 from sources using either JDK 8 or 9 on Mac OS
>> but it keeps failing with:
>>
>> <kl...@Kirks-MacBook-Pro-2>/Users/klund/dev/logging-log4j2 [518]$ mvn
>> install
>> ...
>>
>> [*INFO*]
>> *------------------------------------------------------------------------*
>>
>> [*INFO*] *BUILD FAILURE*
>>
>> [*INFO*]
>> *------------------------------------------------------------------------*
>>
>> [*INFO*] Total time: 13.948 s
>>
>> [*INFO*] Finished at: 2020-07-15T12:36:26-07:00
>>
>> [*INFO*]
>> *------------------------------------------------------------------------*
>>
>> [*ERROR*] Failed to execute goal
>> org.apache.maven.plugins:maven-compiler-plugin:3.8.1:testCompile
>> *(default-testCompile)* on project log4j-api: *Compilation failure*
>>
>> [*ERROR*] */Users/klund/dev/logging-log4j2/log4j-api/src/test/java/org/apache/logging/log4j/util/StackLocatorUtilTest.java:[25,18]
>> error: cannot find symbol*
>>
>> [*ERROR*] * symbol: class Reflection*
>>
>> [*ERROR*] * location: package sun.reflect*
>>
>> I'm not using JDK 11 -- there are some older emails from last year about
>> that hitting this same error using JDK 11. I'm trying to build with either
>> JDK 8 or 9 (using jenv).
>>
>> Any ideas what I'm doing wrong or what I should change to get the build
>> past this error? Thanks in advance!
>>
>> <kl...@Kirks-MacBook-Pro-2>/Users/klund/dev/logging-log4j2 [517]$ java
>> -version
>> java version "1.8.0_202"
>> Java(TM) SE Runtime Environment (build 1.8.0_202-b08)
>> Java HotSpot(TM) 64-Bit Server VM (build 25.202-b08, mixed mode)
>>
>> I used 1.8 in this latest build but I've also tried 9. I also created sym
>> links in /Library/Java/JavaVirtualMachines/ to match the definitions in the
>> toolchains-sample-mac.xml file (not sure if this is correct or not):
>>
>> <kl...@Kirks-MacBook-Pro-2>/Users/klund/dev/logging-log4j2 [515]$ ll
>> /Library/Java/JavaVirtualMachines/
>> total 0
>> drwxr-xr-x 17 root wheel 544 Mar 12 14:56 ./
>> drwxr-xr-x 5 root wheel 160 Jan 3 2019 ../
>> drwxr-xr-x@ 3 klund staff 96 Nov 27 2018 adoptopenjdk-10.jdk/
>> drwxr-xr-x@ 3 root wheel 96 Oct 7 2018 adoptopenjdk-9.jdk/
>> lrwxr-xr-x 1 root wheel 49 Mar 6 11:50 java7@ ->
>> /Library/Java/JavaVirtualMachines/jdk1.7.0_80.jdk
>> lrwxr-xr-x 1 root wheel 50 Mar 6 11:52 java8@ ->
>> /Library/Java/JavaVirtualMachines/jdk1.8.0_202.jdk
>> lrwxr-xr-x 1 root wheel 47 Mar 6 13:19 java9@ ->
>> /Library/Java/JavaVirtualMachines/jdk-9.0.4.jdk
>> drwxr-xr-x 3 root wheel 96 Sep 13 2018 jdk-10.0.2.jdk/
>> drwxr-xr-x 3 root wheel 96 Mar 6 13:14 jdk-9.0.4.jdk/
>> drwxr-xr-x 3 root wheel 96 Aug 18 2016 jdk1.7.0_80.jdk/
>> drwxr-xr-x 3 root wheel 96 Jun 25 2018 jdk1.8.0_172.jdk/
>> drwxr-xr-x 3 root wheel 96 Sep 13 2018 jdk1.8.0_181.jdk/
>> drwxr-xr-x 3 root wheel 96 Mar 25 2019 jdk1.8.0_201.jdk/
>> drwxr-xr-x 3 root wheel 96 Mar 25 2019 jdk1.8.0_202.jdk/
>> drwxr-xr-x 3 root wheel 96 Feb 12 2016 jdk1.8.0_66.jdk/
>> drwxr-xr-x@ 3 root wheel 96 Jan 18 2019 openjdk-11.0.2.jdk/
>> drwxr-xr-x@ 3 root wheel 96 Dec 11 2019 openjdk-13.0.2.jdk/
>>
>
> -ck
Re: Build fails to compile StackLocatorUtilTest.java due to sun.reflect
Posted by Carter Kozak <ck...@ckozak.net>.
I ran into a similar issue earlier and resolved it by setting my JAVA_HOME to match my java 1.8 jdk from my toolchains.xml:
export JAVA_HOME=/usr/lib/jvm/java-8-openjdk-amd64
On Wed, Jul 15, 2020, at 15:43, Kirk Lund wrote:
> I'm trying to build 2.13.1 from sources using either JDK 8 or 9 on Mac OS
> but it keeps failing with:
>
> <kl...@Kirks-MacBook-Pro-2>/Users/klund/dev/logging-log4j2 [518]$ mvn
> install
> ...
>
> [*INFO*]
> *------------------------------------------------------------------------*
>
> [*INFO*] *BUILD FAILURE*
>
> [*INFO*]
> *------------------------------------------------------------------------*
>
> [*INFO*] Total time: 13.948 s
>
> [*INFO*] Finished at: 2020-07-15T12:36:26-07:00
>
> [*INFO*]
> *------------------------------------------------------------------------*
>
> [*ERROR*] Failed to execute goal
> org.apache.maven.plugins:maven-compiler-plugin:3.8.1:testCompile
> *(default-testCompile)* on project log4j-api: *Compilation failure*
>
> [*ERROR*] */Users/klund/dev/logging-log4j2/log4j-api/src/test/java/org/apache/logging/log4j/util/StackLocatorUtilTest.java:[25,18]
> error: cannot find symbol*
>
> [*ERROR*] * symbol: class Reflection*
>
> [*ERROR*] * location: package sun.reflect*
>
> I'm not using JDK 11 -- there are some older emails from last year about
> that hitting this same error using JDK 11. I'm trying to build with either
> JDK 8 or 9 (using jenv).
>
> Any ideas what I'm doing wrong or what I should change to get the build
> past this error? Thanks in advance!
>
> <kl...@Kirks-MacBook-Pro-2>/Users/klund/dev/logging-log4j2 [517]$ java
> -version
> java version "1.8.0_202"
> Java(TM) SE Runtime Environment (build 1.8.0_202-b08)
> Java HotSpot(TM) 64-Bit Server VM (build 25.202-b08, mixed mode)
>
> I used 1.8 in this latest build but I've also tried 9. I also created sym
> links in /Library/Java/JavaVirtualMachines/ to match the definitions in the
> toolchains-sample-mac.xml file (not sure if this is correct or not):
>
> <kl...@Kirks-MacBook-Pro-2>/Users/klund/dev/logging-log4j2 [515]$ ll
> /Library/Java/JavaVirtualMachines/
> total 0
> drwxr-xr-x 17 root wheel 544 Mar 12 14:56 ./
> drwxr-xr-x 5 root wheel 160 Jan 3 2019 ../
> drwxr-xr-x@ 3 klund staff 96 Nov 27 2018 adoptopenjdk-10.jdk/
> drwxr-xr-x@ 3 root wheel 96 Oct 7 2018 adoptopenjdk-9.jdk/
> lrwxr-xr-x 1 root wheel 49 Mar 6 11:50 java7@ ->
> /Library/Java/JavaVirtualMachines/jdk1.7.0_80.jdk
> lrwxr-xr-x 1 root wheel 50 Mar 6 11:52 java8@ ->
> /Library/Java/JavaVirtualMachines/jdk1.8.0_202.jdk
> lrwxr-xr-x 1 root wheel 47 Mar 6 13:19 java9@ ->
> /Library/Java/JavaVirtualMachines/jdk-9.0.4.jdk
> drwxr-xr-x 3 root wheel 96 Sep 13 2018 jdk-10.0.2.jdk/
> drwxr-xr-x 3 root wheel 96 Mar 6 13:14 jdk-9.0.4.jdk/
> drwxr-xr-x 3 root wheel 96 Aug 18 2016 jdk1.7.0_80.jdk/
> drwxr-xr-x 3 root wheel 96 Jun 25 2018 jdk1.8.0_172.jdk/
> drwxr-xr-x 3 root wheel 96 Sep 13 2018 jdk1.8.0_181.jdk/
> drwxr-xr-x 3 root wheel 96 Mar 25 2019 jdk1.8.0_201.jdk/
> drwxr-xr-x 3 root wheel 96 Mar 25 2019 jdk1.8.0_202.jdk/
> drwxr-xr-x 3 root wheel 96 Feb 12 2016 jdk1.8.0_66.jdk/
> drwxr-xr-x@ 3 root wheel 96 Jan 18 2019 openjdk-11.0.2.jdk/
> drwxr-xr-x@ 3 root wheel 96 Dec 11 2019 openjdk-13.0.2.jdk/
>
-ck