Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 915126 - net-wireless/unifi-7.5.176 does not start on Java 17: Unable to make private java.time.Instant(long,int) accessible
Summary: net-wireless/unifi-7.5.176 does not start on Java 17: Unable to make private ...
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: Normal normal with 1 vote (vote)
Assignee: Conrad Kostecki
URL: https://community.ui.com/releases/Uni...
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2023-10-03 17:51 UTC by Jyrki Launonen
Modified: 2023-10-10 07:01 UTC (History)
3 users (show)

See Also:
Package list:
Runtime testing required: ---


Attachments
/usr/bin/unifi patch (unifi.patch,379 bytes, patch)
2023-10-05 15:57 UTC, drserge
Details | Diff
Patch for unifi-7.5.176.ebuild (unifi-7.5.176.ebuild.patch,559 bytes, patch)
2023-10-06 12:29 UTC, Joël
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Jyrki Launonen 2023-10-03 17:51:04 UTC
7.5.176 updated required Java version, which is marked in RDEPEND with virtual/jre:17, but even so openjdk-bin:17 won't allow Unifi to start due a long nested exception with final exception:

  Caused by: java.lang.reflect.InaccessibleObjectException: Unable to make private java.time.Instant(long,int) accessible: module java.base do
es not "opens java.time" to unnamed module @43c3d622

Linked in URL is a comment from vendor explaining to someone else what arguments are needed, among which are a bunch of --add-opens -arguments. Adding them in the ebuild for java-pkg_dolauncher --java_args string resolves the issue.
Something like this:

	java-pkg_dolauncher \
		unifi \
		--java_args '-Dorg.xerial.snappy.tempdir=/usr/lib/unifi/tmp -Djava.library.path= --add-opens java.base/java.lang=ALL-UNNAMED --add-opens java.base/java.time=ALL-UNNAMED --add-opens java.base/sun.security.util=ALL-UNNAMED --add-opens java.base/java.io=ALL-UNNAMED --add-opens java.rmi/sun.rmi.transport=ALL-UNNAMED' \
		--jar ace.jar \
		--pwd '/usr/lib/unifi'

Whether the other parameters described in URL are needed I do not know nor have tried; this seems to be the smallest change required.


Reproducible: Always

Steps to Reproduce:
1. emerge =net-wireless/unifi-7.5.176  (after keywords)
2. rc-service unifi start  (or similar)
3. see /var/log/unifi/server.log for errors

Actual Results:  
Opening the service web page gives 404 not found.

Expected Results:  
Opening the service web page gives Unifi login page.
Comment 1 Joël 2023-10-03 19:05:16 UTC
I confirm!
Same issue with:
* dev-java/openjdk-17.0.6_p10
* net-wireless/unifi-7.5.176

I haven't tried the fix, but it makes sense indeed.
Comment 2 drserge 2023-10-05 15:57:04 UTC
Created attachment 872190 [details, diff]
/usr/bin/unifi patch

Successfully started unifi 7.5.176 with =dev-java/openjdk-jre-bin-17.0.6_p10 after adding:
--add-opens java.base/java.time=ALL-UNNAMED
to gjl_java_args in /usr/bin/unifi
Comment 3 Joël 2023-10-06 12:29:14 UTC
Created attachment 872221 [details, diff]
Patch for unifi-7.5.176.ebuild

Works great! This can be fixed in the build itself (patch attached).

However please note that --add-opens is not supported yet in JDK 8, as far as I know.
Comment 4 drserge 2023-10-07 22:39:40 UTC
(In reply to Joël from comment #3)
> Created attachment 872221 [details, diff] [details, diff]
> Patch for unifi-7.5.176.ebuild
> 
> Works great! This can be fixed in the build itself (patch attached).
> 
> However please note that --add-opens is not supported yet in JDK 8, as far
> as I know.

Java 17 is a requirement for Unifi 7.5.176 AFAIK.
Comment 5 Larry the Git Cow gentoo-dev 2023-10-09 22:00:16 UTC
The bug has been closed via the following commit(s):

https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=e3cf91a73f24a075c2320e1cb744dbff27ff17ab

commit e3cf91a73f24a075c2320e1cb744dbff27ff17ab
Author:     Conrad Kostecki <conikost@gentoo.org>
AuthorDate: 2023-10-09 21:58:44 +0000
Commit:     Conrad Kostecki <conikost@gentoo.org>
CommitDate: 2023-10-09 21:59:40 +0000

    net-wireless/unifi: add needed java opts
    
    Closes: https://bugs.gentoo.org/915126
    Signed-off-by: Conrad Kostecki <conikost@gentoo.org>

 .../unifi/{unifi-7.5.176.ebuild => unifi-7.5.176-r1.ebuild}       | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)
Comment 6 Joël 2023-10-10 07:01:52 UTC
Well done, thank you!