Results 1 to 5 of 5

Thread: Timeout with Connection to Quartz RMI Scheduler

  1. #1
    Join Date
    Jan 2005
    Posts
    8

    Smile Timeout with Connection to Quartz RMI Scheduler

    Hello,

    I am connecting to a handful of RMI Schedulers across the globe. One particular RMI Scheduler instance is in Sydney, Australia and the client is located in the NorthEast of the US. When I try to connect to the RMI Schedulers from the distant client I eventually receive a timeout after about 40 seconds. Is there a timeout set within quartz? Could there be a configuration property for quartz to extend timeouts or would a certain rmi property help (I have tried some to no avail)?

    I have 2 other RMI objects binded on that server that I can connect to without a timeout occuring. Those objects I connect/setup using Spring Remoting.

    Any ideas. The following is a stacktrace of the timeout.

    Thanks in advance,
    Anthony Bargnesi

    org.quartz.SchedulerException: Error communicating with remote scheduler. [See nested exception: java.rmi.ConnectException: Connection refused to host: 172.16.10.97; nested exception is:
    java.net.ConnectException: Connection timed out: connect]

    at org.quartz.impl.RemoteScheduler.invalidateHandleCr eateException(RemoteScheduler.java:135)

    at org.quartz.impl.RemoteScheduler.getSchedulerName(R emoteScheduler.java:149)

    at org.quartz.impl.SchedulerRepository.bind(Scheduler Repository.java:80)

    at org.quartz.impl.DirectSchedulerFactory.createRemot eScheduler(DirectSchedulerFactory.java:226)

    at com.aquent.benchmark.SchedulerFactory.createRMISch eduler(SchedulerFactory.java:15)

    at com.aquent.benchmark.BenchmarkInstanceProxy.afterP ropertiesSet(BenchmarkInstanceProxy.java:41)

    at org.springframework.beans.factory.support.Abstract AutowireCapableBeanFactory.invokeInitMethods(Abstr actAutowireCapableBeanFactory.java:1091)

    at org.springframework.beans.factory.support.Abstract AutowireCapableBeanFactory.createBean(AbstractAuto wireCapableBeanFactory.java:396)

    at org.springframework.beans.factory.support.Abstract BeanFactory.getBean(AbstractBeanFactory.java:233)

    at org.springframework.beans.factory.support.Abstract BeanFactory.getBean(AbstractBeanFactory.java:145)

    at org.springframework.beans.factory.support.DefaultL istableBeanFactory.preInstantiateSingletons(Defaul tListableBeanFactory.java:283)

    at org.springframework.context.support.AbstractApplic ationContext.refresh(AbstractApplicationContext.ja va:313)

    at org.springframework.context.support.ClassPathXmlAp plicationContext.<init>(ClassPathXmlApplicationCon text.java:87)

    at org.springframework.context.support.ClassPathXmlAp plicationContext.<init>(ClassPathXmlApplicationCon text.java:72)

    at com.aquent.benchmark.ControllerInstance.start(Cont rollerInstance.java:32)

    at com.aquent.benchmark.ControllerInstance.main(Contr ollerInstance.java:72)

    * Nested Exception (Underlying Cause) ---------------

    java.rmi.ConnectException: Connection refused to host: 172.16.10.97; nested exception is:

    java.net.ConnectException: Connection timed out: connect

    at sun.rmi.transport.tcp.TCPEndpoint.newSocket(TCPEnd point.java:574)

    at sun.rmi.transport.tcp.TCPChannel.createConnection( TCPChannel.java:185)

    at sun.rmi.transport.tcp.TCPChannel.newConnection(TCP Channel.java:171)

    at sun.rmi.server.UnicastRef.invoke(UnicastRef.java:9 4)

    at org.quartz.core.QuartzScheduler_Stub.getSchedulerN ame(Unknown Source)

    at org.quartz.impl.RemoteScheduler.getSchedulerName(R emoteScheduler.java:147)

    at org.quartz.impl.SchedulerRepository.bind(Scheduler Repository.java:80)

    at org.quartz.impl.DirectSchedulerFactory.createRemot eScheduler(DirectSchedulerFactory.java:226)

    at com.aquent.benchmark.SchedulerFactory.createRMISch eduler(SchedulerFactory.java:15)

    at com.aquent.benchmark.BenchmarkInstanceProxy.afterP ropertiesSet(BenchmarkInstanceProxy.java:41)

    at org.springframework.beans.factory.support.Abstract AutowireCapableBeanFactory.invokeInitMethods(Abstr actAutowireCapableBeanFactory.java:1091)

    at org.springframework.beans.factory.support.Abstract AutowireCapableBeanFactory.createBean(AbstractAuto wireCapableBeanFactory.java:396)

    at org.springframework.beans.factory.support.Abstract BeanFactory.getBean(AbstractBeanFactory.java:233)

    at org.springframework.beans.factory.support.Abstract BeanFactory.getBean(AbstractBeanFactory.java:145)

    at org.springframework.beans.factory.support.DefaultL istableBeanFactory.preInstantiateSingletons(Defaul tListableBeanFactory.java:283)

    at org.springframework.context.support.AbstractApplic ationContext.refresh(AbstractApplicationContext.ja va:313)

    at org.springframework.context.support.ClassPathXmlAp plicationContext.<init>(ClassPathXmlApplicationCon text.java:87)

    at org.springframework.context.support.ClassPathXmlAp plicationContext.<init>(ClassPathXmlApplicationCon text.java:72)

    at com.aquent.benchmark.ControllerInstance.start(Cont rollerInstance.java:32)

    at com.aquent.benchmark.ControllerInstance.main(Contr ollerInstance.java:72)

    Caused by: java.net.ConnectException: Connection timed out: connect

    at java.net.PlainSocketImpl.socketConnect(Native Method)

    at java.net.PlainSocketImpl.doConnect(PlainSocketImpl .java:333)

    at java.net.PlainSocketImpl.connectToAddress(PlainSoc ketImpl.java:195)

    at java.net.PlainSocketImpl.connect(PlainSocketImpl.j ava:182)

    at java.net.SocksSocketImpl.connect(SocksSocketImpl.j ava:366)

    at java.net.Socket.connect(Socket.java:507)

    at java.net.Socket.connect(Socket.java:457)

    at java.net.Socket.<init>(Socket.java:365)

    at java.net.Socket.<init>(Socket.java:178)

    at sun.rmi.transport.proxy.RMIDirectSocketFactory.cre ateSocket(RMIDirectSocketFactory.java:22)

    at sun.rmi.transport.proxy.RMIMasterSocketFactory.cre ateSocket(RMIMasterSocketFactory.java:128)

    at sun.rmi.transport.tcp.TCPEndpoint.newSocket(TCPEnd point.java:569)

    ... 19 more
    Anthony Bargnesi
    Web Developer
    Aquent

    \'There\'s no place like 127.0.0.1\'

  2. #2
    Join Date
    Jan 2005
    Location
    Bucharest, Romania
    Posts
    5,403

    Default

    First of all make sure that the IP actually is reachable - 172.16.x.x is a private address and unless you are using VPN you will not reach US or Canada with it.
    If the address works and the timeout of 40 is too small google to find out the timeout parameter that can be set for RMI (IIRC, there is a default system property though it can be set when the RMI connection is created).
    Costin Leau
    SpringSource - http://www.SpringSource.com- Spring Training, Consulting, and Support - "From the Source"
    http://twitter.com/costinl
    Please use [ c o d e ] [ / c o d e ] tags

  3. #3
    Join Date
    Jan 2005
    Posts
    8

    Default

    Costin, thanks for the reply. The system with the 172.16.x.x address is on a company network and is reachable. It turns out though that it wasn't a timeout issue at all even though the exceptions stated that. The remote machine (rmi server) was firewalled and even though we opened port 2650 for the RMI registry we failed to open a second port for the RMI calls to be made on. This port is usually system assigned, so with the TimeoutSocketFactory class I set the port to 2651 if it is originally zero (meaning system assigned).

    So it wasn't a timeout at all but a connection failure on ports when an RMI call is made. That explained why the RMI Remote objects were able to be looked up and not called.

    Thanks for the insight,

    Anthony
    Anthony Bargnesi
    Web Developer
    Aquent

    \'There\'s no place like 127.0.0.1\'

  4. #4
    Join Date
    Mar 2012
    Posts
    2

    Default

    Hi Anthony

    I am facing the same problem. can u plz tell me what code you ve written for TimeoutSocketFactory class and where u ve placed the code.

    I would be very greatful if you help.

    Thanks in advance
    Sharat

  5. #5
    Join Date
    Mar 2012
    Posts
    2

    Default Error solved

    The prob is due to fire wall problem. since the listening port is random, use the following line in server.properties file to eliminate the problem

    Code:
    org.quartz.scheduler.rmi.serverport:7080
    use any port that is allowed by the firewall.


    Cheers
    Sharat

Posting Permissions

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