Results 1 to 2 of 2

Thread: Spring Exception...

  1. #1
    Join Date
    Oct 2010
    Location
    Chennai
    Posts
    1

    Default Spring Exception...

    Haiii, i am a beginner in spring.. i got an exception while running a simple spring code in eclipse.

    The exception is as follows:

    INFO: Loading XML bean definitions from class path resource [Spring.xml]
    Exception in thread "main" org.springframework.beans.factory.BeanDefinitionSt oreException: IOException parsing XML document from class path resource [Spring.xml]; nested exception is java.net.ConnectException: Connection timed out: connect
    Caused by: java.net.ConnectException: Connection timed out: 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.Socket.connect(Unknown Source)
    at java.net.Socket.connect(Unknown Source)
    at sun.net.NetworkClient.doConnect(Unknown Source)
    at sun.net.www.http.HttpClient.openServer(Unknown Source)
    at sun.net.www.http.HttpClient.openServer(Unknown Source)
    at sun.net.www.http.HttpClient.<init>(Unknown Source)
    at sun.net.www.http.HttpClient.New(Unknown Source)
    at sun.net.www.http.HttpClient.New(Unknown Source)
    at sun.net.http://www.protocol.http.HttpURLConn...ie nt(Unknown Source)
    at sun.net.http://www.protocol.http.HttpURLConn...nect(U nknown Source)
    at sun.net.http://www.protocol.http.HttpURLConn...nect(Unknow n Source)
    at sun.net.http://www.protocol.http.HttpURLConn...ream (Unknown Source)
    at org.apache.xerces.impl.XMLEntityManager.setupCurre ntEntity(Unknown Source)
    at org.apache.xerces.impl.XMLEntityManager.startEntit y(Unknown Source)
    at org.apache.xerces.impl.XMLEntityManager.startDTDEn tity(Unknown Source)
    at org.apache.xerces.impl.XMLDTDScannerImpl.setInputS ource(Unknown Source)
    at org.apache.xerces.impl.XMLDocumentScannerImpl$DTDD ispatcher.dispatch(Unknown Source)
    at org.apache.xerces.impl.XMLDocumentFragmentScannerI mpl.scanDocument(Unknown Source)
    at org.apache.xerces.parsers.XML11Configuration.parse (Unknown Source)
    at org.apache.xerces.parsers.XML11Configuration.parse (Unknown Source)
    at org.apache.xerces.parsers.XMLParser.parse(Unknown Source)
    at org.apache.xerces.parsers.DOMParser.parse(Unknown Source)
    at org.apache.xerces.jaxp.DocumentBuilderImpl.parse(U nknown Source)
    at org.springframework.beans.factory.xml.DefaultDocum entLoader.loadDocument(DefaultDocumentLoader.java: 76)
    at org.springframework.beans.factory.xml.XmlBeanDefin itionReader.doLoadBeanDefinitions(XmlBeanDefinitio nReader.java:351)
    at org.springframework.beans.factory.xml.XmlBeanDefin itionReader.loadBeanDefinitions(XmlBeanDefinitionR eader.java:303)
    at org.springframework.beans.factory.xml.XmlBeanDefin itionReader.loadBeanDefinitions(XmlBeanDefinitionR eader.java:280)
    at org.springframework.beans.factory.xml.XmlBeanFacto ry.<init>(XmlBeanFactory.java:73)
    at org.springframework.beans.factory.xml.XmlBeanFacto ry.<init>(XmlBeanFactory.java:61)
    at com.springg.SpringClient.main(SpringClient.java:17 )

    -------------------------------------------------------------------------
    My "Spring .xml" file is:

    <?xml version="1.0" encoding="UTF-8"?>
    <!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN//EN" "
    http://www.springframework.org/dtd/spring-beans.dtd ">
    <beans>
    <bean id="userDao"
    class="com.spring.dao.UserDaoImpl">
    </bean>
    </beans>

    --------------------------------------------------------------------------

    I cant solve the problem. Please help me..?

  2. #2

    Default

    Hi,

    I don't know why you get the exception, but the origin seems to be when reading the DTD, so I suggest you switch to XSD, which is a good idea in itself. Replace the beginning of your XML with:

    Code:
    <beans xmlns="http://www.springframework.org/schema/beans" xsi:schemaLocation="http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-3.0.xsd">
    If you need more namespaces (for AOP, transaction management, etc...), you will have to add them in the same way. SpringSource Tool Suite and other IDE plugins can do that for you.
    Gabriel Axel
    Sparklix | Blog | Twitter | Github

Posting Permissions

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