barchart / barchart-udt

Java wrapper for native C++ UDT protocol.
https://github.com/barchart/barchart-udt/wiki
128 stars 89 forks source link

Failed to LOAD native library #61

Open infofinity opened 10 years ago

infofinity commented 10 years ago

The IBM JDK includes a version.properties file (for its built-in HealthCenter CPU profiling tool) which is read before the version.properties file in VersionUDT.java. This causes a NullPointerException in barchartName with the following output on the console (using http://www.littleshoot.org/littleproxy/ as an example):

java.lang.IllegalStateException: Fatal: library load failed. at com.barchart.udt.lib.LibraryLoaderUDT.load(LibraryLoaderUDT.java:75) at com.barchart.udt.SocketUDT.(SocketUDT.java:142) at java.lang.J9VMInternals.initializeImpl(Native Method) at java.lang.J9VMInternals.initialize(J9VMInternals.java:228) at com.barchart.udt.EpollUDT.(EpollUDT.java:140) at com.barchart.udt.nio.SelectorUDT.(SelectorUDT.java:78) at com.barchart.udt.nio.SelectorProviderUDT.openSelector(SelectorProviderUDT.java:107) at com.barchart.udt.nio.SelectorProviderUDT.openSelector(SelectorProviderUDT.java:24) at io.netty.channel.nio.NioEventLoop.openSelector(NioEventLoop.java:126) at io.netty.channel.nio.NioEventLoop.(NioEventLoop.java:120) at io.netty.channel.nio.NioEventLoopGroup.newChild(NioEventLoopGroup.java:87) at io.netty.util.concurrent.MultithreadEventExecutorGroup.(MultithreadEventExecutorGroup.java:57) at io.netty.channel.MultithreadEventLoopGroup.(MultithreadEventLoopGroup.java:49) at io.netty.channel.nio.NioEventLoopGroup.(NioEventLoopGroup.java:61) at org.littleshoot.proxy.impl.DefaultHttpProxyServer$ServerGroup.initializeTransport(DefaultHttpProxyServer.java:448) at org.littleshoot.proxy.impl.DefaultHttpProxyServer$ServerGroup.(DefaultHttpProxyServer.java:413) at org.littleshoot.proxy.impl.DefaultHttpProxyServer$ServerGroup.(DefaultHttpProxyServer.java:368) at org.littleshoot.proxy.impl.DefaultHttpProxyServer.(DefaultHttpProxyServer.java:154) at org.littleshoot.proxy.impl.DefaultHttpProxyServer.(DefaultHttpProxyServer.java:78) at org.littleshoot.proxy.impl.DefaultHttpProxyServer$DefaultHttpProxyServerBootstrap.build(DefaultHttpProxyServer.java:726) at org.littleshoot.proxy.impl.DefaultHttpProxyServer$DefaultHttpProxyServerBootstrap.start(DefaultHttpProxyServer.java:714) at org.littleshoot.proxy.Launcher.main(Launcher.java:112) 244 2014-01-20 17:14:40,707 WARN [main] impl.DefaultHttpProxyServer.? (?:?) - Unable to initialize transport protocol UDT: null java.lang.ExceptionInInitializerError at java.lang.J9VMInternals.initialize(J9VMInternals.java:250) at com.barchart.udt.EpollUDT.(EpollUDT.java:140) at com.barchart.udt.nio.SelectorUDT.(SelectorUDT.java:78) at com.barchart.udt.nio.SelectorProviderUDT.openSelector(SelectorProviderUDT.java:107) at com.barchart.udt.nio.SelectorProviderUDT.openSelector(SelectorProviderUDT.java:24) at io.netty.channel.nio.NioEventLoop.openSelector(NioEventLoop.java:126) at io.netty.channel.nio.NioEventLoop.(NioEventLoop.java:120) at io.netty.channel.nio.NioEventLoopGroup.newChild(NioEventLoopGroup.java:87) at io.netty.util.concurrent.MultithreadEventExecutorGroup.(MultithreadEventExecutorGroup.java:57) at io.netty.channel.MultithreadEventLoopGroup.(MultithreadEventLoopGroup.java:49) at io.netty.channel.nio.NioEventLoopGroup.(NioEventLoopGroup.java:61) at org.littleshoot.proxy.impl.DefaultHttpProxyServer$ServerGroup.initializeTransport(DefaultHttpProxyServer.java:448) at org.littleshoot.proxy.impl.DefaultHttpProxyServer$ServerGroup.(DefaultHttpProxyServer.java:413) at org.littleshoot.proxy.impl.DefaultHttpProxyServer$ServerGroup.(DefaultHttpProxyServer.java:368) at org.littleshoot.proxy.impl.DefaultHttpProxyServer.(DefaultHttpProxyServer.java:154) at org.littleshoot.proxy.impl.DefaultHttpProxyServer.(DefaultHttpProxyServer.java:78) at org.littleshoot.proxy.impl.DefaultHttpProxyServer$DefaultHttpProxyServerBootstrap.build(DefaultHttpProxyServer.java:726) at org.littleshoot.proxy.impl.DefaultHttpProxyServer$DefaultHttpProxyServerBootstrap.start(DefaultHttpProxyServer.java:714) at org.littleshoot.proxy.Launcher.main(Launcher.java:112) Caused by: java.lang.RuntimeException: load at com.barchart.udt.SocketUDT.(SocketUDT.java:146) at java.lang.J9VMInternals.initializeImpl(Native Method) at java.lang.J9VMInternals.initialize(J9VMInternals.java:228) ... 18 more Caused by: java.lang.IllegalStateException: Fatal: library load failed. at com.barchart.udt.lib.LibraryLoaderUDT.load(LibraryLoaderUDT.java:75) at com.barchart.udt.SocketUDT.(SocketUDT.java:142) ... 20 more 245 2014-01-20 17:14:40,708 ERROR [Finalizer thread] udt.EpollUDT.? (?:?) - failed to destroy id=0 java.lang.NullPointerException at com.barchart.udt.EpollUDT.destroy(EpollUDT.java:155) at com.barchart.udt.EpollUDT.finalize(EpollUDT.java:190) at java.lang.J9VMInternals.runFinalize(J9VMInternals.java:455)

This works fine on a non-IBM JDK.

I resolved this problem by changing version.properties to versionudt.properties and recompiling VersionUDT and renaming version.properties in the core JAR file. Can you please fix this as well in master?

Also, it would be nice if LibraryLoaderUDT.java called e.printStackTrace in its catch blocks as the warning message was not useful in finding root cause.