jpackage usage problems

Alexey Semenyuk alexey.semenyuk at oracle.com
Thu Apr 7 18:16:14 UTC 2022


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-discuss at 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 <mstone at 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(Linux
>> Pa
>> ckageBundler.java:72)
>>          at
>> jdk.jpackage/jdk.jpackage.internal.Arguments.generateBundle(Arguments
>> .j
>> ava:688)
>>          at
>> jdk.jpackage/jdk.jpackage.internal.Arguments.processArguments(Argumen
>> 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(Arguments
>> .j
>> ava:710)
>>          at
>> jdk.jpackage/jdk.jpackage.internal.Arguments.processArguments(Argumen
>> 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(Linux
>> Pa
>> ckageBundler.java:72)
>>          at
>> jdk.jpackage/jdk.jpackage.internal.Arguments.generateBundle(Arguments
>> .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-discuss at 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 <mstone at 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$static$
>>>> 1(
>>>> Linu
>>>> xDebBundler.java:83)
>>>>           at
>>>> jdk.jpackage/jdk.jpackage.internal.LinuxPackageBundler.validate(L
>>>> in
>>>> uxPa
>>>> ckageBundler.java:72)
>>>>           at
>>>> jdk.jpackage/jdk.jpackage.internal.Arguments.generateBundle(Argum
>>>> 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(Argum
>>>> 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$static$
>>>> 1(
>>>> Linu
>>>> xDebBundler.java:83)
>>>>           at
>>>> jdk.jpackage/jdk.jpackage.internal.LinuxPackageBundler.validate(L
>>>> in
>>>> uxPa
>>>> ckageBundler.java:72)
>>>>           at
>>>> jdk.jpackage/jdk.jpackage.internal.Arguments.generateBundle(Argum
>>>> en
>>>> ts.j
>>>> ava:663)
>>>>           ... 3 more
>>>>
>>>> $
>>>>
>>>>



More information about the core-libs-dev mailing list