Results 1 to 5 of 5

Thread: Web service consumer ignores http.proxyHost and http.proxyPort in webapp

  1. #1
    Join Date
    Nov 2009
    Location
    Montreal, Quebec
    Posts
    398

    Default Web service consumer ignores http.proxyHost and http.proxyPort in webapp

    I have a web application which monitors a message queue on RabbitMQ using Spring AMQP. When the queue being monitored gets a message, the web application will take the value in the message and use it to perform a web service call (through Spring Integration's abstraction). In development, I had Tomcat running on my laptop and things worked fine. The queue was read and the web service was consumed and the data downloaded. In production, the Tomcat server exists on a linux server behind a proxy server. Reading from the queue works fine, but consuming the web service times out. I have http.proxyHost and http.proxyPort set in the environment variable $JAVA_OPTS, but it seems to be ignored. So I modified the Tomcat startup script so that it would add -Dhttp.proxyHost and -Dhttp.proxyPort when Tomcat starts. Still, consuming the web service times out. I'm really not sure what else to try. I don't want to configure the HttpClient in my application config because I'd have to change it any time I deploy to a server which uses a different proxy.

    Your help is appreciated, Thanks

  2. #2
    Join Date
    Nov 2009
    Location
    Montreal, Quebec
    Posts
    398

    Default

    I found my problem. Problem was with the proxy server IP address.

  3. #3

    Default

    Hi pgrimard,
    We have same problem,we developed Spring MVC application which consumes alfresco webservices sdk,It works locally fine but our production environment is in linux,it gives the connection timeout exception,But in the server logs it shows success message as 200,we have developed this app in STS ide 2.8.1,with java system library 1.7,So could you please explain briefly ,how you solved your problem..
    Thanks in advance

  4. #4
    Join Date
    Nov 2009
    Location
    Montreal, Quebec
    Posts
    398

    Default

    Well like my reply said, the first thing I determined was that the IP address I was using as my proxy host was incorrect. Once I corrected it at the server level, my application running in Tomcat still couldn't get through. What I ended up doing was modifying the Tomcat catalina.sh script which gets used when Tomcat is started as a service. It's located in the Tomcat bin directory.

    The highlighted text is what I added to the existing script.

    Code:
    if [ "$1" = "start" ]; then
      ${JAVACMD} $JAVA_OPTS $CATALINA_OPTS \
        -Dhttp.proxyHost=192.168.10.11 \
        -Dhttp.proxyPort=8080 \
        -classpath "$CLASSPATH" \
        -Dcatalina.base="$CATALINA_BASE" \
        -Dcatalina.home="$CATALINA_HOME" \
        -Djava.endorsed.dirs="$JAVA_ENDORSED_DIRS" \
        -Djava.io.tmpdir="$CATALINA_TMPDIR" \
        -Djava.util.logging.config.file="${CATALINA_BASE}/conf/logging.properties" \
        -Djava.util.logging.manager="org.apache.juli.ClassLoaderLogManager" \
        org.apache.catalina.startup.Bootstrap start \
        >> ${CATALINA_BASE}/logs/catalina.out 2>&1 &
        if [ ! -z "$CATALINA_PID" ]; then
          echo $! > $CATALINA_PID
        fi
    I had first attempted to add the proxy settings to the $JAVA_OPTS environment variable since it's used at the beginning of the start command, but for some reason it didn't work. Placing the proxy settings directly in the script is the only way I've managed to get it working.

  5. #5

    Default

    Thank you So much for brief explanation

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •