有人用过Quartz RMI 嘛,为什么我设置的远程调用服务端可以注册RMI服务成功,但是我在客户端调用的时候老师出现连接拒绝,求大侠解决,我的服务端和客户端的properties配置如下
Server.properties
- Java code
org.quartz.scheduler.instanceName = EximBills Enterprise Schedule Serviceorg.quartz.scheduler.rmi.export = trueorg.quartz.scheduler.rmi.registryHost = 127.0.0.1org.quartz.scheduler.rmi.registryPort = 1099org.quartz.scheduler.rmi.serverPort = 0org.quartz.scheduler.rmi.createRegistry = trueorg.quartz.scheduler.rmi.proxy = falseorg.quartz.scheduler.wrapJobExecutionInUserTransaction = falseorg.quartz.threadPool.class = org.quartz.simpl.SimpleThreadPoolorg.quartz.threadPool.threadCount = 10org.quartz.threadPool.threadPriority = 5org.quartz.threadPool.threadsInheritContextClassLoaderOfInitializingThread = trueorg.quartz.jobStore.misfireThreshold = 60000org.quartz.jobStore.class = org.quartz.simpl.RAMJobStore
Client.properties
- Java code
org.quartz.scheduler.instanceName = EximBills Enterprise Schedule Serviceorg.quartz.scheduler.rmi.registryHost = 127.0.0.1org.quartz.scheduler.rmi.registryPort = 1099org.quartz.scheduler.rmi.proxy = trueorg.quartz.scheduler.wrapJobExecutionInUserTransaction = falseorg.quartz.threadPool.class = org.quartz.simpl.SimpleThreadPoolorg.quartz.threadPool.threadCount = 10org.quartz.threadPool.threadPriority = 5org.quartz.threadPool.threadsInheritContextClassLoaderOfInitializingThread = trueorg.quartz.jobStore.misfireThreshold = 60000org.quartz.jobStore.class = org.quartz.simpl.RAMJobStoreorg.quartz.scheduler.rmi.export = false
出错信息:
- Java code
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 moreCaused 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)