2016-12-18 11 views
1

Ich versuche, netty-socketio Server zu starten, und ich kann nicht Ursprünge dieser Ausnahme verfolgen. Ich habe im Stacktrace-Platz markiert, wo es zur Antwort führen kann, also wenn jemand eine Erklärung dazu geben könnte, wird es sehr geschätzt.java.lang.NoSuchMethodError in netty-socketio Server

public class SocketIoServer { 
    private Configuration cnf = new Configuration(); 
    private SocketIOServer server; 

    public SocketIoServer() { 

     Configuration config = new Configuration(); 
     config.setHostname("localhost"); 
     config.setPort(8081); 

     server = new SocketIOServer(config); 
     server.start(); 
    } 
} 

Wenn ich Socket initialisieren wird eine Ausnahme ausgelöst. Hier Kontext:

Exception in thread "main" java.lang.IllegalArgumentException: 

java.lang.reflect.InvocationTargetException 
    at com.corundumstudio.socketio.Configuration.<init>(Configuration.java:112) 
    at com.corundumstudio.socketio.SocketIOServer.<init>(SocketIOServer.java:66) 
    at SocketIoServer.<init>(SocketIoServer.java:17) 
    at Server.main(Server.java:19) 
    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 com.intellij.rt.execution.application.AppMain.main(AppMain.java:147) 
Caused by: java.lang.reflect.InvocationTargetException 
    at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) 
    at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:57) 
    at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) 
    at java.lang.reflect.Constructor.newInstance(Constructor.java:526) 
    at com.corundumstudio.socketio.Configuration.<init>(Configuration.java:109) 
    ... 8 more 

Diese Linie insbesondere

Caused by: java.lang.NoSuchMethodError: 
com.fasterxml.jackson.databind.module.SimpleModule.setSerializerModifier(Lcom/fasterxml/jackson/databind/ser/BeanSerializerModifier;)Lcom/fasterxml/jackson/databind/module/SimpleModule; 
    at com.corundumstudio.socketio.protocol.JacksonJsonSupport.init(JacksonJsonSupport.java:316) 
    at com.corundumstudio.socketio.protocol.JacksonJsonSupport.<init>(JacksonJsonSupport.java:311) 
    at com.corundumstudio.socketio.protocol.JacksonJsonSupport.<init>(JacksonJsonSupport.java:304) 
    ... 13 more 

Antwort

0

Sie haben offenbar einen Konflikt der Version von jackson-databind in Ihrem Projekt in der Tat die Klasse com.corundumstudio.socketio.protocol.JacksonJsonSupport auf der Methode beruht SimpleModule#setSerializerModifier(BeanSerializerModifier mod) die seither hinzugefügt Die Version 2.2, so wie es diese Methode nicht finden kann, bedeutet, dass Sie eine Version von jackson-databind älter als 2.2 in Ihrem Klassenpfad haben, so dass die Methode nicht gefunden werden kann.

Überprüfen Sie alle Gläser, die Sie in Ihrem Klassenpfad haben und stellen Sie sicher, dass Sie nur eine Version von jackson-databind haben, die der von netty-socketio erwarteten Version entspricht. Angenommen, Sie verwenden beispielsweise die Version 1.7.12 von netty-socketio, ist die erwartete Version von jackson-databind2.7.4, wie Sie here sehen können.

+1

Danke, das war genau das Problem. –

Verwandte Themen