我正在試驗一個簡單的Thrift服務器,並希望用java編寫客戶端。 我跑的命令生成的Java代碼編譯錯誤Thrift 0.8.0
- >節儉-gen的java BLT.thrift
生成的Java文件Optimization.java示出了在Eclipse IDE下面的錯誤。
public static class Client extends org.apache.thrift.TServiceClient implements Iface
Error: The type TServiceClient cannot be the superclass of Client; asuperclass must be a class
public Client(org.apache.thrift.protocol.TProtocol prot)
{
super(prot, prot);
}
The constructor Object(TProtocol, TProtocol) is undefined. .....
我還是繼續和它編譯。
->mvn clean install
Optimization.java:[38,54] no interface expected here
[ERROR] /thrift/Optimization.java:[39,83] type parameter model.thrift.Optimization.Client is not within its bound
[ERROR] /thrift/Optimization.java:[68,6] cannot find symbol
symbol : method
sendBase(java.lang.String,com.model.thrift.Optimization.maximizeRevenue_args)
location: class model.thrift.Optimization.Client
[ERROR] /thrift/Optimization.java:[74,6] cannot find symbol
symbol : method
receiveBase(model.thrift.Optimization.maximizeRevenue_result,java.lang.String)
location: class model.thrift.Optimization.Client
[ERROR] /thrift/Optimization.java:[98,97] cannot find symbol
symbol : variable ___protocolFactory
location: model.thrift.Optimization.AsyncClient
[ERROR] /thrift/Optimization.java:[98,117] cannot find symbol
symbol : variable ___transport
location: class model.thrift.Optimization.AsyncClient
[ERROR] /thrift/Optimization.java:[99,10] cannot find symbol
symbol : variable ___currentMethod
location: class model.thrift.Optimization.AsyncClient
[ERROR] /thrift/Optimization.java:[100,6] cannot find symbol
symbol : variable ___manager
location: class thrift.Optimization.AsyncClient
[ERROR] /thrift/Optimization.java:[387,23] cannot find symbol
symbol : method getScheme()
location: class org.apache.thrift.protocol.TProtocol
[ERROR] /thrift/Optimization.java:[391,23] cannot find symbol
symbol : method getScheme()
location: class org.apache.thrift.protocol.TProtocol
[ERROR] /thrift/Optimization.java:[665,23] cannot find symbol
symbol : method getScheme()
location: class org.apache.thrift.protocol.TProtocol
[ERROR] /thrift/Optimization.java:[669,23] cannot find symbol
symbol : method getScheme()
-> mvn dependency:tree | grep -i thrift
[INFO] \- org.apache.thrift:libthrift:jar:0.8.0:compile
-> thrift -version java
Thrift version 0.8.0
我發現這個線程,但推薦的解決方案並沒有爲我工作 Maven Thrift repository
我也沒有用於生成代碼,並且得到了使用上述拉罐罐子的校驗POM。有人會知道爲什麼這些會有所不同
->md5sum /usr/local/lib/libthrift-0.8.0.jar
fff7102558cb0ab1c103b62752166ce8 /usr/local/lib/libthrift-0.8.0.jar
->md5sum ~/.m2/repository/org/apache/thrift/libthrift/0.8.0/libthrift-0.8.0.jar
d68695bb2406cb2ab5fbae6ff6e27d7e
/home/nipun/.m2/repository/org/apache/thrift/libthrift/0.8.0/libthrift-0.8.0.jar
任何幫助/見解將不勝感激。
我在我的pom.xml 以下依賴我在我的pom.xml以下依賴性 org.apache.thrift libthrift 0.8.0 –
user1686831