有人用过Quartz RMI 嘛,为什么我设置的远程调用服务端可以注册RMI服务成功,但是我在客户端调用的时候老师出现连接拒绝,求大侠解决,我的服务端和客户端的properties配置如下
Server.propertiesorg.quartz.scheduler.instanceName = EximBills Enterprise Schedule Service
org.quartz.scheduler.rmi.export = true
org.quartz.scheduler.rmi.registryHost = 127.0.0.1
org.quartz.scheduler.rmi.registryPort = 1099
org.quartz.scheduler.rmi.serverPort = 0
org.quartz.scheduler.rmi.createRegistry = true
org.quartz.scheduler.rmi.proxy = false
org.quartz.scheduler.wrapJobExecutionInUserTransaction = false
org.quartz.threadPool.class = org.quartz.simpl.SimpleThreadPool
org.quartz.threadPool.threadCount = 10
org.quartz.threadPool.threadPriority = 5
org.quartz.threadPool.threadsInheritContextClassLoaderOfInitializingThread = true
org.quartz.jobStore.misfireThreshold = 60000
org.quartz.jobStore.class = org.quartz.simpl.RAMJobStoreClient.propertiesorg.quartz.scheduler.instanceName = EximBills Enterprise Schedule Service
org.quartz.scheduler.rmi.registryHost = 127.0.0.1
org.quartz.scheduler.rmi.registryPort = 1099
org.quartz.scheduler.rmi.proxy = true
org.quartz.scheduler.wrapJobExecutionInUserTransaction = false
org.quartz.threadPool.class = org.quartz.simpl.SimpleThreadPool
org.quartz.threadPool.threadCount = 10
org.quartz.threadPool.threadPriority = 5
org.quartz.threadPool.threadsInheritContextClassLoaderOfInitializingThread = true
org.quartz.jobStore.misfireThreshold = 60000
org.quartz.jobStore.class = org.quartz.simpl.RAMJobStore
org.quartz.scheduler.rmi.export = false出错信息:Exception in thread "main" org.quartz.SchedulerException: Could not get handle to remote scheduler: Connection refused to host: localhost; nested exception is: 
java.net.ConnectException: Connection refused: connect [See nested exception: java.rmi.ConnectException: Connection refused to host: localhost; nested exception is: 
java.net.ConnectException: Connection refused: connect]
at org.quartz.impl.RemoteScheduler.getRemoteScheduler(RemoteScheduler.java:123)
at org.quartz.impl.RemoteScheduler.getSchedulerName(RemoteScheduler.java:149)
at org.quartz.impl.SchedulerRepository.bind(SchedulerRepository.java:82)
at org.quartz.impl.StdSchedulerFactory.instantiate(StdSchedulerFactory.java:629)
at org.quartz.impl.StdSchedulerFactory.getScheduler(StdSchedulerFactory.java:1355)
at org.quartz.impl.StdSchedulerFactory.getDefaultScheduler(StdSchedulerFactory.java:1371)
at QuartzRMIClient.run(QuartzRMIClient.java:21)
at QuartzRMIClient.main(QuartzRMIClient.java:34)
Caused by: java.rmi.ConnectException: Connection refused to host: localhost; nested exception is: 
java.net.ConnectException: Connection refused: connect
at sun.rmi.transport.tcp.TCPEndpoint.newSocket(Unknown Source)
at sun.rmi.transport.tcp.TCPChannel.createConnection(Unknown Source)
at sun.rmi.transport.tcp.TCPChannel.newConnection(Unknown Source)
at sun.rmi.server.UnicastRef.newCall(Unknown Source)
at sun.rmi.registry.RegistryImpl_Stub.lookup(Unknown Source)
at org.quartz.impl.RemoteScheduler.getRemoteScheduler(RemoteScheduler.java:120)
... 7 more
Caused by: java.net.ConnectException: Connection refused: 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 sun.rmi.transport.proxy.RMIDirectSocketFactory.createSocket(Unknown Source)
at sun.rmi.transport.proxy.RMIMasterSocketFactory.createSocket(Unknown Source)

解决方案 »

  1.   

    properties文件没有问题,你查看下1099端口是否已开启服务。
      

  2.   

    端口的服务开启应该是Quartz框架自己开启的吧,怎么去查看这个端口的服务有没有开启啊?
      

  3.   

    经过反编译quartz代码,调试得知,配置文件有问题,
    org.quartz.scheduler.rmi.export = true可能是拷贝过来的,中间的空格被其他编码编译成了“?”,所以一直没得到true,所以默认是false,远程没调用起来.