Announcement Announcement Module
Collapse
No announcement yet.
Spring iBatis SqlMapConfig.xml loading issue: SocketException Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Spring iBatis SqlMapConfig.xml loading issue: SocketException

    Hi,
    Trying to set up a simple iBatis framework on Spring.
    applicationContext.xml and SqlMapConfig.xml,EmployeeMapConfig.xml are placed under WEB-INF folder.

    The entire set up is on WAS 6.1 server, using RAD to create projects.

    Code is as follows:

    <?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="dataSource" class="org.apache.commons.dbcp.BasicDataSource" destroy-method="close">
    <property name="driverClassName" value="oracle.jdbc.driver.OracleDriver" />
    <property name="url" value="jdbc:oracle:thin:@<myhostort:schema>" />
    <property name="username" value="test" />
    <property name="password" value="testpwd" />
    </bean>

    <bean id="sqlMap" class="org.springframework.orm.ibatis.SqlMapClient FactoryBean">
    <property name="configLocation" value="WEB-INF/SqlMapConfig.xml" />
    <property name="dataSource" ref="dataSource" />
    </bean>

    <bean id="employeeService" class="com.myfolder.TestDAO">
    <property name="sqlMapClient" ref="sqlMap" />
    </bean>
    </beans>

    SqlMapConfig.xml
    <!DOCTYPE sqlMap
    PUBLIC "-//iBATIS.com//DTD SQL Map 2.0//EN"
    "http://ibatis.apache.org/dtd/sql-map-2.dtd">

    <sqlMapConfig>
    <settings useStatementNamespaces="true"/>
    <sqlMap resource="WEB-INF/EmployeeSQLMap.xml"/>
    </sqlMapConfig>


    It loads applicationContext.xml
    and while it tries to load SqlMapConfig.xml, it runs into error


    [3/31/10 12:24:28:900 IST] 00000019 WebGroup A SRVE0169I: Loading Web Module: testWeb.
    [3/31/10 12:24:29:150 IST] 00000019 WebApp A SRVE0180I: [testEAR#testWeb.war] [/testWeb] [Servlet.LOG]: Initializing Spring root WebApplicationContext
    [3/31/10 12:24:29:166 IST] 00000019 ContextLoader I org.springframework.web.context.ContextLoader initWebApplicationContext Root WebApplicationContext: initialization started
    [3/31/10 12:24:29:322 IST] 00000019 XmlWebApplica I org.springframework.context.support.AbstractApplic ationContext prepareRefresh Refreshing org.springframework.web.context.support.XmlWebAppl icationContext@6880688: display name [Root WebApplicationContext]; startup date [Wed Mar 31 12:24:29 IST 2010]; root of context hierarchy
    [3/31/10 12:24:29:619 IST] 00000019 XmlBeanDefini I org.springframework.beans.factory.xml.XmlBeanDefin itionReader loadBeanDefinitions Loading XML bean definitions from ServletContext resource [/WEB-INF/applicationContext.xml]
    [3/31/10 12:24:29:712 IST] 00000019 XmlBeanDefini I org.springframework.beans.factory.xml.XmlBeanDefin itionReader loadBeanDefinitions Loading XML bean definitions from ServletContext resource [/WEB-INF/SQLMapConfig.xml]
    [3/31/10 12:24:50:853 IST] 00000019 ContextLoader E org.springframework.web.context.ContextLoader initWebApplicationContext Context initialization failed
    org.springframework.beans.factory.BeanDefinitionSt oreException: IOException parsing XML document from ServletContext resource [/WEB-INF/SQLMapConfig.xml]; nested exception is java.net.SocketException: Operation timed out: connect:could be due to invalid address at org.springframework.beans.factory.xml.XmlBeanDefin itionReader.doLoadBeanDefinitions(XmlBeanDefinitio nReader.java:416)
    at org.springframework.beans.factory.xml.XmlBeanDefin itionReader.loadBeanDefinitions(XmlBeanDefinitionR eader.java:342)
    at org.springframework.beans.factory.xml.XmlBeanDefin itionReader.loadBeanDefinitions(XmlBeanDefinitionR eader.java:310)
    at org.springframework.beans.factory.support.Abstract BeanDefinitionReader.loadBeanDefinitions(AbstractB eanDefinitionReader.java:143)
    at org.springframework.beans.factory.support.Abstract BeanDefinitionReader.loadBeanDefinitions(AbstractB eanDefinitionReader.java:178)
    at org.springframework.beans.factory.support.Abstract BeanDefinitionReader.loadBeanDefinitions(AbstractB eanDefinitionReader.java:149)
    at org.springframework.web.context.support.XmlWebAppl icationContext.loadBeanDefinitions(XmlWebApplicati onContext.java:124)
    at org.springframework.web.context.support.XmlWebAppl icationContext.loadBeanDefinitions(XmlWebApplicati onContext.java:92)
    at org.springframework.context.support.AbstractRefres hableApplicationContext.refreshBeanFactory(Abstrac tRefreshableApplicationContext.java:123)
    at org.springframework.context.support.AbstractApplic ationContext.obtainFreshBeanFactory(AbstractApplic ationContext.java:423)
    at org.springframework.context.support.AbstractApplic ationContext.refresh(AbstractApplicationContext.ja va:353)
    at org.springframework.web.context.ContextLoader.crea teWebApplicationContext(ContextLoader.java:255)
    at org.springframework.web.context.ContextLoader.init WebApplicationContext(ContextLoader.java:199)
    at org.springframework.web.context.ContextLoaderListe ner.contextInitialized(ContextLoaderListener.java: 45)
    at com.ibm.ws.wswebcontainer.webapp.WebApp.notifyServ letContextCreated(WebApp.java:608)
    at com.ibm.ws.webcontainer.webapp.WebApp.commonInitia lizationFinish(WebApp.java:266)
    at com.ibm.ws.wswebcontainer.webapp.WebApp.initialize (WebApp.java:272)
    at com.ibm.ws.wswebcontainer.webapp.WebGroup.addWebAp plication(WebGroup.java:88)
    at com.ibm.ws.wswebcontainer.VirtualHost.addWebApplic ation(VirtualHost.java:157)
    at com.ibm.ws.wswebcontainer.WebContainer.addWebApp(W ebContainer.java:655)
    at com.ibm.ws.wswebcontainer.WebContainer.addWebAppli cation(WebContainer.java:608)
    at com.ibm.ws.webcontainer.component.WebContainerImpl .install(WebContainerImpl.java:333)
    at com.ibm.ws.webcontainer.component.WebContainerImpl .start(WebContainerImpl.java:549)
    at com.ibm.ws.runtime.component.ApplicationMgrImpl.st art(ApplicationMgrImpl.java:1295)
    at com.ibm.ws.runtime.component.DeployedApplicationIm pl.fireDeployedObjectStart(DeployedApplicationImpl .java:1129)
    at com.ibm.ws.runtime.component.DeployedModuleImpl.st art(DeployedModuleImpl.java:567)
    at com.ibm.ws.runtime.component.DeployedApplicationIm pl.start(DeployedApplicationImpl.java:814)
    at com.ibm.ws.runtime.component.ApplicationMgrImpl.st artApplication(ApplicationMgrImpl.java:948)
    at com.ibm.ws.runtime.component.ApplicationMgrImpl$Ap pInitializer.run(ApplicationMgrImpl.java:2114)
    at com.ibm.wsspi.runtime.component.WsComponentImpl$_A synchInitializer.run(WsComponentImpl.java:340)
    at com.ibm.ws.util.ThreadPool$Worker.run(ThreadPool.j ava:1510)
    Caused by: java.net.SocketException: Operation timed out: connect:could be due to invalid address
    at java.net.PlainSocketImpl.socketConnect(Native Method)
    at java.net.PlainSocketImpl.doConnect(PlainSocketImpl .java:372)
    at java.net.PlainSocketImpl.connectToAddress(PlainSoc ketImpl.java:233)
    at java.net.PlainSocketImpl.connect(PlainSocketImpl.j ava:220)
    at java.net.Socket.connect(Socket.java:536)
    at java.net.Socket.connect(Socket.java:486)
    at sun.net.NetworkClient.doConnect(NetworkClient.java :180)
    at sun.net.http://www.http.HttpClient.openServe...lient.java:397)
    at sun.net.http://www.http.HttpClient.openServe...lient.java:507)
    at sun.net.www.http.HttpClient.<init>(HttpClient.java :245)
    at sun.net.www.http.HttpClient.New(HttpClient.java:319)
    at sun.net.www.http.HttpClient.New(HttpClient.java:331)
    at sun.net.http://www.protocol.http.HttpURLConn...ction.java:821)
    at sun.net.http://www.protocol.http.HttpURLConn...ction.java:773)
    at sun.net.http://www.protocol.http.HttpURLConn...ction.java:698)
    at sun.net.http://www.protocol.http.HttpURLConn...ction.java:942)
    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: 75)
    at org.springframework.beans.factory.xml.XmlBeanDefin itionReader.doLoadBeanDefinitions(XmlBeanDefinitio nReader.java:396)
    ... 30 more

  • #2
    I am also getting this annoying error when I deploy application in Tomcat, however this works fine in my local eclipse IDE. Have you ever got a good answer to this problem? I could not find a specific answer to this while googling. Someone open this as bug in apache ibatis JIRA but it seems closed as not an ibatis bug but without any precise answer.

    Comment

    Working...
    X