惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

酷 壳 – CoolShell
酷 壳 – CoolShell
H
Hacker News: Front Page
P
Palo Alto Networks Blog
T
ThreatConnect
Apple Machine Learning Research
Apple Machine Learning Research
博客园_首页
T
True Tiger Recordings
P
Privacy & Cybersecurity Law Blog
B
Blog
IT之家
IT之家
Last Week in AI
Last Week in AI
F
Full Disclosure
Hacker News: Ask HN
Hacker News: Ask HN
C
Comments on: Blog
Microsoft Azure Blog
Microsoft Azure Blog
C
Cybersecurity and Infrastructure Security Agency CISA
Microsoft Security Blog
Microsoft Security Blog
博客园 - 【当耐特】
N
News and Events Feed by Topic
NISL@THU
NISL@THU
腾讯CDC
雷峰网
雷峰网
Security Latest
Security Latest
李成银的技术随笔
M
Microsoft Research Blog - Microsoft Research
L
LangChain Blog
L
Lohrmann on Cybersecurity
cs.CL updates on arXiv.org
cs.CL updates on arXiv.org
C
Check Point Blog
Y
Y Combinator Blog
Recent Announcements
Recent Announcements
博客园 - Franky
N
News | PayPal Newsroom
V
V2EX
A
About on SuperTechFans
The Register - Security
The Register - Security
月光博客
月光博客
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
Google Online Security Blog
Google Online Security Blog
MyScale Blog
MyScale Blog
Cisco Talos Blog
Cisco Talos Blog
Vercel News
Vercel News
WordPress大学
WordPress大学
C
Cyber Attacks, Cyber Crime and Cyber Security
The Hacker News
The Hacker News
IntelliJ IDEA : IntelliJ IDEA – the Leading IDE for Professional Development in Java and Kotlin | The JetBrains Blog
IntelliJ IDEA : IntelliJ IDEA – the Leading IDE for Professional Development in Java and Kotlin | The JetBrains Blog
爱范儿
爱范儿
A
Arctic Wolf
L
LINUX DO - 最新话题
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More

博客园 - 大侠(cer)

阿里巴巴又抄袭创业公司产品,这次已被告上法庭(一) 手机app传统邀请码安装与免邀请码安装区别,如何选择呢? 好用的一些开源系统 一个搞笑的招聘启事 java和android及IOS对接RSA加密经验 mysql大数据表改表结构方案 android开发中监控android软件网络请求的软件Charles使用入门 android IOC框架学习记录 java分布式事务 android开发时使用游标时一定要关闭 今天发现ConcurrentHashMap的key是不区分大小写的 js方法isNaN使用时注意,“1.”这样子的东西他也会认为是数字 - 大侠(cer) 使用nginx+lua实现web项目的灰度发布 nginx增加lua支持 两台机器使用rsync同步数据(手工执行命令同步)(使用推的方式) 在ubuntu使用基于l2tp的VPN设置(支持硬件key的哦) - 大侠(cer) ubuntu服务器配制jmagick环境 windows中架设基于Apache的svn服务器 amoeba学习
CentOS安装thrift
大侠(cer) · 2012-02-10 · via 博客园 - 大侠(cer)

1.安装jdk

2.安装ant

3.安装  ivy

a、下载apache ivy:http://labs.renren.com/apache-mirror//ant/ivy/2.2.0/apache-ivy-2.2.0-bin.tar.gz
b、tar xzvf apache-ivy-2.2.0-bin.tar.gz
c、cp ivy-2.2.0.jar to ANT_HOME/lib

d、goto apache-ivy-2.2.0/src/example/hello-ivy, and run ant,也就是在目录apache-ivy-2.2.0/src/example/hello-ivy,运行ant

如果看到: 

BUILD SUCCESSFUL

Total time: 29 seconds

就代表成了 

在centos里再执行这一句应没问题:sudo yum install automake libtool flex bison pkgconfig gcc-c++ boost-devel libevent-devel zlib-devel python-devel ruby-devel 

 哈哈

4. 安装thrift

a>下载thrift:http://mirror.bjtu.edu.cn/apache//thrift/0.8.0/thrift-0.8.0.tar.gz

b>tar -zxvf thrift-0.8.0.tar.gz

c>cd  thrift-0.8.0

d> ./configure --with-boost=/usr/local

e>make 

f>make install 

g>在命今行内输入 thrift,如果有提示,应就可以了

如果遇到"Error: libcrypto required" 错误,请安装libssl-dev

5.构建thrift java 服务器端和客户端

 a>新建testJava.thrift文件:

namespace java Test
service Something{
    i32 ping()

b>testJava.thrift目录执行如下命令:thrift –gen java testJava.thrift ,生成的源文件在./gen-java/目录下

c>进入gen-java目录

d>编写SomethingImpl.java

package Test;

import org.apache.thrift.TException;

class SomethingImpl implements Something.Iface {
    public SomethingImpl() {
    }

    public int ping() throws TException {
        System.out.println("Recieve ping from client...");
        return 0;
    }

e> Server.java

package Test;

import java.io.IOException;
import org.apache.thrift.protocol.TBinaryProtocol;
import org.apache.thrift.protocol.TBinaryProtocol.Factory;
import org.apache.thrift.server.TServer;
import org.apache.thrift.server.TSimpleServer;
import org.apache.thrift.server.TThreadPoolServer;
import org.apache.thrift.transport.TServerSocket;
import org.apache.thrift.transport.TTransportException;

public class Server {
    private void start() {
        try {
            TServerSocket serverTransport = new TServerSocket(7911);
            Something.Processor processor = new Something.Processor(new SomethingImpl());
            Factory protFactory = new TBinaryProtocol.Factory(truetrue);
            //TServer server = new TThreadPoolServer(processor, serverTransport,protFactory);
            
//TServer server = new TSimpleServer(new Args(serverTransport).processor(processor));
            TServer server = new TThreadPoolServer(new TThreadPoolServer.Args(serverTransport).processor(processor));
            System.out.println("Starting server on port 7911 ...");
            server.serve();

        } catch (TTransportException e) {
            e.printStackTrace();
        } catch (Exception e) {
            e.printStackTrace();
        }
    }

    public static void main(String args[]) {
        Server srv = new Server();
        srv.start();
    }

f> Client.java

package Test;

import java.io.IOException;
import org.apache.thrift.*;
import org.apache.thrift.protocol.*;
import org.apache.thrift.transport.*;

public class Client {
      public static void main(String [] args) {
           try {
                    TTransport transport = new TSocket("localhost", 7911);
                    TProtocol protocol = new TBinaryProtocol(transport);
                    Something.Client client = new Something.Client(protocol);
                    transport.open();
                    System.out.println("Client calls ping()");
                    client.ping();
                    transport.close();
               } catch (TException x) {
                    x.printStackTrace();
               }   
        }   

}  

g>要求如下几个包支持libthrift-0.8.0.jar  log4j-1.2.14.jar  slf4j-api-1.5.8.jar  slf4j-log4j12-1.5.8.jar,所以可以如下命令编译:

 javac -classpath ./:../lib/libthrift-0.8.0.jar:../lib/log4j-1.2.14.jar:../lib/slf4j-api-1.5.8.jar:../lib/slf4j-log4j12-1.5.8.jar *.java

h> 启动服务器。退到gen-java目录,输入java  -classpath ./:../lib/libthrift-0.8.0.jar:../lib/log4j-1.2.14.jar:../lib/slf4j-api-1.5.8.jar:../lib/slf4j-log4j12-1.5.8.jar Test/Server,屏幕显示如下:

Starting server on port 7911 ...

i> 启动客户端。在同一目录下输入java  -classpath ./:../lib/libthrift-0.8.0.jar:../lib/log4j-1.2.14.jar:../lib/slf4j-api-1.5.8.jar:../lib/slf4j-log4j12-1.5.8.jar  Test/Client,屏幕显示如下:

Client calls ping()

这时服务器端的输出多了一行:

Recieve ping from client...

成功了!!!!!!!!!!!!!!!!!!!!!!!! 

问题:

1.

error: command 'gcc' failed with exit status 1

install python-dev