Hey, guys,

I created the simplest hbm mapping and try to build session factory(full project attached, Hibernate-core4.0.0.CR6):

/new MetadataSources(
                 new ServiceRegistryBuilder().configure()
.buildServiceRegistry()).buildMetadata().buildSessionFactory();/


And I get this exception(full log attached):

Caused by: org.xml.sax.SAXParseException; lineNumber: 5; columnNumber: 26; cvc-elt.1: Cannot find the declaration of element 'hibernate-configuration'. at com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.createSAXParseException(ErrorHandlerWrapper.java:198)
   ...


When I build session factory using old syntax

/new Configuration().configure().buildSessionFactory();/

it works only with DTD schema(not 100% sure I found a correct header to use xsd for hibernate.cfg.xml):

<hibernate-configuration
xmlns="http://www.hibernate.org/xsd/hibernate-configuration";
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
xsi:schemaLocation="http://www.hibernate.org/xsd/hibernate-configuration https://raw.github.com/hibernate/hibernate-core/master/hibernate-core/src/main/resources/org/hibernate/hibernate-configuration-4.0.xsd";>

.

This seems like a bug, or I do something wrong?

Dmitry Geraskov


Exception in thread "main" 
org.hibernate.internal.util.config.ConfigurationException: Unable to perform 
unmarshalling at line number 5 and column 26 in RESOURCE hibernate.cfg.xml. 
Message: cvc-elt.1: Cannot find the declaration of element 
'hibernate-configuration'.
        at 
org.hibernate.service.internal.JaxbProcessor.unmarshal(JaxbProcessor.java:120)
        at 
org.hibernate.service.internal.JaxbProcessor.unmarshal(JaxbProcessor.java:69)
        at 
org.hibernate.service.ServiceRegistryBuilder.configure(ServiceRegistryBuilder.java:162)
        at 
org.hibernate.service.ServiceRegistryBuilder.configure(ServiceRegistryBuilder.java:147)
        at r.RunWithConfig.main(RunWithConfig.java:13)
Caused by: javax.xml.bind.UnmarshalException
 - with linked exception:
[org.xml.sax.SAXParseException; lineNumber: 5; columnNumber: 26; cvc-elt.1: 
Cannot find the declaration of element 'hibernate-configuration'.]
        at 
com.sun.xml.internal.bind.v2.runtime.unmarshaller.UnmarshallerImpl.handleStreamException(UnmarshallerImpl.java:414)
        at 
com.sun.xml.internal.bind.v2.runtime.unmarshaller.UnmarshallerImpl.unmarshal0(UnmarshallerImpl.java:351)
        at 
com.sun.xml.internal.bind.v2.runtime.unmarshaller.UnmarshallerImpl.unmarshal(UnmarshallerImpl.java:321)
        at 
org.hibernate.service.internal.JaxbProcessor.unmarshal(JaxbProcessor.java:108)
        ... 4 more
Caused by: org.xml.sax.SAXParseException; lineNumber: 5; columnNumber: 26; 
cvc-elt.1: Cannot find the declaration of element 'hibernate-configuration'.
        at 
com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.createSAXParseException(ErrorHandlerWrapper.java:198)
        at 
com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.error(ErrorHandlerWrapper.java:134)
        at 
com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(XMLErrorReporter.java:387)
        at 
com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(XMLErrorReporter.java:321)
        at 
com.sun.org.apache.xerces.internal.impl.xs.XMLSchemaValidator.handleStartElement(XMLSchemaValidator.java:1919)
        at 
com.sun.org.apache.xerces.internal.impl.xs.XMLSchemaValidator.startElement(XMLSchemaValidator.java:709)
        at 
com.sun.org.apache.xerces.internal.jaxp.validation.ValidatorHandlerImpl.startElement(ValidatorHandlerImpl.java:565)
        at 
com.sun.xml.internal.bind.v2.runtime.unmarshaller.ValidatingUnmarshaller.startElement(ValidatingUnmarshaller.java:78)
        at 
com.sun.xml.internal.bind.v2.runtime.unmarshaller.InterningXmlVisitor.startElement(InterningXmlVisitor.java:60)
        at 
com.sun.xml.internal.bind.v2.runtime.unmarshaller.StAXStreamConnector.handleStartElement(StAXStreamConnector.java:231)
        at 
com.sun.xml.internal.bind.v2.runtime.unmarshaller.StAXStreamConnector.bridge(StAXStreamConnector.java:165)
        at 
com.sun.xml.internal.bind.v2.runtime.unmarshaller.UnmarshallerImpl.unmarshal0(UnmarshallerImpl.java:349)
        ... 6 more

_______________________________________________
hibernate-dev mailing list
hibernate-dev@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/hibernate-dev

Reply via email to