You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user-java@ibatis.apache.org by er...@aftenposten.no on 2005/07/07 17:34:48 UTC
SAXParseException, parsing the sqlMap-config.xml file!
Hi there!
In my IntelliJ, in our Resin web applications it all works just fine with SQLMap, but when I tries to
run a scheduler job (Quartz) from command prompt using SQLMap from a .bat file (I run the job
from IntelliJ it works fine) it seems that suddenly the parsing of the config file is not working anymore.
I have also tried to copy the java command run by IntelliJ, into the bat file I'm starting so I get as close as
I can get the same "environment" as the one in IntelliJ, still the same problem.
Does anyone have any clues about what's wrong ? Some kind of conflict with the dtd ??? but why now ?
Can it be some kind of conflict of .jar files ? Need to change the sequence ? Pretty lost here now.
Thanks for any clues!
Erlend Bjørge
--------
Here is the exception I get, check the red line where the exception happens in my code, look further down.
-------
java.lang.ExceptionInInitializerError
at no.aftenposten.multimedia.aguiden.bus.facade.FacadeFactory.getFacadeAdmin(FacadeFactory.java:19)
at no.aftenposten.multimedia.aguiden.bus.common.batch.AGuidenDBUpdater.<init>(AGuidenDBUpdater.java:42)
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
at java.lang.reflect.Constructor.newInstance(Constructor.java:274)
at java.lang.Class.newInstance0(Class.java:308)
at java.lang.Class.newInstance(Class.java:261)
at org.quartz.core.JobRunShell.initialize(JobRunShell.java:135)
at org.quartz.core.QuartzSchedulerThread.run(QuartzSchedulerThread.java:335)
Caused by: com.ibatis.common.exception.NestedRuntimeException: Error occurred. Cause: com.ibatis.common.xml.NodeletException: Error parsing XML. Cause: org.xml.sax.SAXParseException: The content of element type "sqlMapConfig" must match "(properties?,settings?,typeAlias*,typeHandler*,transactionMa
nager?,sqlMap+)+".
Caused by: org.xml.sax.SAXParseException: The content of element type "sqlMapConfig" must match "(properties?,settings?,typeAlias*,typeHandler*,transactionManager?,sqlMap+)+".
Caused by: com.ibatis.common.xml.NodeletException: Error parsing XML. Cause: org.xml.sax.SAXParseException: The content of element type "sqlMapConfig" must match "(properties?,settings?,typeAlias*,typeHandler*,transactionManager?,sqlMap+)+".
Caused by: org.xml.sax.SAXParseException: The content of element type "sqlMapConfig" must match "(properties?,settings?,typeAlias*,typeHandler*,transactionManager?,sqlMap+)+".
at com.ibatis.sqlmap.engine.builder.xml.SqlMapConfigParser.parse(SqlMapConfigParser.java:81)
at com.ibatis.sqlmap.client.SqlMapClientBuilder.buildSqlMapClient(SqlMapClientBuilder.java:62)
at no.aftenposten.multimedia.aguiden.bus.facade.AgFacade.getSqlMapClient(AgFacade.java:39)
at no.aftenposten.multimedia.aguiden.bus.facade.AgFacade.<clinit>(AgFacade.java:20)
... 10 more
Caused by: com.ibatis.common.xml.NodeletException: Error parsing XML. Cause: org.xml.sax.SAXParseException: The content of element type "sqlMapConfig" must match "(properties?,settings?,typeAlias*,typeHandler*,transactionManager?,sqlMap+)+".
Caused by: org.xml.sax.SAXParseException: The content of element type "sqlMapConfig" must match "(properties?,settings?,typeAlias*,typeHandler*,transactionManager?,sqlMap+)+".
at com.ibatis.common.xml.NodeletParser.parse(NodeletParser.java:53)
at com.ibatis.sqlmap.engine.builder.xml.SqlMapConfigParser.parse(SqlMapConfigParser.java:78)
... 13 more
Caused by: org.xml.sax.SAXParseException: The content of element type "sqlMapConfig" must match "(properties?,settings?,typeAlias*,typeHandler*,transactionManager?,sqlMap+)+".
at org.apache.xerces.framework.XMLParser.reportError(XMLParser.java:1213)
at org.apache.xerces.validators.common.XMLValidator.reportRecoverableXMLError(XMLValidator.java:1851)
at org.apache.xerces.validators.common.XMLValidator.callEndElement(XMLValidator.java:1495)
at org.apache.xerces.framework.XMLDocumentScanner$ContentDispatcher.dispatch(XMLDocumentScanner.java:1149)
at org.apache.xerces.framework.XMLDocumentScanner.parseSome(XMLDocumentScanner.java:381)
at org.apache.xerces.framework.XMLParser.parse(XMLParser.java:1098)
at org.apache.xerces.jaxp.DocumentBuilderImpl.parse(DocumentBuilderImpl.java:195)
at com.ibatis.common.xml.NodeletParser.createDocument(NodeletParser.java:150)
at com.ibatis.common.xml.NodeletParser.parse(NodeletParser.java:50)
... 14 more
----------------------------
Here is my config file with the "correct" header:
-------------------------
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE sqlMapConfig PUBLIC "-//iBATIS.com//DTD SQL Map Config 2.0//EN" "http://www.ibatis.com/dtd/sql-map-config-2.dtd <http://www.ibatis.com/dtd/sql-map-config-2.dtd> ">
<sqlMapConfig>
<properties resource="conf/sqlMap-config.properties"/>
<settings
cacheModelsEnabled="true"
enhancementEnabled="true"
lazyLoadingEnabled="true"
maxRequests="256"
maxSessions="128"
maxTransactions="32"
useStatementNamespaces="false"/>
<transactionManager type="JDBC">
<dataSource type="SIMPLE">
<property name="JDBC.Driver" value="${driver}"/>
<property name="JDBC.ConnectionURL" value="${url}"/>
<property name="JDBC.Username" value="${username}"/>
<property name="JDBC.Password" value="${password}"/>
....
.....
.......
.........
</sqlMapConfig>
----------------------------
Here is my getSqlMapClient:
-----------------------
private static SqlMapClient getSqlMapClient() {
String resource = "no/aftenposten/multimedia/aguiden/bus/dao/sql/sqlMap-config.xml";
Reader reader = null;
try {
reader = Resources.getResourceAsReader( resource );
} catch ( IOException e ) {
System.out.println("############ GAME OVER - SYSTEM.EXIT(-1) ############\n");
System.out.println("############ FATAL ERROR, NOT ABLE TO OPEN THE sqlMap-config.xml FILE ############");
System.out.println("############ " + resource + " ############");
System.out.println("############ FATAL ERROR, NOT ABLE TO OPEN THE sqlMap-config.xml FILE ############");
System.exit(-1);
}
SqlMapClient sqlMap = SqlMapClientBuilder.buildSqlMapClient( reader ); (Line 39, See red line in the exception)
return sqlMap;
}
Re: SAXParseException, parsing the sqlMap-config.xml file!
Posted by Larry Meadors <la...@gmail.com>.
Or try to use a validating editor, like JEdit.
On 7/7/05, Brandon Goodin <br...@gmail.com> wrote:
> Apparently you have an element type that is not in proper order with the DTD.
>
> Caused by: org.xml.sax.SAXParseException: The content of element type
> "sqlMapConfig" must match
> "(properties?,settings?,typeAlias*,typeHandler*,transactionManager?,sqlMap+)+".
>
> Check your sql map config and make sure your elements are properly ordered.
>
> Brandon
>
> On 7/7/05, erlend.bjorge@aftenposten.no <er...@aftenposten.no> wrote:
> >
> > Hi there!
> >
> > In my IntelliJ, in our Resin web applications it all works just fine with
> > SQLMap, but when I tries to
> > run a scheduler job (Quartz) from command prompt using SQLMap from a .bat
> > file (I run the job
> > from IntelliJ it works fine) it seems that suddenly the parsing of the
> > config file is not working anymore.
> >
> > I have also tried to copy the java command run by IntelliJ, into the bat
> > file I'm starting so I get as close as
> > I can get the same "environment" as the one in IntelliJ, still the same
> > problem.
> >
> > Does anyone have any clues about what's wrong ? Some kind of conflict with
> > the dtd ??? but why now ?
> > Can it be some kind of conflict of .jar files ? Need to change the sequence
> > ? Pretty lost here now.
> >
> > Thanks for any clues!
> >
> > Erlend Bjørge
> >
> > --------
> >
> > Here is the exception I get, check the red line where the exception happens
> > in my code, look further down.
> >
> > -------
> >
> > java.lang.ExceptionInInitializerError
> > at
> > no.aftenposten.multimedia.aguiden.bus.facade.FacadeFactory.getFacadeAdmin(FacadeFactory.java:19)
> > at
> > no.aftenposten.multimedia.aguiden.bus.common.batch.AGuidenDBUpdater.<init>(AGuidenDBUpdater.java:42)
> > at
> > sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native
> > Method)
> > at
> > sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
> > at
> > sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
> > at
> > java.lang.reflect.Constructor.newInstance(Constructor.java:274)
> > at java.lang.Class.newInstance0(Class.java:308)
> > at java.lang.Class.newInstance(Class.java:261)
> > at
> > org.quartz.core.JobRunShell.initialize(JobRunShell.java:135)
> > at
> > org.quartz.core.QuartzSchedulerThread.run(QuartzSchedulerThread.java:335)
> > Caused by:
> > com.ibatis.common.exception.NestedRuntimeException: Error
> > occurred. Cause: com.ibatis.common.xml.NodeletException:
> > Error parsing XML. Cause: org.xml.sax.SAXParseException: The content of
> > element type "sqlMapConfig" must match
> > "(properties?,settings?,typeAlias*,typeHandler*,transactionMa
> > nager?,sqlMap+)+".
> > Caused by: org.xml.sax.SAXParseException: The content of element type
> > "sqlMapConfig" must match
> > "(properties?,settings?,typeAlias*,typeHandler*,transactionManager?,sqlMap+)+".
> > Caused by: com.ibatis.common.xml.NodeletException: Error
> > parsing XML. Cause: org.xml.sax.SAXParseException: The content of element
> > type "sqlMapConfig" must match
> > "(properties?,settings?,typeAlias*,typeHandler*,transactionManager?,sqlMap+)+".
> > Caused by: org.xml.sax.SAXParseException: The content of element type
> > "sqlMapConfig" must match
> > "(properties?,settings?,typeAlias*,typeHandler*,transactionManager?,sqlMap+)+".
> > at
> > com.ibatis.sqlmap.engine.builder.xml.SqlMapConfigParser.parse(SqlMapConfigParser.java:81)
> > at
> > com.ibatis.sqlmap.client.SqlMapClientBuilder.buildSqlMapClient(SqlMapClientBuilder.java:62)
> > at
> > no.aftenposten.multimedia.aguiden.bus.facade.AgFacade.getSqlMapClient(AgFacade.java:39)
> > at
> > no.aftenposten.multimedia.aguiden.bus.facade.AgFacade.<clinit>(AgFacade.java:20)
> > ... 10 more
> > Caused by: com.ibatis.common.xml.NodeletException: Error
> > parsing XML. Cause: org.xml.sax.SAXParseException: The content of element
> > type "sqlMapConfig" must match
> > "(properties?,settings?,typeAlias*,typeHandler*,transactionManager?,sqlMap+)+".
> > Caused by: org.xml.sax.SAXParseException: The content of element type
> > "sqlMapConfig" must match
> > "(properties?,settings?,typeAlias*,typeHandler*,transactionManager?,sqlMap+)+".
> > at
> > com.ibatis.common.xml.NodeletParser.parse(NodeletParser.java:53)
> > at
> > com.ibatis.sqlmap.engine.builder.xml.SqlMapConfigParser.parse(SqlMapConfigParser.java:78)
> > ... 13 more
> > Caused by: org.xml.sax.SAXParseException: The content of element type
> > "sqlMapConfig" must match
> > "(properties?,settings?,typeAlias*,typeHandler*,transactionManager?,sqlMap+)+".
> > at
> > org.apache.xerces.framework.XMLParser.reportError(XMLParser.java:1213)
> > at
> > org.apache.xerces.validators.common.XMLValidator.reportRecoverableXMLError(XMLValidator.java:1851)
> > at
> > org.apache.xerces.validators.common.XMLValidator.callEndElement(XMLValidator.java:1495)
> > at
> > org.apache.xerces.framework.XMLDocumentScanner$ContentDispatcher.dispatch(XMLDocumentScanner.java:1149)
> > at
> > org.apache.xerces.framework.XMLDocumentScanner.parseSome(XMLDocumentScanner.java:381)
> > at
> > org.apache.xerces.framework.XMLParser.parse(XMLParser.java:1098)
> > at
> > org.apache.xerces.jaxp.DocumentBuilderImpl.parse(DocumentBuilderImpl.java:195)
> > at
> > com.ibatis.common.xml.NodeletParser.createDocument(NodeletParser.java:150)
> > at
> > com.ibatis.common.xml.NodeletParser.parse(NodeletParser.java:50)
> > ... 14 more
> >
> > ----------------------------
> >
> > Here is my config file with the "correct" header:
> >
> > -------------------------
> >
> > <?xml version="1.0" encoding="UTF-8" ?>
> > <!DOCTYPE sqlMapConfig PUBLIC "-//iBATIS.com//DTD SQL Map Config 2.0//EN"
> > "http://www.ibatis.com/dtd/sql-map-config-2.dtd">
> >
> > <sqlMapConfig>
> >
> > <properties resource="conf/sqlMap-config.properties"/>
> >
> > <settings
> > cacheModelsEnabled="true"
> > enhancementEnabled="true"
> > lazyLoadingEnabled="true"
> > maxRequests="256"
> > maxSessions="128"
> > maxTransactions="32"
> > useStatementNamespaces="false"/>
> >
> > <transactionManager type="JDBC">
> > <dataSource type="SIMPLE">
> > <property name="JDBC.Driver" value="${driver}"/>
> > <property name="JDBC.ConnectionURL" value="${url}"/>
> > <property name="JDBC.Username" value="${username}"/>
> > <property name="JDBC.Password" value="${password}"/>
> > ....
> > .....
> > .......
> > .........
> >
> > </sqlMapConfig>
> >
> > ----------------------------
> > Here is my getSqlMapClient:
> > -----------------------
> >
> > private static SqlMapClient getSqlMapClient() {
> >
> > String resource =
> > "no/aftenposten/multimedia/aguiden/bus/dao/sql/sqlMap-config.xml";
> >
> > Reader reader = null;
> >
> > try {
> > reader = Resources.getResourceAsReader( resource );
> > } catch ( IOException e ) {
> > System.out.println("############ GAME OVER -
> > SYSTEM.EXIT(-1) ############\n");
> >
> > System.out.println("############ FATAL ERROR, NOT ABLE TO
> > OPEN THE sqlMap-config.xml FILE ############");
> > System.out.println("############ " + resource + "
> > ############");
> > System.out.println("############ FATAL ERROR, NOT ABLE TO
> > OPEN THE sqlMap-config.xml FILE ############");
> > System.exit(-1);
> > }
> >
> > SqlMapClient sqlMap =
> > SqlMapClientBuilder.buildSqlMapClient( reader ); (Line
> > 39, See red line in the exception)
> >
> > return sqlMap;
> > }
> >
>
Re: SAXParseException, parsing the sqlMap-config.xml file!
Posted by Brandon Goodin <br...@gmail.com>.
Apparently you have an element type that is not in proper order with the DTD.
Caused by: org.xml.sax.SAXParseException: The content of element type
"sqlMapConfig" must match
"(properties?,settings?,typeAlias*,typeHandler*,transactionManager?,sqlMap+)+".
Check your sql map config and make sure your elements are properly ordered.
Brandon
On 7/7/05, erlend.bjorge@aftenposten.no <er...@aftenposten.no> wrote:
>
> Hi there!
>
> In my IntelliJ, in our Resin web applications it all works just fine with
> SQLMap, but when I tries to
> run a scheduler job (Quartz) from command prompt using SQLMap from a .bat
> file (I run the job
> from IntelliJ it works fine) it seems that suddenly the parsing of the
> config file is not working anymore.
>
> I have also tried to copy the java command run by IntelliJ, into the bat
> file I'm starting so I get as close as
> I can get the same "environment" as the one in IntelliJ, still the same
> problem.
>
> Does anyone have any clues about what's wrong ? Some kind of conflict with
> the dtd ??? but why now ?
> Can it be some kind of conflict of .jar files ? Need to change the sequence
> ? Pretty lost here now.
>
> Thanks for any clues!
>
> Erlend Bjørge
>
> --------
>
> Here is the exception I get, check the red line where the exception happens
> in my code, look further down.
>
> -------
>
> java.lang.ExceptionInInitializerError
> at
> no.aftenposten.multimedia.aguiden.bus.facade.FacadeFactory.getFacadeAdmin(FacadeFactory.java:19)
> at
> no.aftenposten.multimedia.aguiden.bus.common.batch.AGuidenDBUpdater.<init>(AGuidenDBUpdater.java:42)
> at
> sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native
> Method)
> at
> sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
> at
> sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
> at
> java.lang.reflect.Constructor.newInstance(Constructor.java:274)
> at java.lang.Class.newInstance0(Class.java:308)
> at java.lang.Class.newInstance(Class.java:261)
> at
> org.quartz.core.JobRunShell.initialize(JobRunShell.java:135)
> at
> org.quartz.core.QuartzSchedulerThread.run(QuartzSchedulerThread.java:335)
> Caused by:
> com.ibatis.common.exception.NestedRuntimeException: Error
> occurred. Cause: com.ibatis.common.xml.NodeletException:
> Error parsing XML. Cause: org.xml.sax.SAXParseException: The content of
> element type "sqlMapConfig" must match
> "(properties?,settings?,typeAlias*,typeHandler*,transactionMa
> nager?,sqlMap+)+".
> Caused by: org.xml.sax.SAXParseException: The content of element type
> "sqlMapConfig" must match
> "(properties?,settings?,typeAlias*,typeHandler*,transactionManager?,sqlMap+)+".
> Caused by: com.ibatis.common.xml.NodeletException: Error
> parsing XML. Cause: org.xml.sax.SAXParseException: The content of element
> type "sqlMapConfig" must match
> "(properties?,settings?,typeAlias*,typeHandler*,transactionManager?,sqlMap+)+".
> Caused by: org.xml.sax.SAXParseException: The content of element type
> "sqlMapConfig" must match
> "(properties?,settings?,typeAlias*,typeHandler*,transactionManager?,sqlMap+)+".
> at
> com.ibatis.sqlmap.engine.builder.xml.SqlMapConfigParser.parse(SqlMapConfigParser.java:81)
> at
> com.ibatis.sqlmap.client.SqlMapClientBuilder.buildSqlMapClient(SqlMapClientBuilder.java:62)
> at
> no.aftenposten.multimedia.aguiden.bus.facade.AgFacade.getSqlMapClient(AgFacade.java:39)
> at
> no.aftenposten.multimedia.aguiden.bus.facade.AgFacade.<clinit>(AgFacade.java:20)
> ... 10 more
> Caused by: com.ibatis.common.xml.NodeletException: Error
> parsing XML. Cause: org.xml.sax.SAXParseException: The content of element
> type "sqlMapConfig" must match
> "(properties?,settings?,typeAlias*,typeHandler*,transactionManager?,sqlMap+)+".
> Caused by: org.xml.sax.SAXParseException: The content of element type
> "sqlMapConfig" must match
> "(properties?,settings?,typeAlias*,typeHandler*,transactionManager?,sqlMap+)+".
> at
> com.ibatis.common.xml.NodeletParser.parse(NodeletParser.java:53)
> at
> com.ibatis.sqlmap.engine.builder.xml.SqlMapConfigParser.parse(SqlMapConfigParser.java:78)
> ... 13 more
> Caused by: org.xml.sax.SAXParseException: The content of element type
> "sqlMapConfig" must match
> "(properties?,settings?,typeAlias*,typeHandler*,transactionManager?,sqlMap+)+".
> at
> org.apache.xerces.framework.XMLParser.reportError(XMLParser.java:1213)
> at
> org.apache.xerces.validators.common.XMLValidator.reportRecoverableXMLError(XMLValidator.java:1851)
> at
> org.apache.xerces.validators.common.XMLValidator.callEndElement(XMLValidator.java:1495)
> at
> org.apache.xerces.framework.XMLDocumentScanner$ContentDispatcher.dispatch(XMLDocumentScanner.java:1149)
> at
> org.apache.xerces.framework.XMLDocumentScanner.parseSome(XMLDocumentScanner.java:381)
> at
> org.apache.xerces.framework.XMLParser.parse(XMLParser.java:1098)
> at
> org.apache.xerces.jaxp.DocumentBuilderImpl.parse(DocumentBuilderImpl.java:195)
> at
> com.ibatis.common.xml.NodeletParser.createDocument(NodeletParser.java:150)
> at
> com.ibatis.common.xml.NodeletParser.parse(NodeletParser.java:50)
> ... 14 more
>
> ----------------------------
>
> Here is my config file with the "correct" header:
>
> -------------------------
>
> <?xml version="1.0" encoding="UTF-8" ?>
> <!DOCTYPE sqlMapConfig PUBLIC "-//iBATIS.com//DTD SQL Map Config 2.0//EN"
> "http://www.ibatis.com/dtd/sql-map-config-2.dtd">
>
> <sqlMapConfig>
>
> <properties resource="conf/sqlMap-config.properties"/>
>
> <settings
> cacheModelsEnabled="true"
> enhancementEnabled="true"
> lazyLoadingEnabled="true"
> maxRequests="256"
> maxSessions="128"
> maxTransactions="32"
> useStatementNamespaces="false"/>
>
> <transactionManager type="JDBC">
> <dataSource type="SIMPLE">
> <property name="JDBC.Driver" value="${driver}"/>
> <property name="JDBC.ConnectionURL" value="${url}"/>
> <property name="JDBC.Username" value="${username}"/>
> <property name="JDBC.Password" value="${password}"/>
> ....
> .....
> .......
> .........
>
> </sqlMapConfig>
>
> ----------------------------
> Here is my getSqlMapClient:
> -----------------------
>
> private static SqlMapClient getSqlMapClient() {
>
> String resource =
> "no/aftenposten/multimedia/aguiden/bus/dao/sql/sqlMap-config.xml";
>
> Reader reader = null;
>
> try {
> reader = Resources.getResourceAsReader( resource );
> } catch ( IOException e ) {
> System.out.println("############ GAME OVER -
> SYSTEM.EXIT(-1) ############\n");
>
> System.out.println("############ FATAL ERROR, NOT ABLE TO
> OPEN THE sqlMap-config.xml FILE ############");
> System.out.println("############ " + resource + "
> ############");
> System.out.println("############ FATAL ERROR, NOT ABLE TO
> OPEN THE sqlMap-config.xml FILE ############");
> System.exit(-1);
> }
>
> SqlMapClient sqlMap =
> SqlMapClientBuilder.buildSqlMapClient( reader ); (Line
> 39, See red line in the exception)
>
> return sqlMap;
> }
>