当与轴2罐一起使用时,Twitter4j BlockingQueue.queue会给出nullpointer异常

时间:2014-12-23 14:01:45

标签: twitter twitter4j twitter-streaming-api twitter-hbc

我正在尝试使用twitter4j API来使用twitter的流API。它正在完善,直到我添加了少数轴2库。

代码:

BlockingQueue<String> queue = twitter.getBlockingQueue();
        //Infinite loop to always receive the messages
        while (true) {
            String twitterServerReply = null;
            try{
                twitterServerReply = queue.take();
            }
            catch(Exception e){
                e.printStackTrace();
            }} 

以下是我得到的例外情况:

Exception in thread "hosebird-client-io-thread-0" java.lang.NullPointerException
at com.twitter.hbc.httpclient.RestartableHttpClient.getConnectionManager(RestartableHttpClient.java:83)
at com.twitter.hbc.httpclient.ClientBase.run(ClientBase.java:165)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
at java.lang.Thread.run(Thread.java:744)    

这是我的POM.XML:

<?xml version="1.0"?><project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.twitter</groupId>
<artifactId>hbc-example</artifactId>
<version>2.2.1-SNAPSHOT</version>
<packaging>jar</packaging>
<name>Hosebird Client Examples</name>
<dependencies>
    <dependency>
        <groupId>com.twitter</groupId>
        <artifactId>hbc-core</artifactId> <!-- or hbc-twitter4j -->
        <version>2.2.0</version> <!-- or whatever the latest version is -->
    </dependency>
    <dependency>
        <groupId>com.googlecode.json-simple</groupId>
        <artifactId>json-simple</artifactId>
        <version>1.1.1</version>
    </dependency>
    <dependency>
        <groupId>org.twitter4j</groupId>
        <artifactId>twitter4j-core</artifactId>
        <version>[4.0,)</version>
    </dependency>
     <dependency>
        <groupId>org.apache.axis2</groupId>
        <artifactId>axis2</artifactId>
        <version>1.6.2</version>
    </dependency>
    <dependency>
        <groupId>org.apache.axis2</groupId>
        <artifactId>axis2-adb</artifactId>
        <version>1.6.2</version>
    </dependency>
    <dependency>
        <groupId>org.apache.axis2</groupId>
        <artifactId>axis2-transport-local</artifactId>
        <version>1.6.2</version>
    </dependency>
    <dependency>
        <groupId>org.apache.axis2</groupId>
        <artifactId>axis2-kernel</artifactId>
        <version>1.6.2</version>
    </dependency>
    <dependency>
        <groupId>org.apache.axis2</groupId>
        <artifactId>axis2-transport-http</artifactId>
        <version>1.6.2</version>
    </dependency>
</dependencies>

我必须使用AXIS 2,因为我需要使用一些SOAP Web服务。 任何人都可以帮忙检查我可能会遇到哪些依赖关系?

注意:如果我删除所有轴2依赖项,它的工作完全正常。

0 个答案:

没有答案