How to use JGit https authentication using Kerberos - java

I am trying to clone a git repository over https from a windows server. This server uses single-sign-on and therefore relates to kerberos5. Having little knowledge with that my simple code:
CloneCommand clone = Git.cloneRepository();
clone.setURI("https://gerrit.intra.infineon.com/dcgr/sys/sysbox");
clone.setCredentialsProvider(new UsernamePasswordCredentialsProvider("user", "pass"));
clone.setDirectory(new File("C:\\userdata\\temp\\gittest"));
clone.setBranch("master");
clone.call();
results in an exception:
org.eclipse.jgit.errors.TransportException: https://gerrit.mycompany.com/sampleRepo: cannot open git-upload-pack
at org.eclipse.jgit.transport.TransportHttp.connect(TransportHttp.java:518)
at org.eclipse.jgit.transport.TransportHttp.openFetch(TransportHttp.java:296)
at org.eclipse.jgit.transport.FetchProcess.executeImp(FetchProcess.java:136)
at org.eclipse.jgit.transport.FetchProcess.execute(FetchProcess.java:122)
at org.eclipse.jgit.transport.Transport.fetch(Transport.java:1138)
at org.eclipse.jgit.api.FetchCommand.call(FetchCommand.java:130)
... 22 more
Caused by: java.io.IOException
at org.eclipse.jgit.transport.HttpAuthMethod$Negotiate.configureRequest(HttpAuthMethod.java:547)
at org.eclipse.jgit.transport.TransportHttp.httpOpen(TransportHttp.java:561)
at org.eclipse.jgit.transport.TransportHttp.httpOpen(TransportHttp.java:523)
at org.eclipse.jgit.transport.TransportHttp.connect(TransportHttp.java:462)
... 27 more
Caused by: GSSException: No valid credentials provided (Mechanism level: No valid credentials provided (Mechanism level: Attempt to obtain new INITIATE credentials failed! (null)))
at sun.security.jgss.spnego.SpNegoContext.initSecContext(SpNegoContext.java:454)
at sun.security.jgss.GSSContextImpl.initSecContext(GSSContextImpl.java:248)
at sun.security.jgss.GSSContextImpl.initSecContext(GSSContextImpl.java:179)
at org.eclipse.jgit.transport.HttpAuthMethod$Negotiate.configureRequest(HttpAuthMethod.java:541)
... 30 more
Caused by: GSSException: No valid credentials provided (Mechanism level: Attempt to obtain new INITIATE credentials failed! (null))
at sun.security.jgss.krb5.Krb5InitCredential.getTgt(Krb5InitCredential.java:343)
at sun.security.jgss.krb5.Krb5InitCredential.getInstance(Krb5InitCredential.java:145)
at sun.security.jgss.krb5.Krb5MechFactory.getCredentialElement(Krb5MechFactory.java:122)
at sun.security.jgss.krb5.Krb5MechFactory.getMechanismContext(Krb5MechFactory.java:187)
at sun.security.jgss.GSSManagerImpl.getMechanismContext(GSSManagerImpl.java:224)
at sun.security.jgss.GSSContextImpl.initSecContext(GSSContextImpl.java:212)
at sun.security.jgss.GSSContextImpl.initSecContext(GSSContextImpl.java:179)
at sun.security.jgss.spnego.SpNegoContext.GSS_initSecContext(SpNegoContext.java:875)
at sun.security.jgss.spnego.SpNegoContext.initSecContext(SpNegoContext.java:317)
... 33 more
Caused by: javax.security.auth.login.LoginException: No password provided
at com.sun.security.auth.module.Krb5LoginModule.promptForPass(Krb5LoginModule.java:919)
at com.sun.security.auth.module.Krb5LoginModule.attemptAuthentication(Krb5LoginModule.java:760)
at com.sun.security.auth.module.Krb5LoginModule.login(Krb5LoginModule.java:617)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:497)
at javax.security.auth.login.LoginContext.invoke(LoginContext.java:755)
at javax.security.auth.login.LoginContext.access$000(LoginContext.java:195)
at javax.security.auth.login.LoginContext$4.run(LoginContext.java:682)
at javax.security.auth.login.LoginContext$4.run(LoginContext.java:680)
at java.security.AccessController.doPrivileged(Native Method)
at javax.security.auth.login.LoginContext.invokePriv(LoginContext.java:680)
at javax.security.auth.login.LoginContext.login(LoginContext.java:587)
at sun.security.jgss.GSSUtil.login(GSSUtil.java:255)
at sun.security.jgss.krb5.Krb5Util.getTicket(Krb5Util.java:158)
at sun.security.jgss.krb5.Krb5InitCredential$1.run(Krb5InitCredential.java:335)
at sun.security.jgss.krb5.Krb5InitCredential$1.run(Krb5InitCredential.java:331)
at java.security.AccessController.doPrivileged(Native Method)
at sun.security.jgss.krb5.Krb5InitCredential.getTgt(Krb5InitCredential.java:330)
... 41 more
The error message "No password provided" seems odd to me. Has anyone already done this and can come up with a working example?

Related

Javafx image is not found

i have this code in my JavaFX code
Image arrowRight = new Image("/Users/murad/Desktop/arrowright.png");
ImageView arrowRightv = new ImageView(arrowRight);
My goal is to find the image that is on my desktop and then to put it on the screen.But this code returns me this error:
java.lang.reflect.InvocationTargetException
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62
)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl
.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at com.sun.javafx.application.LauncherImpl.launchApplicationWithArgs(LauncherIm
pl.java:389)
at com.sun.javafx.application.LauncherImpl.launchApplication(LauncherImpl.java:
328)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62
)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl
.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at sun.launcher.LauncherHelper$FXHelper.main(LauncherHelper.java:767)
Caused by: java.lang.RuntimeException: Exception in Application start method
at com.sun.javafx.application.LauncherImpl.launchApplication1(LauncherImpl.java
:917)
at com.sun.javafx.application.LauncherImpl.lambda$launchApplication$155(Launche
rImpl.java:182)
at java.lang.Thread.run(Thread.java:745)
Caused by: java.lang.IllegalArgumentException: Invalid URL: unknown protocol: c
at javafx.scene.image.Image.validateUrl(Image.java:1121)
at javafx.scene.image.Image.<init>(Image.java:620)
at Kanban.start(Kanban.java:152)
at com.sun.javafx.application.LauncherImpl.lambda$launchApplication1$162(Launch
erImpl.java:863)
at com.sun.javafx.application.PlatformImpl.lambda$runAndWait$175(PlatformImpl.j
ava:326)
at com.sun.javafx.application.PlatformImpl.lambda$null$173(PlatformImpl.java:29
5)
at java.security.AccessController.doPrivileged(Native Method)
at com.sun.javafx.application.PlatformImpl.lambda$runLater$174(PlatformImpl.jav
a:294)
at com.sun.glass.ui.InvokeLaterDispatcher$Future.run(InvokeLaterDispatcher.java
:95)
Caused by: java.net.MalformedURLException: unknown protocol: c
at java.net.URL.<init>(URL.java:600)
at java.net.URL.<init>(URL.java:490)
at java.net.URL.<init>(URL.java:439)
at javafx.scene.image.Image.validateUrl(Image.java:1115)
... 8 more
I tried doing what i did above with FileInputStream,but that didn't work.Also i got the url from Mac,so it's definitely not wrong.
What am i doing wrong?
The parameter is an URL,
"file:/Users/murad/Desktop/arrowright.png"
The error show that you were on Windows with "c:/...." - hence the error that no protocol c exists. ("file:///c:/...").

why set port to 80 failed in undertow server? (java)

When I "mvn exec:java" the java program, I have problems to set port to 80, but 8080 can be successful.
Undertow server = Undertow.builder()
.addHttpListener(80, "localhost")
.setHandler(path)
.build();
server.start();
when I set it as 80, i got exceptions like
java.lang.reflect.InvocationTargetException
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.codehaus.mojo.exec.ExecJavaMojo$1.run(ExecJavaMojo.java:297)
at java.lang.Thread.run(Thread.java:745)
Caused by: java.lang.RuntimeException: java.net.SocketException: Permission denied
at io.undertow.Undertow.start(Undertow.java:141)
at cc.cmu.edu.Q1.Q1Controller.main(Q1Controller.java:46)
... 6 more
Caused by: java.net.SocketException: Permission denied
at sun.nio.ch.Net.bind0(Native Method)
at sun.nio.ch.Net.bind(Net.java:433)
at sun.nio.ch.Net.bind(Net.java:425)
at sun.nio.ch.ServerSocketChannelImpl.bind(ServerSocketChannelImpl.java:223)
at sun.nio.ch.ServerSocketAdaptor.bind(ServerSocketAdaptor.java:74)
at sun.nio.ch.ServerSocketAdaptor.bind(ServerSocketAdaptor.java:67)
at org.xnio.nio.NioXnioWorker.createTcpConnectionServer(NioXnioWorker.java:175)
at org.xnio.XnioWorker.createStreamConnectionServer(XnioWorker.java:242)
at io.undertow.Undertow.start(Undertow.java:120)
... 7 more
You need root access to be able to listen on all ports below 1024.
Start your application as root, or with a sudo command.

Phoenix connection throws error message "Failed to find any Kerberos tgt" after running for some time

I am using Phoenix to connect to secure HBase. It runs well when the client starts up. I can connect to HBase an query the data from HBase. The Phoenix JDBC connection is in the connection pool and doesn't close. But after a few hours, I can't query anything from HBase using the same connection. I have to restart the client in order to make my application work. The error messages are:
Caused by: org.apache.hadoop.hbase.client.RetriesExhaustedException: Failed after attempts=1, exceptions:
Fri Nov 11 06:24:01 CST 2016, RpcRetryingCaller{globalStartTime=1478867041301, pause=100, retries=1}, java.io.IOException: Could not set up IO Streams to <regionserver>/<ip_address>:60020
at org.apache.hadoop.hbase.client.RpcRetryingCaller.callWithRetries(RpcRetryingCaller.java:147) ~[hbase-client-1.0.1.jar:1.0.1]
at org.apache.hadoop.hbase.ipc.RegionCoprocessorRpcChannel.callExecService(RegionCoprocessorRpcChannel.java:95) ~[hbase-client-1.0.1.jar:1.0.1]
at org.apache.hadoop.hbase.ipc.CoprocessorRpcChannel.callMethod(CoprocessorRpcChannel.java:56) ~[hbase-client-1.0.1.jar:1.0.1]
at org.apache.phoenix.coprocessor.generated.MetaDataProtos$MetaDataService$Stub.getTable(MetaDataProtos.java:11769) ~[phoenix-core-4.5.1-HBase-1.0.jar:4.5.1-HBase-1.0]
at org.apache.phoenix.query.ConnectionQueryServicesImpl$7.call(ConnectionQueryServicesImpl.java:1301) ~[phoenix-core-4.5.1-HBase-1.0.jar:4.5.1-HBase-1.0]
at org.apache.phoenix.query.ConnectionQueryServicesImpl$7.call(ConnectionQueryServicesImpl.java:1288) ~[phoenix-core-4.5.1-HBase-1.0.jar:4.5.1-HBase-1.0]
at org.apache.hadoop.hbase.client.HTable$16.call(HTable.java:1737) ~[hbase-client-1.0.1.jar:1.0.1]
at java.util.concurrent.FutureTask.run(FutureTask.java:262) ~[na:1.7.0_79]
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145) [na:1.7.0_79]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615) [na:1.7.0_79]
... 1 common frames omitted
Caused by: java.io.IOException: Could not set up IO Streams to <regionserver>/<ip_address>:60020
at org.apache.hadoop.hbase.ipc.RpcClientImpl$Connection.setupIOstreams(RpcClientImpl.java:772) ~[hbase-client-1.0.1.jar:1.0.1]
at org.apache.hadoop.hbase.ipc.RpcClientImpl$Connection.writeRequest(RpcClientImpl.java:880) ~[hbase-client-1.0.1.jar:1.0.1]
at org.apache.hadoop.hbase.ipc.RpcClientImpl$Connection.tracedWriteRequest(RpcClientImpl.java:849) ~[hbase-client-1.0.1.jar:1.0.1]
at org.apache.hadoop.hbase.ipc.RpcClientImpl.call(RpcClientImpl.java:1173) ~[hbase-client-1.0.1.jar:1.0.1]
at org.apache.hadoop.hbase.ipc.AbstractRpcClient.callBlockingMethod(AbstractRpcClient.java:216) ~[hbase-client-1.0.1.jar:1.0.1]
at org.apache.hadoop.hbase.ipc.AbstractRpcClient$BlockingRpcChannelImplementation.callBlockingMethod(AbstractRpcClient.java:300) ~[hbase-client-1.0.1.jar:1.0.1]
at org.apache.hadoop.hbase.protobuf.generated.ClientProtos$ClientService$BlockingStub.execService(ClientProtos.java:31913) ~[hbase-protocol-1.0.1.jar:1.0.1]
at org.apache.hadoop.hbase.protobuf.ProtobufUtil.execService(ProtobufUtil.java:1605) ~[hbase-client-1.0.1.jar:1.0.1]
at org.apache.hadoop.hbase.ipc.RegionCoprocessorRpcChannel$1.call(RegionCoprocessorRpcChannel.java:92) ~[hbase-client-1.0.1.jar:1.0.1]
at org.apache.hadoop.hbase.ipc.RegionCoprocessorRpcChannel$1.call(RegionCoprocessorRpcChannel.java:89) ~[hbase-client-1.0.1.jar:1.0.1]
at org.apache.hadoop.hbase.client.RpcRetryingCaller.callWithRetries(RpcRetryingCaller.java:126) ~[hbase-client-1.0.1.jar:1.0.1]
... 10 common frames omitted
Caused by: java.lang.RuntimeException: SASL authentication failed. The most likely cause is missing or invalid credentials. Consider 'kinit'.
at org.apache.hadoop.hbase.ipc.RpcClientImpl$Connection$1.run(RpcClientImpl.java:672) ~[hbase-client-1.0.1.jar:1.0.1]
at java.security.AccessController.doPrivileged(Native Method) ~[na:1.7.0_79]
at javax.security.auth.Subject.doAs(Subject.java:415) ~[na:1.7.0_79]
at org.apache.hadoop.security.UserGroupInformation.doAs(UserGroupInformation.java:1628) ~[hadoop-common-2.6.0.jar:na]
at org.apache.hadoop.hbase.ipc.RpcClientImpl$Connection.handleSaslConnectionFailure(RpcClientImpl.java:630) ~[hbase-client-1.0.1.jar:1.0.1]
at org.apache.hadoop.hbase.ipc.RpcClientImpl$Connection.setupIOstreams(RpcClientImpl.java:738) ~[hbase-client-1.0.1.jar:1.0.1]
... 20 common frames omitted
Caused by: javax.security.sasl.SaslException: GSS initiate failed
at com.sun.security.sasl.gsskerb.GssKrb5Client.evaluateChallenge(GssKrb5Client.java:212) ~[na:1.7.0_79]
at org.apache.hadoop.hbase.security.HBaseSaslRpcClient.saslConnect(HBaseSaslRpcClient.java:179) ~[hbase-client-1.0.1.jar:1.0.1]
at org.apache.hadoop.hbase.ipc.RpcClientImpl$Connection.setupSaslConnection(RpcClientImpl.java:604) ~[hbase-client-1.0.1.jar:1.0.1]
at org.apache.hadoop.hbase.ipc.RpcClientImpl$Connection.access$600(RpcClientImpl.java:153) ~[hbase-client-1.0.1.jar:1.0.1]
at org.apache.hadoop.hbase.ipc.RpcClientImpl$Connection$2.run(RpcClientImpl.java:730) ~[hbase-client-1.0.1.jar:1.0.1]
at org.apache.hadoop.hbase.ipc.RpcClientImpl$Connection$2.run(RpcClientImpl.java:727) ~[hbase-client-1.0.1.jar:1.0.1]
at java.security.AccessController.doPrivileged(Native Method) ~[na:1.7.0_79]
at javax.security.auth.Subject.doAs(Subject.java:415) ~[na:1.7.0_79]
at org.apache.hadoop.security.UserGroupInformation.doAs(UserGroupInformation.java:1628) ~[hadoop-common-2.6.0.jar:na]
at org.apache.hadoop.hbase.ipc.RpcClientImpl$Connection.setupIOstreams(RpcClientImpl.java:727) ~[hbase-client-1.0.1.jar:1.0.1]
... 20 common frames omitted
Caused by: org.ietf.jgss.GSSException: No valid credentials provided (Mechanism level: Failed to find any Kerberos tgt)
at sun.security.jgss.krb5.Krb5InitCredential.getInstance(Krb5InitCredential.java:147) ~[na:1.7.0_79]
at sun.security.jgss.krb5.Krb5MechFactory.getCredentialElement(Krb5MechFactory.java:121) ~[na:1.7.0_79]
at sun.security.jgss.krb5.Krb5MechFactory.getMechanismContext(Krb5MechFactory.java:187) ~[na:1.7.0_79]
at sun.security.jgss.GSSManagerImpl.getMechanismContext(GSSManagerImpl.java:223) ~[na:1.7.0_79]
at sun.security.jgss.GSSContextImpl.initSecContext(GSSContextImpl.java:212) ~[na:1.7.0_79]
at sun.security.jgss.GSSContextImpl.initSecContext(GSSContextImpl.java:179) ~[na:1.7.0_79]
at com.sun.security.sasl.gsskerb.GssKrb5Client.evaluateChallenge(GssKrb5Client.java:193) ~[na:1.7.0_79]
... 29 common frames omitted
The credentials may have expired. Do klist at the client and regionserver to see valid tickets when:
you can connect
you cannot connect
Our env: HDP 2.5
We should follow this to auto renew when it is nearing expiry.
Kerberos Tickets expire after a day. So on restarts it will work and last for next 24 hours.
We can auto renew thru this approach
HBase Kerberos connection renewal strategy

wso2am-1.10.0: ERROR - NioEndpoint$SocketProcessor

WSO2 Api Manager's Carbon and Publisher Links Not Working
After starting up wso2-am server as mentioned in its documentation: WSO2 API Manager Documentation / Running the Product only store link is working while accessing the other two components (i.e. carbon and publisher) following exception is occurring every time I'm hitting their URLs:
java.lang.RuntimeException: java.security.NoSuchAlgorithmException: class configured for AlgorithmParameters (provider: SunEC) cannot be found.
at sun.security.ssl.Handshaker.checkThrown(Handshaker.java:1373)
at sun.security.ssl.SSLEngineImpl.checkTaskThrown(SSLEngineImpl.java:529)
at sun.security.ssl.SSLEngineImpl.readNetRecord(SSLEngineImpl.java:807)
at sun.security.ssl.SSLEngineImpl.unwrap(SSLEngineImpl.java:775)
at javax.net.ssl.SSLEngine.unwrap(SSLEngine.java:624)
at org.apache.tomcat.util.net.SecureNioChannel.handshakeUnwrap(SecureNioChannel.java:335)
at org.apache.tomcat.util.net.SecureNioChannel.handshake(SecureNioChannel.java:193)
at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1715)
at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.run(NioEndpoint.java:1698)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
at java.lang.Thread.run(Thread.java:745)
Caused by: java.lang.RuntimeException: java.security.NoSuchAlgorithmException: class configured for AlgorithmParameters (provider: SunEC) cannot be found.
at sun.security.util.ECUtil.getECParameters(ECUtil.java:141)
at sun.security.util.ECUtil.getCurveName(ECUtil.java:214)
at sun.security.ssl.JsseJce.getNamedCurveOid(JsseJce.java:389)
at sun.security.ssl.SupportedEllipticCurvesExtension.getCurveIndex(SupportedEllipticCurvesExtension.java:161)
at sun.security.ssl.HandshakeMessage$ECDH_ServerKeyExchange.<init>(HandshakeMessage.java:1011)
at sun.security.ssl.ServerHandshaker.clientHello(ServerHandshaker.java:884)
at sun.security.ssl.ServerHandshaker.processMessage(ServerHandshaker.java:213)
at sun.security.ssl.Handshaker.processLoop(Handshaker.java:936)
at sun.security.ssl.Handshaker$1.run(Handshaker.java:876)
at sun.security.ssl.Handshaker$1.run(Handshaker.java:873)
at java.security.AccessController.doPrivileged(Native Method)
at sun.security.ssl.Handshaker$DelegatedTask.run(Handshaker.java:1313)
at org.apache.tomcat.util.net.SecureNioChannel.tasks(SecureNioChannel.java:285)
at org.apache.tomcat.util.net.SecureNioChannel.handshakeUnwrap(SecureNioChannel.java:343)
... 7 more
Caused by: java.security.NoSuchAlgorithmException: class configured for AlgorithmParameters (provider: SunEC) cannot be found.
at java.security.Provider$Service.getImplClass(Provider.java:1649)
at java.security.Provider$Service.newInstance(Provider.java:1592)
at sun.security.jca.GetInstance.getInstance(GetInstance.java:236)
at sun.security.jca.GetInstance.getInstance(GetInstance.java:164)
at java.security.Security.getImpl(Security.java:695)
at java.security.AlgorithmParameters.getInstance(AlgorithmParameters.java:146)
at sun.security.util.ECUtil.getECParameters(ECUtil.java:139)
... 20 more
Caused by: java.lang.ClassNotFoundException: sun.security.ec.ECParameters
at java.net.URLClassLoader$1.run(URLClassLoader.java:372)
at java.net.URLClassLoader$1.run(URLClassLoader.java:361)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:360)
at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
at java.security.Provider$Service.getImplClass(Provider.java:1636)
... 26 more
I'm also getting the same exceptions with WSO2 Api Manager's latest version: 2.0.0.
Kindly show me how to tackle it and what's the main cause of such an exception. By the way I'm using Windows 7 Ultimate and JDK 1.8.

Gerrit - plugin gerrit-owners-autoassign-1.1 install issue

I am having the following Stacktrace:
[2015-10-15 19:29:09,264] WARN
com.google.gerrit.server.plugins.PluginLoader : Cannot load plugin
gerrit-owners-autoassign-1.1
com.google.common.util.concurrent.ExecutionError:
com.google.common.util.concurrent.ExecutionError:
java.lang.NoClassDefFoundError:
com/google/gerrit/extensions/events/GitReferenceUpdatedListener$Update
at
com.google.common.cache.LocalCache$Segment.get(LocalCache.java:2201)
at com.google.common.cache.LocalCache.get(LocalCache.java:3937) at
com.google.common.cache.LocalCache.getOrLoad(LocalCache.java:3941) at
com.google.common.cache.LocalCache$LocalLoadingCache.get(LocalCache.java:4824)
at
com.google.common.cache.LocalCache$LocalLoadingCache.getUnchecked(LocalCache.java:4830)
at
com.google.inject.internal.FailableCache.get(FailableCache.java:48)
at
com.google.inject.internal.ConstructorInjectorStore.get(ConstructorInjectorStore.java:50)
at
com.google.inject.internal.ConstructorBindingImpl.initialize(ConstructorBindingImpl.java:136)
at
com.google.inject.internal.InjectorImpl.initializeBinding(InjectorImpl.java:533)
at
com.google.inject.internal.AbstractBindingProcessor$Processor$1.run(AbstractBindingProcessor.java:160)
at
com.google.inject.internal.ProcessedBindingData.initializeBindings(ProcessedBindingData.java:44)
at
com.google.inject.internal.InternalInjectorCreator.initializeStatically(InternalInjectorCreator.java:123)
at
com.google.inject.internal.InternalInjectorCreator.build(InternalInjectorCreator.java:107)
at
com.google.inject.internal.InjectorImpl.createChildInjector(InjectorImpl.java:226)
at
com.google.inject.internal.InjectorImpl.createChildInjector(InjectorImpl.java:233)
at
com.google.gerrit.server.plugins.ServerPlugin.startPlugin(ServerPlugin.java:190)
at
com.google.gerrit.server.plugins.ServerPlugin.start(ServerPlugin.java:170)
at
com.google.gerrit.server.plugins.PluginLoader.runPlugin(PluginLoader.java:461)
at
com.google.gerrit.server.plugins.PluginLoader.rescan(PluginLoader.java:390)
at
com.google.gerrit.server.plugins.PluginLoader.start(PluginLoader.java:295)
at
com.google.gerrit.lifecycle.LifecycleManager.start(LifecycleManager.java:74)
at com.google.gerrit.pgm.Daemon.start(Daemon.java:293) at
com.google.gerrit.pgm.Daemon.run(Daemon.java:205) at
com.google.gerrit.pgm.util.AbstractProgram.main(AbstractProgram.java:64)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:606) at
com.google.gerrit.launcher.GerritLauncher.invokeProgram(GerritLauncher.java:166)
at
com.google.gerrit.launcher.GerritLauncher.mainImpl(GerritLauncher.java:93)
at
com.google.gerrit.launcher.GerritLauncher.main(GerritLauncher.java:50)
at Main.main(Main.java:25) Caused by:
com.google.common.util.concurrent.ExecutionError:
java.lang.NoClassDefFoundError:
com/google/gerrit/extensions/events/GitReferenceUpdatedListener$Update
at
com.google.common.cache.LocalCache$Segment.get(LocalCache.java:2201)
at com.google.common.cache.LocalCache.get(LocalCache.java:3937) at
com.google.common.cache.LocalCache.getOrLoad(LocalCache.java:3941) at
com.google.common.cache.LocalCache$LocalLoadingCache.get(LocalCache.java:4824)
at
com.google.common.cache.LocalCache$LocalLoadingCache.getUnchecked(LocalCache.java:4830)
at
com.google.inject.internal.FailableCache.get(FailableCache.java:48)
at
com.google.inject.internal.MembersInjectorStore.get(MembersInjectorStore.java:68)
at
com.google.inject.internal.ConstructorInjectorStore.createConstructor(ConstructorInjectorStore.java:74)
at
com.google.inject.internal.ConstructorInjectorStore.access$000(ConstructorInjectorStore.java:29)
at
com.google.inject.internal.ConstructorInjectorStore$1.create(ConstructorInjectorStore.java:37)
at
com.google.inject.internal.ConstructorInjectorStore$1.create(ConstructorInjectorStore.java:33)
at
com.google.inject.internal.FailableCache$1.load(FailableCache.java:37)
at
com.google.common.cache.LocalCache$LoadingValueReference.loadFuture(LocalCache.java:3527)
at
com.google.common.cache.LocalCache$Segment.loadSync(LocalCache.java:2319)
at
com.google.common.cache.LocalCache$Segment.lockedGetOrLoad(LocalCache.java:2282)
at
com.google.common.cache.LocalCache$Segment.get(LocalCache.java:2197)
... 31 more Caused by: java.lang.NoClassDefFoundError:
com/google/gerrit/extensions/events/GitReferenceUpdatedListener$Update
at java.lang.Class.getDeclaredMethods0(Native Method) at
java.lang.Class.privateGetDeclaredMethods(Class.java:2615) at
java.lang.Class.getDeclaredMethods(Class.java:1860) at
com.google.inject.spi.InjectionPoint.getInjectionPoints(InjectionPoint.java:688)
at
com.google.inject.spi.InjectionPoint.forInstanceMethodsAndFields(InjectionPoint.java:380)
at
com.google.inject.internal.MembersInjectorStore.createWithListeners(MembersInjectorStore.java:93)
at
com.google.inject.internal.MembersInjectorStore.access$000(MembersInjectorStore.java:37)
at
com.google.inject.internal.MembersInjectorStore$1.create(MembersInjectorStore.java:45)
at
com.google.inject.internal.MembersInjectorStore$1.create(MembersInjectorStore.java:42)
at
com.google.inject.internal.FailableCache$1.load(FailableCache.java:37)
at
com.google.common.cache.LocalCache$LoadingValueReference.loadFuture(LocalCache.java:3527)
at
com.google.common.cache.LocalCache$Segment.loadSync(LocalCache.java:2319)
at
com.google.common.cache.LocalCache$Segment.lockedGetOrLoad(LocalCache.java:2282)
at
com.google.common.cache.LocalCache$Segment.get(LocalCache.java:2197)
... 46 more Caused by: java.lang.ClassNotFoundException:
com.google.gerrit.extensions.events.GitReferenceUpdatedListener$Update
at java.net.URLClassLoader$1.run(URLClassLoader.java:366) at
java.net.URLClassLoader$1.run(URLClassLoader.java:355) at
java.security.AccessController.doPrivileged(Native Method) at
java.net.URLClassLoader.findClass(URLClassLoader.java:354) at
java.lang.ClassLoader.loadClass(ClassLoader.java:425) at
java.lang.ClassLoader.loadClass(ClassLoader.java:358) ... 60 more
I am not really sure what I should look into to fix it.
This looks like a mismatch between the API version that the plugin was built against, and the API version of the Gerrit server.
java.lang.NoClassDefFoundError: com/google/gerrit/extensions/events/GitReferenceUpdatedListener$Update
The GitReferenceUpdatedListener.Update class was removed from the API in Gerrit version 2.8.
To fix this you should first check which version of Gerrit your server is running, and then make sure you've built the plugin against the API with the corresponding version.
I followed the instruction and ended up compiling the plugin with both changes submitted in here: https://github.com/vadims/gerrit-owners/issues/6 (look for the 2 forked repo) and it did work.
It was painful but the plugin does an awesome job so worth the effort!

Categories