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

Can't start gitblit in windows --- java.lang.NoClassDefFoundError: org/kohsuke/args4j/CmdLineException #1294

Closed
sunilkumar1117 opened this issue Sep 25, 2018 · 2 comments
Milestone

Comments

@sunilkumar1117
Copy link

sunilkumar1117 commented Sep 25, 2018

HI
I am using below command to start gitblit.
java -jar gitblit-1.8.0.jar --baseFolder data.

But this is failing with below error.

java.lang.ClassCastException: java.base/jdk.internal.loader.ClassLoaders$AppClassLoader cannot be cast to java.base/java.net.URLClassLoader
at org.moxie.MxLauncher.addJarFile(MxLauncher.java:170)
at org.moxie.MxLauncher.main(MxLauncher.java:117)
java.lang.ClassCastException: java.base/jdk.internal.loader.ClassLoaders$AppClassLoader cannot be cast to java.base/java.net.URLClassLoader
at org.moxie.MxLauncher.addJarFile(MxLauncher.java:170)
at org.moxie.MxLauncher.main(MxLauncher.java:117)
java.lang.ClassCastException: java.base/jdk.internal.loader.ClassLoaders$AppClassLoader cannot be cast to java.base/java.net.URLClassLoader
at org.moxie.MxLauncher.addJarFile(MxLauncher.java:170)
at org.moxie.MxLauncher.main(MxLauncher.java:117)
Exception in thread "main" java.lang.NoClassDefFoundError: org/kohsuke/args4j/CmdLineException
at java.base/java.lang.Class.forName0(Native Method)
at java.base/java.lang.Class.forName(Unknown Source)
at org.moxie.MxLauncher.main(MxLauncher.java:127)
Caused by: java.lang.ClassNotFoundException: org.kohsuke.args4j.CmdLineException
at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(Unknown Source)
at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(Unknown Source)
at java.base/java.lang.ClassLoader.loadClass(Unknown Source)
... 3 more

I have java 10 installed on my windows desktop. I have set the path and classpath variable in environment variables.

@cnzf1
Copy link

cnzf1 commented Mar 27, 2019

I have the same problem, and I have consult a lot of data , but not get a effective idea.

@chirontt
Copy link

chirontt commented Jun 9, 2019

I'm not sure where you got the gitblit-1.8.0.jar file, but that jar is just part of a whole distribution package, like GitblitGO, to be used together. Information about the Gitblit GO package is here at the gitblit.com site.

Even when you get GitblitGO and set it up correctly as per instruction, gitblit only supports Java 7 and 8 runtimes. For Java 9+, you'll get exceptions similar to the above.

A workaround to make it run with Java 9+ is to modify the gitblit.cmd file and change it from:

@java -jar gitblit.jar --baseFolder data %*

to

@java -cp gitblit.jar;"%CD%\ext\*" com.gitblit.GitBlitServer --baseFolder data %*

and then start up the Gitblit server by executing the modified gitblit.cmd file.

@flaix flaix closed this as completed in b902e69 Nov 7, 2019
@flaix flaix added this to the 1.9.0 milestone Nov 7, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants