Get "connect timed out" with twitter4j api

modified HelloWorldAdapter.java to call " unauthenticatedTwitter.getPublicTimeline();".
add following code before calling twitter api
System.setProperty("twitter4j.http.proxyHost", "www-proxy.us.oracle.com"); System.setProperty("twitter4j.http.proxyPort", "80");
the CEP HelloWorld CEP fails with "connect timed out"
If I use similar code (testwitter.java) outside CEP. works fine.
I am using eclipse to test the code.
--- here is part of the testtwitter.java
Twitter unauthenticatedTwitter = new TwitterFactory().getInstance();
     System.out.println("Showing public timeline.");
     System.setProperty("twitter4j.http.proxyHost", "www-proxy.us.oracle.com");
     System.setProperty("twitter4j.http.proxyPort", "80");
     try {
     List<Status> statuses = unauthenticatedTwitter.getPublicTimeline();
     for (Status status : statuses) {
     System.out.println(status.getUser().getName() + ":" +
     status.getText());
--- here is the part of the generateTwitterMessage() at HelloWorld CEP
     Twitter unauthenticatedTwitter = new TwitterFactory().getInstance();
     System.setProperty("twitter4j.http.proxyHost", "www-proxy.us.oracle.com");
     System.setProperty("twitter4j.http.proxyPort", "80");
     System.out.println("---- after seting proxyhost, call generateTwitterMessage");
     System.out.println("---Showing public timeline.");
try {
     List<Status> statuses = unauthenticatedTwitter.getPublicTimeline();
for (Status status : statuses) {
     String twitterMsg = status.getUser().getName() + ":" +status.getText();
System.out.println("msg--"+twitterMsg);
String message = this.message + dateFormat.format(new Date()) + twitterMsg ;
HelloWorldEvent event = new HelloWorldEvent();
event.setMessage(message);
eventSender.sendInsertEvent(event);
}catch ....
Please help me on proxy host/port setup inside CEP

yatin002 wrote:
Any ideas/suggestions to solve this issue ???Catch the Exception?
static boolean checkURL(URL url){
    HttpURLConnection httpCon = null;
    try {
        httpCon = (HttpURLConnection)url.openConnection();
        return httpCon.getResponseCode() == HttpURLConnection.HTTP_OK;
    catch(Exception ex){
        ex.printStackTrace();
        return false;
    finally {
        if( httpCon != null ){
            httpCon.disconnect();
    }

Similar Messages

  • "Connection timed out" with HttpClient.

    Hi,
    My goal is to consume a web service using Apache AXIS. This web service uses Integrated Windows Authentication.
    I use IE have configured Proxy server address and Proxy server port using IE's Tools -> Internet Options -> Connections Tab -> LAN Settings -> Proxy serer.
    If type the webservice endpoint address of the form http://239.271.380.120/serveme/WS.asmx in my browser then I see in my browser "You are not authorized to view this page .. HTTP Error 401.2 - Unauthorized: Access is denied due to server configuration. Internet Information Services (IIS)" but there is another client in another network who is getting a login dialog to enter domain\\username and password when he types the web service endpoint address in the browser. This makes me think that either the so called another client is in the same domain as the web service provider and I am not.
    Anway, I tried to write standalone HttpClient (I use commons-httpclient-3.0-rc3, commons-codec-1.3, commons-logging-1.0.4) program NTCredentialsClient.java like below :
    NTCredentialsClient.java
    import org.apache.commons.httpclient.*;
    import org.apache.commons.httpclient.auth.*;
    import org.apache.commons.httpclient.methods.*;
    public class NTCredentialsClient {
         public static void main(String args[]) {
              HttpClient client = new HttpClient();
              NTCredentials credentials = new NTCredentials("user1", "password1", "MYDESKTOP", "domain1");
              AuthScope authScope = new AuthScope("20.222.335.37", 3128);
              client.getState().setCredentials(authScope, credentials);
              //client.getState().setCredentials(AuthScope.ANY, credentials);
              GetMethod get = new GetMethod("http://239.271.380.120/serveme/WS.asmx");
              get.setDoAuthentication(true);
              try {
                   int status = client.executeMethod(get);
                   System.out.println(status);
                   get.getResponseBodyAsStream();
                   // print the status and response
                    System.out.println(status + "\n" + get.getResponseBodyAsString());
              catch (Exception e) {
                   e.printStackTrace();
              finally {
                   get.releaseConnection();
    ------------------------------------------------------------------In the above program, user1, password1, domain1 are details given by my service provider and
    MYDESKTOP is my local machine name from which I am running the above program. 20.222.335.37
    is my proxy server address and 3128 is my proxy server port. Now when I run the above
    program I get this exception :
    Aug 16, 2005 12:43:45 PM org.apache.commons.httpclient.HttpMethodDirector executeWithRetry
    INFO: I/O exception caught when processing request: Connection timed out: connect
    Aug 16, 2005 12:43:46 PM org.apache.commons.httpclient.HttpMethodDirector executeWithRetry
    INFO: Retrying request
    Aug 16, 2005 12:44:11 PM org.apache.commons.httpclient.HttpMethodDirector executeWithRetry
    INFO: I/O exception caught when processing request: Connection timed out: connect
    Aug 16, 2005 12:44:11 PM org.apache.commons.httpclient.HttpMethodDirector executeWithRetry
    INFO: Retrying request
    Aug 16, 2005 12:44:37 PM org.apache.commons.httpclient.HttpMethodDirector executeWithRetry
    INFO: I/O exception caught when processing request: Connection timed out: connect
    Aug 16, 2005 12:44:37 PM org.apache.commons.httpclient.HttpMethodDirector executeWithRetry
    INFO: Retrying request
    java.net.ConnectException: Connection timed out: connect
            at java.net.PlainSocketImpl.socketConnect(Native Method)
            at java.net.PlainSocketImpl.doConnect(Unknown Source)
            at java.net.PlainSocketImpl.connectToAddress(Unknown Source)
            at java.net.PlainSocketImpl.connect(Unknown Source)
            at java.net.SocksSocketImpl.connect(Unknown Source)
            at java.net.Socket.connect(Unknown Source)
            at java.net.Socket.connect(Unknown Source)
            at java.net.Socket.<init>(Unknown Source)
            at java.net.Socket.<init>(Unknown Source)
            at org.apache.commons.httpclient.protocol.DefaultProtocolSocketFactory.createSocket(DefaultProtocolSocketFactory.java:79)
            at org.apache.commons.httpclient.protocol.DefaultProtocolSocketFactory.createSocket(DefaultProtocolSocketFactory.java:121)
            at org.apache.commons.httpclient.HttpConnection.open(HttpConnection.java:704)
            at org.apache.commons.httpclient.HttpMethodDirector.executeWithRetry(HttpMethodDirector.java:382)
            at org.apache.commons.httpclient.HttpMethodDirector.executeMethod(HttpMethodDirector.java:168)
            at org.apache.commons.httpclient.HttpClient.executeMethod(HttpClient.java:396)
            at org.apache.commons.httpclient.HttpClient.executeMethod(HttpClient.java:324)
            at NTCredentialsClient.main(NTCredentialsClient.java:28)
    ------------------------------------------------------------------Can anyone please tell me whether the configurations I have made in my above client program are correct or is there anything that I am overlooking. Also, in the above program for AuthScope constructor, do I need to pass web service server adderss and port OR my local proxy address and local proxy port as constructor arguments ?
    Please suggest ...
    Thanks & Regards,
    Kr.

    You will need to define your proxy settings. In java, these are provided as system properties:
    System.setProperty("http.proxyHost", "<proxy>");
    System.setProperty("http.proxyPort", "<port>");
    If your proxy uses HTTP authentication, you will need to define a few more system properties, which I don't know off the top of my head. This should actually get you connected with the web server, but as for the 302 error, you'll probably need to contact the system administrator.
    Cheers
    Todd.

  • Cannot web search but can go directly to web addresses, get connection timed out on websearch

    I am using Xp prof and when I enter a subject in the google or yahoo search panel it just goes to the connection has timed out. the server is taking too long to respond.
    I can go directly to a website through favorites and they pop up quickly can be refreshed etc no problems

    I've been having this problem for weeks and have found no solution to it. There are lots of other people with this issue too if you look back on the boards. I even e-mailed AND called Apple and have had no luck. I tried all the suggestions they gave me and all the ones I found on here- nothing worked. I even uninstalled and re-installed iTunes (boy was that a pain!) and no difference.
    The weird part is that I have an old laptop that works and if I buy music with the laptop I can download it with my regular computer buy buying does not work on my regular computer. That tells me it's not a connection issue. I can't get to my account either.
    I can't figure out why an issue that has kept so many people from purchasing a product has been ignored!

  • Can not open my msn mail since I updated Firefox, get connection timed out error

    Since we updated our Firefox to the last version I have not been able to open my email at msn/live.com We have 3 computers networked and it will not open on any of them. However, my husbands account [email protected] opens. I can open it on my home computer but not at our office and it is our office email. Can you help? I've cleared the cache through the tools/options/etc. It will not open on IE either.
    Thanks. Since I can not open this email account I have a yahoo account at [email protected]

    You can check:
    * [[Removing the Search Helper Extension and Bing Bar]]
    You can open the <b>about:config</b> page via the location bar and do a search for <i>bing</i> via the Filter at the top of that page.<br />
    You can reset all <i></i> related prefs via the right-click context menu to their default values.

  • Connection timed out on website. Tried clearing cache/cookies. No proxy. Internet Explorer. Still unable to access. Please help. Website is working.

    I get Connection Timed Out on these websites: energy-medicine-software.com and energy-medicine.info. I tried clearing the cache/cookies. I put in No Proxy. I tried Internet Explorer and still unable to access. I rebooted my computer. I know that this website is active because I contacted the webmaster and he says that it's active at his end. What else can I do to access this site? Thanks!

    Make sure you install several add / mal-ware scanners and run them all
    once in a while. Also;
    It’s very sad, but many of the software down-loaders / installers will trick you
    into installing not only their program, '''but other programs as well'''.
    You have heard of the '''fine print in shady contracts''', right? Well, some
    installers you need to look at the '''itsy bitsy teeny weeny fine print'''.
    You are thinking you are giving the installer permission to install the program
    you want by using the '''recommended''' option. But if you use the
    '''Manual Option Instead''', you discover all kinds of stuff that
    '''you do not even know what it is or what it does'''. From now on,
    everyone needs to '''Use The Manual Option''' to put a stop to this.

  • HT1222 I am trying to update my phone so I can save my info on my old phone & get a new phone, but I get a error that says "There was a problem with downloading teh software, the network connection timed out.."  HELP!  Not sure what my settings shoud be..

    I am trying to update my phone so I can save my info on my old phone & get a new phone, but I get a error that says "There was a problem with downloading teh software, the network connection timed out.."  HELP!  Not sure what my settings shoud be...
    I never updated anything until now...I want o update my iPhone to the newest version, but i do not want ot loose all that I have on this phone. I was told I needed to update the operating systems so i can put things into the cloud for transport to new phone, but I am just not sure how to do this..Can you help out here??

    Dear Jody..jone5
    Good for you that can't update your iphone because I did it and my iphone dosen't work for example I can't download any app like Wecaht or Twitter..
    Goodluck
    Atousa

  • When trying to connect to Airplay speakers I get error message "The  network connection timed out" although some sort of connection is made as the speaker is turned on.  Same thing with Apple TV.  Is the distance from my speaker/ TV the problem?

    When trying to connect from iTunes to Airplay speakers I get error message “The  network connection timed out” although some sort of connection is made as the speaker is turned on.  Same thing with Apple TV.  Is the distance between my PC and the speaker or the AppleTV the problem?

    Hi whitwick,
    If you are having issues with your network connection when attempting to use AirPlay, you may want to use the steps in this article to troubleshoot -
    iTunes: Troubleshooting AirPlay and AirPlay Mirroring
    http://support.apple.com/kb/TS5209
    Thanks for using Apple Support Communities.
    Best,
    Brett L

  • When syncing iPhone with iTunes I get an iTunes stopped working and the network connection timed out message. I reinstalled iTunes and checked settings still no go.

    When syncing iPhone with iTunes I get an iTunes stopped working and the network connection timed out message. I reinstalled iTunes and checked settings still no go.

    Disable or turn off your firewall, anti-virus, and all security software and try the download again.
    Stedman

  • OpenMarket sms api gives "Connection timed out: connect"

    Hello All,
    I am new to web applications with sms services.
    I am trying to send sms from my java application to mobile device. But I am getting below error.
    Aug 25, 2010 10:55:58 AM com.eha.sms.ema.EMACMMessageSendProxy init
    INFO: Move to send the receiver initialization.
    Destination address = +**********
    Source addres = +*****
    Sending message to Simplewire...
    REQUEST XML ==
    <?xml version="1.0" ?>
    <request version="3.0" protocol="wmp" type="submit">
         <user agent="Java/SMS/2.9.16"/>
         <account id="******************" password="***************"/>
         <option type="production"/>
         <source ton="0" address="+*****"/>
         <destination ton="0" address="+**********"/>
         <message udhi="false" text="Hello World!"/>
    </request>
    protocol: http
    remote host: ******Some site given to us by open market people that opens on browser**********
    remote port: 8080
    remote file: /wmp
    {main} [10:55:58.722] Conn: added module com.simplewire.http.RetryModule
    {main} [10:55:58.725] Conn: added module com.simplewire.http.AuthorizationModule
    {main} [10:55:58.726] Conn: added module com.simplewire.http.DefaultModule
    {main} [10:55:58.747] Conn: Creating Socket: smsc-01.openmarket.com:8080
    {main} [10:56:19.759] Conn: java.net.ConnectException: Connection timed out: connect
         at java.net.PlainSocketImpl.socketConnect(Native Method)
         at java.net.PlainSocketImpl.doConnect(Unknown Source)
         at java.net.PlainSocketImpl.connectToAddress(Unknown Source)
         at java.net.PlainSocketImpl.connect(Unknown Source)
         at java.net.SocksSocketImpl.connect(Unknown Source)
         at java.net.Socket.connect(Unknown Source)
         at java.net.Socket.connect(Unknown Source)
         at java.net.Socket.<init>(Unknown Source)
         at java.net.Socket.<init>(Unknown Source)
         at com.simplewire.http.HTTPConnection$_A.run(Unknown Source)
    Message was not sent!
    Error Code: 106
    Error Description: A connection could not be established with the Simplewire network. Connection timed out: connect
    Error Resolution:
    The code I am using is as below.
    private void config()
              Properties properties = new Properties();
              InputStream smscmReceiver = EMACMMessageSendProxy.class.getClassLoader().getResourceAsStream("sms.properties");
              try
                   properties.load(smscmReceiver);
                   System.out.println(properties.getProperty("SMS.SubscriberID").trim());
                   System.out.println(properties.getProperty("SMS.Password").trim());
                   System.out.println(properties.getProperty("SMS.DestinationAddress").trim());
                   System.out.println(properties.getProperty("SMS.SourceAddress").trim());
                   SMS sms = new SMS();
                   // subscriber settings
                   sms.setRemoteHost(" ******Some site given to us by open market people that opens on browser**********");
                   sms.setDebugMode(true);
                   sms.setRemotePort(8080);
                   sms.setSubscriberID(properties.getProperty("SMS.SubscriberID").trim());
                   sms.setSubscriberPassword(properties.getProperty("SMS.Password").trim());
                   // Message Settings
                   sms.setDestinationAddr(properties.getProperty("SMS.DestinationAddress").trim());          // recipient of message
                   sms.setSourceAddr(properties.getProperty("SMS.SourceAddress").trim());               // originator of message
                   sms.setMsgText("Hello World!");
                   System.out.println("Sending message to Simplewire...");
                   // submit message and check results
                   if (sms.submit())
                        System.out.println("Message was sent!");
         System.out.println("Ticket ID: " + sms.getMsgTicketID());
                   else
                        System.out.println("Message was not sent!");
                        System.out.println("Error Code: " + sms.getErrorCode());
                        System.out.println("Error Description: " + sms.getErrorDesc());
                        System.out.println("Error Resolution: " + sms.getErrorResolution() + "\n");
              } catch (IOException e)
              log.error("Load profile sms.properties failed to send Move.", e);
    I am using windows 7 and the required info from the java code is picked up from a property file.
    destination address is a "+" sign followed by cell number of client in US and I am in diff country.
    source code I am using is "+" sign followed by a short code given by client.
    I am also not aware what short codes are for.
    I am also not sure whether I am passing correct parameters.
    I just followed a demo code from the api's sample file. (open market api......swsms-2.9.16 is the jar used.).
    would like to know If destination address can be my cell number.
    The open market people have configured the demo short code for our SMS messaging account.
    This feature will allow us to test our platform to send and receive SMS messages
    while we are waiting for our dedicated short code.
    Mobile Originated messages MUST start with our assigned keyword(s) to be routed to you.
    We have a few keywords but don't know how to use them.
    Please help!
    Thanks in advance.
    Edited by: Vish_1x1 on Aug 24, 2010 11:06 PM

    I had a same problem.
    It was definately URL and SOAP Action Problem.
    Also, I didnt configure the Proxy too.
    Please dont waste more time in looking inot other configs.
    Just give a careful look at Target URL and SOAP Action, again and again.
    Sweta , Please make this question Answerd , it will be useful for other users.
    And Bahvesh Deserves good points..
    Thanks ,
    Deo.

  • TS3694 Why can't I update my iPhone 4 to iOS 5.1? Every time I try it gets all the way done downloading it; however when it's processing the file the page tells me "There is a problem downloading the software for the iPhone. Network connection timed out.

    Why can't I update my iPhone 4 to iOS 5.1? Every time I try it gets all the way done downloading it; however when it's processing the file the page tells me "There is a problem downloading the software for the iPhone. Network connection timed out. Make sure your network settings are correct and your network connection is active. or try again later." and next to the file it has err = -3259. I have tried this 17 times and it won't work. My iTunes is completely up to date. I have made sure that my connection is fine and I have tried turning my firewall off with no avail. This has happened to me before but usually the update will go through after 2-3 tries, never to this extent. I don't know what to do. Help!

    Error -3259 is a network timeout error, usually. This article might help:
    http://support.apple.com/kb/TS2799

  • I get a connection timed out error when trying to connect to the itunes store, if I have pending downloads they show up and I can download, also I was able to access my account, yet I can't access other parts of the store, I am in greece on a macbook pro

    I am from the states and am in Greece on vacation.  I have a good wifi connection yet keep getting a connection timed out error when I try to access the itunes store.  It is funny because pending downloads show up in the cue, and they download no problem.  I can also open my account.  When I try to go the the movies or music section of the stor though it just times out.  I tried updating to the latest itunes software and restarting, also I checked all the proxy boxes in the network section of the settings then unchecked them all and restarted and it keeps doing the same thing.  Any help would be appreciated.
    Thanks

    Welcome to AD!
    There's been plenty of posts about Norton & the removal tool here. Unfortunately many folks seem to not even know it comes pre-installed on most PCs! Even a trial version, never used or long since expired can cause problems - and not just with iTunes.
    Anyone with a Dell, HP, Gateway EEE PC, Asus ..... what Windows PC manufacturer does NOT have this junk software pre-installed?
    Almost all of them have made deals with Symantec to pre-install it.
    Horrible, horrible software.
    Anyway, glad you finally solved your problem.

  • I am having alot of problems with itunes, including a "connection timed out" error CONSTANTLY. Any suggestions?

    My iTunes has always been a huge pain no matter what ive done. It runs slowly in general, freezes up every now and then, and when trying to restore my iPod touch 4g, i need to download a software update, which is impossible, due to the fact that every time i try i get a "Network connection timed out" message. I have also had the issue of my account locking me out twice now in a very short period of time, and i have no idea why. It says for security reasons, but ive changed passwords and everything.
    I would like to know if an update is comming soon to make things smoother, because ive long since lost patience with iTunes.

    If you are getting a network timeout error when downloading an iOS update then try temporarily turning off all your firewall and antivirus software until the download has completed.
    In terms of whether an update is coming, we are just fellow users on here so we won't know when the next update might be, and what might or might not be in it.

  • Losing Airport/ Get message "connection timed out" when try to re-connect

    This has happened several times over the past few days. First time, trying to re-connect, it didn't see my network name. Then re-entered name, selected/joined, password shows up, but connection times out. Tonight, it saw my name, password showed up, but wouldn't connect, not matter what, with message "connection timed out."
    Both times the only thing that worked was a re-start. Tonight, even after a re-start, got "connection timed out" message at first, but was able to get back on by clicking on the icon. I see the following logs.
    Error: airportd MIG failed = -6 ((null)) (port = 26123)
    Macintosh-3 Apple80211Agent[91]: Error joining .......: Connection timeout (-6 timeout connecting)
    Macintosh-3 airportd[673]: Error: Apple80211Associate() failed -6
    Until this happens, the connection is solid, usually with 54 mbs. I've googled around for these logs, but haven't seen anything conclusive. Any ideas? Thanks.

    Don't mean to add to the possible confusion here, but most newer routers (Apple included) allow their users to "hide" their network, so it's also very possible and likely in an apartment situation that you can pick up interference from a network that you or Air Radar cannot "see".
    So, trying to find the "right" channel becomes a bit more of guessing game.
    Understand that you need "g" for your devices. For the future though, you might watch the Air Radar screen for channels in the 36-48 and 149-161 range to see how much less activity is going on there.

  • Customer Getting "The MX connection timed out."When Joining The Beehive OWC

    Hello,
    I have attempted to use the Beehive client for initiating the owc with customers, and in 60-70% if the cases, they end up getting the message, "The MX connection timed out".
    I don't know how to get around this issue, will appreciate if someone has a fix or work around to overcome this issue.
    I am working on a Win 7 platform, Beehive Conferencing 2.0.1.7.0
    I am also having an issue when starting an owc. Beehive (by default) assigns 'My Personal Workspace' as the location of my conference. But when I click on the dropdown,
    on the second line, I see "loading", but nothing ever loads.
    Thanks.
    Anees.

    Hi Phil,
    I am getting the same error message MX connection timed out.
    (I am Oracle customer). My desktop running window 7, has latest JRE 7 update 21 installed. still getting the error.
    Couldn't get beehive running, but no issue when using the old web conference RTC real-time collaboration from Oracle.
    Any ideas what else I need to do to fix this. (Oracle customer support very much give up and frustrate too).
    Thank you.
    Elizabeth.

  • When I try to sign in with new password for apple, I constantly get "session timed out"

    When I try to sign in with a new password for IPhone, I constantly get "session timed out" and I am asked to try again and it does the same

    sounds like your connection to the internet has failed.

Maybe you are looking for