gitblit-org / gitblit

pure java git solution
http://gitblit.com
Apache License 2.0
2.27k stars 671 forks source link

Gitblit Manager launch issue #1407

Closed aimi617 closed 2 years ago

aimi617 commented 2 years ago

It seems the latest version of Gitblit Manager v1.9.2 is broken and doesn't start in Windows. At least 3 java classes are missing in \com\gitblit\client subfolder of manager.jar: GitblitManagerLauncher.class, GitblitManagerLauncher$1.class, GitblitManagerLauncher$2.class.

Also the manifest file \META-INF\Manifest.mf must be corrected at line 16: main-class: com.gitblit.client.GitblitManagerLauncher

After those changes, I could launch GM without issues by command: java -jar manager.jar (jre1.8.0_321 environment).

flaix commented 2 years ago

How did you start the manager in earlier versions of Gitblit? I have never used it and I find no mention of how to run it in the documentation.

aimi617 commented 2 years ago

Earlier versions of GM launched without issues, but versions v1.9.1 and v1.9.2 stopped running. Comparing the content of manager.jar I revealed the missing classes and incorrect manifest. To run GM in Windows, unpack manager-1.9.x.zip to any folder and execute the command "java -jar manager.jar" in console using environment java path, or make a batch file where you can put a path to java.exe, like "C:\Program Files\Java\jre...\bin\java.exe" -jar manager.jar. Please note, GM distributive doesn't run under JDK, use JRE only.

flaix commented 2 years ago

Please note that the GitblitManagerLauncher class was removed in Gitblit 1.9.0. This was so that Gitblit can run with Java9 or later. Java has changed how JARs can be loaded, so the mechanism to extend the class path during runtime, and thus add the JARs in the ext directory , can no longer be used in Java 9 and later. All the Launcher classes from the various Gitblit programs had to be removed.

To start the manager, you will unfortunately need to explicitly set the class path on the command line: java -cp manager.jar;"%CD%/ext/*" com.gitblit.client.GitblitManager

Or lInux/MacOS: java -cp "manager.jar:ext/*" com.gitblit.client.GitblitManager

aimi617 commented 2 years ago

Is it possible to use same lines on jre1.8.0 or jdk-17? And can you explain the meaning of "%CD%/ext/*", can I put a path explicitly to /ext/ folder in Windows?

Please note to setweb.enableRpcManagement = true and web.enableRpcAdministration = true in defaults.properties of Gitblit on a server.

flaix commented 2 years ago

Gitblit does currently not run with Java-17, due to other restrictions introduced in Java-17. For all other Java versions this is the only way to start the Manager, since the Launcher is no longer there and the JARs from the ext directory must be explicitly put on the class path.

The %CD% uses the Windows CD environment variable which resolves to the current path. So this still only works if you are in the directory with the manager.jarand ext directory. You can also simply use: java -cp "manager.jar;ext/*" com.gitblit.client.GitblitManager Well, I haven't tried it on Windows, but you should just as well be able to leave the %CD%out.

It is probably best to put this in a small BAT file.

aimi617 commented 2 years ago

Thanks, it works. I restored an original manager.jar from distributive and updated BAT file.