0

I'm trying to build an example from hibernate tutorial from http://docs.jboss.org/hibernate/orm/3.3/reference/en/html/tutorial.html using maven, and I get the following errors:

java.lang.reflect.InvocationTargetException
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:601)
at org.codehaus.mojo.exec.ExecJavaMojo$1.run(ExecJavaMojo.java:297)
at java.lang.Thread.run(Thread.java:722)
 Caused by: java.lang.ExceptionInInitializerError
at org.hibernate.tutorial.util.HibernateUtil.buildSessionFactory(HibernateUtil.java:18)
at org.hibernate.tutorial.util.HibernateUtil.<clinit>(HibernateUtil.java:8)
at org.hibernate.tutorial.EventManager.createAndStoreEvent(EventManager.java:23)
at org.hibernate.tutorial.EventManager.main(EventManager.java:16)
... 6 more
 Caused by: org.hibernate.HibernateException: Could not parse configuration: /hibernate.cfg.xml
at org.hibernate.cfg.Configuration.doConfigure(Configuration.java:2014)
at org.hibernate.cfg.Configuration.configure(Configuration.java:1926)
at org.hibernate.cfg.Configuration.configure(Configuration.java:1905)
at org.hibernate.tutorial.util.HibernateUtil.buildSessionFactory(HibernateUtil.java:13)
... 9 more
  Caused by: org.dom4j.DocumentException: http://hibernate.sourceforge.net/hibernate-configuration-%0A3.0.dtd Nested exception: http://hibernate.sourceforge.net/hibernate-configuration-%0A3.0.dtd
at org.dom4j.io.SAXReader.read(SAXReader.java:484)
at org.hibernate.cfg.Configuration.doConfigure(Configuration.java:2006)
... 12 more

I replaced "http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd" to "http://www.hibernate.org/dtd/hibernate-configuration-3.0.dtd" in my hibernate.cfg.xml but it still doesn't work.

1 Answer 1

1

I think you have a linefeed (return at the line end) in the URL. Did you remark the %0A (that is the acsii code for line feed) in the String .../hibernate-configuration-%0A3.0.dtd ?

Sign up to request clarification or add additional context in comments.

1 Comment

no, I think the problem lies outside of my hibernate.cfg.xml because the same exception occurs no matter what the content of hibernate.cfg.xml is(I can even remove all the content an still the sam error).

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.