Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/meteor/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Java 无法加载属性_Java_Xml_Spring_Web Services - Fatal编程技术网

Java 无法加载属性

Java 无法加载属性,java,xml,spring,web-services,Java,Xml,Spring,Web Services,您好,我打算用java(NetBeans)开发web服务,但是get Conconnect有问题,我遇到以下错误: org.springframework.beans.factory.BeanInitializationException: Could not load properties; nested exception is java.net.UnknownHostException: C Caused by: java.net.UnknownHostException: C

您好,我打算用java(NetBeans)开发web服务,但是get Conconnect有问题,我遇到以下错误:

  org.springframework.beans.factory.BeanInitializationException: Could not load properties; nested exception is java.net.UnknownHostException: C
    Caused by: java.net.UnknownHostException: C
        at java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:184)
        at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:172)
        at java.net.Socket.connect(Socket.java:589)
        at java.net.Socket.connect(Socket.java:538)
        at sun.net.ftp.impl.FtpClient.doConnect(FtpClient.java:957)
        at sun.net.ftp.impl.FtpClient.tryConnect(FtpClient.java:917)
        at sun.net.ftp.impl.FtpClient.connect(FtpClient.java:1012)
        at sun.net.ftp.impl.FtpClient.connect(FtpClient.java:998)
        at sun.net.www.protocol.ftp.FtpURLConnection.connect(FtpURLConnection.java:294)
        at sun.net.www.protocol.ftp.FtpURLConnection.getInputStream(FtpURLConnection.java:393)
        at org.springframework.core.io.UrlResource.getInputStream(UrlResource.java:103)
        at org.springframework.core.io.support.PropertiesLoaderSupport.loadProperties(PropertiesLoaderSupport.java:179)
        at org.springframework.core.io.support.PropertiesLoaderSupport.mergeProperties(PropertiesLoaderSupport.java:158)
        at org.springframework.beans.factory.config.PropertyResourceConfigurer.postProcessBeanFactory(Proper    at org.springframework.beans.factory.config.PropertyResourceConfigurer.postProcessBeanFactory(PropertyResourceConfigurer.java:68)
        at org.springframework.context.support.AbstractApplicationContext.invokeBeanFactoryPostProcessors(AbstractApplicationContext.java:467)
        at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:334)
        at org.springframework.context.support.ClassPathXmlApplicationContext.<init>(ClassPathXmlApplicationContext.java:122)
        at org.springframework.context.support.ClassPathXmlApplicationContext.<init>(ClassPathXmlApplicationContext.java:76)
        at com.rsa.ims.components.spring.SimpleApplicationLoader.loadBeanFactory(SimpleApplicationLoader.java:134)
        at com.rsa.ims.components.spring.SimpleApplicationLoader.useBeanFactory(SimpleApplicationLoader.java:105)
        at com.rsa.command.ConnectionFactory.getSpringBeanTarget(ConnectionFactory.java:183)
        at com.rsa.command.ConnectionFactory.getTarget(ConnectionFactory.java:156)
        at com.rsa.command.ConnectionFactory.getConnection(ConnectionFactory.java:238)
        at com.rsa.command.ConnectionFactory.getConnection(ConnectionFactory.java:281)
        at com.arame.rsa.cmdConnection.getConnection(cmdConnection.java:33)
        at com.arame.rsa.ApiRsaTest.main(ApiRsaTest.java:49)
    Exception in thread "main" java.lang.NullPointerException
        at com.arame.rsa.cmdConnection.closeConnection(cmdConnection.java:59)
        at com.arame.rsa.ApiRsaTest.main(ApiRsaTest.java:94)
org.springframework.beans.factory.BeanInitializationException:无法加载属性;嵌套异常是java.net.UnknownHostException:C
原因:java.net.UnknownHostException:C
位于java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:184)
位于java.net.PlainSocketImpl.connect(PlainSocketImpl.java:172)
位于java.net.Socket.connect(Socket.java:589)
位于java.net.Socket.connect(Socket.java:538)
位于sun.net.ftp.impl.FtpClient.doConnect(FtpClient.java:957)
位于sun.net.ftp.impl.FtpClient.tryConnect(FtpClient.java:917)
位于sun.net.ftp.impl.FtpClient.connect(FtpClient.java:1012)
位于sun.net.ftp.impl.FtpClient.connect(FtpClient.java:998)
位于sun.net.www.protocol.ftp.FtpURLConnection.connect(FtpURLConnection.java:294)
位于sun.net.www.protocol.ftp.FtpURLConnection.getInputStream(FtpURLConnection.java:393)
位于org.springframework.core.io.UrlResource.getInputStream(UrlResource.java:103)
位于org.springframework.core.io.support.PropertiesLoaderSupport.loadProperties(PropertiesLoaderSupport.java:179)
位于org.springframework.core.io.support.PropertiesLoaderSupport.mergeProperties(PropertiesLoaderSupport.java:158)
位于org.springframework.beans.factory.config.PropertyResourceConfiger.postProcessBeanFactory(位于org.springframework.beans.factory.config.PropertyResourceConfiger.postProcessBeanFactory)(PropertyResourceConfiger.java:68)
位于org.springframework.context.support.AbstractApplicationContext.invokeBeanFactoryPostProcessors(AbstractApplicationContext.java:467)
位于org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:334)
位于org.springframework.context.support.ClassPathXmlApplicationContext。(ClassPathXmlApplicationContext.java:122)
位于org.springframework.context.support.ClassPathXmlApplicationContext。(ClassPathXmlApplicationContext.java:76)
位于com.rsa.ims.components.spring.SimpleApplicationLoader.loadBeanFactory(SimpleApplicationLoader.java:134)
位于com.rsa.ims.components.spring.SimpleApplicationLoader.useBeanFactory(SimpleApplicationLoader.java:105)
位于com.rsa.command.ConnectionFactory.getSpringBeanTarget(ConnectionFactory.java:183)
位于com.rsa.command.ConnectionFactory.getTarget(ConnectionFactory.java:156)
位于com.rsa.command.ConnectionFactory.getConnection(ConnectionFactory.java:238)
位于com.rsa.command.ConnectionFactory.getConnection(ConnectionFactory.java:281)
在com.arame.rsa.cmdConnection.getConnection(cmdConnection.java:33)上
位于com.arame.rsa.ApiRsaTest.main(ApiRsaTest.java:49)
线程“main”java.lang.NullPointerException中出现异常
位于com.arame.rsa.cmdConnection.closeConnection(cmdConnection.java:59)
位于com.arame.rsa.ApiRsaTest.main(ApiRsaTest.java:94)
我有config.properties,其中是URL和Context.xml。这个文件处理从文件config.properties检索属性,还有log4j.xml/dtd,它们都在我的类路径中

这是我的con Context.xml

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

    <bean name="PrimaryPropertyPlaceHolderPostProcessor" class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">

        <property name="order" value="10"/>
        <property name="systemPropertiesModeName" value="SYSTEM_PROPERTIES_MODE_OVERRIDE"/>
        <property name="location" value="file://C:\\Users\\gerardo.granados\\Documents\\APITest\\build\\classes\\config.properties"/>
        <property name="ignoreUnresolvablePlaceholders" value="false"/>
        <property name="ignoreResourceNotFound" value="false"/>
    </bean>

    <bean name="ConnectionInfoProvider"
          class="com.rsa.command.PropertiesConnectionInfoProvider"
          lazy-init="false">
        <property name="propertiesFile" value="config.properties"/>
    </bean>


    <alias alias="CommandAPIConnection" name="SOAPCommandTargetBasicAuth"/>


    <bean name="ClusterTarget" lazy-init="true"
          class="com.rsa.command.RemoteCommandTargetFactoryBean">
        <property name="providerURL" value="t3s://node1-address,node2-address:7002"/>
        <property name="connectionInfoProvider" ref="ConnectionInfoProvider"/>
        <property name="targetClass" value="com.rsa.command.EJBRemoteTarget"/>
        <property name="cacheable" value="true"/>
    </bean>


    <bean name="SpecificNodeTarget" lazy-init="true"
          class="com.rsa.command.RemoteCommandTargetFactoryBean">
        <property name="providerURL" value="t3s://node2-address:7002"/>
        <property name="connectionInfoProvider" ref="ConnectionInfoProvider"/>
        <property name="targetClass" value="com.rsa.command.EJBRemoteTarget"/>
        <property name="cacheable" value="true"/>
        <property name="properties">
            <props>

                <prop key="com.rsa.naming.pin.to.primary.server">true</prop>
            </props>
        </property>
    </bean>
</beans>

真的
有什么建议吗???谢谢你的建议:

<property name="location" value="file://C:\\Users\\gerardo.granados\\Documents\\APITest\\build\\classes\\config.properties"/>

这在一个相关问题中对我起了作用。

在配置的某个点上,您试图连接到一台您标识为
C
的机器,这可以通过-->
java.net.UnknownHostException:C
<property name="location" value="file:C:\\Users\\gerardo.granados\\Documents\\APITest\\build\\classes\\config.properties"/>