Spring:无法在任何属性源

时间:2017-04-24 19:04:23

标签: java xml spring spring-mvc

我正在尝试使用Spring Remoting制作客户端服务器程序,并且在运行服务器时我一直收到标题中的错误。收到此错误后,程序继续运行,但没有任何反应,调试只是停止。

以下是来自服务器配置XML的代码:

<?xml version="1.0" encoding="UTF-8"?>

<beans xmlns="http://www.springframework.org/schema/beans"
   xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
   xsi:schemaLocation="http://www.springframework.org/schema/beans
   http://www.springframework.org/schema/beans/spring-beans.xsd">

<bean id="userRepo" class="repository.FlightRepo"/>
<bean id="loginRepo" class="repository.UserManager"/>

<bean id="flightService" class="service.FlightService">
    <constructor-arg ref="userRepo"/>
</bean>

<bean id="loginService" class="service.LoginService">
    <constructor-arg ref="loginRepo"/>
</bean>

<bean class="org.springframework.remoting.rmi.RmiServiceExporter">
    <property name="serviceName" value="Flight"/>
    <property name="service" ref="flightService"/>
    <property name="serviceInterface" value="service.IFlightService"/>
    <property name="servicePort" value="1099"/>
</bean>

<bean class="org.springframework.remoting.rmi.RmiServiceExporter">
    <property name="serviceName" value="Flight"/>
    <property name="service" ref="loginService"/>
    <property name="serviceInterface" value="service.ILoginService"/>
    <property name="servicePort" value="1099"/>
</bean>

从客户端XML:

<beans xmlns="http://www.springframework.org/schema/beans"
   xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
   xsi:schemaLocation="http://www.springframework.org/schema/beans
   http://www.springframework.org/schema/beans/spring-beans.xsd">

<bean id="flightService" class="org.springframework.remoting.rmi.RmiProxyFactoryBean">
    <property name="serviceUrl" value="rmi://127.0.0.1:1099/Flight"/>
    <property name="serviceInterface" value="service.IFlightService"/>
</bean>

<bean id="loginService" class="org.springframework.remoting.rmi.RmiProxyFactoryBean">
    <property name="serviceUrl" value="rmi://127.0.0.1:1099/Flights"/>
    <property name="serviceInterface" value="service.ILoginService"/>
</bean>

21:54:21.191 [main] DEBUG org.springframework.beans.factory.xml.PluggableSchemaResolver - Found XML schema [http://www.springframework.org/schema/beans/spring-beans.xsd] in classpath: org/springframework/beans/factory/xml/spring-beans-4.3.xsd
21:54:21.222 [main] DEBUG org.springframework.beans.factory.xml.DefaultBeanDefinitionDocumentReader - Loading bean definitions
21:54:21.238 [main] DEBUG org.springframework.beans.factory.xml.BeanDefinitionParserDelegate - Neither XML 'id' nor 'name' specified - using generated bean name [org.springframework.remoting.rmi.RmiServiceExporter#0]
21:54:21.238 [main] DEBUG org.springframework.beans.factory.xml.BeanDefinitionParserDelegate - Neither XML 'id' nor 'name' specified - using generated bean name [org.springframework.remoting.rmi.RmiServiceExporter#1]
21:54:21.238 [main] DEBUG org.springframework.beans.factory.xml.XmlBeanDefinitionReader - Loaded 6 bean definitions from location pattern [ServerBean.xml]
21:54:21.238 [main] DEBUG org.springframework.context.support.ClassPathXmlApplicationContext - Bean factory for org.springframework.context.support.ClassPathXmlApplicationContext@71bc1ae4: org.springframework.beans.factory.support.DefaultListableBeanFactory@7ca48474: defining beans [userRepo,loginRepo,flightService,loginService,org.springframework.remoting.rmi.RmiServiceExporter#0,org.springframework.remoting.rmi.RmiServiceExporter#1]; root of factory hierarchy
21:54:21.253 [main] DEBUG org.springframework.context.support.ClassPathXmlApplicationContext - Unable to locate MessageSource with name 'messageSource': using default [org.springframework.context.support.DelegatingMessageSource@553f17c]
21:54:21.253 [main] DEBUG org.springframework.context.support.ClassPathXmlApplicationContext - Unable to locate ApplicationEventMulticaster with name 'applicationEventMulticaster': using default [org.springframework.context.event.SimpleApplicationEventMulticaster@1ce92674]
21:54:21.253 [main] DEBUG org.springframework.beans.factory.support.DefaultListableBeanFactory - Pre-instantiating singletons in org.springframework.beans.factory.support.DefaultListableBeanFactory@7ca48474: defining beans [userRepo,loginRepo,flightService,loginService,org.springframework.remoting.rmi.RmiServiceExporter#0,org.springframework.remoting.rmi.RmiServiceExporter#1]; root of factory hierarchy
21:54:21.253 [main] DEBUG org.springframework.beans.factory.support.DefaultListableBeanFactory - Creating shared instance of singleton bean 'userRepo'
21:54:21.253 [main] DEBUG org.springframework.beans.factory.support.DefaultListableBeanFactory - Creating instance of bean 'userRepo'
21:54:21.503 [main] DEBUG org.springframework.beans.factory.support.DefaultListableBeanFactory - Eagerly caching bean 'userRepo' to allow for resolving potential circular references
21:54:21.503 [main] DEBUG org.springframework.beans.factory.support.DefaultListableBeanFactory - Finished creating instance of bean 'userRepo'
21:54:21.503 [main] DEBUG org.springframework.beans.factory.support.DefaultListableBeanFactory - Creating shared instance of singleton bean 'loginRepo'
21:54:21.503 [main] DEBUG org.springframework.beans.factory.support.DefaultListableBeanFactory - Creating instance of bean 'loginRepo'
21:54:21.503 [main] DEBUG org.springframework.beans.factory.support.DefaultListableBeanFactory - Eagerly caching bean 'loginRepo' to allow for resolving potential circular references
21:54:21.503 [main] DEBUG org.springframework.beans.factory.support.DefaultListableBeanFactory - Finished creating instance of bean 'loginRepo'
21:54:21.503 [main] DEBUG org.springframework.beans.factory.support.DefaultListableBeanFactory - Creating shared instance of singleton bean 'flightService'
21:54:21.503 [main] DEBUG org.springframework.beans.factory.support.DefaultListableBeanFactory - Creating instance of bean 'flightService'
21:54:21.503 [main] DEBUG org.springframework.beans.factory.support.DefaultListableBeanFactory - Returning cached instance of singleton bean 'userRepo'
21:54:21.535 [main] DEBUG org.springframework.beans.factory.support.DefaultListableBeanFactory - Eagerly caching bean 'flightService' to allow for resolving potential circular references
21:54:21.535 [main] DEBUG org.springframework.beans.factory.support.DefaultListableBeanFactory - Finished creating instance of bean 'flightService'
21:54:21.535 [main] DEBUG org.springframework.beans.factory.support.DefaultListableBeanFactory - Creating shared instance of singleton bean 'loginService'
21:54:21.535 [main] DEBUG org.springframework.beans.factory.support.DefaultListableBeanFactory - Creating instance of bean 'loginService'
21:54:21.535 [main] DEBUG org.springframework.beans.factory.support.DefaultListableBeanFactory - Returning cached instance of singleton bean 'loginRepo'
21:54:21.535 [main] DEBUG org.springframework.beans.factory.support.DefaultListableBeanFactory - Eagerly caching bean 'loginService' to allow for resolving potential circular references
21:54:21.535 [main] DEBUG org.springframework.beans.factory.support.DefaultListableBeanFactory - Finished creating instance of bean 'loginService'
21:54:21.535 [main] DEBUG org.springframework.beans.factory.support.DefaultListableBeanFactory - Creating shared instance of singleton bean 'org.springframework.remoting.rmi.RmiServiceExporter#0'
21:54:21.535 [main] DEBUG org.springframework.beans.factory.support.DefaultListableBeanFactory - Creating instance of bean 'org.springframework.remoting.rmi.RmiServiceExporter#0'
21:54:21.550 [main] DEBUG org.springframework.beans.factory.support.DefaultListableBeanFactory - Eagerly caching bean 'org.springframework.remoting.rmi.RmiServiceExporter#0' to allow for resolving potential circular references
21:54:21.581 [main] DEBUG org.springframework.beans.factory.support.DefaultListableBeanFactory - Returning cached instance of singleton bean 'flightService'
21:54:21.597 [main] DEBUG org.springframework.beans.factory.support.DefaultListableBeanFactory - Invoking afterPropertiesSet() on bean with name 'org.springframework.remoting.rmi.RmiServiceExporter#0'
21:54:21.597 [main] INFO org.springframework.remoting.rmi.RmiServiceExporter - Looking for RMI registry at port '1099'
21:54:22.691 [main] DEBUG org.springframework.remoting.rmi.RmiServiceExporter - RMI registry access threw exception
java.rmi.ConnectException: Connection refused to host: 192.168.0.10; nested exception is: 
    java.net.ConnectException: Connection refused: connect
    at sun.rmi.transport.tcp.TCPEndpoint.newSocket(TCPEndpoint.java:619)
    at sun.rmi.transport.tcp.TCPChannel.createConnection(TCPChannel.java:216)
    at sun.rmi.transport.tcp.TCPChannel.newConnection(TCPChannel.java:202)
    at sun.rmi.server.UnicastRef.newCall(UnicastRef.java:342)
    at sun.rmi.registry.RegistryImpl_Stub.list(Unknown Source)
    at org.springframework.remoting.rmi.RmiServiceExporter.testRegistry(RmiServiceExporter.java:411)
    at org.springframework.remoting.rmi.RmiServiceExporter.getRegistry(RmiServiceExporter.java:391)
    at org.springframework.remoting.rmi.RmiServiceExporter.getRegistry(RmiServiceExporter.java:370)
    at org.springframework.remoting.rmi.RmiServiceExporter.getRegistry(RmiServiceExporter.java:331)
    at org.springframework.remoting.rmi.RmiServiceExporter.prepare(RmiServiceExporter.java:263)
    at org.springframework.remoting.rmi.RmiServiceExporter.afterPropertiesSet(RmiServiceExporter.java:227)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1687)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1624)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:555)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:483)
    at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:306)
    at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:230)
    at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:302)
    at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:197)
    at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:761)
    at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:866)
    at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:542)
    at org.springframework.context.support.ClassPathXmlApplicationContext.<init>(ClassPathXmlApplicationContext.java:139)
    at org.springframework.context.support.ClassPathXmlApplicationContext.<init>(ClassPathXmlApplicationContext.java:83)
    at Main.main(Main.java:8)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:498)
    at com.intellij.rt.execution.application.AppMain.main(AppMain.java:147)
Caused by: java.net.ConnectException: Connection refused: connect
    at java.net.DualStackPlainSocketImpl.connect0(Native Method)
    at java.net.DualStackPlainSocketImpl.socketConnect(DualStackPlainSocketImpl.java:79)
    at java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:350)
    at java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:206)
    at java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:188)
    at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:172)
    at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:392)
    at java.net.Socket.connect(Socket.java:589)
    at java.net.Socket.connect(Socket.java:538)
    at java.net.Socket.<init>(Socket.java:434)
    at java.net.Socket.<init>(Socket.java:211)
    at sun.rmi.transport.proxy.RMIDirectSocketFactory.createSocket(RMIDirectSocketFactory.java:40)
    at sun.rmi.transport.proxy.RMIMasterSocketFactory.createSocket(RMIMasterSocketFactory.java:148)
    at sun.rmi.transport.tcp.TCPEndpoint.newSocket(TCPEndpoint.java:613)
    ... 29 common frames omitted
21:54:22.707 [main] INFO org.springframework.remoting.rmi.RmiServiceExporter - Could not detect RMI registry - creating new one
21:54:22.707 [main] INFO org.springframework.remoting.rmi.RmiServiceExporter - Binding service 'Flight' to RMI registry: RegistryImpl[UnicastServerRef [liveRef: [endpoint:[192.168.0.10:1099](local),objID:[0:0:0, 0]]]]
21:54:22.722 [main] DEBUG org.springframework.beans.factory.support.DefaultListableBeanFactory - Finished creating instance of bean 'org.springframework.remoting.rmi.RmiServiceExporter#0'
21:54:22.722 [main] DEBUG org.springframework.beans.factory.support.DefaultListableBeanFactory - Creating shared instance of singleton bean 'org.springframework.remoting.rmi.RmiServiceExporter#1'
21:54:22.722 [main] DEBUG org.springframework.beans.factory.support.DefaultListableBeanFactory - Creating instance of bean 'org.springframework.remoting.rmi.RmiServiceExporter#1'
21:54:22.722 [main] DEBUG org.springframework.beans.factory.support.DefaultListableBeanFactory - Eagerly caching bean 'org.springframework.remoting.rmi.RmiServiceExporter#1' to allow for resolving potential circular references
21:54:22.722 [main] DEBUG org.springframework.beans.factory.support.DefaultListableBeanFactory - Returning cached instance of singleton bean 'loginService'
21:54:22.722 [main] DEBUG org.springframework.beans.factory.support.DefaultListableBeanFactory - Invoking afterPropertiesSet() on bean with name 'org.springframework.remoting.rmi.RmiServiceExporter#1'
21:54:22.722 [main] INFO org.springframework.remoting.rmi.RmiServiceExporter - Looking for RMI registry at port '1099'
21:54:22.738 [main] INFO org.springframework.remoting.rmi.RmiServiceExporter - Binding service 'Flight' to RMI registry: RegistryImpl_Stub[UnicastRef [liveRef: [endpoint:[192.168.0.10:1099](remote),objID:[0:0:0, 0]]]]
21:54:22.753 [main] DEBUG org.springframework.beans.factory.support.DefaultListableBeanFactory - Finished creating instance of bean 'org.springframework.remoting.rmi.RmiServiceExporter#1'
21:54:22.753 [main] DEBUG org.springframework.context.support.ClassPathXmlApplicationContext - Unable to locate LifecycleProcessor with name 'lifecycleProcessor': using default [org.springframework.context.support.DefaultLifecycleProcessor@419c5f1a]
21:54:22.753 [main] DEBUG org.springframework.beans.factory.support.DefaultListableBeanFactory - Returning cached instance of singleton bean 'lifecycleProcessor'
21:54:22.753 [main] DEBUG org.springframework.core.env.PropertySourcesPropertyResolver - Could not find key 'spring.liveBeansView.mbeanDomain' in any property source

该项目是在IntelliJ中制作的,我正在使用Gradle。

谢谢。

0 个答案:

没有答案