[invalid configuration] probleme dans hibernate.cfg.xml
Bonjour,
J'ai une base de donnée Mysql et j'utilise hibernate 3.1.3
Quand j'appelle config.configure()
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13
| private Configuration config = null;
// Usine a fabriquer des sessions
private SessionFactory factory = null;
private Session session;
public TestHibernate() {
// par defaut hibernate.cfg.xml est utilise
config = new Configuration();
config.configure();
factory = config.buildSessionFactory();
} |
j'obtient comme erreur
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27
| invalid configuration
org.hibernate.MappingException: invalid configuration
at org.hibernate.cfg.Configuration.doConfigure(Configuration.java:1369)
at org.hibernate.cfg.Configuration.configure(Configuration.java:1310)
at org.hibernate.cfg.Configuration.configure(Configuration.java:1296)
at TestHibernate.<init>(TestHibernate.java:25)
at TestHibernate.init(TestHibernate.java:42)
at TestHibernate.main(TestHibernate.java:34)
Caused by: org.xml.sax.SAXParseException: Document root element "xsl:stylesheet", must match DOCTYPE root "null".
at org.apache.xerces.util.ErrorHandlerWrapper.createSAXParseException(ErrorHandlerWrapper.java:232)
at org.apache.xerces.util.ErrorHandlerWrapper.error(ErrorHandlerWrapper.java:173)
at org.apache.xerces.impl.XMLErrorReporter.reportError(XMLErrorReporter.java:362)
at org.apache.xerces.impl.XMLErrorReporter.reportError(XMLErrorReporter.java:296)
at org.apache.xerces.impl.dtd.XMLDTDValidator.rootElementSpecified(XMLDTDValidator.java:1553)
at org.apache.xerces.impl.dtd.XMLDTDValidator.handleStartElement(XMLDTDValidator.java:1844)
at org.apache.xerces.impl.dtd.XMLDTDValidator.startElement(XMLDTDValidator.java:752)
at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanStartElement(XMLDocumentFragmentScannerImpl.java:752)
at org.apache.xerces.impl.XMLDocumentScannerImpl$ContentDispatcher.scanRootElementHook(XMLDocumentScannerImpl.java:942)
at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl$FragmentContentDispatcher.dispatch(XMLDocumentFragmentScannerImpl.java:1520)
at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanDocument(XMLDocumentFragmentScannerImpl.java:333)
at org.apache.xerces.parsers.DTDConfiguration.parse(DTDConfiguration.java:524)
at org.apache.xerces.parsers.DTDConfiguration.parse(DTDConfiguration.java:580)
at org.apache.xerces.parsers.XMLParser.parse(XMLParser.java:152)
at org.apache.xerces.parsers.AbstractSAXParser.parse(AbstractSAXParser.java:1169)
at org.dom4j.io.SAXReader.read(SAXReader.java:465)
at org.hibernate.cfg.Configuration.doConfigure(Configuration.java:1366)
... 5 more |
Je comprend pas trop pourquoi ça me dit
Citation:
Document root element "xsl:stylesheet", must match DOCTYPE root "null".
Mon fichier hibernate.cfg.xml:
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27
| <?xml version='1.0' encoding='utf-8'?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
version="1.0">
<xsl:output method="xml" indent="yes"
doctype-public="-//Hibernate/Hibernate Configuration DTD//EN"
doctype-system="http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd" />
<xsl:template match="env">
<hibernate-configuration>
<!-- The souscription SessionFactory instance jndi/ifastart -->
<session-factory name="Tpr">
<property name="show_sql">true</property>
<property name="hibernate.connection.driver_class">com.mysql.jdbc.Driver</property>
<property name="hibernate.connection.url">jdbc:mysql://localhost/retplb01</property>
<property name="hibernate.connection.password">user01</property>
<property name="hibernate.connection.username">pass01</property>
<property name="hibernate.connection.pool_size">10</property>
<property name="dialect">org.hibernate.dialect.MySQLDialect</property>
<!-- mapping files -->
<mapping resource="/Tcar.hbm.xml" />
<mapping resource="/Tperson.hbm.xml" />
</session-factory>
</hibernate-configuration>
</xsl:template>
</xsl:stylesheet> |
Comment résoudre cette erreur ?Et pourquoi j'ai cette erreur aussi parcequ'il me semble que mon fichier de config est bon lol
Merci d'avance