java.lang.NoClassDefFoundError:io / netty / handler / ssl / SslContextBuilder
我正在尝试实现relayrides / pushy ,但我收到以下运行时错误:
Jun 28, 2017 2:06:58 PM com.turo.pushy.apns.SslUtil getSslProvider INFO: Native SSL provider not available; will use JDK SSL provider. Exception in thread "main" java.lang.NoClassDefFoundError: io/netty/handler/ssl/SslContextBuilder at com.turo.pushy.apns.ApnsClientBuilder.build(ApnsClientBuilder.java:396) at com.jobs.spring.service.NotificationServiceImpl.sendIOSPushNotification(NotificationServiceImpl.java:122) Caused by: java.lang.ClassNotFoundException: io.netty.handler.ssl.SslContextBuilder
的pom.xml
org.apache.httpcomponents httpclient 4.5.2 com.turo pushy 0.10 io.netty netty-tcnative 2.0.5.Final io.netty netty-handler 4.0.27.Final com.ning async-http-client 1.9.40 com.google.code.gson gson 2.8.1
java的
final ApnsClient apnsClient = new ApnsClientBuilder() .setClientCredentials(new File(PATH_TO_P12_CERT), CERT_PASSWORD ) .build();
我猜我的mvn依赖是不正确的。 任何帮助赞赏。
UPDATE
我将我的依赖项更新为:
com.turo pushy 0.10 io.netty netty-all 4.1.11.Final io.netty netty-tcnative 2.0.1.Final com.google.code.gson gson 2.6
但现在得到:
Jun 28, 2017 2:40:18 PM com.turo.pushy.apns.SslUtil getSslProvider INFO: Native SSL provider not available; will use JDK SSL provider. Exception in thread "main" java.lang.NoSuchMethodError: io.netty.bootstrap.Bootstrap.config()Lio/netty/bootstrap/BootstrapConfig; at com.turo.pushy.apns.ApnsClient.(ApnsClient.java:172) at com.turo.pushy.apns.ApnsClientBuilder.build(ApnsClientBuilder.java:420) at com.jobs.spring.service.NotificationServiceImpl.sendIOSPushNotification(NotificationServiceImpl.java:121)
好像你混合了netty 4.1和4.0。 如果你想使用pushy,你只需要使用4.1。
你是否在我之间清理了类路径,我创建了一个只包含依赖项的测试项目
com.turo pushy 0.10
和一个简单的主类只是使用上面使用的剪切创建客户端,它工作得很好
对我来说,类似路径上可能有两个版本的BootstrapConfig。 除了pushy和clean / refresh maven依赖项之外,尝试删除所有依赖项。