thrift-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Nipun Bhatia <nipunbha...@gmail.com>
Subject Re: Compilation errors on generated Java code Thrift 0.8.0
Date Fri, 21 Sep 2012 20:05:32 GMT
I figured out what the issue was. It turns out my pom.xml had a
dependency on the hadoop jar which was causing these issues. What was
surprising was the fact that doing mvn dependency:tree | grep -i
thrift only showed org.apache.thrift:libthrift:jar:0.8.0:compile. It
seems hadoop packages the thrift jar instead of having it as a
dependency.

On Wed, Sep 19, 2012 at 9:54 PM, Nipun Bhatia <nipunbhatia@gmail.com> wrote:
> I did a checksum on the jar in the maven repository and one that got
> installed and they are different:
>
> ->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
>
> The jar in the maven repository got installed using this pom:
>  <dependency>
>      <groupId>org.apache.thrift</groupId>
>       <artifactId>libthrift</artifactId>
>      <version>0.8.0</version>
>  </dependency>
>
> Any idea why this two would be different?
>
> -Nipun
>
>
> On Wed, Sep 19, 2012 at 8:13 PM, Juan Moreno
> <jwellington.moreno@gmail.com> wrote:
>> Could it be that the compiler you are using has a different version than
>> the dependency listed?
>> On Sep 19, 2012 9:02 PM, "Nipun Bhatia" <nipunbhatia@gmail.com> wrote:
>>
>>> hey
>>> I was experimenting with a simple Thrift server and wanted to write
>>> the client in java.
>>> I ran the command
>>> ->thrift -gen java BLT.thrift
>>> The generated java file Optimization.java shows the following error in
>>> the Eclipse IDE.
>>> Code snippet:
>>>    public static class Client extends org.apache.thrift.TServiceClient
>>> implements   Iface
>>> Error:
>>> The type TServiceClient cannot be the superclass of Client; a
>>> superclass must be a class
>>>
>>> public Client(org.apache.thrift.protocol.TProtocol prot)
>>>     {
>>>       super(prot, prot);
>>>     }
>>> The constructor Object(TProtocol, TProtocol) is undefined.
>>> .....
>>>
>>>
>>> I still went ahead and compiled it.
>>> ->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()
>>>
>>> I have the following dependency in my pom.xml
>>>
>>> <dependency>
>>>     <groupId>org.apache.thrift</groupId>
>>>      <artifactId>libthrift</artifactId>
>>>      <version>0.8.0</version>
>>> </dependency>
>>>
>>> -> mvn dependency:tree | grep -i thrift
>>> [INFO] \- org.apache.thrift:libthrift:jar:0.8.0:compile
>>>
>>> -> thrift -version java
>>> Thrift version 0.8.0
>>>
>>> I did find this thread but the recommended solution didnt work for me
>>> http://stackoverflow.com/questions/2582085/maven-thrift-repository
>>>
>>> Any help/insight  would be much appreciated.
>>>
>>> Thanks
>>>

Mime
View raw message