日期:2014-05-19  浏览次数:20876 次

初学ibatis报错!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!1!!!!!!!!!!!!!1!!!!!!!!!!!!!
网上说是sqlmapconfig.xml配错了,我看了半天还是报错。还有common-loggin没导入,我导了还是报错。

这些文件都放在src中,
导入包mybatis-3.1.1.jar
ibatis-common-1.3.1.jar
ibatis-dao-1.3.1.jar
ibatis-sqlmap-2.3.0.jar
ojdbc14.jar


报如下异常:
Java code

Exception in thread "main" java.lang.ExceptionInInitializerError
    at com.ibatis.sqlmap.engine.builder.xml.SqlMapConfigParser.<init>(SqlMapConfigParser.java:58)
    at com.ibatis.sqlmap.engine.builder.xml.SqlMapConfigParser.<init>(SqlMapConfigParser.java:45)
    at com.ibatis.sqlmap.client.SqlMapClientBuilder.buildSqlMapClient(SqlMapClientBuilder.java:63)
    at test.main(test.java:29)
Caused by: java.lang.RuntimeException: Error creating logger for class class com.ibatis.sqlmap.engine.impl.SqlMapClientImpl.  Cause: java.lang.NullPointerException
    at com.ibatis.common.logging.LogFactory.getLog(LogFactory.java:33)
    at com.ibatis.sqlmap.engine.impl.SqlMapClientImpl.<clinit>(SqlMapClientImpl.java:40)
    ... 4 more
Caused by: java.lang.NullPointerException
    at com.ibatis.common.logging.LogFactory.getLog(LogFactory.java:31)
    ... 5 more







SqlMapConfig.xml
XML code

<?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" />
        
    <transactionManager type="JDBC">
        <dataSource type="SIMPLE">
            <property name="JDBC.Driver" value="$" />
            <property name="JDBC.ConnectionURL" value="$" />
            <property name="JDBC.Username" value="$" />
            <property name="JDBC.Password" value="$" />
            <property name="JDBC.DefaultAutoCommit" value="true" />
            <property name="Pool.MaximumActiveConnections" value="10" />
            <property name="Pool.MaximumIdleConnections" value="5" />
            <property name="Pool.MaximumCheckoutTime" value="180000" />
            <property name="Pool.TimeToWait" value="10000" />
            <property name="Pool.PingQuery" value="select 1 from dual" />
            <property name="Pool.PingEnabled" value="true" />
            <property name="Pool.PingConnectionsOlderThan" value="0" />
            <property name="Pool.PingConnectionsNotUsedFor" value="3600000" />
            <property name="Pool.QuietMode" value="true" />
        </dataSource>
    </transactionManage