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";<[email protected]>;
 ????????: 2014??3??17??(??????) ????11:10
 ??????: "user"<[email protected]>; 
 
 ????: 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.

.

Reply via email to