Xml parsing error


#1

hi every body, please i received this message error whane running my java application , i know that it is about hibernate.cfg.xml file but i don’t know how resolving it.
the message is as follow:

INFO: HHH000412: Hibernate Core {5.2.17.Final}
mai 08, 2018 10:39:24 PM org.hibernate.cfg.Environment <clinit>
INFO: HHH000206: hibernate.properties not found
Exception in thread "main" java.lang.ClassCastException: com.sun.xml.internal.stream.events.EntityReferenceEvent cannot be cast to javax.xml.stream.events.Characters
	at com.sun.xml.internal.stream.events.DummyEvent.asCharacters(Unknown Source)
	at com.sun.xml.internal.bind.v2.runtime.unmarshaller.StAXEventConnector.handleCharacters(Unknown Source)
	at com.sun.xml.internal.bind.v2.runtime.unmarshaller.StAXEventConnector.bridge(Unknown Source)
	at com.sun.xml.internal.bind.v2.runtime.unmarshaller.UnmarshallerImpl.unmarshal0(Unknown Source)
	at com.sun.xml.internal.bind.v2.runtime.unmarshaller.UnmarshallerImpl.unmarshal(Unknown Source)
	at org.hibernate.boot.cfgxml.internal.JaxbCfgProcessor.unmarshal(JaxbCfgProcessor.java:126)
	at org.hibernate.boot.cfgxml.internal.JaxbCfgProcessor.unmarshal(JaxbCfgProcessor.java:65)
	at org.hibernate.boot.cfgxml.internal.ConfigLoader.loadConfigXmlResource(ConfigLoader.java:57)
	at org.hibernate.boot.registry.StandardServiceRegistryBuilder.configure(StandardServiceRegistryBuilder.java:163)
	at org.hibernate.cfg.Configuration.configure(Configuration.java:258)
	at one.hibernate.demo.CreateStudentDemo.main(CreateStudentDemo.java:16)

can you help me please.thank’s


#2

Are you using Java 8 or later? Hibernate 5.2 requires at least Java 8.


#3

hi vlad, i’m using java 8 and hibernate 5.2.17 , but when i run my main classe i’ve this message error :

com.sun.xml.internal.stream.events.EntityReferenceEvent cannot be cast to javax.xml.stream.events.Characters.

i don’t know how proceeding

thank’s


#4

That’s strange indeed. Are you running that via the IDE or Maven?


#5

hi vlad , i’m workin on eclipse IDE, i’m just beginning, i found the error ,it’s located in the hibernate.cfg.xml , it is as follow:

<property name="connection.url">jdbc:mysql://localhost:3306/mydatabase?useLegacyDatetimeCode=false&serverTimezone=UTC&useSSL=false</property>

i’ve an xml syntax error, but i don’t know how resolving it.
for information i work on eclipse oxygen, java 8, and hibernate 5.2.17.
thank you


#6

Try this:

<property name="connection.url">jdbc:mysql://localhost:3306/mydatabase?useSSL=false</property>
<property name="connection.serverTimezone">UTC</property>
<property name="connection.useLegacyDatetimeCode">false</property>