<?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>
<settings cacheModelsEnabled="true"
enhancementEnabled="true"
lazyLoadingEnabled="true"
errorTracingEnabled="true"
maxRequests="32"
maxSessions="10"
maxTransactions="5"
useStatementNamespaces="false"
/>
<properties resource="SqlMap.Properties"/>
<transactionManager type="JDBC">
<dataSource type="SIMPLE">
<property value="${drivername}" name="JDBC.Driver" />
<property value="${url}" name="JDBCDBC.ConnectionURL" />
<property value="${username}" name="JDBC.Username" />
<property value="${password}" name="JDBC.Password" />
</dataSource>
</transactionManager>
<sqlMap resource="booksjoop/ibatis/bookinfo.xml" />
</sqlMapConfig>
//=====================================================
java.lang.ExceptionInInitializerError
Caused by: java.lang.RuntimeException: 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?,resultObjectFactory?,typeAlias*,typeHandler*,transactionManager?,sqlMap+)+".
at com.ibatis.sqlmap.engine.builder.xml.SqlMapConfigParser.parse(SqlMapConfigParser.java:49)
at com.ibatis.sqlmap.client.SqlMapClientBuilder.buildSqlMapClient(SqlMapClientBuilder.java:63)
at bookshop.bookinfoDAOImpl.<clinit>(bookinfoDAOImpl.java:15)
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?,resultObjectFactory?,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:46)
... 2 more
Caused by: org.xml.sax.SAXParseException: The content of element type "sqlMapConfig" must match "(properties?,settings?,resultObjectFactory?,typeAlias*,typeHandler*,transactionManager?,sqlMap+)+".
at com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.createSAXParseException(Unknown Source)
at com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.error(Unknown Source)
at com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(Unknown Source)
at com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(Unknown Source)
at com.sun.org.apache.xerces.internal.impl.dtd.XMLDTDValidator.handleEndElement(Unknown Source)
at com.sun.org.apache.xerces.internal.impl.dtd.XMLDTDValidator.endElement(Unknown Source)
at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanEndElement(Unknown Source)
at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl$FragmentContentDispatcher.dispatch(Unknown Source)
at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanDocument(Unknown Source)
at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(Unknown Source)
at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(Unknown Source)
at com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(Unknown Source)
at com.sun.org.apache.xerces.internal.parsers.DOMParser.parse(Unknown Source)
at com.sun.org.apache.xerces.internal.jaxp.DocumentBuilderImpl.parse(Unknown Source)
at com.ibatis.common.xml.NodeletParser.createDocument(NodeletParser.java:157)
at com.ibatis.common.xml.NodeletParser.parse(NodeletParser.java:50)
... 3 more
Exception in thread "main"
始终找不到哪个配置字段出错?难道每个都要写?我看视频教程里只写了一部分就可以了的啊.
13 个解决方案
#1
The content of element type "sqlMapConfig" must match "(properties?,settings?,resultObjectFactory?,typeAlias*,typeHandler*,transactionManager?,sqlMap+)+".
写全
写全
#3
先<properties resource="SqlMap.Properties"/>
再<settings cacheModelsEnabled="true"
enhancementEnabled="true"
lazyLoadingEnabled="true"
errorTracingEnabled="true"
maxRequests="32"
maxSessions="10"
maxTransactions="5"
useStatementNamespaces="false"
/>
must match "(properties?,settings?,resultObjectFactory?,typeAlias*,typeHandler*,transactionManager?,sqlMap+)+".
带*的 可以没有
*的 可以
再<settings cacheModelsEnabled="true"
enhancementEnabled="true"
lazyLoadingEnabled="true"
errorTracingEnabled="true"
maxRequests="32"
maxSessions="10"
maxTransactions="5"
useStatementNamespaces="false"
/>
must match "(properties?,settings?,resultObjectFactory?,typeAlias*,typeHandler*,transactionManager?,sqlMap+)+".
带*的 可以没有
*的 可以
#4
<!DOCTYPE 是这里的问题... tina;
不过有出现别的问题了;再看.
不过有出现别的问题了;再看.
#5
"(properties?,settings?,resultObjectFactory?,typeAlias*,typeHandler*,transactionManager?,sqlMap+)+".
按照这个顺序写配置
按照这个顺序写配置
#6
<property value="${url}" name="JDBCDBC.ConnectionURL" />改成
<property value="${url}" name="JDBC.ConnectionURL" />
<property value="${url}" name="JDBC.ConnectionURL" />
#7
我试着让自己爱上编程..问题解决了也给点分吧,过年都散光了
#8
谢谢!但是 还有这个问题,明明有这个 SqlMap.Properties 文件的 怎么说找不到呢? ctrl+点击 都能跳到这个界面上去的;
Caused by: java.lang.RuntimeException: Error occurred. Cause: com.ibatis.common.xml.NodeletException: Error parsing XML. Cause: java.lang.RuntimeException: Error parsing XPath '/sqlMapConfig/properties'. Cause: java.lang.RuntimeException: Error loading properties. Cause: java.io.IOException: Could not find resource SqlMap.Properties
at com.ibatis.sqlmap.engine.builder.xml.SqlMapConfigParser.parse(SqlMapConfigParser.java:49)
at com.ibatis.sqlmap.client.SqlMapClientBuilder.buildSqlMapClient(SqlMapClientBuilder.java:63)
at bookshop.bookinfoDAOImpl.<clinit>(bookinfoDAOImpl.java:15)
Caused by: com.ibatis.common.xml.NodeletException: Error parsing XML. Cause: java.lang.RuntimeException: Error parsing XPath '/sqlMapConfig/properties'. Cause: java.lang.RuntimeException: Error loading properties. Cause: java.io.IOException: Could not find resource SqlMap.Properties
at com.ibatis.common.xml.NodeletParser.parse(NodeletParser.java:53)
at com.ibatis.sqlmap.engine.builder.xml.SqlMapConfigParser.parse(SqlMapConfigParser.java:46)
... 2 more
#9
<properties resource="SqlMap.Properties"/>
我配置文件里没这东西,不知道你用来干嘛的
我配置文件里没这东西,不知道你用来干嘛的
#10
路径确认下
#11
<!-- The properties (name=value) in the file specified here can be used placeholders in this config file (e.g. “${driver}”. The file is relative to the classpath and is completely optional. -->
<properties resource=" examples/sqlmap/maps/SqlMapConfigExample.properties " />
<properties resource=" examples/sqlmap/maps/SqlMapConfigExample.properties " />
#12
我把 资源文件去了;
改成 这样后
...
<transactionManager type="JDBC">
<dataSource type="SIMPLE">
<property name="JDBC.Driver" value="com.microsoft.jdbc.sqlserver.SQLServerDriver"/>
<property name="JDBC.ConnectionURL" value="jdbc:microsoft:sqlserver://localhost:1433;DatabaseName=bookshop" />
<property name="JDBC.Username" value="sa" />
<property name="JDBC.Password" value="ham"/>
</dataSource>
</transactionManager>
...
出现 java.lang.NoClassDefFoundError: com/microsoft/jdbc/base/BaseDriver
改成 这样后
...
<transactionManager type="JDBC">
<dataSource type="SIMPLE">
<property name="JDBC.Driver" value="com.microsoft.jdbc.sqlserver.SQLServerDriver"/>
<property name="JDBC.ConnectionURL" value="jdbc:microsoft:sqlserver://localhost:1433;DatabaseName=bookshop" />
<property name="JDBC.Username" value="sa" />
<property name="JDBC.Password" value="ham"/>
</dataSource>
</transactionManager>
...
出现 java.lang.NoClassDefFoundError: com/microsoft/jdbc/base/BaseDriver
#13
汗,又知道了 原因了 只加了mssqlserver.jar 是不够的 还有 2个也要加进来;;;
#1
The content of element type "sqlMapConfig" must match "(properties?,settings?,resultObjectFactory?,typeAlias*,typeHandler*,transactionManager?,sqlMap+)+".
写全
写全
#2
#3
先<properties resource="SqlMap.Properties"/>
再<settings cacheModelsEnabled="true"
enhancementEnabled="true"
lazyLoadingEnabled="true"
errorTracingEnabled="true"
maxRequests="32"
maxSessions="10"
maxTransactions="5"
useStatementNamespaces="false"
/>
must match "(properties?,settings?,resultObjectFactory?,typeAlias*,typeHandler*,transactionManager?,sqlMap+)+".
带*的 可以没有
*的 可以
再<settings cacheModelsEnabled="true"
enhancementEnabled="true"
lazyLoadingEnabled="true"
errorTracingEnabled="true"
maxRequests="32"
maxSessions="10"
maxTransactions="5"
useStatementNamespaces="false"
/>
must match "(properties?,settings?,resultObjectFactory?,typeAlias*,typeHandler*,transactionManager?,sqlMap+)+".
带*的 可以没有
*的 可以
#4
<!DOCTYPE 是这里的问题... tina;
不过有出现别的问题了;再看.
不过有出现别的问题了;再看.
#5
"(properties?,settings?,resultObjectFactory?,typeAlias*,typeHandler*,transactionManager?,sqlMap+)+".
按照这个顺序写配置
按照这个顺序写配置
#6
<property value="${url}" name="JDBCDBC.ConnectionURL" />改成
<property value="${url}" name="JDBC.ConnectionURL" />
<property value="${url}" name="JDBC.ConnectionURL" />
#7
我试着让自己爱上编程..问题解决了也给点分吧,过年都散光了
#8
谢谢!但是 还有这个问题,明明有这个 SqlMap.Properties 文件的 怎么说找不到呢? ctrl+点击 都能跳到这个界面上去的;
Caused by: java.lang.RuntimeException: Error occurred. Cause: com.ibatis.common.xml.NodeletException: Error parsing XML. Cause: java.lang.RuntimeException: Error parsing XPath '/sqlMapConfig/properties'. Cause: java.lang.RuntimeException: Error loading properties. Cause: java.io.IOException: Could not find resource SqlMap.Properties
at com.ibatis.sqlmap.engine.builder.xml.SqlMapConfigParser.parse(SqlMapConfigParser.java:49)
at com.ibatis.sqlmap.client.SqlMapClientBuilder.buildSqlMapClient(SqlMapClientBuilder.java:63)
at bookshop.bookinfoDAOImpl.<clinit>(bookinfoDAOImpl.java:15)
Caused by: com.ibatis.common.xml.NodeletException: Error parsing XML. Cause: java.lang.RuntimeException: Error parsing XPath '/sqlMapConfig/properties'. Cause: java.lang.RuntimeException: Error loading properties. Cause: java.io.IOException: Could not find resource SqlMap.Properties
at com.ibatis.common.xml.NodeletParser.parse(NodeletParser.java:53)
at com.ibatis.sqlmap.engine.builder.xml.SqlMapConfigParser.parse(SqlMapConfigParser.java:46)
... 2 more
#9
<properties resource="SqlMap.Properties"/>
我配置文件里没这东西,不知道你用来干嘛的
我配置文件里没这东西,不知道你用来干嘛的
#10
路径确认下
#11
<!-- The properties (name=value) in the file specified here can be used placeholders in this config file (e.g. “${driver}”. The file is relative to the classpath and is completely optional. -->
<properties resource=" examples/sqlmap/maps/SqlMapConfigExample.properties " />
<properties resource=" examples/sqlmap/maps/SqlMapConfigExample.properties " />
#12
我把 资源文件去了;
改成 这样后
...
<transactionManager type="JDBC">
<dataSource type="SIMPLE">
<property name="JDBC.Driver" value="com.microsoft.jdbc.sqlserver.SQLServerDriver"/>
<property name="JDBC.ConnectionURL" value="jdbc:microsoft:sqlserver://localhost:1433;DatabaseName=bookshop" />
<property name="JDBC.Username" value="sa" />
<property name="JDBC.Password" value="ham"/>
</dataSource>
</transactionManager>
...
出现 java.lang.NoClassDefFoundError: com/microsoft/jdbc/base/BaseDriver
改成 这样后
...
<transactionManager type="JDBC">
<dataSource type="SIMPLE">
<property name="JDBC.Driver" value="com.microsoft.jdbc.sqlserver.SQLServerDriver"/>
<property name="JDBC.ConnectionURL" value="jdbc:microsoft:sqlserver://localhost:1433;DatabaseName=bookshop" />
<property name="JDBC.Username" value="sa" />
<property name="JDBC.Password" value="ham"/>
</dataSource>
</transactionManager>
...
出现 java.lang.NoClassDefFoundError: com/microsoft/jdbc/base/BaseDriver
#13
汗,又知道了 原因了 只加了mssqlserver.jar 是不够的 还有 2个也要加进来;;;