Ubuntu thrift 服务编译 未找到TSimpleServer的引用 5C

环境 Ubuntu16.04 g++ 5.4 thrift 0.11
thrift已安装正确,生成相应的cpp代码 进行服务端编译 makefile如下
1 CC=g++ -Wall -O2
2 CFLAGS=-I/usr/local/include/thrift -I./
3 LFLAGS=-L/usr/local/lib
4 LDEXEFLAGS=-lthrift
5 CPPDEFS=-DHAVE_NETINET_IN_H
6 SRC=test_service.cpp\
7 test_types.cpp\
8 test_constants.cpp
9
10 all: server
11
12 server: test_service_server.skeleton.cpp
13 ${CC} ${CPPDEFS} -o server ${CFLAGS} test_service_server.skeleton.cpp ${SRC} ${LFLAGS} ${LDEXEFLAGS}
14
15
16 clean:
17 rm -f ./*.o server

编译后出现
g++ -Wall -O2 -DHAVE_NETINET_IN_H -o server -I/usr/local/include/thrift -I./ test_service_server.skeleton.cpp test_service.cpp test_types.cpp test_constants.cpp -L/usr/local/lib -lthrift
/tmp/cckAX0Xn.o:在函数‘main’中:
test_service_server.skeleton.cpp:(.text.startup+0x299):对‘apache::thrift::server::TSimpleServer::TSimpleServer(boost::shared_ptrapache::thrift::TProcessor const&, boost::shared_ptr :TServerTransport> const&, boost::shared_ptrapache::thrift::transport::TTransportFactory const&, boost::shared_ptrapache::thrift::protocol::TProtocolFactory const&)’未定义的引用
collect2: error: ld returned 1 exit status
makefile:13: recipe for target 'server' failed
make: *** [server] Error 1

这样的错误,但是查看资料,lthrift已经在最后,不知为何还会出错?

2个回答

是shared_ptr连接的问题,应该链接stdcxx的库

/tmp/ccX2bX8q.o: In function `main':
/root/workspace/thrift/test3/gen-cpp/WorkerManager_server.skeleton.cpp:41: undefined reference to `apache::thrift::server::TSimpleServer::TSimpleServer(boost::shared_ptr<apache::thrift::TProcessor> const&, boost::shared_ptr<apache::thrift::transport::TServerTransport> const&, boost::shared_ptr<apache::thrift::transport::TTransportFactory> const&, boost::shared_ptr<apache::thrift::protocol::TProtocolFactory> const&)'
collect2: error: ld returned 1 exit status

由于使用了 boost 库,
改为 stdcxx 即可,-std=c++11

g++ -g -Wall -I./ -I/usr/local/include/thrift WorkerManager.cpp worker_types.cpp worker_constants.cpp WorkerManager_server.skeleton.cpp -L/usr/local/lib/*.so -lthrift -std=c++11 -o server
``
Csdn user default icon
上传中...
上传图片
插入图片
抄袭、复制答案,以达到刷声望分或其他目的的行为,在CSDN问答是严格禁止的,一经发现立刻封号。是时候展现真正的技术了!
其他相关推荐
thrift 编译 BUG thrift小白提问

求大神帮忙看看什么问题 ``` /home/testThrtift/gen-cpp/serDemo_server.skeleton.cpp:36:对‘apache::thrift::server::TSimpleServer::TSimpleServer(boost::shared_ptr<apache::thrift::TProcessor> const&, boost::shared_ptr<apache::thrift::transport::TServerTransport> const&, boost::shared_ptr<apache::thrift::transport::TTransportFactory> const&, boost::shared_ptr<apache::thrift::protocol::TProtocolFactory> const&)’未定义的引用 ``` 为什么会提示这个BUG? 刚刚开始用thrift,版本是0.12

利用mingw编译 thrift库

环境:windows7 下用QT开发,编译器为mingw。 状况:想通过mingw+msys编译Thrift库,通过msys执行./configuare命令,出现找不到sys/un.h等头文件的问题 百度的了解到这些事linux下面的文件,在mingw下面的sys头文件夹下面并没有这些头文件,像这种问题如何编译?谢谢

thrift生成java文件报错

现在linux机器,安装thrift ``` [root@localhost workspace]# thrift -version Thrift version 0.14.0 ``` 然后编写hello.thrift文件 ``` service HelloService { string sayHello (1: string name); } ``` 再执行 ``` thrift -gen java hello.thrift ``` 然后打开当前目录下HelloService.java 把文件放到eclipse下,开始编写服务端和客户端 发现报错 ![图片说明](https://img-ask.csdn.net/upload/201912/10/1575945621_252555.png) ![图片说明](https://img-ask.csdn.net/upload/201912/10/1575945629_175679.png) maven的pom文件: ``` <dependency> <groupId>org.apache.thrift</groupId> <artifactId>libthrift</artifactId> <version>0.10.0</version> </dependency> <dependency> <groupId>org.slf4j</groupId> <artifactId>slf4j-log4j12</artifactId> <version>1.7.5</version> </dependency> ``` 网友们知道什么原因吗,百度也没查到对应问题

thrift使用TThreadPoolServer时出现undefined

thrift使用时编译服务端出现了TThreadPoolServer的构造问题,这里无故出现的boost::shared_ptr类型问题,在之前编译过程中一直没有出现问题,直到重新编译thrift之后才出现类似问题 undefined reference to `apache::thrift::server::TThreadPoolServer::TThreadPoolServer(boost::shared_ptr<apache::thrift::TProcessor> const&, boost::shared_ptr<apache::thrift::transport::TServerTransport> const&, boost::shared_ptr<apache::thrift::transport::TTransportFactory> const&, boost::shared_ptr<apache::thrift::protocol::TProtocolFactory> const&, boost::shared_ptr<apache::thrift::concurrency::ThreadManager> const&)' undefined reference to `apache::thrift::concurrency::PosixThreadFactory::newThread(boost::shared_ptr<apache::thrift::concurrency::Runnable>) const'

C++在windows平台下利用thrift通信

在windows下使用C++和Thrift开发客户端程序与HBase进行通信,总是实现不了。 已经安装了thrift所依赖的boost,libevent,openssl底层东西,也成功编译出了libthrift.lib和libthriftnb.lib两个lib库。 客户端程序添加引用如下: 1.在C++/常规/附加包含目录中添加对头文件的引用:C:\openssl\include;C:\libevent\include;C:\boost\include;E:\HBase\thrift-0.9.3\lib\cpp\src;E:\HBase\thrift-0.9.3\lib\cpp\src\thrift。 2.在链接器/常规/附加库目录中添加库文件目录:C:\openssl\out32dll;C:\libevent\libs;C:\boost\libs;E:\HBase\thrift-0.9.3\lib\cpp\Debug 3.在链接器/输入/附加依赖项中添加对libthrift.lib和libthriftnb.lib两个lib库的引用 但是在创建客户端引用的过程中总是报错: 错误 2 error LNK2019: 无法解析的外部符号 "public: void __thiscall apache::thrift::TOutput::perror(char const *,int)" (?perror@TOutput@thrift@apache@@QAEXPBDH@Z),该符号在函数 "protected: void __thiscall apache::thrift::transport::TSocket::openConnection(struct addrinfo *)" (?openConnection@TSocket@transport@thrift@apache@@IAEXPAUaddrinfo@@@Z) 中被引用 E:\HBase\thrift-0.9.3\lib\cpp\CppDemo\libthrift.lib(TSocket.obj) CppDemo 错误 3 error LNK2019: 无法解析的外部符号 "public: static class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > __cdecl apache::thrift::TOutput::strerror_s(int)" (?strerror_s@TOutput@thrift@apache@@SA?AV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@H@Z),该符号在函数 "public: __thiscall apache::thrift::transport::TTransportException::TTransportException(enum apache::thrift::transport::TTransportException::TTransportExceptionType,class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const &,int)" (??0TTransportException@transport@thrift@apache@@QAE@W4TTransportExceptionType@0123@ABV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@H@Z) 中被引用 E:\HBase\thrift-0.9.3\lib\cpp\CppDemo\libthrift.lib(TSocket.obj) CppDemo 程序代码如下: #include "stdafx.h" #include<thrift/protocol/TProtocol.h> #include <thrift/transport/TSocket.h> #include <thrift/protocol/TBinaryProtocol.h> #include <thrift/server/TSimpleServer.h> #include <thrift/transport/TServerSocket.h> #include <thrift/transport/TBufferTransports.h> using namespace std; using namespace ::apache::thrift; using namespace ::apache::thrift::protocol; using namespace ::apache::thrift::transport; using namespace ::apache::thrift::server; using boost::shared_ptr; int _tmain(int argc, _TCHAR* argv[]) { boost::shared_ptr<TTransport> socket(new TSocket("127.0.0.1", 9090)); return 0; } 各位大神,可有办法?急...

为Go生成多个Thrift文件的正确方法

<div class="post-text" itemprop="text"> <p>So I have the following files</p> <pre><code>/src/baseService.thrift /baseTypes.thrift /baseSecurity.thrift </code></pre> <p>I want all of these thrift definitions to be created into one library. The top of each file is thus:</p> <pre><code>baseService.thrift ================== namespace java foo.bar namespace cpp foo.bar namespace js foo.bar namespace go foo.bar import "baseTypes.thrift" baseTypes.thrift ================ namespace java foo.bar namespace cpp foo.bar namespace js foo.bar namespace go foo.bar baseSecurity.thrift =================== namespace java foo.bar namespace cpp foo.bar namespace js foo.bar namespace go foo.bar import "baseTypes.thrift" </code></pre> <p>The problem is, how to I create all of these into one lib package? It works fine for java/cpp/js but when I try to build for go it's a no go.</p> <p>With thrift, you can't do a <code>thrift gen:baz *.thrift</code>, you have to do the files one at a time. For the other languages, we just do a:</p> <pre><code>for f in `find *.thrift`; do thrift -o myGenDir --gen go $f" done </code></pre> <p>(substitute appropriate gen command for each lang)</p> <p>For Python this is fine because it puts every gen'd file in it's own dir based on the filename [ i.e. foo/bar/{filename}/ttypes.py]. For Java it dumps all of the files in foo/bar/ but every class name is unique. For cpp, it dumps it all into the gen dir, but uniquely named per thrift file [so {filename.h}, {filename.cpp}]. For Go, however, it dumps everything into foo/bar like so:</p> <pre><code>/foo/bar/constants.go /foo/bar/service.go /foo/bar/service-remote/ /foo/bar/baz/ [for anything that has a namespace of foo.bar.baz] /foo/bar/ttypes.go </code></pre> <p>The problem is, the ttypes.go and (presumably) constants.go are getting overwritten by whatever is gen'd last in the for loop. Is there a way around this? It works for the other languages - seems like it's an oversight for Go. What am I missing. We've got lots of Thrift files with lots of stuff in them - I'd rather not have to combine everything that's at the same package level into one thrift file.</p> </div>

windows下用thrift预构建编译器生成的java代码有语法错误

我的IDL文件内容如下: ``` namespace java com service TestService { i32 test1(1:string tagName) } ``` 在这里只定义了一个服务TestService 使用thrift-0.12.0.exe编译后生成的java报错如下: ![图片说明](https://img-ask.csdn.net/upload/201906/26/1561535110_654451.png) 下面是用的jar包: ![图片说明](https://img-ask.csdn.net/upload/201906/26/1561535413_178399.png) 我直接用的thrift预构建编译器(thrift-0.12.0.exe),官方推荐源码安装,难道这个预构建的没法直接用吗还是咋了

在45分钟工作正常后,TSocket在Thrift服务器上超时

<div class="post-text" itemprop="text"> <p>I wrote a script to connect to HBase using Thrift Server. Each minute this script fetches 3200 records from HBase and updates some information and saves it. The first 30-45 minutes this is working fine on the Ambari Hadoop cluster. After that a query exception occurs:</p> <blockquote> <p>exception 'Thrift\Exception\TTransportException'<br> with message 'TSocket: timed out reading 4 bytes from 192.168.1.55:9090'<br> in <code>/home/responsive/thrift/thrift/lib/Thrift/Transport/TSocket.php:274</code></p> </blockquote> <p>To resolve this error, I restarted the Thrift service and then it is working fine again, but I don't know why this error occurs.</p> <p>Do you have any idea what is causing this? </p> </div>

使用thrift生成PHP服务器存根

<div class="post-text" itemprop="text"> <p>So yesterday i wrote my own thrift IDL which went fine and now I'm trying to generate some code from it With that in mind I went to generate code in PHP, Java, C# and Python with my first written IDL So on thrift 0.10.0 I used this command:</p> <pre><code>thrift --gen py:new_styles --gen csharp:async --gen java --gen php:server thriftfile.thrift </code></pre> <p>This gave me what I wanted for all the languages except for PHP because I want to generate some server stubs but it won't let me It only creates my Service1.php, Service2.php, Types.php in the namespace I defined in the IDL</p> <p>What am I doing wrong?</p> </div>

C#调用Thrift出现Thrift.TApplicationException

最近用C#客户端调用Curator RPC Proxy服务,远程与zookeeper通信。客户端与RPC Proxy之间通信用Thrift,Thrift文件是从官网下载且能正常编译使用。 实现以下两个功能: (1)监听zookeeper中特定node事件,包括增、删、改等信息; ![图片说明](https://img-ask.csdn.net/upload/201501/09/1420764037_326591.png) (2)从客户端按下按钮,增加一个新node。 ![图片说明](https://img-ask.csdn.net/upload/201501/09/1420764119_695395.png) 现在第一个功能已正常实现,第二个在铵下后出现如下错误,且界面死机。 ![图片说明](https://img-ask.csdn.net/upload/201501/09/1420764189_40320.png) 自己添加的所有代码如下: ``` public partial class Form1 : Form { //CuratorService CuratorService.Client curatorService = null; EventService.Client eventService = null; CuratorProjection curatorProjection = null; CuratorProjection projection2 = null; //TTransport type TTransport transport = null; TProtocol protocol = null; //Thread operation function public static void eventCycle( object obj, object obj2, object obj3){ CuratorProjection projection = (CuratorProjection)obj; EventService.Client eventService = (EventService.Client)obj2; CuratorService.Client curatorService = (CuratorService.Client)obj3; PathChildrenCacheProjection cacheProjection = curatorService.startPathChildrenCache( projection, "/root", true, false, PathChildrenCacheStartMode.BUILD_INITIAL_CACHE ); while(Thread.CurrentThread.IsAlive){ try { CuratorEvent remoteEvent = eventService.getNextEvent(projection); if (CuratorEventType.PING == remoteEvent.Type) { Console.WriteLine("Heartbeat"); } else if (CuratorEventType.PATH_CHILDREN_CACHE == remoteEvent.Type) { if (PathChildrenCacheEventType.CHILD_ADDED == remoteEvent.ChildrenCacheEvent.Type) { ChildData child = remoteEvent.ChildrenCacheEvent.Data; String path = child.Path; Console.WriteLine("Children Added " + path); } else if (PathChildrenCacheEventType.CHILD_REMOVED == remoteEvent.ChildrenCacheEvent.Type) { ChildData child = remoteEvent.ChildrenCacheEvent.Data; String path = child.Path; Console.WriteLine("Child Deleted: " + path); } } }catch( TTransportException transError) { Console.WriteLine( transError.Data ); }catch( TException tError ) { if( tError is TApplicationException ) Console.WriteLine(tError.Data); } } } public Form1() { InitializeComponent(); transport = new TSocket( "127.0.0.1", 1234 ); transport.Open(); protocol = new TBinaryProtocol( transport ); curatorService = new CuratorService.Client( protocol ); eventService = new EventService.Client( protocol ); curatorProjection = curatorService.newCuratorProjection("main"); projection2 = curatorService.newCuratorProjection("main"); Thread eventListener = new Thread(delegate() { eventCycle(curatorProjection, eventService, curatorService); }); eventListener.Start(); } private void button1_Click(object sender, EventArgs e) { try { CreateSpec node = new CreateSpec(); node.Path = "/root/xm"; node.Data = Encoding.Default.GetBytes("XM"); node.Mode = CreateMode.PERSISTENT_SEQUENTIAL; node.CreatingParentsIfNeeded = true; OptionalPath path = curatorService.createNode( projection2, node ); if(null != path) Console.WriteLine( path.ToString() ); }catch( TTransportException error){ Console.WriteLine( error.Data ); }catch( TApplicationException tError){ Console.WriteLine( tError.Data ); } } } ```

Thrift编译器(0.9.3)生成Thrift包中未定义的函数thrift.PrependError

<div class="post-text" itemprop="text"> <p>I use <code>thrift</code> compiler (0.9.3) to generate gen-go folder, while the compiler generates a function <code>thrift.PrependError</code> which can't be found in <code>thrift</code> package (<code>git.apache.org/thrift.git/lib/go/thrift</code>). </p> <p>Should I use <code>thrift</code> compiler (0.9.2)?</p> </div>

节俭:没有找到类'Thrift \ Transport \ TSocket'

<div class="post-text" itemprop="text"> <p>I am following the official tutorial for a client and php server using Apache Thrift. My problem is that it does not recognize the TSocket class.</p> <p>Will I have problems with the namespace?</p> <p><strong>Error:</strong></p> <blockquote> <p>Fatal error: Class 'Thrift\Transport\TSocket' not found in D:\Calculadora\tutorial\php\PhpClient.php on line 45</p> </blockquote> <pre><code>&lt;?php namespace tutorial\php; error_reporting(E_ALL); require_once __DIR__.'/../../lib/php/lib/ClassLoader/ThriftClassLoader.php'; use Thrift\ClassLoader\ThriftClassLoader; $GEN_DIR = realpath(dirname(__FILE__).'/..').'/gen-php'; $loader = new ThriftClassLoader(); $loader-&gt;registerNamespace('Thrift', __DIR__ . '/../../lib/php/lib'); $loader-&gt;registerDefinition('shared', $GEN_DIR); $loader-&gt;registerDefinition('tutorial', $GEN_DIR); $loader-&gt;register(); use Thrift\Protocol\TBinaryProtocol; use Thrift\Transport\TSocket; use Thrift\Transport\THttpClient; use Thrift\Transport\TBufferedTransport; use Thrift\Exception\TException; try { $socket = new THttpClient('localhost', 8080, '/php/PhpServer.php'); $socket = new TSocket('localhost', 9090); $transport = new TBufferedTransport($socket, 1024, 1024); $protocol = new TBinaryProtocol($transport); $client = new \tutorial\CalculatorClient($protocol); $transport-&gt;open(); } catch (TException $tx) { print 'TException: '.$tx-&gt;getMessage()." "; } ?&gt; </code></pre> </div>

基于PHP的Thrift客户端的节俭服务

<div class="post-text" itemprop="text"> <p>I have downloaded thrift .tar file and took lib/php/src folder and I renamed it as thrift . Then in my PHP file to write PHP Thrift Client , I have following code:</p> <pre><code>&lt;?php $GLOBALS['THRIFT_ROOT'] = 'thrift'; require_once 'thrift/Thrift.php'; require_once 'thrift/transport/TTransport.php'; require_once 'thrift/transport/TSocket.php'; require_once 'thrift/protocol/TBinaryProtocol.php'; require_once 'thrift/transport/TFramedTransport.php'; require_once 'thrift/transport/TBufferedTransport.php'; require_once 'thrift/packages/MyService/MyService.php'; require_once 'thrift/packages/MyService/MyService_types.php'; $transport = new TSocket('localhost',1100); $transport-&gt;open(); $protocol = new TBinaryProtocol($transport); $client= new MyServiceClient($protocol, $protocol); $result = $client-&gt;operation('param1', 'param2'); Print 'result = ' . $result; $transport-&gt;close(); </code></pre> <p>When I tried to execute it , it give error that I don't have <code>MyService</code> files. And it is correct I don't have that. I want to know that from where I can get that file or from where I can know how to write such service. I am asking that because I am not well versed with Apache Thrift. Please tell if I am doing some thing wrong or if any one knows how I can write service file and what will be in it? Will there be some sort of compiler required for just writing PHP Thrift client?</p> <p>Please tell whatever you know , thanks for giving some time to my question.</p> </div>

Spark1.3基于scala2.11编译hive-thrift报错,关于jline的

[INFO] [INFO] ------------------------------------------------------------------------ [INFO] Building Spark Project Hive Thrift Server 1.3.0 [INFO] ------------------------------------------------------------------------ [INFO] [INFO] --- maven-clean-plugin:2.5:clean (default-clean) @ spark-hive-thriftserver_2.11 --- [INFO] Deleting /usr/local/spark-1.3.0/sql/hive-thriftserver/target [INFO] [INFO] --- maven-enforcer-plugin:1.3.1:enforce (enforce-versions) @ spark-hive-thriftserver_2.11 --- [INFO] [INFO] --- scala-maven-plugin:3.2.0:add-source (eclipse-add-source) @ spark-hive-thriftserver_2.11 --- [INFO] Add Source directory: /usr/local/spark-1.3.0/sql/hive-thriftserver/src/main/scala [INFO] Add Test Source directory: /usr/local/spark-1.3.0/sql/hive-thriftserver/src/test/scala [INFO] [INFO] --- build-helper-maven-plugin:1.8:add-source (add-scala-sources) @ spark-hive-thriftserver_2.11 --- [INFO] Source directory: /usr/local/spark-1.3.0/sql/hive-thriftserver/src/main/scala added. [INFO] [INFO] --- build-helper-maven-plugin:1.8:add-source (add-default-sources) @ spark-hive-thriftserver_2.11 --- [INFO] Source directory: /usr/local/spark-1.3.0/sql/hive-thriftserver/v0.13.1/src/main/scala added. [INFO] [INFO] --- maven-remote-resources-plugin:1.5:process (default) @ spark-hive-thriftserver_2.11 --- [INFO] [INFO] --- maven-resources-plugin:2.6:resources (default-resources) @ spark-hive-thriftserver_2.11 --- [INFO] Using 'UTF-8' encoding to copy filtered resources. [INFO] skip non existing resourceDirectory /usr/local/spark-1.3.0/sql/hive-thriftserver/src/main/resources [INFO] Copying 3 resources [INFO] [INFO] --- scala-maven-plugin:3.2.0:compile (scala-compile-first) @ spark-hive-thriftserver_2.11 --- [WARNING] Zinc server is not available at port 3030 - reverting to normal incremental compile [INFO] Using incremental compilation [INFO] compiler plugin: BasicArtifact(org.scalamacros,paradise_2.11.2,2.0.1,null) [INFO] Compiling 9 Scala sources to /usr/local/spark-1.3.0/sql/hive-thriftserver/target/scala-2.11/classes... [ERROR] /usr/local/spark-1.3.0/sql/hive-thriftserver/src/main/scala/org/apache/spark/sql/hive/thriftserver/SparkSQLCLIDriver.scala:25: object ConsoleReader is not a member of package jline [ERROR] import jline.{ConsoleReader, History} [ERROR] ^ [WARNING] Class jline.Completor not found - continuing with a stub. [WARNING] Class jline.ConsoleReader not found - continuing with a stub. [ERROR] /usr/local/spark-1.3.0/sql/hive-thriftserver/src/main/scala/org/apache/spark/sql/hive/thriftserver/SparkSQLCLIDriver.scala:165: not found: type ConsoleReader [ERROR] val reader = new ConsoleReader() [ERROR] ^ [ERROR] Class jline.Completor not found - continuing with a stub. [WARNING] Class com.google.protobuf.Parser not found - continuing with a stub. [WARNING] Class com.google.protobuf.Parser not found - continuing with a stub. [WARNING] Class com.google.protobuf.Parser not found - continuing with a stub. [WARNING] Class com.google.protobuf.Parser not found - continuing with a stub. [WARNING] 6 warnings found [ERROR] three errors found [INFO] ------------------------------------------------------------------------ [INFO] Reactor Summary: [INFO] [INFO] Spark Project Parent POM ........................... SUCCESS [01:20 min] [INFO] Spark Project Networking ........................... SUCCESS [01:31 min] [INFO] Spark Project Shuffle Streaming Service ............ SUCCESS [ 47.808 s] [INFO] Spark Project Core ................................. SUCCESS [34:00 min] [INFO] Spark Project Bagel ................................ SUCCESS [03:21 min] [INFO] Spark Project GraphX ............................... SUCCESS [09:22 min] [INFO] Spark Project Streaming ............................ SUCCESS [15:07 min] [INFO] Spark Project Catalyst ............................. SUCCESS [14:35 min] [INFO] Spark Project SQL .................................. SUCCESS [16:31 min] [INFO] Spark Project ML Library ........................... SUCCESS [18:15 min] [INFO] Spark Project Tools ................................ SUCCESS [01:50 min] [INFO] Spark Project Hive ................................. SUCCESS [13:58 min] [INFO] Spark Project REPL ................................. SUCCESS [06:13 min] [INFO] Spark Project YARN ................................. SUCCESS [07:05 min] [INFO] Spark Project Hive Thrift Server ................... FAILURE [01:39 min] [INFO] Spark Project Assembly ............................. SKIPPED [INFO] Spark Project External Twitter ..................... SKIPPED [INFO] Spark Project External Flume Sink .................. SKIPPED [INFO] Spark Project External Flume ....................... SKIPPED [INFO] Spark Project External MQTT ........................ SKIPPED [INFO] Spark Project External ZeroMQ ...................... SKIPPED [INFO] Spark Project Examples ............................. SKIPPED [INFO] Spark Project YARN Shuffle Service ................. SKIPPED [INFO] ------------------------------------------------------------------------ [INFO] BUILD FAILURE [INFO] ------------------------------------------------------------------------ [INFO] Total time: 02:25 h [INFO] Finished at: 2015-04-16T14:11:24+08:00 [INFO] Final Memory: 62M/362M [INFO] ------------------------------------------------------------------------ [WARNING] The requested profile "hadoop-2.5" could not be activated because it does not exist. [ERROR] Failed to execute goal net.alchim31.maven:scala-maven-plugin:3.2.0:compile (scala-compile-first) on project spark-hive-thriftserver_2.11: Execution scala-compile-first of goal net.alchim31.maven:scala-maven-plugin:3.2.0:compile failed. CompileFailed -> [Help 1] [ERROR] [ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch. [ERROR] Re-run Maven using the -X switch to enable full debug logging. [ERROR] [ERROR] For more information about the errors and possible solutions, please read the following articles: [ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/PluginExecutionException [ERROR] [ERROR] After correcting the problems, you can resume the build with the command [ERROR] mvn <goals> -rf :spark-hive-thriftserver_2.11

生成文件时保持目录结构

<div class="post-text" itemprop="text"> <p>I have those thrift interfaces:</p> <pre><code>./thrift/a/a1.thrift ./thrift/a/a2.thrift ./thrift/b/b1.thrift ./thrift/b/b2.thrift </code></pre> <p>where a1.thrift includes a2, b1, b2 (with <code>include "thrift/a/a2.thrift"</code>)</p> <p>I generate the Go files for all those with <code>thrift -r --gen go:package_prefix=work -I . --out . thrift/a/a1.thrift</code></p> <p>It outputs:</p> <pre><code>./a1/constants.go ./a1/ttypes.go ./a2/... ./b1/... ./b2/... </code></pre> <p><strong>How can I tell thrift to output in?</strong></p> <pre><code>./a/a1/... ./a/a2/... ./b/b1/... ./b/b2/... </code></pre> <p>Note that I can move those files by hand but first I have many and second in Go <strong>the package has to match the directories</strong>, so I would need to edit those files. As an example the generated Go file for a1 will import a2 as <code>work/a2</code> and not <code>work/a/a2</code>)</p> </div>

如何在Thrift版本0.10.0的Go中从Thrift Server获取客户端IP?

<div class="post-text" itemprop="text"> <p>I'm writing a thrift service in Golang and I would like to understand how I can get the client's IP address in the handler functions implementation.</p> <p>I have tried it in Java, which can be obtained by overwrite TProcessor#process(in,out), but it seems that this way doesn't work in Golang.</p> <pre><code>serverTransport, err := thrift.NewTServerSocket(net.JoinHostPort(ip, strconv.FormatInt(port, 10))) //serverTransport, err := thrift.NewTServerSocket(net.JoinHostPort("127.0.0.1", "9999")) if err != nil { log.Error(err.Error()) os.Exit(1) } protocolFactory := thrift.NewTCompactProtocolFactory() transportFactory := thrift.NewTFramedTransportFactoryMaxLength(thrift.NewTTransportFactory(), 524288000) processor := iface.NewNMPDataServiceProcessor(new(impl.NMPDataService)) server := thrift.NewTSimpleServer4(processor, serverTransport, transportFactory, protocolFactory) server.Serve() defer server.Stop() </code></pre> <p>The Handler implementation of NMPDataService interface:</p> <pre><code>package impl import ( "NMPService/Framework/logger" "NMPService/NmpService/thrift/iface" "NMPService/NmpService/utils" "syscall" "errors" "fmt" "io" "io/ioutil" "os" "path/filepath" "regexp" "strconv" "strings" "time" "github.com/yeka/zip" ) var log = logger.GetBeeLogger() // NMPDataService . type NMPDataService struct { } const ( // MaxDownloadFileLimit ... MaxDownloadFileLimit int64 = 15728640 TempFolder string = "tmp" ) // ExistsFolder method // Parameters: // - Path func (handler *NMPDataService) ExistsFolder(path string) (bool, error) { log.Info("Check exist folder, path: %s", path) if strings.Contains(path, "\\") { path = strings.ReplaceAll(path, "\\", "/") } fileInfo, err := os.Stat(path) if os.IsNotExist(err) { log.Error("folder %s not exist", path) return false, nil } if !fileInfo.IsDir() { msg := "the path is not folder." log.Error(msg) return false, NewRPCException(1, msg, errors.New(msg)) } if err != nil { log.Error("Check exist folder error.") return false, NewRPCException(1, "Check exist folder error", err) } return true, nil } </code></pre> <p>Above is my code on Server side. I want to get client IP information from server.</p> </div>

Thrift问题:thrift --gen csharp demo.thrift执行后的文件出错

![图片说明](https://img-ask.csdn.net/upload/201807/25/1532499496_979041.png) 如上图, Apache Thrift问题 cmd 执行命令 :thrift --gen csharp demo.thrift 后的.cs文件报错 就以上两个 。 错误提示是:“TProtocol”不包含“IncrementRecursionDepth”的定义。 “TProtocol”不包含“DecrementRecursionDepth”的定义。 这个要怎么改?

thrift服务端中可否使用多线程,会出现什么问题

thrift服务端可以使用多线程模型,但是由于单个任务很大,时间很长,可以通过在服务端代码中使用多线程来加速处理么?

Visual studio中使用thrift做客户端,如何导入thrift的第三方依赖?

项目--> C++目录--> 包含目录 选择boost包含目录,thrift包含目录,openssl包含目录; 在main中引入thrift通信要用的头文件: #include "stdafx.h" #include <thrift/transport/TSocket.h> #include <thrift/transport/TBufferTransports.h> #include <thrift/protocol/TBinaryProtocol.h> using namespace apache::thrift; using namespace apache::thrift::protocol; using namespace apache::thrift::transport; using namespace std; using boost::shared_ptr; //#pragma comment(lib, "libthrift.lib") //#pragma comment(lib, "libeay32.lib") //#pragma comment(lib, "ssleay32.lib") int main(int argc, char **argv) { boost::shared_ptr<TSocket> socket(new TSocket("localhost", 9090)); return 0; } 运行有错误: ThriftClientTest.obj : error LNK2001: 无法解析的外部符号 "public: __cdecl apache::thrift::transport::TSocket::TSocket(class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const &,int)" (??0TSocket@transport@thrift@apache@@QEAA@AEBV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@H@Z) 不知道这是什么原因造成的?谁能帮我解答一下吗

在中国程序员是青春饭吗?

今年,我也32了 ,为了不给大家误导,咨询了猎头、圈内好友,以及年过35岁的几位老程序员……舍了老脸去揭人家伤疤……希望能给大家以帮助,记得帮我点赞哦。 目录: 你以为的人生 一次又一次的伤害 猎头界的真相 如何应对互联网行业的「中年危机」 一、你以为的人生 刚入行时,拿着傲人的工资,想着好好干,以为我们的人生是这样的: 等真到了那一天,你会发现,你的人生很可能是这样的: ...

程序员请照顾好自己,周末病魔差点一套带走我。

程序员在一个周末的时间,得了重病,差点当场去世,还好及时挽救回来了。

我以为我学懂了数据结构,直到看了这个导图才发现,我错了

数据结构与算法思维导图

String s = new String(" a ") 到底产生几个对象?

老生常谈的一个梗,到2020了还在争论,你们一天天的,哎哎哎,我不是针对你一个,我是说在座的各位都是人才! 上图红色的这3个箭头,对于通过new产生一个字符串(”宜春”)时,会先去常量池中查找是否已经有了”宜春”对象,如果没有则在常量池中创建一个此字符串对象,然后堆中再创建一个常量池中此”宜春”对象的拷贝对象。 也就是说准确答案是产生了一个或两个对象,如果常量池中原来没有 ”宜春” ,就是两个。...

技术大佬:我去,你写的 switch 语句也太老土了吧

昨天早上通过远程的方式 review 了两名新来同事的代码,大部分代码都写得很漂亮,严谨的同时注释也很到位,这令我非常满意。但当我看到他们当中有一个人写的 switch 语句时,还是忍不住破口大骂:“我擦,小王,你丫写的 switch 语句也太老土了吧!” 来看看小王写的代码吧,看完不要骂我装逼啊。 private static String createPlayer(PlayerTypes p...

Linux面试题(2020最新版)

文章目录Linux 概述什么是LinuxUnix和Linux有什么区别?什么是 Linux 内核?Linux的基本组件是什么?Linux 的体系结构BASH和DOS之间的基本区别是什么?Linux 开机启动过程?Linux系统缺省的运行级别?Linux 使用的进程间通信方式?Linux 有哪些系统日志文件?Linux系统安装多个桌面环境有帮助吗?什么是交换空间?什么是root帐户什么是LILO?什...

将一个接口响应时间从2s优化到 200ms以内的一个案例

一、背景 在开发联调阶段发现一个接口的响应时间特别长,经常超时,囧… 本文讲讲是如何定位到性能瓶颈以及修改的思路,将该接口从 2 s 左右优化到 200ms 以内 。 二、步骤 2.1 定位 定位性能瓶颈有两个思路,一个是通过工具去监控,一个是通过经验去猜想。 2.1.1 工具监控 就工具而言,推荐使用 arthas ,用到的是 trace 命令 具体安装步骤很简单,大家自行研究。 我的使用步骤是...

学历低,无法胜任工作,大佬告诉你应该怎么做

微信上收到一位读者小涛的留言,大致的意思是自己只有高中学历,经过培训后找到了一份工作,但很难胜任,考虑要不要辞职找一份他能力可以胜任的实习工作。下面是他留言的一部分内容: 二哥,我是 2016 年高中毕业的,考上了大学但没去成,主要是因为当时家里经济条件不太允许。 打工了三年后想学一门技术,就去培训了。培训的学校比较垃圾,现在非常后悔没去正规一点的机构培训。 去年 11 月份来北京找到了一份工...

JVM内存结构和Java内存模型别再傻傻分不清了

JVM内存结构和Java内存模型都是面试的热点问题,名字看感觉都差不多,网上有些博客也都把这两个概念混着用,实际上他们之间差别还是挺大的。 通俗点说,JVM内存结构是与JVM的内部存储结构相关,而Java内存模型是与多线程编程相关,本文针对这两个总是被混用的概念展开讲解。 JVM内存结构 JVM构成 说到JVM内存结构,就不会只是说内存结构的5个分区,而是会延展到整个JVM相关的问题,所以先了解下

和黑客斗争的 6 天!

互联网公司工作,很难避免不和黑客们打交道,我呆过的两家互联网公司,几乎每月每天每分钟都有黑客在公司网站上扫描。有的是寻找 Sql 注入的缺口,有的是寻找线上服务器可能存在的漏洞,大部分都...

Google 与微软的浏览器之争

浏览器再现“神仙打架”。整理 | 屠敏头图 | CSDN 下载自东方 IC出品 | CSDN(ID:CSDNnews)从 IE 到 Chrome,再从 Chrome 到 Edge,微软与...

讲一个程序员如何副业月赚三万的真实故事

loonggg读完需要3分钟速读仅需 1 分钟大家好,我是你们的校长。我之前讲过,这年头,只要肯动脑,肯行动,程序员凭借自己的技术,赚钱的方式还是有很多种的。仅仅靠在公司出卖自己的劳动时...

上班一个月,后悔当初着急入职的选择了

最近有个老铁,告诉我说,上班一个月,后悔当初着急入职现在公司了。他之前在美图做手机研发,今年美图那边今年也有一波组织优化调整,他是其中一个,在协商离职后,当时捉急找工作上班,因为有房贷供着,不能没有收入来源。所以匆忙选了一家公司,实际上是一个大型外包公司,主要派遣给其他手机厂商做外包项目。**当时承诺待遇还不错,所以就立马入职去上班了。但是后面入职后,发现薪酬待遇这块并不是HR所说那样,那个HR自...

女程序员,为什么比男程序员少???

昨天看到一档综艺节目,讨论了两个话题:(1)中国学生的数学成绩,平均下来看,会比国外好?为什么?(2)男生的数学成绩,平均下来看,会比女生好?为什么?同时,我又联想到了一个技术圈经常讨...

搜狗输入法也在挑战国人的智商!

故事总是一个接着一个到来...上周写完《鲁大师已经彻底沦为一款垃圾流氓软件!》这篇文章之后,鲁大师的市场工作人员就找到了我,希望把这篇文章删除掉。经过一番沟通我先把这篇文章从公号中删除了...

85后蒋凡:28岁实现财务自由、34岁成为阿里万亿电商帝国双掌门,他的人生底层逻辑是什么?...

蒋凡是何许人也? 2017年12月27日,在入职4年时间里,蒋凡开挂般坐上了淘宝总裁位置。 为此,时任阿里CEO张勇在任命书中力赞: 蒋凡加入阿里,始终保持创业者的冲劲,有敏锐的...

总结了 150 余个神奇网站,你不来瞅瞅吗?

原博客再更新,可能就没了,之后将持续更新本篇博客。

副业收入是我做程序媛的3倍,工作外的B面人生是怎样的?

提到“程序员”,多数人脑海里首先想到的大约是:为人木讷、薪水超高、工作枯燥…… 然而,当离开工作岗位,撕去层层标签,脱下“程序员”这身外套,有的人生动又有趣,马上展现出了完全不同的A/B面人生! 不论是简单的爱好,还是正经的副业,他们都干得同样出色。偶尔,还能和程序员的特质结合,产生奇妙的“化学反应”。 @Charlotte:平日素颜示人,周末美妆博主 大家都以为程序媛也个个不修边幅,但我们也许...

MySQL数据库面试题(2020最新版)

文章目录数据库基础知识为什么要使用数据库什么是SQL?什么是MySQL?数据库三大范式是什么mysql有关权限的表都有哪几个MySQL的binlog有有几种录入格式?分别有什么区别?数据类型mysql有哪些数据类型引擎MySQL存储引擎MyISAM与InnoDB区别MyISAM索引与InnoDB索引的区别?InnoDB引擎的4大特性存储引擎选择索引什么是索引?索引有哪些优缺点?索引使用场景(重点)...

如果你是老板,你会不会踢了这样的员工?

有个好朋友ZS,是技术总监,昨天问我:“有一个老下属,跟了我很多年,做事勤勤恳恳,主动性也很好。但随着公司的发展,他的进步速度,跟不上团队的步伐了,有点...

我入职阿里后,才知道原来简历这么写

私下里,有不少读者问我:“二哥,如何才能写出一份专业的技术简历呢?我总感觉自己写的简历太烂了,所以投了无数份,都石沉大海了。”说实话,我自己好多年没有写过简历了,但我认识的一个同行,他在阿里,给我说了一些他当年写简历的方法论,我感觉太牛逼了,实在是忍不住,就分享了出来,希望能够帮助到你。 01、简历的本质 作为简历的撰写者,你必须要搞清楚一点,简历的本质是什么,它就是为了来销售你的价值主张的。往深...

离职半年了,老东家又发 offer,回不回?

有小伙伴问松哥这个问题,他在上海某公司,在离职了几个月后,前公司的领导联系到他,希望他能够返聘回去,他很纠结要不要回去? 俗话说好马不吃回头草,但是这个小伙伴既然感到纠结了,我觉得至少说明了两个问题:1.曾经的公司还不错;2.现在的日子也不是很如意。否则应该就不会纠结了。 老实说,松哥之前也有过类似的经历,今天就来和小伙伴们聊聊回头草到底吃不吃。 首先一个基本观点,就是离职了也没必要和老东家弄的苦...

男生更看重女生的身材脸蛋,还是思想?

往往,我们看不进去大段大段的逻辑。深刻的哲理,往往短而精悍,一阵见血。问:产品经理挺漂亮的,有点心动,但不知道合不合得来。男生更看重女生的身材脸蛋,还是...

什么时候跳槽,为什么离职,你想好了么?

都是出来打工的,多为自己着想

程序员为什么千万不要瞎努力?

本文作者用对比非常鲜明的两个开发团队的故事,讲解了敏捷开发之道 —— 如果你的团队缺乏统一标准的环境,那么即使勤劳努力,不仅会极其耗时而且成果甚微,使用...

为什么程序员做外包会被瞧不起?

二哥,有个事想询问下您的意见,您觉得应届生值得去外包吗?公司虽然挺大的,中xx,但待遇感觉挺低,马上要报到,挺纠结的。

当HR压你价,说你只值7K,你该怎么回答?

当HR压你价,说你只值7K时,你可以流畅地回答,记住,是流畅,不能犹豫。 礼貌地说:“7K是吗?了解了。嗯~其实我对贵司的面试官印象很好。只不过,现在我的手头上已经有一份11K的offer。来面试,主要也是自己对贵司挺有兴趣的,所以过来看看……”(未完) 这段话主要是陪HR互诈的同时,从公司兴趣,公司职员印象上,都给予对方正面的肯定,既能提升HR的好感度,又能让谈判气氛融洽,为后面的发挥留足空间。...

面试:第十六章:Java中级开发(16k)

HashMap底层实现原理,红黑树,B+树,B树的结构原理 Spring的AOP和IOC是什么?它们常见的使用场景有哪些?Spring事务,事务的属性,传播行为,数据库隔离级别 Spring和SpringMVC,MyBatis以及SpringBoot的注解分别有哪些?SpringMVC的工作原理,SpringBoot框架的优点,MyBatis框架的优点 SpringCould组件有哪些,他们...

面试阿里p7,被按在地上摩擦,鬼知道我经历了什么?

面试阿里p7被问到的问题(当时我只知道第一个):@Conditional是做什么的?@Conditional多个条件是什么逻辑关系?条件判断在什么时候执...

终于懂了TCP和UDP协议区别

终于懂了TCP和UDP协议区别

立即提问
相关内容推荐