2016-12-30 2 views
3
내가 컴파일하려고

및 실행 자바 grpc 클라이언트 로컬 종속성을 사용하지만, 나는 다음과 같은 오류가 점점 오전 :자바 grpc 런타임 오류

apply plugin: 'java' 

repositories { 
    flatDir { 
     dirs 'libs' 
    } 
} 

dependencies { 
    compile name: 'grpc-netty-1.0.3' 
    compile name: 'grpc-okhttp-1.0.3' 
    compile name: 'grpc-protobuf-1.0.3' 
    compile name: 'grpc-stub-1.0.3' 
    compile name: 'grpc-core-1.0.3' 
    compile name: 'guava-20.0' 
    compile name: 'protobuf-java-3.1.0' 
} 

jar { 
    manifest { 
     attributes(
     'Main-Class': 'myclient.myClient', 
     'Class-Path': configurations.compile.collect {it.getName() }.join(' ') 
     ) 
    } 
} 
:

여기
Exception in thread "main" java.lang.NoClassDefFoundError: io/netty/channel/socket/nio/NioSocketChannel 
at io.grpc.netty.NettyChannelBuilder.<init>(NettyChannelBuilder.java:69) 
at io.grpc.netty.NettyChannelBuilder.<init>(NettyChannelBuilder.java:103) 
at io.grpc.netty.NettyChannelBuilder.forAddress(NettyChannelBuilder.java:91) 
at io.grpc.netty.NettyChannelProvider.builderForAddress(NettyChannelProvider.java:52) 
at io.grpc.netty.NettyChannelProvider.builderForAddress(NettyChannelProvider.java:38) 
at io.grpc.ManagedChannelBuilder.forAddress(ManagedChannelBuilder.java:45) 
at myclient.MyClient.<init>(myClient.java:28) 
at myclient.MyClient.main(myClient.java:90) 
Caused by: java.lang.ClassNotFoundException: io.netty.channel.socket.nio.NioSocketChannel 
at java.net.URLClassLoader.findClass(URLClassLoader.java:381) 
at java.lang.ClassLoader.loadClass(ClassLoader.java:424) 
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:331) 
at java.lang.ClassLoader.loadClass(ClassLoader.java:357) 
... 8 more 

내 Gradle을 파일을

프로그램이 컴파일되지만 실행되지는 않습니다. 나는 이미 protos에서 Java 파일을 생성했고 올바른 protoc 및 protoc-gen-grpc-java를 사용하여 jar 라이브러리와 일치하는지 확인했습니다. 어떤 도움을 주셔서 감사합니다.

답변

2

당신이 그물코 jar 파일이 필요

https://mvnrepository.com/artifact/io.netty/netty-all/4.0.0.CR1

여기에서 다운로드 그리고

UPDATE 클래스 패스에 추가하는 것을 잊지 말아 :

내 나쁜, 모든 종속 항아리를 다운로드하십시오 파일. => 컴파일 종속 (16)

https://mvnrepository.com/artifact/io.netty/netty-codec-http2/5.0.0.Alpha2

+1

주셔서 감사 체크. jar을 추가하고이 오류가 발생했습니다 : http://pastebin.com/tyPKJvPT – CoderCole

+0

@CoderCole, pastebin에 대한 액세스 권한이 없습니다. – hanumant

+1

모든 종속성을 추가했는데 이제는 io/grpc/Context와 관련된 다른 NoClassDefFoundError가 표시됩니다. $ CancellationListener – CoderCole

관련 문제