English 中文(简体)
MyBatis Configuration.xml with dataSource
原标题:MyBatis Configuration.xml with dataSource

我每次试图与数据库连接时,都会保留这一例外。

Error building SqlSession.

The error may exist in SQL Mapper Configuration

Cause: org.apache.ibatis.builder.BuilderException: Error creating document instance. Cause: org.xml.sax.SAXParseException: The content of element type "dataSource" must match "(property)*".

我的Conifugration.xml档案:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE configuration PUBLIC "-//mybatis.org//DTD Config 3.0//EN" "http://mybatis.org/dtd/mybatis-3-config.dtd">
<configuration>
    <environments default="development">
        <environment id="development">
          <transactionManager type="JDBC"/>
          <dataSource type="POOLED">    
                <property name="driver" value="com.mysql.jdbc.Driver"/>
                <property name="url" value="jdbc:mysql://localhost:3360/teste"/>
                <property name="username" value="root"/>
                <property name="password" value="root"/>
           </dataSource>
        </environment>
    </environments>
</configuration>

我已经对此进行了搜索,研究了数据来源样本,就像其他样本一样。

谁知道什么?

问题回答

我看一看MyBatis组合。 我在文件结尾处有以下三行:</environments></configuration>

<mappers>
  <mapper resource="YourHandbuiltOrMyBatisGeneratedMapper.xml"/>
</mappers>

地图仪是 Java接口,帮助 Java了解如何使用CRUD(Create, Read, Update, 删除)。 这些信函的对应之处包括:斜体字插入()等接口;选择ByPrimaryKey, int UpdateByExample; int切除ByExample。

Hope that helps.

The exception is saying that the stuff inside your <dataSource/> element must be zero or one <property/> tags. Might you have inadvertently included a hidden character in your XML source file, perhaps from copying and pasting? Other than that I do not see anything wrong with your XML.





相关问题
how to represent it in dtd?

I have two element action and guid. guid is a required field when action is add. but when action is del it will not appear in file. How to represent this in dtd ?

.Net application configuration add xml-data

I need to add xml-content to my application configuration file. Is there a way to add it directly to the appSettings section or do I need to implement a configSection? Is it possible to add the xml ...

XStream serializing collections

I have a class structure that I would like to serialize with Xstream. The root class contains a collection of other objects (of varying types). I would like to only serialize part of the objects that ...

MS Word splits words in its XML format

I have a Word 2003 document saved as a XML in WordProcessingML format. It contains few placeholders which will be dynamically replaced by an appropriate content. But, the problem is that Word ...

Merging an XML file with a list of changes

I have two XML files that are generated by another application I have no control over. The first is a settings file, and the second is a list of changes that should be applied to the first. Main ...

How do I check if a node has no siblings?

I have a org.w3c.dom.Node object. I would like to see if it has any other siblings. Here s what I have tried: Node sibling = node.getNextSibling(); if(sibling == null) return true; else ...

Ordering a hash to xml: Rails

I m building an xml document from a hash. The xml attributes need to be in order. How can this be accomplished? hash.to_xml

热门标签