You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@thrift.apache.org by 郑华斌 <hu...@qq.com> on 2014/03/17 04:32:06 UTC
回复: NoClassDefFoundError org/apache/thrift/protocol/TProtocolFactory
Thanks very much.
I noticed there is a dependency directory under the "target" directory.
finally I solved it by running like this.
java -cp target/simple_proxy-1.0-SNAPSHOT.jar:target/dependency/* com.xx.App
------------------ 原始邮件 ------------------
发件人: "Matthew Chambers";<mc...@wetafx.co.nz>;
发送时间: 2014年3月17日(星期一) 中午11:10
收件人: "user"<us...@thrift.apache.org>;
主题: Re: NoClassDefFoundError org/apache/thrift/protocol/TProtocolFactory
You probably need to add the path to the thrift jar file in your command
line, unless its being dumped into simple_proxy but I doubt it is. I
believe you can build a jar meant for execution which is a lot like a
war in the way it has all the dependencies embedded into the jar.
On 17/03/14 16:06, 郑华斌 wrote:
> hi,
>
> I'm using thrift 0.9.1 and build a java project with maven. It packages the project well but when I run the project, it throws an exception: Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/thrift/protocol/TProtocolFactory
>
> The command line I ran the program is : java -cp target/simple_proxy-1.0-SNAPSHOT.jar com.xx.App
>
> and the full stack list is:
>
> Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/thrift/protocol/TProtocolFactory
> Caused by: java.lang.ClassNotFoundException: org.apache.thrift.protocol.TProtocolFactory
> at java.net.URLClassLoader$1.run(URLClassLoader.java:217)
> at java.security.AccessController.doPrivileged(Native Method)
> at java.net.URLClassLoader.findClass(URLClassLoader.java:205)
> at java.lang.ClassLoader.loadClass(ClassLoader.java:321)
> at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:294)
> at java.lang.ClassLoader.loadClass(ClassLoader.java:266)
>
> Related maven dependency is:
> <dependency>
> <groupId>org.apache.thrift</groupId>
> <artifactId>libthrift</artifactId>
> <version>0.9.1</version>
> </dependency>
>
> Can anyone help me? Thanks.
.