ibatis-user-java mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Sundar Sankaranarayanan" <Sundar.Sankaranaraya...@phoenix.edu>
Subject RE: problem parsing sqlMaps
Date Thu, 28 Feb 2008 15:44:26 GMT
Hi,
 
Did you add the sqlMapClient as a reference in you Spring application context? I guess that
is what is missing. 
If you are using Older version of Spring then you should use something like this
<beans>

<bean id="dataSource" class="org.apache.commons.dbcp.BasicDataSource" destroy-method="close">

<property name="driverClassName" value="${jdbc.driverClassName}"/>

<property name="url" value="${jdbc.url}"/>

<property name="username" value="${jdbc.username}"/>

<property name="password" value="${jdbc.password}"/>

</bean>

<bean id="sqlMapClient" class="org.springframework.orm.ibatis.SqlMapClientFactoryBean">

<property name="configLocation" value="WEB-INF/sqlmap-config.xml"/>

<property name="dataSource" ref="dataSource"/>

</bean>

</beans>

 

and use the "sqlMapClient" as a reference property. 

If you are using version 2.5, you could effectively use it as a setter in your dao

@Resource

public void setSqlMapClient(SqlMapClient sqlMapClient) {

super.setSqlMapClient(sqlMapClient);

}

Your Dao should extend SqlMapClientDaoSupport
 
 
Hope this helps. You could check the Spring-reference.pdf for a detailed explainationf of
the same too.
 
Regards
Sundar

________________________________

From: guillen.olmos.angel@servexternos.repsolypf.com [mailto:guillen.olmos.angel@servexternos.repsolypf.com]

Sent: Thursday, February 28, 2008 2:28 AM
To: user-java@ibatis.apache.org
Subject: problem parsing sqlMaps



Hi, 

As noted in 3.2.1 Element Content and Appendix E of the XML Specification, it is required
that content models in element type declarations be deterministic.

In  http://ibatis.apache.org/dtd/sql-map-2.dtd <http://ibatis.apache.org/dtd/sql-map-2.dtd>
 , there is:
<!ELEMENT sqlMap (typeAlias* | cacheModel* | resultMap* | parameterMap* | sql* | statement*
| insert* | update* | delete* | select* | procedure*)+>


I think it causes my xml parser cant parse my sqlMaps returning this error: 
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'calendarDAOTarget'
defined in class path resource [isifconfig/sigc/calendar/calendar-dao.xml]: Cannot resolve
reference to bean 'calendarSqlMapConfig' while setting bean property 'sqlMapClient'; nested
exception is org.springframework.beans.factory.BeanCreationException: Error creating bean
with name 'calendarSqlMapConfig' defined in class path resource [isifconfig/sigc/calendar/calendar-dao.xml]:
Invocation of init method failed; nested exception is java.lang.RuntimeException: Error occurred.
 Cause: com.ibatis.common.xml.NodeletException: Error parsing XML.  Cause: java.lang.RuntimeException:
Error parsing XPath '/sqlMapConfig/sqlMap'.  Cause: com.ibatis.common.xml.NodeletException:
Error parsing XML.  Cause: com.sap.engine.lib.xml.parser.NestedSAXParserException: Fatal Error:
com.sap.engine.lib.xml.parser.NestedSAXParserException: You are probably using a nondeterministic
model like (a*|b*)*, try to replace it with an equivalent deterministic one, e.g. (a|b)* (Unknown
Source, row:0, col:-1) -> com.sap.engine.lib.xml.parser.ParserException: You are probably
using a nondeterministic model like (a*|b*)*, try to replace it with an equivalent deterministic
one, e.g. (a|b)*(Unknown Source)(:main:, row=9, col=113) -> com.sap.engine.lib.xml.parser.NestedSAXParserException:
You are probably using a nondeterministic model like (a*|b*)*, try to replace it with an equivalent
deterministic one, e.g. (a|b)* (Unknown Source, row:0, col:-1) -> com.sap.engine.lib.xml.parser.ParserException:
You are probably using a nondeterministic model like (a*|b*)*, try to replace it with an equivalent
deterministic one, e.g. (a|b)*(Unknown Source)

Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with
name 'calendarSqlMapConfig' defined in class path resource [isifconfig/sigc/calendar/calendar-dao.xml]:
Invocation of init method failed; nested exception is java.lang.RuntimeException: Error occurred.
 Cause: com.ibatis.common.xml.NodeletException: Error parsing XML.  Cause: java.lang.RuntimeException:
Error parsing XPath '/sqlMapConfig/sqlMap'.  Cause: com.ibatis.common.xml.NodeletException:
Error parsing XML.  Cause: com.sap.engine.lib.xml.parser.NestedSAXParserException: Fatal Error:
com.sap.engine.lib.xml.parser.NestedSAXParserException: You are probably using a nondeterministic
model like (a*|b*)*, try to replace it with an equivalent deterministic one, e.g. (a|b)* (Unknown
Source, row:0, col:-1) -> com.sap.engine.lib.xml.parser.ParserException: You are probably
using a nondeterministic model like (a*|b*)*, try to replace it with an equivalent deterministic
one, e.g. (a|b)*(Unknown Source)(:main:, row=9, col=113) -> com.sap.engine.lib.xml.parser.NestedSAXParserException:
You are probably using a nondeterministic model like (a*|b*)*, try to replace it with an equivalent
deterministic one, e.g. (a|b)* (Unknown Source, row:0, col:-1) -> com.sap.engine.lib.xml.parser.ParserException:
You are probably using a nondeterministic model like (a*|b*)*, try to replace it with an equivalent
deterministic one, e.g. (a|b)*(Unknown Source)

Caused by: java.lang.RuntimeException: Error occurred.  Cause: com.ibatis.common.xml.NodeletException:
Error parsing XML.  Cause: java.lang.RuntimeException: Error parsing XPath '/sqlMapConfig/sqlMap'.
 Cause: com.ibatis.common.xml.NodeletException: Error parsing XML.  Cause: com.sap.engine.lib.xml.parser.NestedSAXParserException:
Fatal Error: com.sap.engine.lib.xml.parser.NestedSAXParserException: You are probably using
a nondeterministic model like (a*|b*)*, try to replace it with an equivalent deterministic
one, e.g. (a|b)* (Unknown Source, row:0, col:-1) -> com.sap.engine.lib.xml.parser.ParserException:
You are probably using a nondeterministic model like (a*|b*)*, try to replace it with an equivalent
deterministic one, e.g. (a|b)*(Unknown Source)(:main:, row=9, col=113) -> com.sap.engine.lib.xml.parser.NestedSAXParserException:
You are probably using a nondeterministic model like (a*|b*)*, try to replace it with an equivalent
deterministic one, e.g. (a|b)* (Unknown Source, row:0, col:-1) -> com.sap.engine.lib.xml.parser.ParserException:
You are probably using a nondeterministic model like (a*|b*)*, try to replace it with an equivalent
deterministic one, e.g. (a|b)*(Unknown Source)

        at com.ibatis.sqlmap.engine.builder.xml.SqlMapConfigParser.parse(SqlMapConfigParser.java:89)

        at com.ibatis.sqlmap.client.SqlMapClientBuilder.buildSqlMapClient(SqlMapClientBuilder.java:63)

        at org.springframework.orm.ibatis.SqlMapClientFactoryBean.afterPropertiesSet(SqlMapClientFactoryBean.java:255)

        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1057)

        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1024)

        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:421)

        at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:245)

        at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:140)

        at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:242)

        at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:156)

        at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveReference(BeanDefinitionValueResolver.java:248)

        at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveValueIfNecessary(BeanDefinitionValueResolver.java:128)

        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyPropertyValues(AbstractAutowireCapableBeanFactory.java:950)

        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:740)

        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:417)

        at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:245)

        at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:140)

        at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:242)

        at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:156)

        at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:273)

        at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:346)

        at org.springframework.context.support.ClassPathXmlApplicationContext.<init>(ClassPathXmlApplicationContext.java:92)

        at org.springframework.context.support.ClassPathXmlApplicationContext.<init>(ClassPathXmlApplicationContext.java:77)

        at org.springframework.context.support.ClassPathXmlApplicationContext.<init>(ClassPathXmlApplicationContext.java:68)

        at com.repsolypf.isif.config.SpringContext.getApplicationContext(SpringContext.java:121)

        at com.repsolypf.isif.config.SpringContext.getBean(SpringContext.java:68) 
        at com.repsolypf.isif.client.ClientFachadaNegocio.invoke(ClientFachadaNegocio.java:80)

        at com.repsolypf.sigefi.local.test.SigefiTestCase.testEco(SigefiTestCase.java:362)

        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) 
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) 
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)

        at java.lang.reflect.Method.invoke(Method.java:324) 
        at junit.framework.TestCase.runTest(TestCase.java:154) 
        at junit.framework.TestCase.runBare(TestCase.java:127) 
        at junit.framework.TestResult$1.protect(TestResult.java:106) 
        at junit.framework.TestResult.runProtected(TestResult.java:124) 
        at junit.framework.TestResult.run(TestResult.java:109) 
        at junit.framework.TestCase.run(TestCase.java:118) 
        at junit.framework.TestSuite.runTest(TestSuite.java:208) 
        at junit.framework.TestSuite.run(TestSuite.java:203) 
        at junit.textui.TestRunner.doRun(TestRunner.java:116) 
        at junit.textui.TestRunner.doRun(TestRunner.java:109) 
        at junit.textui.TestRunner.run(TestRunner.java:72) 
        at com.repsolypf.sigefi.local.test.SigefiTestCase.main(SigefiTestCase.java:386) 
Caused by: com.ibatis.common.xml.NodeletException: Error parsing XML.  Cause: java.lang.RuntimeException:
Error parsing XPath '/sqlMapConfig/sqlMap'.  Cause: com.ibatis.common.xml.NodeletException:
Error parsing XML.  Cause: com.sap.engine.lib.xml.parser.NestedSAXParserException: Fatal Error:
com.sap.engine.lib.xml.parser.NestedSAXParserException: You are probably using a nondeterministic
model like (a*|b*)*, try to replace it with an equivalent deterministic one, e.g. (a|b)* (Unknown
Source, row:0, col:-1) -> com.sap.engine.lib.xml.parser.ParserException: You are probably
using a nondeterministic model like (a*|b*)*, try to replace it with an equivalent deterministic
one, e.g. (a|b)*(Unknown Source)(:main:, row=9, col=113) -> com.sap.engine.lib.xml.parser.NestedSAXParserException:
You are probably using a nondeterministic model like (a*|b*)*, try to replace it with an equivalent
deterministic one, e.g. (a|b)* (Unknown Source, row:0, col:-1) -> com.sap.engine.lib.xml.parser.ParserException:
You are probably using a nondeterministic model like (a*|b*)*, try to replace it with an equivalent
deterministic one, e.g. (a|b)*(Unknown Source)

        at com.ibatis.common.xml.NodeletParser.parse(NodeletParser.java:53) 
        at com.ibatis.sqlmap.engine.builder.xml.SqlMapConfigParser.parse(SqlMapConfigParser.java:86)

        ... 43 more 



¿Is there another dtd I can use? I'm using ibatis 2.0b4 

Un saludo 
  
Angel Guillén 

Ext: 87545 


Mime
View raw message