Could not initialize class io.netty.util.internal.PlatformDependent0 from: io.netty.util.internal.Pl

1,075 views
Skip to first unread message

Gadi Eichhorn

unread,
Jan 8, 2017, 4:05:05 AM1/8/17
to vert.x
Hi All,

I am using Vertx 3.3.3 from OSGi bndtools project and face some issues with dynamic staring of my bundle that depends on Vertx and on Netty. I wonder if anyone faced the same Netty issue and how to resolve it?

This error seemed to be fixed in Netty 4.1.7.FInal -> https://github.com/netty/netty/issues/5987

Vertx using Netty 4.1.5 


\- io.vertx:vertx-core:jar:3.3.3:compile
   
+- io.netty:netty-common:jar:4.1.5.Final:compile
   
+- io.netty:netty-buffer:jar:4.1.5.Final:compile
   
+- io.netty:netty-transport:jar:4.1.5.Final:compile
   
+- io.netty:netty-handler:jar:4.1.5.Final:compile
   
|  \- io.netty:netty-codec:jar:4.1.5.Final:compile
   
+- io.netty:netty-handler-proxy:jar:4.1.5.Final:compile
   
|  \- io.netty:netty-codec-socks:jar:4.1.5.Final:compile
   
+- io.netty:netty-codec-http:jar:4.1.5.Final:compile
   
+- io.netty:netty-codec-http2:jar:4.1.5.Final:compile
   
+- io.netty:netty-resolver:jar:4.1.5.Final:compile
   
+- io.netty:netty-resolver-dns:jar:4.1.5.Final:compile
   
|  \- io.netty:netty-codec-dns:jar:4.1.5.Final:compile
   
+- com.fasterxml.jackson.core:jackson-core:jar:2.7.4:compile
   
\- com.fasterxml.jackson.core:jackson-databind:jar:2.7.4:compile
     
\- com.fasterxml.jackson.core:jackson-annotations:jar:2.7.0:compile


here is the error:

10:51:07.839 [main] DEBUG io.netty.util.internal.logging.InternalLoggerFactory - Using SLF4J as the default logging framework
10:51:07.842 [main] DEBUG io.netty.util.ResourceLeakDetector - -Dio.netty.leakDetection.level: simple
10:51:07.844 [main] DEBUG io.netty.util.ResourceLeakDetector - -Dio.netty.leakDetection.maxRecords: 4
10:51:07.864 [main] DEBUG io.netty.channel.MultithreadEventLoopGroup - -Dio.netty.eventLoopThreads: 8
10:51:07.879 [main] DEBUG io.netty.util.internal.PlatformDependent0 - java.nio.Buffer.address: available
10:51:07.880 [main] DEBUG io.netty.util.internal.PlatformDependent - Platform: Windows
10:51:07.880 [main] DEBUG io.netty.util.internal.PlatformDependent - Java version: 8
10:51:07.880 [main] DEBUG io.netty.util.internal.PlatformDependent - -Dio.netty.noUnsafe: false
10:51:07.881 [main] DEBUG io.netty.util.internal.PlatformDependent - maxDirectMemory: 3776970752 bytes (maybe)
! Failed to start bundle xxxx, exception activator error Could not initialize class io.netty.util.internal.PlatformDependent0 from: io.netty.util.internal.PlatformDependent:<clinit>#101



My activator class has:

public class VertxActivator implements BundleActivator {


   
private static final Logger LOGGER = LoggerFactory.getLogger(VertxActivator.class);
   
private ServiceRegistration<Vertx> vertxRegistration;
   
private ServiceRegistration<EventBus> ebRegistration;


   
@Override
   
public void start(BundleContext bc) throws Exception {
        LOGGER
.info("START");


        LOGGER
.info("Creating Vert.x instance");
       
Vertx vertx = TcclSwitch.executeWithTCCLSwitch(() -> Vertx.vertx());


        vertxRegistration
= bc.registerService(Vertx.class, vertx, null);
        LOGGER
.info("Vert.x service registered");
        ebRegistration
= bc.registerService(EventBus.class, vertx.eventBus(), null);
        LOGGER
.info("Vert.x Event Bus service registered");
   
}


   
@Override
   
public void stop(BundleContext bc) throws Exception {
       
if (vertxRegistration != null) {
            vertxRegistration
.unregister();
            vertxRegistration
= null;
       
}
       
if (ebRegistration != null) {
            ebRegistration
.unregister();
            ebRegistration
= null;
       
}
        LOGGER
.info("STOP");
   
}
}


any help appreciated
Thanks,

Gadi.

Clement Escoffier

unread,
Jan 8, 2017, 4:20:17 AM1/8/17
to ve...@googlegroups.com
Hi,


Clement


--
You received this message because you are subscribed to the Google Groups "vert.x" group.
To unsubscribe from this group and stop receiving emails from it, send an email to vertx+un...@googlegroups.com.
Visit this group at https://groups.google.com/group/vertx.
To view this discussion on the web, visit https://groups.google.com/d/msgid/vertx/f0122bf1-ba25-4009-ae2f-0928dbb796d2%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Gadi Eichhorn

unread,
Jan 8, 2017, 8:50:35 AM1/8/17
to vert.x
Thanks Clement,

Any suggestions how to resolve this?
I am using the standalone maven setup... I didnt have this issue when I used the standard bndtool workspace.

Thanks,
Gadi.
Message has been deleted

Gadi Eichhorn

unread,
Jan 9, 2017, 3:17:29 AM1/9/17
to vert.x

Gadi Eichhorn

unread,
Jan 14, 2017, 10:05:28 AM1/14/17
to vert.x
I changed the initialization code to a service and now I am getting a different error

@Component(immediate = true)
public class VertxRegistrationService {


 
private final static Logger LOGGER = LoggerFactory.getLogger(VertxRegistrationService.class);

 
private ServiceRegistration<Vertx> vertxRegistration;
 
private ServiceRegistration<EventBus> ebRegistration;

 
private Vertx vertx;


 
@Activate
 
public void start(BundleContext context) throws Exception {

 LOGGER
.info("Creating Vert.x instance");



 vertx
= TcclSwitch.executeWithTCCLSwitch(() -> Vertx.vertx());
 
// vertx = Vertx.vertx();


 vertxRegistration
= context.registerService(Vertx.class, vertx, null);

 LOGGER
.info("Vert.x service registered");

 ebRegistration
= context.registerService(EventBus.class, vertx.eventBus(), null);

 LOGGER
.info("Vert.x Event Bus service registered");
 
}



 
@Deactivate
 
public void stop(BundleContext context) {

 
if (ebRegistration != null) {
 ebRegistration
.unregister();
 ebRegistration
= null;
 
}
 
if (vertxRegistration != null) {
 vertxRegistration
.unregister();
 vertxRegistration
= null;
 
}

 
if (vertx != null) {
 vertx
.close();
 
}
 
}



}



ERROR: helloworld-web (8): [com.example.hello.web.VertxRegistrationService(0)] The start method has thrown an exception
java
.lang.NoClassDefFoundError: Could not initialize class io.netty.util.internal.PlatformDependent0
 at io
.netty.util.internal.PlatformDependent.<clinit>(PlatformDependent.java:101)
 at io
.netty.util.ConstantPool.<init>(ConstantPool.java:32)
 at io
.netty.util.Signal$1.<init>(Signal.java:27)
 at io
.netty.util.Signal.<clinit>(Signal.java:27)
 at io
.netty.util.concurrent.DefaultPromise.<clinit>(DefaultPromise.java:42)
 at io
.netty.util.concurrent.MultithreadEventExecutorGroup.<init>(MultithreadEventExecutorGroup.java:36)
 at io
.netty.util.concurrent.MultithreadEventExecutorGroup.<init>(MultithreadEventExecutorGroup.java:58)
 at io
.netty.util.concurrent.MultithreadEventExecutorGroup.<init>(MultithreadEventExecutorGroup.java:47)
 at io
.netty.channel.MultithreadEventLoopGroup.<init>(MultithreadEventLoopGroup.java:58)
 at io
.netty.channel.nio.NioEventLoopGroup.<init>(NioEventLoopGroup.java:77)
 at io
.netty.channel.nio.NioEventLoopGroup.<init>(NioEventLoopGroup.java:72)
 at io
.netty.channel.nio.NioEventLoopGroup.<init>(NioEventLoopGroup.java:59)
 at io
.vertx.core.impl.VertxImpl.<init>(VertxImpl.java:133)
 at io
.vertx.core.impl.VertxImpl.<init>(VertxImpl.java:122)
 at io
.vertx.core.impl.VertxImpl.<init>(VertxImpl.java:118)
 at io
.vertx.core.impl.VertxFactoryImpl.vertx(VertxFactoryImpl.java:34)
 at io
.vertx.core.Vertx.vertx(Vertx.java:80)
 at com
.example.hello.web.VertxRegistrationService.lambda$0(VertxRegistrationService.java:26)
 at com
.example.hello.web.TcclSwitch.executeWithTCCLSwitch(TcclSwitch.java:11)
 at com
.example.hello.web.VertxRegistrationService.start(VertxRegistrationService.java:26)
 at sun
.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
 at sun
.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
 at sun
.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
 at java
.lang.reflect.Method.invoke(Unknown Source)
 at org
.apache.felix.scr.impl.helper.BaseMethod.invokeMethod(BaseMethod.java:222)
 at org
.apache.felix.scr.impl.helper.BaseMethod.access$500(BaseMethod.java:37)
 at org
.apache.felix.scr.impl.helper.BaseMethod$Resolved.invoke(BaseMethod.java:615)
 at org
.apache.felix.scr.impl.helper.BaseMethod.invoke(BaseMethod.java:499)
 at org
.apache.felix.scr.impl.helper.ActivateMethod.invoke(ActivateMethod.java:295)
 at org
.apache.felix.scr.impl.manager.SingleComponentManager.createImplementationObject(SingleComponentManager.java:302)
 at org
.apache.felix.scr.impl.manager.SingleComponentManager.createComponent(SingleComponentManager.java:113)
 at org
.apache.felix.scr.impl.manager.SingleComponentManager.getService(SingleComponentManager.java:866)
 at org
.apache.felix.scr.impl.manager.SingleComponentManager.getServiceInternal(SingleComponentManager.java:833)
 at org
.apache.felix.scr.impl.manager.AbstractComponentManager.activateInternal(AbstractComponentManager.java:724)
 at org
.apache.felix.scr.impl.manager.AbstractComponentManager.enable(AbstractComponentManager.java:399)
 at org
.apache.felix.scr.impl.config.ConfigurableComponentHolder.enableComponents(ConfigurableComponentHolder.java:676)
 at org
.apache.felix.scr.impl.BundleComponentActivator.initialEnable(BundleComponentActivator.java:339)
 at org
.apache.felix.scr.impl.Activator.loadComponents(Activator.java:360)
 at org
.apache.felix.scr.impl.Activator.access$000(Activator.java:53)
 at org
.apache.felix.scr.impl.Activator$ScrExtension.start(Activator.java:260)
 at org
.apache.felix.utils.extender.AbstractExtender.createExtension(AbstractExtender.java:259)
 at org
.apache.felix.utils.extender.AbstractExtender.modifiedBundle(AbstractExtender.java:232)
 at org
.osgi.util.tracker.BundleTracker$Tracked.customizerModified(BundleTracker.java:482)
 at org
.osgi.util.tracker.BundleTracker$Tracked.customizerModified(BundleTracker.java:415)
 at org
.osgi.util.tracker.AbstractTracked.track(AbstractTracked.java:232)
 at org
.osgi.util.tracker.BundleTracker$Tracked.bundleChanged(BundleTracker.java:444)
 at org
.apache.felix.framework.util.EventDispatcher.invokeBundleListenerCallback(EventDispatcher.java:916)
 at org
.apache.felix.framework.util.EventDispatcher.fireEventImmediately(EventDispatcher.java:835)
 at org
.apache.felix.framework.util.EventDispatcher.fireBundleEvent(EventDispatcher.java:517)
 at org
.apache.felix.framework.Felix.fireBundleEvent(Felix.java:4541)
 at org
.apache.felix.framework.Felix.startBundle(Felix.java:2172)
 at org
.apache.felix.framework.BundleImpl.start(BundleImpl.java:998)
 at aQute
.launcher.Launcher.update(Launcher.java:483)
 at aQute
.launcher.Launcher.activate(Launcher.java:382)
 at aQute
.launcher.Launcher.run(Launcher.java:276)
 at aQute
.launcher.Launcher.main(Launcher.java:133)
ERROR
: helloworld-web (8): [com.example.hello.web.VertxRegistrationService(0)] Failed creating the component instance; see log for reason

Reply all
Reply to author
Forward
0 new messages