Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1jwqaK-0005CD-9H for pljava-dev@arkaria.postgresql.org; Sat, 18 Jul 2020 17:25:16 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1jwqaJ-0005oT-4N for pljava-dev@arkaria.postgresql.org; Sat, 18 Jul 2020 17:25:15 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1jwqaI-0005ly-PU for pljava-dev@lists.postgresql.org; Sat, 18 Jul 2020 17:25:15 +0000 Received: from mail-ej1-x62c.google.com ([2a00:1450:4864:20::62c]) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1jwqaF-0001QB-Ro for pljava-dev@lists.postgresql.org; Sat, 18 Jul 2020 17:25:13 +0000 Received: by mail-ej1-x62c.google.com with SMTP id a21so14052960ejj.10 for ; Sat, 18 Jul 2020 10:25:11 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=5heUA/LBZq8trl2xGvwP+XRu6F8Hr5mD8P2LVlmx/ek=; b=AkGi7OGotW+PhD/gb1Pfh4rS3WWzKF3jOcTa4GwelpuhICQZJ2agqmUmvUayEkQ1JU QaIAF7IUxzln7tcsZQsLwdQumRZZQCm3yDPX7qtRqeTz0CWG8v2AfTKdkyCjLXojbOS5 ZwKwUHP4XlKoMvO5JVMOpJU+nywNDYo6oZ8BS/0y79WEjd0MZ54GcvOENR8s0l1HbTKD Aiz3PGxyscU6LIiAdwVkXn6xzkAQKoIRdNaG9ySKF/aK3d7Loy+j8h4tP36BaCYrmxo2 hwq00HQfG83LPEJ+MBx3mqW441+GMrZXiRQxAriKZRGASBF2IKRW2keoy+PxLRC6P3Gw Z7FQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=5heUA/LBZq8trl2xGvwP+XRu6F8Hr5mD8P2LVlmx/ek=; b=G1a+6/aLpH8LketSKtwf8DkQWKpqiqJ59mJnt83s7Dgo/FbnMK1FX1DUoZ2kpaX6/r Xpku6q04LoIGe6p3nIz8Wuxt+tRzuTj8vA8TK5dsGZuiDWaGQ1jaUcVCagiUbXLmaqEJ 8UNzdIycXISD27NQt3YXEYCIi11WV79cIFAPR+0lZYHDNkslVvsviWhrSD1e9aCzr2wV XbEbjrW6L53k3GiM7X+Yb2uo11jlVKvOaAwDH5cqR29YvrmuRlVLXgsUMlMngYr+9upJ qujEtY7W4qFlL36Ixg/+/olckO+6Sedns8IUuBd3Kahw/5RL6/BjiK5mcrnBY7b7ukWk trrA== X-Gm-Message-State: AOAM533RSMbPqzpc6w9PE5yloApSrAPdG112hmgSx0gdEkS84f8cM7k3 mYlI72ptd0UgADD/h3D3xowcvdmF+0168wmJXfZT/YcJ738= X-Google-Smtp-Source: ABdhPJzTd3l6ZPZc1rtdmrI022UZEUAJUiCGqNuqdPcA7AT9J0c8jb8T7Rln77xeHaZorwkQ1F4Ys8Znnr+4jOxuUsI= X-Received: by 2002:a17:906:594c:: with SMTP id g12mr13691276ejr.255.1595093108541; Sat, 18 Jul 2020 10:25:08 -0700 (PDT) MIME-Version: 1.0 References: <5F0734AD.7060001@anastigmatix.net> <5F077926.2050806@anastigmatix.net> <5F07C2D5.5050904@anastigmatix.net> <5F0D35BA.30904@anastigmatix.net> <5F0E3972.5070609@anastigmatix.net> <5F0F2DA2.5090603@anastigmatix.net> <5F12FF49.6090906@anastigmatix.net> <5F12FF80.5020208@anastigmatix.net> In-Reply-To: <5F12FF80.5020208@anastigmatix.net> From: Kartik Ohri Date: Sat, 18 Jul 2020 22:54:56 +0530 Message-ID: Subject: Re: PL/Java new build plugin To: Chapman Flack Cc: pljava-dev@lists.postgresql.org Content-Type: multipart/alternative; boundary="0000000000001e50b305aaba8efd" List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk --0000000000001e50b305aaba8efd Content-Type: text/plain; charset="UTF-8" I found this resource http://blog.chalda.cz/2018/02/17/Maven-plugin-and-fight-with-classloading.html. Using it I modified my mojo code to update the class loader. It didn't work. I also used the ClassLoaderUtils referred in to view what resources the class loader was loading. This is the output from a standalone program where I call the script engine to print the name of all script engines it can find. It is able to find Oracle Nashorn. [jdk.internal.loader.ClassLoaders$AppClassLoader@5bc2b487] hashCode=1539486855 -> loader resource: null -> loader resource element: file:/home/amcap1712/Desktop/ -> loader resource element: jar:file:/usr/share/java/java-atk-wrapper.jar!/META-INF [jdk.internal.loader.ClassLoaders$PlatformClassLoader@78308db1] hashCode=2016447921 -> loader resource: null -> loader resource element: jar:file:/usr/share/java/java-atk-wrapper.jar!/META-INF context class loader=[jdk.internal.loader.ClassLoaders$AppClassLoader@5bc2b487] hashCode=1539486855 This is the output from the mojo where it is not able to find any script engine. java.net.URLClassLoader@14840ffe] hashCode=344199166 -> loader resource: null -> loader resource element: jar:file:/usr/share/java/java-atk-wrapper.jar!/META-INF -> loader resource element: jar:file:/home/amcap1712/pljava/pljava-pgxs/target/pljava-pgxs-0.0.1-SNAPSHOT.jar!/META-INF -> loader resource element: jar:file:/home/amcap1712/.m2/repository/org/codehaus/plexus/plexus-utils/1.1/plexus-utils-1.1.jar!/META-INF -> loader resource element: jar:file:/home/amcap1712/Downloads/idea-IC-193.6911.18/plugins/maven/lib/maven3/boot/plexus-classworlds-2.6.0.jar!/META-INF -> loader resource element: jar:file:/home/amcap1712/Downloads/idea-IC-193.6911.18/lib/idea_rt.jar!/META-INF [ClassRealm[plugin>org.postgresql:pljava-pgxs:0.0.1-SNAPSHOT, parent: jdk.internal.loader.ClassLoaders$AppClassLoader@42a57993]] hashCode=402683266 -> loader resource: null -> loader resource element: jar:file:/usr/share/java/java-atk-wrapper.jar!/META-INF -> loader resource element: jar:file:/home/amcap1712/pljava/pljava-pgxs/target/pljava-pgxs-0.0.1-SNAPSHOT.jar!/META-INF -> loader resource element: jar:file:/home/amcap1712/.m2/repository/org/codehaus/plexus/plexus-utils/1.1/plexus-utils-1.1.jar!/META-INF -> loader resource element: jar:file:/home/amcap1712/Downloads/idea-IC-193.6911.18/plugins/maven/lib/maven3/boot/plexus-classworlds-2.6.0.jar!/META-INF -> loader resource element: jar:file:/home/amcap1712/Downloads/idea-IC-193.6911.18/lib/idea_rt.jar!/META-INF context class loader=[java.net.URLClassLoader@14840ffe] hashCode=344199166 What surprised me is that the only entry in the first case is present in the second case but still the second fails, Am I missing something here ? --0000000000001e50b305aaba8efd Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
I found this resource=C2=A0http://blo= g.chalda.cz/2018/02/17/Maven-plugin-and-fight-with-classloading.html. U= sing it I modified my mojo code to update the class loader. It didn't w= ork. I also used the ClassLoaderUtils referred in to view what resources th= e class loader was loading.

This is the output fro= m a standalone program where I call the script engine to print the name of = all script engines it can find. It is able to find Oracle Nashorn.
[jd= k.internal.loader.ClassLoaders$AppClassLoader@5bc2b487] hashCode=3D15394868= 55
-> loader resource: null
-> loader resource element: file:/h= ome/amcap1712/Desktop/
-> loader resource element: jar:file:/usr/shar= e/java/java-atk-wrapper.jar!/META-INF
[jdk.internal.loader.ClassLoaders= $PlatformClassLoader@78308db1] hashCode=3D2016447921
-> loader resou= rce: null
-> loader resource element: jar:file:/usr/share/java/java-= atk-wrapper.jar!/META-INF
context class loader=3D[jdk.internal.loader.= ClassLoaders$AppClassLoader@5bc2b487] hashCode=3D1539486855

<= div>This is the output from the mojo where it is not able to find any scrip= t engine.
java.net.URLClassLoader@14840ffe] hashCode=3D344199166<= br>-> loader resource: null
-> loader resource element: jar:file:/= usr/share/java/java-atk-wrapper.jar!/META-INF
-> loader resource elem= ent: jar:file:/home/amcap1712/pljava/pljava-pgxs/target/pljava-pgxs-0.0.1-S= NAPSHOT.jar!/META-INF
-> loader resource element: jar:file:/home/amca= p1712/.m2/repository/org/codehaus/plexus/plexus-utils/1.1/plexus-utils-1.1.= jar!/META-INF
-> loader resource element: jar:file:/home/amcap1712/Do= wnloads/idea-IC-193.6911.18/plugins/maven/lib/maven3/boot/plexus-classworld= s-2.6.0.jar!/META-INF
-> loader resource element: jar:file:/home/amca= p1712/Downloads/idea-IC-193.6911.18/lib/idea_rt.jar!/META-INF
[ClassRea= lm[plugin>org.postgresql:pljava-pgxs:0.0.1-SNAPSHOT, parent: jdk.interna= l.loader.ClassLoaders$AppClassLoader@42a57993]] hashCode=3D402683266
-&= gt; loader resource: null
-> loader resource element: jar:file:/usr/= share/java/java-atk-wrapper.jar!/META-INF
-> loader resource element= : jar:file:/home/amcap1712/pljava/pljava-pgxs/target/pljava-pgxs-0.0.1-SNAP= SHOT.jar!/META-INF
-> loader resource element: jar:file:/home/amcap1= 712/.m2/repository/org/codehaus/plexus/plexus-utils/1.1/plexus-utils-1.1.ja= r!/META-INF
-> loader resource element: jar:file:/home/amcap1712/Dow= nloads/idea-IC-193.6911.18/plugins/maven/lib/maven3/boot/plexus-classworlds= -2.6.0.jar!/META-INF
-> loader resource element: jar:file:/home/amca= p1712/Downloads/idea-IC-193.6911.18/lib/idea_rt.jar!/META-INF
context = class loader=3D[java.net.URLClassLoader@14840ffe] hashCode=3D344199166
<= /div>

What surprised me is that the only entry in the fi= rst case is present in the second case but still the second fails, Am I mis= sing something here ?
--0000000000001e50b305aaba8efd--