1. 程式人生 > >IOS推送http2使用netty服務啟動異常

IOS推送http2使用netty服務啟動異常

IOS推送http2使用netty服務啟動異常

現象

使用netty開發×××送HTTP2,本機執行正常,部署至linux伺服器異常。

原因

是linux伺服器核心版本過低,所使用GLIBC類庫版本過低。netty要求GLIBC_2.10,我的伺服器最高才GLIBC_2.5。

linux檢視GLIBC版本命令

strings /lib64/libc.so.6 |grep GLIBC_
IOS推送http2使用netty服務啟動異常

解決辦法

升級linux核心版本以及GLIBC類庫版本。

以下附netty伺服器異常日誌


2018-11-18 16:54:30 [ appleJobScheduler_Worker-1:64224 ] - [ DEBUG ] io.netty.util.internal.NativeLibraryLoader:91 Unable to load the library: netty-tcnative-linux-x86_64.
java.lang.UnsatisfiedLinkError: /tmp/libnetty-tcnative-linux-x86_648869710963839557158.so: /lib64/libc.so.6: version `GLIBC_2.10' not found (required by /tmp/libnetty-tcnative-linux-x86_648869710963839557158.so)
at java.lang.ClassLoader$NativeLibrary.load(Native Method)
at java.lang.ClassLoader.loadLibrary1(ClassLoader.java:1965)
at java.lang.ClassLoader.loadLibrary0(ClassLoader.java:1890)
at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1851)
at java.lang.Runtime.load0(Runtime.java:795)
at java.lang.System.load(System.java:1062)
at io.netty.util.internal.NativeLibraryLoader.load(NativeLibraryLoader.java:214)
at io.netty.util.internal.NativeLibraryLoader.loadFirstAvailable(NativeLibraryLoader.java:161)
at io.netty.handler.ssl.OpenSsl.loadTcNative(OpenSsl.java:238)
at io.netty.handler.ssl.OpenSsl.<clinit>(OpenSsl.java:65)
at javapns.http2.client.ApnsHttp2Client.getBaseSslContextBuilder(ApnsHttp2Client.java:151)
at javapns.http2.client.ApnsHttp2Client.getSslContextWithCertificateAndPrivateKey(ApnsHttp2Client.java:143)
at javapns.http2.client.ApnsHttp2Client.getSslContextWithP12InputStream(ApnsHttp2Client.java:139)
at javapns.http2.client.ApnsHttp2Client.<init>(ApnsHttp2Client.java:86)
at javapns.http2.client.ApnsHttp2Client.<init>(ApnsHttp2Client.java:82)
at javapns.http2.client.ApnsHttp2.<init>(ApnsHttp2.java:48)
at com.pushservicenotificationios.javapns.http2.config.ApnsHttp2Config.getAppleServer(ApnsHttp2Config.java:53)
at com.pushservicenotificationios.admin.process.ReceiveProcess.receive(ReceiveProcess.java:107)
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 org.springframework.util.MethodInvoker.invoke(MethodInvoker.java:269)
at org.springframework.scheduling.quartz.MethodInvokingJobDetailFactoryBean$MethodInvokingJob.executeInternal(MethodInvokingJobDetailFactoryBean.java:257)
at org.springframework.scheduling.quartz.QuartzJobBean.execute(QuartzJobBean.java:75)
at org.quartz.core.JobRunShell.run(JobRunShell.java:202)
at org.quartz.simpl.SimpleThreadPool$WorkerThread.run(SimpleThreadPool.java:573)
2018-11-18 16:54:30 [ appleJobScheduler_Worker-1:64229 ] - [ DEBUG ] io.netty.util.internal.NativeLibraryLoader:91 Unable to load the library: netty-tcnative-linux-x86_64-fedora.
java.lang.UnsatisfiedLinkError: no netty-tcnative-linux-x86_64-fedora in java.library.path
at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1886)
at java.lang.Runtime.loadLibrary0(Runtime.java:849)
at java.lang.System.loadLibrary(System.java:1088)
at io.netty.util.internal.NativeLibraryLoader.load(NativeLibraryLoader.java:189)
at io.netty.util.internal.NativeLibraryLoader.loadFirstAvailable(NativeLibraryLoader.java:161)
at io.netty.handler.ssl.OpenSsl.loadTcNative(OpenSsl.java:238)
at io.netty.handler.ssl.OpenSsl.<clinit>(OpenSsl.java:65)
at javapns.http2.client.ApnsHttp2Client.getBaseSslContextBuilder(ApnsHttp2Client.java:151)
at javapns.http2.client.ApnsHttp2Client.getSslContextWithCertificateAndPrivateKey(ApnsHttp2Client.java:143)
at javapns.http2.client.ApnsHttp2Client.getSslContextWithP12InputStream(ApnsHttp2Client.java:139)
at javapns.http2.client.ApnsHttp2Client.<init>(ApnsHttp2Client.java:86)
at javapns.http2.client.ApnsHttp2Client.<init>(ApnsHttp2Client.java:82)
at javapns.http2.client.ApnsHttp2.<init>(ApnsHttp2.java:48)
at com.pushservicenotificationios.javapns.http2.config.ApnsHttp2Config.getAppleServer(ApnsHttp2Config.java:53)
at com.pushservicenotificationios.admin.process.ReceiveProcess.receive(ReceiveProcess.java:107)
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 org.springframework.util.MethodInvoker.invoke(MethodInvoker.java:269)
at org.springframework.scheduling.quartz.MethodInvokingJobDetailFactoryBean$MethodInvokingJob.executeInternal(MethodInvokingJobDetailFactoryBean.java:257)
at org.springframework.scheduling.quartz.QuartzJobBean.execute(QuartzJobBean.java:75)
at org.quartz.core.JobRunShell.run(JobRunShell.java:202)
at org.quartz.simpl.SimpleThreadPool$WorkerThread.run(SimpleThreadPool.java:573)
2018-11-18 16:54:30 [ appleJobScheduler_Worker-1:64232 ] - [ DEBUG ] io.netty.util.internal.NativeLibraryLoader:91 Unable to load the library: netty-tcnative.
java.lang.UnsatisfiedLinkError: no netty-tcnative in java.library.path
at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1886)
at java.lang.Runtime.loadLibrary0(Runtime.java:849)
at java.lang.System.loadLibrary(System.java:1088)
at io.netty.util.internal.NativeLibraryLoader.load(NativeLibraryLoader.java:189)
at io.netty.util.internal.NativeLibraryLoader.loadFirstAvailable(NativeLibraryLoader.java:161)
at io.netty.handler.ssl.OpenSsl.loadTcNative(OpenSsl.java:238)
at io.netty.handler.ssl.OpenSsl.<clinit>(OpenSsl.java:65)
at javapns.http2.client.ApnsHttp2Client.getBaseSslContextBuilder(ApnsHttp2Client.java:151)
at javapns.http2.client.ApnsHttp2Client.getSslContextWithCertificateAndPrivateKey(ApnsHttp2Client.java:143)
at javapns.http2.client.ApnsHttp2Client.getSslContextWithP12InputStream(ApnsHttp2Client.java:139)
at javapns.http2.client.ApnsHttp2Client.<init>(ApnsHttp2Client.java:86)
at javapns.http2.client.ApnsHttp2Client.<init>(ApnsHttp2Client.java:82)
at javapns.http2.client.ApnsHttp2.<init>(ApnsHttp2.java:48)
at com.pushservicenotificationios.javapns.http2.config.ApnsHttp2Config.getAppleServer(ApnsHttp2Config.java:53)
at com.pushservicenotificationios.admin.process.ReceiveProcess.receive(ReceiveProcess.java:107)
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 org.springframework.util.MethodInvoker.invoke(MethodInvoker.java:269)
at org.springframework.scheduling.quartz.MethodInvokingJobDetailFactoryBean$MethodInvokingJob.executeInternal(MethodInvokingJobDetailFactoryBean.java:257)
at org.springframework.scheduling.quartz.QuartzJobBean.execute(QuartzJobBean.java:75)
at org.quartz.core.JobRunShell.run(JobRunShell.java:202)
at org.quartz.simpl.SimpleThreadPool$WorkerThread.run(SimpleThreadPool.java:573)
2018-11-18 16:54:30 [ appleJobScheduler_Worker-1:64235 ] - [ DEBUG ] io.netty.handler.ssl.OpenSsl:91 Failed to load netty-tcnative; OpenSslEngine will be unavailable, unless the application has already loaded the symbols by some other means. See

http://netty.io/wiki/forked-tomcat-native.html for more information.
java.lang.IllegalArgumentException: Failed to load any of the given libraries: [netty-tcnative-linux-x86_64, netty-tcnative-linux-x86_64-fedora, netty-tcnative]
at io.netty.util.internal.NativeLibraryLoader.loadFirstAvailable(NativeLibraryLoader.java:167)
at io.netty.handler.ssl.OpenSsl.loadTcNative(OpenSsl.java:238)
at io.netty.handler.ssl.OpenSsl.<clinit>(OpenSsl.java:65)
at javapns.http2.client.ApnsHttp2Client.getBaseSslContextBuilder(ApnsHttp2Client.java:151)
at javapns.http2.client.ApnsHttp2Client.getSslContextWithCertificateAndPrivateKey(ApnsHttp2Client.java:143)
at javapns.http2.client.ApnsHttp2Client.getSslContextWithP12InputStream(ApnsHttp2Client.java:139)
at javapns.http2.client.ApnsHttp2Client.<init>(ApnsHttp2Client.java:86)
at javapns.http2.client.ApnsHttp2Client.<init>(ApnsHttp2Client.java:82)
at javapns.http2.client.ApnsHttp2.<init>(ApnsHttp2.java:48)
at com.pushservicenotificationios.javapns.http2.config.ApnsHttp2Config.getAppleServer(ApnsHttp2Config.java:53)
at com.pushservicenotificationios.admin.process.ReceiveProcess.receive(ReceiveProcess.java:107)
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 org.springframework.util.MethodInvoker.invoke(MethodInvoker.java:269)
at org.springframework.scheduling.quartz.MethodInvokingJobDetailFactoryBean$MethodInvokingJob.executeInternal(MethodInvokingJobDetailFactoryBean.java:257)
at org.springframework.scheduling.quartz.QuartzJobBean.execute(QuartzJobBean.java:75)
at org.quartz.core.JobRunShell.run(JobRunShell.java:202)
at org.quartz.simpl.SimpleThreadPool$WorkerThread.run(SimpleThreadPool.java:573)
2018-11-18 16:54:30 [ appleJobScheduler_Worker-1:64237 ] - [ DEBUG ] io.netty.handler.ssl.OpenSsl:91 Failed to initialize netty-tcnative; OpenSslEngine will be unavailable. See
http://netty.io/wiki/forked-tomcat-native.html
for more information.
java.lang.UnsatisfiedLinkError: org.apache.tomcat.jni.Library.version(I)I
at org.apache.tomcat.jni.Library.version(Native Method)
at org.apache.tomcat.jni.Library.initialize(Library.java:176)
at io.netty.handler.ssl.OpenSsl.initializeTcNative(OpenSsl.java:243)
at io.netty.handler.ssl.OpenSsl.<clinit>(OpenSsl.java:76)
at javapns.http2.client.ApnsHttp2Client.getBaseSslContextBuilder(ApnsHttp2Client.java:151)
at javapns.http2.client.ApnsHttp2Client.getSslContextWithCertificateAndPrivateKey(ApnsHttp2Client.java:143)
at javapns.http2.client.ApnsHttp2Client.getSslContextWithP12InputStream(ApnsHttp2Client.java:139)
at javapns.http2.client.ApnsHttp2Client.<init>(ApnsHttp2Client.java:86)
at javapns.http2.client.ApnsHttp2Client.<init>(ApnsHttp2Client.java:82)
at javapns.http2.client.ApnsHttp2.<init>(ApnsHttp2.java:48)
at com.pushservicenotificationios.javapns.http2.config.ApnsHttp2Config.getAppleServer(ApnsHttp2Config.java:53)
at com.pushservicenotificationios.admin.process.ReceiveProcess.receive(ReceiveProcess.java:107)
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 org.springframework.util.MethodInvoker.invoke(MethodInvoker.java:269)
at org.springframework.scheduling.quartz.MethodInvokingJobDetailFactoryBean$MethodInvokingJob.executeInternal(MethodInvokingJobDetailFactoryBean.java:257)
at org.springframework.scheduling.quartz.QuartzJobBean.execute(QuartzJobBean.java:75)
at org.quartz.core.JobRunShell.run(JobRunShell.java:202)
at org.quartz.simpl.SimpleThreadPool$WorkerThread.run(SimpleThreadPool.java:573)
2018-11-18 16:54:30 [ appleJobScheduler_Worker-1:64454 ] - [ DEBUG ] io.netty.handler.ssl.JdkSslContext:76 Default protocols (JDK): [TLSv1.2, TLSv1.1, TLSv1]
2018-11-18 16:54:30 [ appleJobScheduler_Worker-1:64455 ] - [ DEBUG ] io.netty.handler.ssl.JdkSslContext:76 Default cipher suites (JDK): [TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA, TLS_RSA_WITH_AES_128_CBC_SHA, SSL_RSA_WITH_3DES_EDE_CBC_SHA]