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

OSGi: ClassNotFoundException: javax.security.cert.X509Certificate cannot be found by io.etcd.jetcd-all_0.3.0.SNAPSHOT #382

Closed
vorburger opened this issue Sep 6, 2018 · 3 comments · Fixed by #385
Assignees

Comments

@vorburger
Copy link
Member

I'm hitting this while playing over in https://github.com/vorburger/opendaylight-etcd :

[INFO] --- maven-surefire-plugin:2.18.1:test (default) @ odl-etcd-demo-restconf ---
[INFO] Surefire report directory: /home/vorburger/dev/ODL/git.etcd/opendaylight-etcd/features/odl-etcd-demo-restconf/target/surefire-reports

-------------------------------------------------------
 T E S T S
-------------------------------------------------------
Running org.opendaylight.odlparent.featuretest.SingleFeatureTest

Tests run: 1, Failures: 0, Errors: 1, Skipped: 0, Time elapsed: 41.393 sec <<< FAILURE! - in org.opendaylight.odlparent.featuretest.SingleFeatureTest
installFeatureCatchAndLog(org.opendaylight.odlparent.featuretest.SingleFeatureTest)[repoUrl: file:/home/vorburger/dev/ODL/git.etcd/opendaylight-etcd/features/odl-etcd-demo-restconf/target/feature/feature.xml, Feature: odl-etcd-demo-restconf 0.0.1.SNAPSHOT]  Time elapsed: 39.831 sec  <<< ERROR!
org.opendaylight.odlparent.bundlestest.lib.SystemStateFailureException: diag failed; some bundles failed to start
diag: Failure {Installed=0, Resolved=4, Unknown=0, GracePeriod=9, Waiting=0, Starting=0, Active=295, Stopping=0, Failure=1}

(...)

7. NOK org.opendaylight.etcd.ds:0.0.1.SNAPSHOT: OSGi state = Active, Karaf bundleState = Failure, due to: Blueprint
6/9/18 5:21 PM
Exception: 
org.osgi.service.blueprint.container.ComponentDefinitionException: Error when instantiating bean etcdDOMDataBroker of class org.opendaylight.etcd.ds.impl.EtcdDOMDataBroker
org.osgi.service.blueprint.container.ComponentDefinitionException: org.osgi.service.blueprint.container.ComponentDefinitionException: Error when instantiating bean etcdDOMDataBroker of class org.opendaylight.etcd.ds.impl.EtcdDOMDataBroker
	at org.apache.aries.blueprint.container.ServiceRecipe.createService(ServiceRecipe.java:310)
	at org.apache.aries.blueprint.container.ServiceRecipe.internalGetService(ServiceRecipe.java:252)
	at org.apache.aries.blueprint.container.ServiceRecipe.internalCreate(ServiceRecipe.java:149)
	at org.apache.aries.blueprint.di.AbstractRecipe$1.call(AbstractRecipe.java:79)
	at java.util.concurrent.FutureTask.run(FutureTask.java:266)
	at org.apache.aries.blueprint.di.AbstractRecipe.create(AbstractRecipe.java:88)
	at org.apache.aries.blueprint.container.BlueprintRepository.createInstances(BlueprintRepository.java:255)
	at org.apache.aries.blueprint.container.BlueprintRepository.createAll(BlueprintRepository.java:186)
	at org.apache.aries.blueprint.container.BlueprintContainerImpl.instantiateEagerComponents(BlueprintContainerImpl.java:704)
	at org.apache.aries.blueprint.container.BlueprintContainerImpl.doRun(BlueprintContainerImpl.java:410)
	at org.apache.aries.blueprint.container.BlueprintContainerImpl.run(BlueprintContainerImpl.java:275)
	at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
	at java.util.concurrent.FutureTask.run(FutureTask.java:266)
	at org.apache.aries.blueprint.container.ExecutorServiceWrapper.run(ExecutorServiceWrapper.java:106)
	at org.apache.aries.blueprint.utils.threading.impl.DiscardableRunnable.run(DiscardableRunnable.java:48)
	at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
	at java.util.concurrent.FutureTask.run(FutureTask.java:266)
	at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$201(ScheduledThreadPoolExecutor.java:180)
	at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:293)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
	at java.lang.Thread.run(Thread.java:748)
Caused by: org.osgi.service.blueprint.container.ComponentDefinitionException: Error when instantiating bean etcdDOMDataBroker of class org.opendaylight.etcd.ds.impl.EtcdDOMDataBroker
	at org.apache.aries.blueprint.container.BeanRecipe.wrapAsCompDefEx(BeanRecipe.java:361)
	at org.apache.aries.blueprint.container.BeanRecipe.getInstanceFromType(BeanRecipe.java:351)
	at org.apache.aries.blueprint.container.BeanRecipe.getInstance(BeanRecipe.java:282)
	at org.apache.aries.blueprint.container.BeanRecipe.internalCreate2(BeanRecipe.java:830)
	at org.apache.aries.blueprint.container.BeanRecipe.internalCreate(BeanRecipe.java:811)
	at org.apache.aries.blueprint.di.AbstractRecipe$1.call(AbstractRecipe.java:79)
	at java.util.concurrent.FutureTask.run(FutureTask.java:266)
	at org.apache.aries.blueprint.di.AbstractRecipe.create(AbstractRecipe.java:88)
	at org.apache.aries.blueprint.di.RefRecipe.internalCreate(RefRecipe.java:62)
	at org.apache.aries.blueprint.di.AbstractRecipe.create(AbstractRecipe.java:106)
	at org.apache.aries.blueprint.container.ServiceRecipe.createService(ServiceRecipe.java:285)
	... 21 more
Caused by: org.opendaylight.etcd.ds.impl.EtcdException: failed to connect (in time) to etcd server
	at org.opendaylight.etcd.ds.impl.EtcdServerUtils.getServerHeader(EtcdServerUtils.java:40)
	at org.opendaylight.etcd.ds.impl.EtcdServerUtils.getServerRevision(EtcdServerUtils.java:33)
	at org.opendaylight.etcd.ds.impl.EtcdDOMDataBrokerProvider.init(EtcdDOMDataBrokerProvider.java:90)
	at org.opendaylight.etcd.ds.impl.EtcdDOMDataBroker.<init>(EtcdDOMDataBroker.java:43)
	at org.opendaylight.etcd.ds.impl.EtcdDOMDataBroker.<init>(EtcdDOMDataBroker.java:36)
	at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
	at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
	at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
	at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
	at org.apache.aries.blueprint.utils.ReflectionUtils.newInstance(ReflectionUtils.java:331)
	at org.apache.aries.blueprint.container.BeanRecipe.newInstance(BeanRecipe.java:984)
	at org.apache.aries.blueprint.container.BeanRecipe.getInstanceFromType(BeanRecipe.java:349)
	... 30 more
Caused by: java.util.concurrent.ExecutionException: java.util.concurrent.ExecutionException: io.etcd.jetcd.shaded.io.grpc.StatusRuntimeException: INTERNAL: Panic! This is a bug!
	at java.util.concurrent.CompletableFuture.reportGet(CompletableFuture.java:357)
	at java.util.concurrent.CompletableFuture.get(CompletableFuture.java:1915)
	at org.opendaylight.etcd.ds.impl.EtcdServerUtils.getServerHeader(EtcdServerUtils.java:38)
	... 41 more
Caused by: java.util.concurrent.ExecutionException: io.etcd.jetcd.shaded.io.grpc.StatusRuntimeException: INTERNAL: Panic! This is a bug!
	at io.etcd.jetcd.shaded.com.google.common.util.concurrent.AbstractFuture.getDoneValue(AbstractFuture.java:500)
	at io.etcd.jetcd.shaded.com.google.common.util.concurrent.AbstractFuture.get(AbstractFuture.java:479)
	at io.etcd.jetcd.internal.impl.Util.lambda$toCompletableFutureWithRetry$1(Util.java:128)
	... 3 more
Caused by: io.etcd.jetcd.shaded.io.grpc.StatusRuntimeException: INTERNAL: Panic! This is a bug!
	at io.etcd.jetcd.shaded.io.grpc.Status.asRuntimeException(Status.java:526)
	at io.etcd.jetcd.shaded.io.grpc.stub.ClientCalls$UnaryStreamToFuture.onClose(ClientCalls.java:468)
	at io.etcd.jetcd.shaded.io.grpc.PartialForwardingClientCallListener.onClose(PartialForwardingClientCallListener.java:39)
	at io.etcd.jetcd.shaded.io.grpc.ForwardingClientCallListener.onClose(ForwardingClientCallListener.java:23)
	at io.etcd.jetcd.shaded.io.grpc.ForwardingClientCallListener$SimpleForwardingClientCallListener.onClose(ForwardingClientCallListener.java:40)
	at io.etcd.jetcd.internal.impl.ClientConnectionManager$AuthTokenInterceptor$1$1.onClose(ClientConnectionManager.java:308)
	at io.etcd.jetcd.shaded.io.grpc.PartialForwardingClientCallListener.onClose(PartialForwardingClientCallListener.java:39)
	at io.etcd.jetcd.shaded.io.grpc.ForwardingClientCallListener.onClose(ForwardingClientCallListener.java:23)
	at io.etcd.jetcd.shaded.io.grpc.ForwardingClientCallListener$SimpleForwardingClientCallListener.onClose(ForwardingClientCallListener.java:40)
	at io.etcd.jetcd.shaded.io.grpc.internal.CensusStatsModule$StatsClientInterceptor$1$1.onClose(CensusStatsModule.java:684)
	at io.etcd.jetcd.shaded.io.grpc.PartialForwardingClientCallListener.onClose(PartialForwardingClientCallListener.java:39)
	at io.etcd.jetcd.shaded.io.grpc.ForwardingClientCallListener.onClose(ForwardingClientCallListener.java:23)
	at io.etcd.jetcd.shaded.io.grpc.ForwardingClientCallListener$SimpleForwardingClientCallListener.onClose(ForwardingClientCallListener.java:40)
	at io.etcd.jetcd.shaded.io.grpc.internal.CensusTracingModule$TracingClientInterceptor$1$1.onClose(CensusTracingModule.java:403)
	at io.etcd.jetcd.shaded.io.grpc.internal.ClientCallImpl.closeObserver(ClientCallImpl.java:459)
	at io.etcd.jetcd.shaded.io.grpc.internal.ClientCallImpl.access$300(ClientCallImpl.java:63)
	at io.etcd.jetcd.shaded.io.grpc.internal.ClientCallImpl$ClientStreamListenerImpl.close(ClientCallImpl.java:546)
	at io.etcd.jetcd.shaded.io.grpc.internal.ClientCallImpl$ClientStreamListenerImpl.access$600(ClientCallImpl.java:467)
	at io.etcd.jetcd.shaded.io.grpc.internal.ClientCallImpl$ClientStreamListenerImpl$1StreamClosed.runInContext(ClientCallImpl.java:584)
	at io.etcd.jetcd.shaded.io.grpc.internal.ContextRunnable.run(ContextRunnable.java:37)
	at io.etcd.jetcd.shaded.io.grpc.internal.SerializingExecutor.run(SerializingExecutor.java:123)
	... 3 more
Caused by: java.lang.NoClassDefFoundError: javax/security/cert/X509Certificate
	at io.etcd.jetcd.shaded.io.netty.util.internal.EmptyArrays.<clinit>(EmptyArrays.java:38)
	at io.etcd.jetcd.shaded.io.netty.util.ResourceLeakDetector.<clinit>(ResourceLeakDetector.java:525)
	at io.etcd.jetcd.shaded.io.netty.buffer.AbstractByteBufAllocator.<clinit>(AbstractByteBufAllocator.java:34)
	at io.etcd.jetcd.shaded.io.netty.buffer.Unpooled.<clinit>(Unpooled.java:74)
	at io.etcd.jetcd.shaded.io.netty.handler.codec.http2.Http2ConnectionHandler.<clinit>(Http2ConnectionHandler.java:74)
	at io.etcd.jetcd.shaded.io.grpc.netty.NettyClientTransport.start(NettyClientTransport.java:192)
	at io.etcd.jetcd.shaded.io.grpc.internal.ForwardingConnectionClientTransport.start(ForwardingConnectionClientTransport.java:32)
	at io.etcd.jetcd.shaded.io.grpc.internal.ForwardingConnectionClientTransport.start(ForwardingConnectionClientTransport.java:32)
	at io.etcd.jetcd.shaded.io.grpc.internal.InternalSubchannel.startNewTransport(InternalSubchannel.java:246)
	at io.etcd.jetcd.shaded.io.grpc.internal.InternalSubchannel.obtainActiveTransport(InternalSubchannel.java:206)
	at io.etcd.jetcd.shaded.io.grpc.internal.ManagedChannelImpl$SubchannelImpl.requestConnection(ManagedChannelImpl.java:1417)
	at io.etcd.jetcd.shaded.io.grpc.PickFirstBalancerFactory$PickFirstBalancer.handleResolvedAddressGroups(PickFirstBalancerFactory.java:74)
	at io.etcd.jetcd.shaded.io.grpc.internal.AutoConfiguredLoadBalancerFactory$AutoConfiguredLoadBalancer.handleResolvedAddressGroups(AutoConfiguredLoadBalancerFactory.java:106)
	at io.etcd.jetcd.shaded.io.grpc.internal.ManagedChannelImpl$NameResolverListenerImpl$1NamesResolved.run(ManagedChannelImpl.java:1286)
	at io.etcd.jetcd.shaded.io.grpc.internal.ChannelExecutor.drain(ChannelExecutor.java:73)
	at io.etcd.jetcd.shaded.io.grpc.internal.ManagedChannelImpl$LbHelperImpl.runSerialized(ManagedChannelImpl.java:1230)
	at io.etcd.jetcd.shaded.io.grpc.internal.ManagedChannelImpl$NameResolverListenerImpl.onAddresses(ManagedChannelImpl.java:1290)
	at io.etcd.jetcd.resolver.SmartNameResolver.doResolve(SmartNameResolver.java:147)
	... 3 more
Caused by: java.lang.ClassNotFoundException: javax.security.cert.X509Certificate cannot be found by io.etcd.jetcd-all_0.3.0.SNAPSHOT
	at org.eclipse.osgi.internal.loader.BundleLoader.findClassInternal(BundleLoader.java:484)
	at org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:395)
	at org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:387)
	at org.eclipse.osgi.internal.loader.ModuleClassLoader.loadClass(ModuleClassLoader.java:150)
	at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
	... 21 more

I guess the MANIFEST.MF of the jetcd-all-*.jar is missing javax.security.cert in its Import-Package ..

@lburgazzoli does jetcd-all-*.jar work for you under OSGi?

vorburger added a commit to vorburger/opendaylight-etcd that referenced this issue Sep 6, 2018
solved a number of issues; starting to look more interesting

now we're blocked by etcd-io/jetcd#382
@vorburger vorburger self-assigned this Sep 6, 2018
@lburgazzoli
Copy link
Collaborator

long time I did't test it

@vorburger
Copy link
Member Author

@lburgazzoli so yeah it's actually totally broken - I was just able to reproduce this, by making the ClientServiceTest actually "do something" ... currently it only assertThat(client).isNotNull(); but if we also make it client.getKVClient().get(...) then I hit the exact same error as above.

I'll see if I can fix this - and try to include a non-regression test in ClientServiceTest.

vorburger added a commit to vorburger/jetcd that referenced this issue Sep 6, 2018
TODO With the ClientServiceTest actually "doing something" now (before
it dit not really), it only works if you have an etcd locally running
("sudo systemctl start etcd") ... we would need to actually start a
server, like the tests in jetcd-core do, for the ClientServiceTest to
pass on CI.
@vorburger
Copy link
Member Author

vorburger commented Sep 6, 2018

I have a fix in vorburger@84a50c4, but with the ClientServiceTest actually "doing something" now (before it dit not really), it only works if you have an etcd locally running ("sudo systemctl start etcd") ... we would need to actually start a server, like the tests in jetcd-core do, for the ClientServiceTest to pass on CI - and need #384 for that.

vorburger added a commit to vorburger/jetcd that referenced this issue Sep 6, 2018
TODO With the ClientServiceTest actually "doing something" now (before
it dit not really), it only works if you have an etcd locally running
("sudo systemctl start etcd") ... we would need to actually start a
server, like the tests in jetcd-core do, for the ClientServiceTest to
pass on CI.
vorburger added a commit to vorburger/jetcd that referenced this issue Sep 6, 2018
TODO With the ClientServiceTest actually "doing something" now (before
it dit not really), it only works if you have an etcd locally running
("sudo systemctl start etcd") ... we would need to actually start a
server, like the tests in jetcd-core do, for the ClientServiceTest to
pass on CI.
vorburger added a commit to vorburger/jetcd that referenced this issue Sep 6, 2018
TODO With the ClientServiceTest actually "doing something" now (before
it dit not really), it only works if you have an etcd locally running
("sudo systemctl start etcd") ... we would need to actually start a
server, like the tests in jetcd-core do, for the ClientServiceTest to
pass on CI.
vorburger added a commit to vorburger/jetcd that referenced this issue Sep 6, 2018
and ensure future non-regression by making the
ClientServiceTest actually "do something" now (before
it dit not really).  This can only work if we have an etcd locally running
("sudo systemctl start etcd") ... so we need to actually start a server,
like the tests in jetcd-core do, for this test to pass on CI, and really
prove that jetcd-all could be loaded and used (!) under OSGi.

For this, we use the new launcher artifact introduced in previous commits.

It's a bit of a PITA to use launcher (based on testcontainers) with Pax Exam.
We solve this by introducing the PaxExamWrapperTest which uses JUnitCore to
programmatically launch ClientServiceChecks (formerly ClientServiceTest).
To make it clear that jetcd-launcher does not work under OSGi, we do not
package it as a bundle anymore, so rm maven-bundle-plugin / MANIFEST.
lburgazzoli pushed a commit that referenced this issue Sep 7, 2018
and ensure future non-regression by making the
ClientServiceTest actually "do something" now (before
it dit not really).  This can only work if we have an etcd locally running
("sudo systemctl start etcd") ... so we need to actually start a server,
like the tests in jetcd-core do, for this test to pass on CI, and really
prove that jetcd-all could be loaded and used (!) under OSGi.

For this, we use the new launcher artifact introduced in previous commits.

It's a bit of a PITA to use launcher (based on testcontainers) with Pax Exam.
We solve this by introducing the PaxExamWrapperTest which uses JUnitCore to
programmatically launch ClientServiceChecks (formerly ClientServiceTest).
To make it clear that jetcd-launcher does not work under OSGi, we do not
package it as a bundle anymore, so rm maven-bundle-plugin / MANIFEST.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging a pull request may close this issue.

2 participants