Hello Alex,

thank you for coming back. We now have four different cases just for
the second build step (appimage->deb). Let me first give you an
overview:


My Desktop (OpenJDK 16): My Command, Your command
Github     (OpenJDK 17): My command, Your command

On Github I started using OpenJDK11, then switched to 16 and finally to
17. In respect to my build they all seem to behave the same. So I will
give the status on all four of the combinations. And btw I use Gradle
to trigger command lines which impacts a bit the log output but
otherwise should not matter.

--My Desktop, my command:--

Starting process 'command 'jpackage''. Working directory:
/home/hiran/NetBeansProjects/settlers-installer/app Command: jpackage
--app-image build/app-image/SettlersRemake --dest build/distributions
--resource-dir build/resources/jpackage
Successfully started process 'command 'jpackage''
:app:jpackagePhase2 (Thread[Execution worker for ':' Thread 3,5,main])
completed. Took 12.313 secs.

This one runs reliably. I was a bit annoyed that the appdir directory
is one level more than for build step 1 (input->appimage) - but maybe
that is exactly because I did not specify --name.
After all I have a Debian package that I can verify and install.


--My Desktop, your command--

Starting process 'command 'jpackage''. Working directory:
/home/hiran/NetBeansProjects/settlers-installer/app Command: jpackage
--app-image build/app-image/SettlersRemake --dest build/distributions
--resource-dir build/resources/jpackage
Successfully started process 'command 'jpackage''
:app:jpackagePhase2 (Thread[Execution worker for ':' Thread 3,5,main])
completed. Took 12.313 secs.

I added --name as you suggested. It seems I still need to specify the
application name on the app-image parameter otherwise the build will
fail. A bit strange since build step 1 was run with --dest build/app-
image.
I have not yet tested the Debian package yet.


--Github, my command--

In build step 1 I am running jpackage like so:

Starting process 'command 'jpackage''. Working directory:
/home/runner/work/settlers-installer/settlers-installer/app Command:
jpackage --type app-image --dest build/app-image -i
build/jpackage_input/app-0.1.0-SNAPSHOT/lib --main-jar app-0.1.0-
SNAPSHOT.jar --main-class settlers.installer.App --name SettlersRemake
--app-version 0.1.0-SNAPSHOT --description Settlers 3 remake - see
https://github.com/ --vendor Hiran --icon
build/resources/main/siedler3-helme-logo.png --resource-dir
build/resources/jpackage
Successfully started process 'command 'jpackage''
:app:jpackagePhase1 (Thread[Daemon worker,5,main]) completed. Took
12.919 secs.

There is no error or any suspect message in stdout- Yet I investigated
and found out that the app-image directory is almost empty. This is a
problem for the second build step. And it is annoying that Gradle
garbles the output with other stuff so I hope to have it separated
correctly.

:app:jpackagePhase2 (Thread[Daemon worker,5,main]) started.

Bundler DEB Bundle failed because of java.lang.NullPointerException:
Cannot invoke "java.lang.CharSequence.length()" because "this.text" is
null

> Task :app:jpackagePhase2 FAILED
* What went wrong:
Execution failed for task ':app:jpackagePhase2'.
> Process 'command 'jpackage'' finished with non-zero exit value 1

Since gradle is not logging the command it invoked I will give you that
line from the build file:

commandLine 'jpackage', '--app-image', 'build/app-
image/SettlersRemake', '--dest', 'build', '--resource-dir',
'build/resources/jpackage'


--Github, your command--

Since you suggested to add --name on the second step, the first step
runs as it was before. And again most files are missing in the output.

Starting process 'command 'jpackage''. Working directory: 
/home/runner/work/settlers-installer/settlers-installer/app Command: jpackage 
--type app-image --dest build/app-image -i 
build/jpackage_input/app-0.1.0-SNAPSHOT/lib --main-jar app-0.1.0-SNAPSHOT.jar 
--main-class settlers.installer.App --name SettlersRemake --app-version 
0.1.0-SNAPSHOT --description Settlers 3 remake - see https://github.com/ 
--vendor Hiran --icon build/resources/main/siedler3-helme-logo.png 
--resource-dir build/resources/jpackage
Successfully started process 'command 'jpackage''
:app:jpackagePhase1 (Thread[Execution worker for ':',5,main]) completed. Took 
12.672 secs.

To verify what files had been created I ran a 'find' afterwards. I had
expected the full application, and the JDK runtime. But I only see
these files for the appimage:

build/app-image
build/app-image/SettlersRemake
build/app-image/SettlersRemake/lib
build/app-image/SettlersRemake/bin
build/app-image/SettlersRemake/bin/SettlersRemake

With that, the second step is called and outputs this much:

Starting process 'command 'jpackage''. Working directory:
/home/runner/work/settlers-installer/settlers-installer/app Command:
jpackage --app-image build/app-image/SettlersRemake --name
SettlersRemake --dest build --resource-dir build/resources/jpackage
Successfully started process 'command 'jpackage''
Warning: app-image dir not generated by jpackage.
:app:jpackagePhase2 (Thread[Daemon worker,5,main]) completed. Took
8.099 secs.


I am surprised to see success, so my next step would be to evaluate the
content of the .deb file. I doubt jpackage would have created all what
was missing just now. However this evaluation will have to wait for a
week.


Hiran



On Thu, 2022-04-07 at 14:16 -0400, Alexey Semenyuk wrote:
> Hi Hiran,
>
> My apologies for not replying to your previous email. In that
> particular
> case the problem seems to be in missing "--name" cli option on the
> second jpackage command line ($JAVA_HOME/bin/jpackage --app-image
> build/app-image --verbose --dest build) that is supposed to build
> .deb
> package from the app image.
> Could you please confirm this is the case so I can file more
> specific
> description in a CR tracking this issue.
>
> Do you have a stack trace for the second NPE? It would help to
> understand what went wrong.
>
> Issue with the Github Runner looks similar to this one [1]
>
> [1]
> https://mail.openjdk.java.net/pipermail/core-libs-dev/2022-March/086656.html
>
> - Alexey
>
> On 4/7/2022 2:57 AM, Hiran Chaudhuri wrote:
> > Hi there.
> >
> > I have another case where running jpackage emits
> >
> > Bundler DEB Bundle failed because of
> > java.lang.NullPointerException:
> > Cannot invoke "java.lang.CharSequence.length()" because "this.text"
> > is
> > null
> >
> > I have never experienced NullPointerExceptions in other JDK tools.
> > Seems to me JPackage is a new kid on the block. In this case,
> > JPackage
> > is invoked to finish from an existing appimage to the final
> > package.
> > the failure is caused because some important files are missing in
> > appimage.
> >
> > The previous run is even more puzzling for me. It is supposed to
> > create
> > the appimage directory. And while it emits no error message, on my
> > development machine it runs reliably while on the Github Runner it
> > just
> > does not create all files - no error message, no exit code -
> > nothing.
> >
> > Any idea what I could be looking at?
> >
> > Hiran
> >
> >
> >
> > On Mon, 2022-04-04 at 08:49 +0200, Hiran Chaudhuri wrote:
> > > Hello Alex,
> > >
> > > I tried running the same command with the jdk19 you pointed at.
> > > As a
> > > first, I get this output:
> > >
> > > $JAVA_HOME/bin/jpackage --version
> > > 19-ea
> > >
> > > With that, I invoked the command as before, and i fairly got the
> > > same
> > > output. So the behaviour in the latest version has not changed.
> > >
> > > Two things I'd like to point out:
> > > - there is no JPackage version in the output itself so both you
> > > and
> > > me
> > > have to trust the correct one was called
> > > - I found out the mistake: I should have used
> > >    --app-image build/app-image/SettlersRemake
> > >    but JPackage gave a warning in the beginning and processed all
> > > the
> > >    rest
> > >
> > > Hiran
> > >
> > >
> > > $JAVA_HOME/bin/jpackage --app-image build/app-image --verbose --
> > > dest
> > > build
> > > [08:41:58.675] Warning: app-image dir not generated by jpackage.
> > > [08:41:58.688] Running dpkg
> > > [08:41:58.696] Command [PID: 21712]:
> > >      dpkg --print-architecture
> > > [08:41:58.696] Output:
> > >      amd64
> > > [08:41:58.698] Returned: 0
> > >
> > > [08:41:58.702] Running dpkg
> > > [08:41:58.719] Command [PID: 21714]:
> > >      dpkg -s coreutils
> > > [08:41:58.719] Output:
> > >      Package: coreutils
> > >      Essential: yes
> > >      Status: install ok installed
> > >      Priority: required
> > >      Section: utils
> > >      Installed-Size: 7196
> > >      Maintainer: Ubuntu Developers <
> > > ubuntu-devel-disc...@lists.ubuntu.com>
> > >      Architecture: amd64
> > >      Multi-Arch: foreign
> > >      Version: 8.30-3ubuntu2
> > >      Pre-Depends: libacl1 (>= 2.2.23), libattr1 (>= 1:2.4.44),
> > > libc6
> > > (>=
> > > 2.28), libselinux1 (>= 2.1.13)
> > >      Description: GNU core utilities
> > >       This package contains the basic file, shell and text
> > > manipulation
> > >       utilities which are expected to exist on every operating
> > > system.
> > >       .
> > >       Specifically, this package includes:
> > >       arch base64 basename cat chcon chgrp chmod chown chroot
> > > cksum
> > > comm
> > > cp
> > >       csplit cut date dd df dir dircolors dirname du echo env
> > > expand
> > > expr
> > >       factor false flock fmt fold groups head hostid id install
> > > join
> > > link ln
> > >       logname ls md5sum mkdir mkfifo mknod mktemp mv nice nl
> > > nohup
> > > nproc
> > > numfmt
> > >       od paste pathchk pinky pr printenv printf ptx pwd readlink
> > > realpath rm
> > >       rmdir runcon sha*sum seq shred sleep sort split stat stty
> > > sum
> > > sync
> > > tac
> > >       tail tee test timeout touch tr true truncate tsort tty
> > > uname
> > > unexpand
> > >       uniq unlink users vdir wc who whoami yes
> > >      Homepage: http://gnu.org/software/coreutils
> > >      Original-Maintainer: Michael Stone <mst...@debian.org>
> > > [08:41:58.719] Returned: 0
> > >
> > > [08:41:58.720] Running dpkg-deb
> > > [08:41:58.722] Warning: app-image dir not generated by jpackage.
> > > [08:41:58.723] Warning: app-image dir not generated by jpackage.
> > > [08:41:58.723] java.lang.NullPointerException: Cannot invoke
> > > "java.lang.CharSequence.length()" because "this.text" is null
> > >          at
> > > java.base/java.util.regex.Matcher.getTextLength(Matcher.java:1769
> > > )
> > >          at
> > > java.base/java.util.regex.Matcher.reset(Matcher.java:415)
> > >          at
> > > java.base/java.util.regex.Matcher.<init>(Matcher.java:252)
> > >          at
> > > java.base/java.util.regex.Pattern.matcher(Pattern.java:1144)
> > >          at
> > > jdk.jpackage/jdk.jpackage.internal.LinuxDebBundler.lambda$static$
> > > 1(Li
> > > nu
> > > xDebBundler.java:84)
> > >          at
> > > jdk.jpackage/jdk.jpackage.internal.LinuxPackageBundler.validate(L
> > > inux
> > > Pa
> > > ckageBundler.java:72)
> > >          at
> > > jdk.jpackage/jdk.jpackage.internal.Arguments.generateBundle(Argum
> > > ents
> > > .j
> > > ava:688)
> > >          at
> > > jdk.jpackage/jdk.jpackage.internal.Arguments.processArguments(Arg
> > > umen
> > > ts
> > > .java:561)
> > >          at
> > > jdk.jpackage/jdk.jpackage.main.Main.execute(Main.java:91)
> > >          at
> > > jdk.jpackage/jdk.jpackage.main.Main.main(Main.java:52)
> > > [08:41:58.725] jdk.jpackage.internal.PackagerException: Bundler
> > > DEB
> > > Bundle failed because of java.lang.NullPointerException: Cannot
> > > invoke
> > > "java.lang.CharSequence.length()" because "this.text" is null
> > >          at
> > > jdk.jpackage/jdk.jpackage.internal.Arguments.generateBundle(Argum
> > > ents
> > > .j
> > > ava:710)
> > >          at
> > > jdk.jpackage/jdk.jpackage.internal.Arguments.processArguments(Arg
> > > umen
> > > ts
> > > .java:561)
> > >          at
> > > jdk.jpackage/jdk.jpackage.main.Main.execute(Main.java:91)
> > >          at
> > > jdk.jpackage/jdk.jpackage.main.Main.main(Main.java:52)
> > > Caused by: java.lang.NullPointerException: Cannot invoke
> > > "java.lang.CharSequence.length()" because "this.text" is null
> > >          at
> > > java.base/java.util.regex.Matcher.getTextLength(Matcher.java:1769
> > > )
> > >          at
> > > java.base/java.util.regex.Matcher.reset(Matcher.java:415)
> > >          at
> > > java.base/java.util.regex.Matcher.<init>(Matcher.java:252)
> > >          at
> > > java.base/java.util.regex.Pattern.matcher(Pattern.java:1144)
> > >          at
> > > jdk.jpackage/jdk.jpackage.internal.LinuxDebBundler.lambda$static$
> > > 1(Li
> > > nu
> > > xDebBundler.java:84)
> > >          at
> > > jdk.jpackage/jdk.jpackage.internal.LinuxPackageBundler.validate(L
> > > inux
> > > Pa
> > > ckageBundler.java:72)
> > >          at
> > > jdk.jpackage/jdk.jpackage.internal.Arguments.generateBundle(Argum
> > > ents
> > > .j
> > > ava:688)
> > >          ... 3 more
> > >
> > >
> > > On Fri, 2022-04-01 at 12:37 -0400, Alexey Semenyuk wrote:
> > > > Hi Hiran,
> > > >
> > > > Looks like jpackage fails because of missing package name on
> > > > the
> > > > command
> > > > line.
> > > > I agree that the error message is not helpful. Can you try one
> > > > of
> > > > jdk19
> > > > EA builds [1] to see if the problem is reproducible?
> > > >
> > > > [1] https://jdk.java.net/19/
> > > >
> > > > - Alexey
> > > >
> > > > On 4/1/2022 5:58 AM, Hiran Chaudhuri wrote:
> > > > > Hello there.
> > > > >
> > > > > While I am trying to package my project using jpackage 16.0.1
> > > > > on
> > > > > Ubuntu
> > > > > 20 LTS I have difficulty in assembling the correct commands.
> > > > >
> > > > > The documentation covers a lot but not everything. For
> > > > > example,
> > > > > it
> > > > > is
> > > > > not clear to me when I have to provide an option - especially
> > > > > since
> > > > > I
> > > > > meanwhile take a two step approach of building the appimage,
> > > > > then
> > > > > tweaking something (that could have done by JPackage
> > > > > directly)
> > > > > and
> > > > > finally building the DEB package.
> > > > >
> > > > > While I believe the documentation is good enough, the error
> > > > > messages
> > > > > presented by JPackage are not. Here is one example. Hopefully
> > > > > you
> > > > > agree
> > > > > that the NullPointerException does not at all tell me what is
> > > > > wrong
> > > > > and
> > > > > what I could improve on.
> > > > >
> > > > > My feeling is that JPackage should do some better error
> > > > > handling
> > > > > and
> > > > > come up with improved messages.
> > > > >
> > > > > Hiran
> > > > >
> > > > >
> > > > > $ jpackage --app-image build/app-image --verbose --dest build
> > > > > [10:34:45.915] Warning: app-image dir not generated by
> > > > > jpackage.
> > > > > [10:34:45.930] Running dpkg
> > > > > [10:34:45.937] Command:
> > > > >       dpkg --print-architecture
> > > > > [10:34:45.937] Output:
> > > > >       amd64
> > > > > [10:34:45.939] Returned: 0
> > > > >
> > > > > [10:34:45.944] Running dpkg
> > > > > [10:34:45.961] Command:
> > > > >       dpkg -s coreutils
> > > > > [10:34:45.962] Output:
> > > > >       Package: coreutils
> > > > >       Essential: yes
> > > > >       Status: install ok installed
> > > > >       Priority: required
> > > > >       Section: utils
> > > > >       Installed-Size: 7196
> > > > >       Maintainer: Ubuntu Developers <
> > > > > ubuntu-devel-disc...@lists.ubuntu.com>
> > > > >       Architecture: amd64
> > > > >       Multi-Arch: foreign
> > > > >       Version: 8.30-3ubuntu2
> > > > >       Pre-Depends: libacl1 (>= 2.2.23), libattr1 (>=
> > > > > 1:2.4.44),
> > > > > libc6 (>=
> > > > > 2.28), libselinux1 (>= 2.1.13)
> > > > >       Description: GNU core utilities
> > > > >        This package contains the basic file, shell and text
> > > > > manipulation
> > > > >        utilities which are expected to exist on every
> > > > > operating
> > > > > system.
> > > > >        .
> > > > >        Specifically, this package includes:
> > > > >        arch base64 basename cat chcon chgrp chmod chown
> > > > > chroot
> > > > > cksum
> > > > > comm
> > > > > cp
> > > > >        csplit cut date dd df dir dircolors dirname du echo
> > > > > env
> > > > > expand
> > > > > expr
> > > > >        factor false flock fmt fold groups head hostid id
> > > > > install
> > > > > join
> > > > > link ln
> > > > >        logname ls md5sum mkdir mkfifo mknod mktemp mv nice nl
> > > > > nohup
> > > > > nproc
> > > > > numfmt
> > > > >        od paste pathchk pinky pr printenv printf ptx pwd
> > > > > readlink
> > > > > realpath rm
> > > > >        rmdir runcon sha*sum seq shred sleep sort split stat
> > > > > stty
> > > > > sum
> > > > > sync
> > > > > tac
> > > > >        tail tee test timeout touch tr true truncate tsort tty
> > > > > uname
> > > > > unexpand
> > > > >        uniq unlink users vdir wc who whoami yes
> > > > >       Homepage: http://gnu.org/software/coreutils
> > > > >       Original-Maintainer: Michael Stone <mst...@debian.org>
> > > > > [10:34:45.962] Returned: 0
> > > > >
> > > > > [10:34:45.963] Running dpkg-deb
> > > > > [10:34:45.965] Warning: app-image dir not generated by
> > > > > jpackage.
> > > > > [10:34:45.967] Warning: app-image dir not generated by
> > > > > jpackage.
> > > > > [10:34:45.967] java.lang.NullPointerException: Cannot invoke
> > > > > "java.lang.CharSequence.length()" because "this.text" is null
> > > > >           at
> > > > > java.base/java.util.regex.Matcher.getTextLength(Matcher.java:
> > > > > 1769
> > > > > )
> > > > >           at
> > > > > java.base/java.util.regex.Matcher.reset(Matcher.java:415)
> > > > >           at
> > > > > java.base/java.util.regex.Matcher.<init>(Matcher.java:252)
> > > > >           at
> > > > > java.base/java.util.regex.Pattern.matcher(Pattern.java:1134)
> > > > >           at
> > > > > jdk.jpackage/jdk.jpackage.internal.LinuxDebBundler.lambda$sta
> > > > > tic$
> > > > > 1(
> > > > > Linu
> > > > > xDebBundler.java:83)
> > > > >           at
> > > > > jdk.jpackage/jdk.jpackage.internal.LinuxPackageBundler.valida
> > > > > te(L
> > > > > in
> > > > > uxPa
> > > > > ckageBundler.java:72)
> > > > >           at
> > > > > jdk.jpackage/jdk.jpackage.internal.Arguments.generateBundle(A
> > > > > rgum
> > > > > en
> > > > > ts.j
> > > > > ava:663)
> > > > >           at
> > > > > jdk.jpackage/jdk.jpackage.internal.Arguments.processArguments
> > > > > (Arg
> > > > > um
> > > > > ents
> > > > > .java:538)
> > > > >           at
> > > > > jdk.jpackage/jdk.jpackage.main.Main.execute(Main.java:98)
> > > > >           at
> > > > > jdk.jpackage/jdk.jpackage.main.Main.main(Main.java:52)
> > > > > [10:34:45.969] jdk.jpackage.internal.PackagerException:
> > > > > Bundler
> > > > > DEB
> > > > > Bundle failed because of java.lang.NullPointerException:
> > > > > Cannot
> > > > > invoke
> > > > > "java.lang.CharSequence.length()" because "this.text" is null
> > > > >           at
> > > > > jdk.jpackage/jdk.jpackage.internal.Arguments.generateBundle(A
> > > > > rgum
> > > > > en
> > > > > ts.j
> > > > > ava:685)
> > > > >           at
> > > > > jdk.jpackage/jdk.jpackage.internal.Arguments.processArguments
> > > > > (Arg
> > > > > um
> > > > > ents
> > > > > .java:538)
> > > > >           at
> > > > > jdk.jpackage/jdk.jpackage.main.Main.execute(Main.java:98)
> > > > >           at
> > > > > jdk.jpackage/jdk.jpackage.main.Main.main(Main.java:52)
> > > > > Caused by: java.lang.NullPointerException: Cannot invoke
> > > > > "java.lang.CharSequence.length()" because "this.text" is null
> > > > >           at
> > > > > java.base/java.util.regex.Matcher.getTextLength(Matcher.java:
> > > > > 1769
> > > > > )
> > > > >           at
> > > > > java.base/java.util.regex.Matcher.reset(Matcher.java:415)
> > > > >           at
> > > > > java.base/java.util.regex.Matcher.<init>(Matcher.java:252)
> > > > >           at
> > > > > java.base/java.util.regex.Pattern.matcher(Pattern.java:1134)
> > > > >           at
> > > > > jdk.jpackage/jdk.jpackage.internal.LinuxDebBundler.lambda$sta
> > > > > tic$
> > > > > 1(
> > > > > Linu
> > > > > xDebBundler.java:83)
> > > > >           at
> > > > > jdk.jpackage/jdk.jpackage.internal.LinuxPackageBundler.valida
> > > > > te(L
> > > > > in
> > > > > uxPa
> > > > > ckageBundler.java:72)
> > > > >           at
> > > > > jdk.jpackage/jdk.jpackage.internal.Arguments.generateBundle(A
> > > > > rgum
> > > > > en
> > > > > ts.j
> > > > > ava:663)
> > > > >           ... 3 more
> > > > >
> > > > > $
> > > > >
> > > > >

Reply via email to