Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Gitblit does not work with Java 16 #1373

Closed
flaix opened this issue Jul 27, 2021 · 5 comments
Closed

Gitblit does not work with Java 16 #1373

flaix opened this issue Jul 27, 2021 · 5 comments

Comments

@flaix
Copy link
Member

flaix commented Jul 27, 2021

My java SDK is v16.

> java --version
java 16.0.1 2021-04-20
Java(TM) SE Runtime Environment (build 16.0.1+9-24)
Java HotSpot(TM) 64-Bit Server VM (build 16.0.1+9-24, mixed mode, sharing)

When start gitblit,log is

[2021-07-27 08:09:15] [info]  Stopping service...
[2021-07-27 08:09:16] [info]  Service stopped.
[2021-07-27 08:09:16] [info]  Run service finished.
[2021-07-27 08:09:16] [info]  Commons Daemon procrun finished
[2021-07-27 08:09:19] [info]  Commons Daemon procrun (1.0.10.0 64-bit) started
[2021-07-27 08:09:19] [info]  Running 'gitblit' Service...
[2021-07-27 08:09:19] [info]  Starting service...
[2021-07-27 08:09:20] [info]  Service started in 1295 ms.

stderr

2021-07-27 08:09:19 Commons Daemon procrun stderr initialized

stdout

2021-07-27 08:09:19 Commons Daemon procrun stdout initialized
2021-07-27 08:09:19 [INFO ] 
  _____  _  _    _      _  _  _
 |  __ \(_)| |  | |    | |(_)| |
 | |  \/ _ | |_ | |__  | | _ | |_
 | | __ | || __|| '_ \ | || || __|  http://gitblit.com
 | |_\ \| || |_ | |_) || || || |_   @gitblit
  \____/|_| \__||_.__/ |_||_| \__|  1.9.1

2021-07-27 08:09:19 [INFO ] Running on Windows Server 2019 (10.0)
2021-07-27 08:09:19 [INFO ] JVM version 16.0.1 (Oracle Corporation)
2021-07-27 08:09:19 [INFO ] Logging initialized @437ms
2021-07-27 08:09:20 [INFO ] Using JCE Unlimited Strength Jurisdiction Policy files
2021-07-27 08:09:20 [INFO ] Setting up HTTPS transport on port 8443
2021-07-27 08:09:20 [INFO ]    certificate alias = localhost
2021-07-27 08:09:20 [INFO ]    keyStorePath   = C:\soft\gitblit-1.9.1\data\serverKeyStore.jks
2021-07-27 08:09:20 [INFO ]    trustStorePath = C:\soft\gitblit-1.9.1\data\serverTrustStore.jks
2021-07-27 08:09:20 [INFO ]    crlPath        = C:\soft\gitblit-1.9.1\data\certs\caRevocationList.crl
2021-07-27 08:09:20 [INFO ] Setting up HTTP transport on port 8090
2021-07-27 08:09:20 [INFO ] Shutdown Monitor listening on port 8081
2021-07-27 08:09:20 [INFO ] jetty-9.2.13.v20150730
2021-07-27 08:09:30 [INFO ] NO JSP Support for /, did not find org.eclipse.jetty.jsp.JettyJspServlet
2021-07-27 08:09:30 [WARN ] FAILED o.e.j.w.WebAppContext@45312be2{/,file:/C:/soft/gitblit-1.9.1/data/temp/webapp/,STARTING}{file:/C:/soft/gitblit-1.9.1/gitblit.jar}: java.lang.ExceptionInInitializerError
java.lang.ExceptionInInitializerError
	at com.google.inject.internal.cglib.reflect.$FastClassEmitter.<init>(FastClassEmitter.java:67)
	at com.google.inject.internal.cglib.reflect.$FastClass$Generator.generateClass(FastClass.java:72)
	at com.google.inject.internal.cglib.core.$DefaultGeneratorStrategy.generate(DefaultGeneratorStrategy.java:25)
	at com.google.inject.internal.cglib.core.$AbstractClassGenerator.create(AbstractClassGenerator.java:216)
	at com.google.inject.internal.cglib.reflect.$FastClass$Generator.create(FastClass.java:64)
	at com.google.inject.internal.BytecodeGen.newFastClass(BytecodeGen.java:204)
	at com.google.inject.internal.ProviderMethod$FastClassProviderMethod.<init>(ProviderMethod.java:256)
	at com.google.inject.internal.ProviderMethod.create(ProviderMethod.java:71)
	at com.google.inject.internal.ProviderMethodsModule.createProviderMethod(ProviderMethodsModule.java:275)
	at com.google.inject.internal.ProviderMethodsModule.getProviderMethods(ProviderMethodsModule.java:144)
	at com.google.inject.internal.ProviderMethodsModule.configure(ProviderMethodsModule.java:123)
	at com.google.inject.spi.Elements$RecordingBinder.install(Elements.java:340)
	at com.google.inject.spi.Elements$RecordingBinder.install(Elements.java:349)
	at com.google.inject.AbstractModule.install(AbstractModule.java:122)
	at com.google.inject.servlet.ServletModule.configure(ServletModule.java:52)
	at com.google.inject.AbstractModule.configure(AbstractModule.java:62)
	at com.google.inject.spi.Elements$RecordingBinder.install(Elements.java:340)
	at com.google.inject.spi.Elements.getElements(Elements.java:110)
	at com.google.inject.internal.InjectorShell$Builder.build(InjectorShell.java:138)
	at com.google.inject.internal.InternalInjectorCreator.build(InternalInjectorCreator.java:104)
	at com.google.inject.Guice.createInjector(Guice.java:96)
	at com.google.inject.Guice.createInjector(Guice.java:73)
	at com.google.inject.Guice.createInjector(Guice.java:62)
	at com.gitblit.servlet.GitblitContext.getInjector(GitblitContext.java:127)
	at com.google.inject.servlet.GuiceServletContextListener.contextInitialized(GuiceServletContextListener.java:47)
	at com.gitblit.servlet.GitblitContext.contextInitialized(GitblitContext.java:145)
	at org.eclipse.jetty.server.handler.ContextHandler.callContextInitialized(ContextHandler.java:800)
	at org.eclipse.jetty.servlet.ServletContextHandler.callContextInitialized(ServletContextHandler.java:444)
	at org.eclipse.jetty.server.handler.ContextHandler.startContext(ContextHandler.java:791)
	at org.eclipse.jetty.servlet.ServletContextHandler.startContext(ServletContextHandler.java:294)
	at org.eclipse.jetty.webapp.WebAppContext.startWebapp(WebAppContext.java:1349)
	at org.eclipse.jetty.webapp.WebAppContext.startContext(WebAppContext.java:1342)
	at org.eclipse.jetty.server.handler.ContextHandler.doStart(ContextHandler.java:741)
	at org.eclipse.jetty.webapp.WebAppContext.doStart(WebAppContext.java:505)
	at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:68)
	at org.eclipse.jetty.util.component.ContainerLifeCycle.start(ContainerLifeCycle.java:132)
	at org.eclipse.jetty.server.Server.start(Server.java:387)
	at org.eclipse.jetty.util.component.ContainerLifeCycle.doStart(ContainerLifeCycle.java:114)
	at org.eclipse.jetty.server.handler.AbstractHandler.doStart(AbstractHandler.java:61)
	at org.eclipse.jetty.server.Server.doStart(Server.java:354)
	at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:68)
	at com.gitblit.GitBlitServer.start(GitBlitServer.java:465)
	at com.gitblit.GitBlitServer.main(GitBlitServer.java:124)
Caused by: java.lang.reflect.InaccessibleObjectException: Unable to make protected final java.lang.Class java.lang.ClassLoader.defineClass(java.lang.String,byte[],int,int,java.security.ProtectionDomain) throws java.lang.ClassFormatError accessible: module java.base does not "opens java.lang" to unnamed module @3b084709
	at java.base/java.lang.reflect.AccessibleObject.checkCanSetAccessible(AccessibleObject.java:357)
	at java.base/java.lang.reflect.AccessibleObject.checkCanSetAccessible(AccessibleObject.java:297)
	at java.base/java.lang.reflect.Method.checkCanSetAccessible(Method.java:199)
	at java.base/java.lang.reflect.Method.setAccessible(Method.java:193)
	at com.google.inject.internal.cglib.core.$ReflectUtils$2.run(ReflectUtils.java:56)
	at java.base/java.security.AccessController.doPrivileged(AccessController.java:312)
	at com.google.inject.internal.cglib.core.$ReflectUtils.<clinit>(ReflectUtils.java:46)
	... 43 more
2021-07-27 08:09:30 [INFO ] Started ServerConnector@6ebf0f36{SSL-HTTP/1.1}{0.0.0.0:8443}
2021-07-27 08:09:30 [INFO ] Started ServerConnector@18920cc{HTTP/1.1}{0.0.0.0:8090}
2021-07-27 08:09:30 [WARN ] FAILED org.eclipse.jetty.server.Server@2807bdeb: java.lang.ExceptionInInitializerError
java.lang.ExceptionInInitializerError
	at com.google.inject.internal.cglib.reflect.$FastClassEmitter.<init>(FastClassEmitter.java:67)
	at com.google.inject.internal.cglib.reflect.$FastClass$Generator.generateClass(FastClass.java:72)
	at com.google.inject.internal.cglib.core.$DefaultGeneratorStrategy.generate(DefaultGeneratorStrategy.java:25)
	at com.google.inject.internal.cglib.core.$AbstractClassGenerator.create(AbstractClassGenerator.java:216)
	at com.google.inject.internal.cglib.reflect.$FastClass$Generator.create(FastClass.java:64)
	at com.google.inject.internal.BytecodeGen.newFastClass(BytecodeGen.java:204)
	at com.google.inject.internal.ProviderMethod$FastClassProviderMethod.<init>(ProviderMethod.java:256)
	at com.google.inject.internal.ProviderMethod.create(ProviderMethod.java:71)
	at com.google.inject.internal.ProviderMethodsModule.createProviderMethod(ProviderMethodsModule.java:275)
	at com.google.inject.internal.ProviderMethodsModule.getProviderMethods(ProviderMethodsModule.java:144)
	at com.google.inject.internal.ProviderMethodsModule.configure(ProviderMethodsModule.java:123)
	at com.google.inject.spi.Elements$RecordingBinder.install(Elements.java:340)
	at com.google.inject.spi.Elements$RecordingBinder.install(Elements.java:349)
	at com.google.inject.AbstractModule.install(AbstractModule.java:122)
	at com.google.inject.servlet.ServletModule.configure(ServletModule.java:52)
	at com.google.inject.AbstractModule.configure(AbstractModule.java:62)
	at com.google.inject.spi.Elements$RecordingBinder.install(Elements.java:340)
	at com.google.inject.spi.Elements.getElements(Elements.java:110)
	at com.google.inject.internal.InjectorShell$Builder.build(InjectorShell.java:138)
	at com.google.inject.internal.InternalInjectorCreator.build(InternalInjectorCreator.java:104)
	at com.google.inject.Guice.createInjector(Guice.java:96)
	at com.google.inject.Guice.createInjector(Guice.java:73)
	at com.google.inject.Guice.createInjector(Guice.java:62)
	at com.gitblit.servlet.GitblitContext.getInjector(GitblitContext.java:127)
	at com.google.inject.servlet.GuiceServletContextListener.contextInitialized(GuiceServletContextListener.java:47)
	at com.gitblit.servlet.GitblitContext.contextInitialized(GitblitContext.java:145)
	at org.eclipse.jetty.server.handler.ContextHandler.callContextInitialized(ContextHandler.java:800)
	at org.eclipse.jetty.servlet.ServletContextHandler.callContextInitialized(ServletContextHandler.java:444)
	at org.eclipse.jetty.server.handler.ContextHandler.startContext(ContextHandler.java:791)
	at org.eclipse.jetty.servlet.ServletContextHandler.startContext(ServletContextHandler.java:294)
	at org.eclipse.jetty.webapp.WebAppContext.startWebapp(WebAppContext.java:1349)
	at org.eclipse.jetty.webapp.WebAppContext.startContext(WebAppContext.java:1342)
	at org.eclipse.jetty.server.handler.ContextHandler.doStart(ContextHandler.java:741)
	at org.eclipse.jetty.webapp.WebAppContext.doStart(WebAppContext.java:505)
	at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:68)
	at org.eclipse.jetty.util.component.ContainerLifeCycle.start(ContainerLifeCycle.java:132)
	at org.eclipse.jetty.server.Server.start(Server.java:387)
	at org.eclipse.jetty.util.component.ContainerLifeCycle.doStart(ContainerLifeCycle.java:114)
	at org.eclipse.jetty.server.handler.AbstractHandler.doStart(AbstractHandler.java:61)
	at org.eclipse.jetty.server.Server.doStart(Server.java:354)
	at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:68)
	at com.gitblit.GitBlitServer.start(GitBlitServer.java:465)
	at com.gitblit.GitBlitServer.main(GitBlitServer.java:124)
Caused by: java.lang.reflect.InaccessibleObjectException: Unable to make protected final java.lang.Class java.lang.ClassLoader.defineClass(java.lang.String,byte[],int,int,java.security.ProtectionDomain) throws java.lang.ClassFormatError accessible: module java.base does not "opens java.lang" to unnamed module @3b084709
	at java.base/java.lang.reflect.AccessibleObject.checkCanSetAccessible(AccessibleObject.java:357)
	at java.base/java.lang.reflect.AccessibleObject.checkCanSetAccessible(AccessibleObject.java:297)
	at java.base/java.lang.reflect.Method.checkCanSetAccessible(Method.java:199)
	at java.base/java.lang.reflect.Method.setAccessible(Method.java:193)
	at com.google.inject.internal.cglib.core.$ReflectUtils$2.run(ReflectUtils.java:56)
	at java.base/java.security.AccessController.doPrivileged(AccessController.java:312)
	at com.google.inject.internal.cglib.core.$ReflectUtils.<clinit>(ReflectUtils.java:46)
	... 43 more

When access http://localhost:8090, the browser shows TIMEOUT. This should be gitblit can not working with jave v16.

So, I use gitblit war, with java v16 and Tomcat9, extract gitblit war to tomcat/webapps, it works for me.

Thanks.

Originally posted by @x1244 in #1315 (comment)

@flaix
Copy link
Member Author

flaix commented Oct 20, 2021

A possible work-around would be to set the --illegal-access=permit parameter to the JVM command line.

@luy710
Copy link

luy710 commented Nov 24, 2021

A possible work-around would be to set the --illegal-access=permit parameter to the JVM command line.

How did you solve it

@flaix
Copy link
Member Author

flaix commented Nov 24, 2021

Who? The OP is running Gitblit as a WAR in a Tomcat application server, where this problem does not manifest.
The posted stack trace is from the stand-alone Gitblit GO version starting up.

@flaix
Copy link
Member Author

flaix commented Dec 9, 2021

The --illegal-access=permit parameter is not going to cut it, because from Java 17 on it is disabled. So as another workaround, the --add-opens option could be employed. Maybe. It helps for startup, to get around problems with Guice by setting it for java.base/java.lang=ALL-UNNAMED. But I found no application for accesses from Lucene when indexing. Which might be solved with dependency updates.
So a fix for this is left for version 1.10 and later.

@flaix
Copy link
Member Author

flaix commented Oct 27, 2022

I am going to close this issue in favour of #1420, because Java 17 is the current LTS release, so that is the one to target for Gitblit.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants