2017-06-28 1 views
0

Je suis en train de mettre en œuvre relayrides/pushy, mais je reçois l'erreur d'exécution suivante:java.lang.NoClassDefFoundError: io/Netty/gestionnaire/ssl/SslContextBuilder

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

<dependency> 
     <groupId>org.apache.httpcomponents</groupId> 
     <artifactId>httpclient</artifactId> 
     <version>4.5.2</version> 
    </dependency> 
    <!-- Push Notifications --> 
    <dependency> 
     <groupId>com.turo</groupId> 
     <artifactId>pushy</artifactId> 
     <version>0.10</version> 
    </dependency> 
    <dependency> 
     <groupId>io.netty</groupId> 
     <artifactId>netty-tcnative</artifactId> 
     <version>2.0.5.Final</version> 
    </dependency> 
    <dependency> 
     <groupId>io.netty</groupId> 
     <artifactId>netty-handler</artifactId> 
     <version>4.0.27.Final</version> 
    </dependency> 
    <dependency> 
     <groupId>com.ning</groupId> 
     <artifactId>async-http-client</artifactId> 
     <version>1.9.40</version> 
    </dependency> 
    <dependency> 
     <groupId>com.google.code.gson</groupId> 
     <artifactId>gson</artifactId> 
     <version>2.8.1</version> 
    </dependency> 

java

final ApnsClient apnsClient = new ApnsClientBuilder() 
      .setClientCredentials(new File(PATH_TO_P12_CERT), CERT_PASSWORD) 
      .build(); 

Je suppose que mes dépendances mvn sont incorrectes. Toute aide appréciée.

enter image description here

MISE À JOUR

Je mis à jour mes dépendances à:

<dependency> 
     <groupId>com.turo</groupId> 
     <artifactId>pushy</artifactId> 
     <version>0.10</version> 
    </dependency> 
    <dependency> 
     <groupId>io.netty</groupId> 
     <artifactId>netty-all</artifactId> 
     <version>4.1.11.Final</version> 
    </dependency> 
    <dependency> 
     <groupId>io.netty</groupId> 
     <artifactId>netty-tcnative</artifactId> 
     <version>2.0.1.Final</version> 
    </dependency> 
    <dependency> 
     <groupId>com.google.code.gson</groupId> 
     <artifactId>gson</artifactId> 
     <version>2.6</version> 
    </dependency> 

Mais maintenant obtenir:

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.<init>(ApnsClient.java:172) 
    at com.turo.pushy.apns.ApnsClientBuilder.build(ApnsClientBuilder.java:420) 
    at com.jobs.spring.service.NotificationServiceImpl.sendIOSPushNotification(NotificationServiceImpl.java:121) 

Répondre

0

Avez-vous nettoyer votre classpath entre j'ai créé un projet de test ne contenant que la dépendance

<dependency> 
    <groupId>com.turo</groupId> 
    <artifactId>pushy</artifactId> 
    <version>0.10</version> 
</dependency> 

et une simple classe principale, juste créer le client avec le Snipped vous utilisez ci-dessus et il fonctionne bien

Pour moi, il semble que il pourrait y avoir deux versions de BootstrapConfig sur la classpath. Essayez de supprimer toutes les dépendances en plus de pushy et de nettoyer/rafraîchir les dépendances maven.

1

semble que vous mélangez Netty 4.1 et 4.0. Vous devez utiliser seulement 4.1 si vous voulez utiliser pushy.