?
Solved

Could not parse configuration: /hibernate.cfg.xml

Posted on 2010-01-11
16
Medium Priority
?
1,291 Views
Last Modified: 2012-05-08
Hi,
Could you help please!

This errors appearse when I try to connect to the database and try to create a session Factory,  any suggestion!

10/01/11 16:41:02 %%%% Error Creating SessionFactory %%%%
org.hibernate.HibernateException: Could not parse configuration: /hibernate.cfg.xml
        at org.hibernate.cfg.Configuration.doConfigure(Configuration.java:1500)
        at org.hibernate.cfg.Configuration.configure(Configuration.java:1434)
        at com.bancoazteca.srm.modelo.hibernate.HibernateSessionFactory.rebuildSessionFactory(HibernateSessionFactory.java:68)
        at com.bancoazteca.srm.modelo.hibernate.HibernateSessionFactory.getSession(HibernateSessionFactory.java:44)
        at com.bancoazteca.srm.modelo.dao.transaccion.Transaccion.obtenerConexionSrm(Transaccion.java:405)
        at com.bancoazteca.srm.arquitectura.business.LogonADNDelegate.buscaSucursalExistenciaS(LogonADNDelegate.java:370)
        at com.bancoazteca.srm.arquitectura.business.LogonADNDelegate.buscaExistenciaSucursal(LogonADNDelegate.java:352)
        at com.bancoazteca.srm.control.action.logueo.LogonADNAction.execute(LogonADNAction.java:79)
        at org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java:419)
        at org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:224)
        at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1194)
        at org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:432)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:763)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:856)
        at com.evermind.server.http.ResourceFilterChain.doFilter(ResourceFilterChain.java:64)
        at org.displaytag.filter.ResponseOverrideFilter.doFilter(ResponseOverrideFilter.java:125)
        at com.evermind.server.http.ServletRequestDispatcher.invoke(ServletRequestDispatcher.java:621)
        at com.evermind.server.http.ServletRequestDispatcher.forwardInternal(ServletRequestDispatcher.java:368)
        at com.evermind.server.http.HttpRequestHandler.doProcessRequest(HttpRequestHandler.java:866)
        at com.evermind.server.http.HttpRequestHandler.processRequest(HttpRequestHandler.java:448)
        at com.evermind.server.http.HttpRequestHandler.serveOneRequest(HttpRequestHandler.java:216)
        at com.evermind.server.http.HttpRequestHandler.run(HttpRequestHandler.java:117)
        at com.evermind.server.http.HttpRequestHandler.run(HttpRequestHandler.java:110)
        at oracle.oc4j.network.ServerSocketReadHandler$SafeRunnable.run(ServerSocketReadHandler.java:260)
        at com.evermind.util.ReleasableResourcePooledExecutor$MyWorker.run(ReleasableResourcePooledExecutor.java:303)
        at java.lang.Thread.run(Thread.java:595)
Caused by: org.dom4j.DocumentException:  Nested exception:
        at org.dom4j.io.SAXReader.read(SAXReader.java:484)
        at org.hibernate.cfg.Configuration.doConfigure(Configuration.java:1490)
0
Comment
Question by:osmendez
  • 4
  • 4
  • 2
  • +3
14 Comments
 
LVL 20

Expert Comment

by:a_b
ID: 26290196
"Caused by: org.dom4j.DocumentException:  Nested exception:
        at org.dom4j.io.SAXReader.read(SAXReader.java:484)"

Seems like the cfg file is not correctly formatted. Please post the file.
0
 
LVL 20

Expert Comment

by:Sathish David Kumar N
ID: 26290516
is this
<?xml version='1.0' encoding='utf-8'?>
appere in 1st line of ur xml file ???

Please post the code !!


0
 
LVL 86

Expert Comment

by:CEHJ
ID: 26291281
Try validating your config file

http://validator.w3.org/
0
Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

 
LVL 12

Expert Comment

by:Gibu George
ID: 26292529
If possible please post your hibernate.cf.xml
0
 

Author Comment

by:osmendez
ID: 26294598
Sure my xml file is this


<?xml version='1.0' encoding='UTF-8'?>
<!DOCTYPE hibernate-configuration PUBLIC
          "-//Hibernate/Hibernate Configuration DTD 3.0//EN"
          "http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd">
<hibernate-configuration>
 <session-factory>
 
 <property name="connection.username">user</property>

  <property name="connection.url">jdbc:oracle:thin:@Server:1521:ORCL</property>
  <property name="dialect">org.hibernate.dialect.Oracle9Dialect</property>
  <property name="myeclipse.connection.profile">Oracle</property>
  <property name="connection.password">passwd</property>
  <property name="connection.driver_class">oracle.jdbc.driver.OracleDriver</property>
 
 
  <property name="connection.autocommit">false</property>
  <property name="connection.provider_class">org.hibernate.connection.C3P0ConnectionProvider</property>
  <property name="hibernate.c3p0.idle_connection_test_period">60</property>
  <property name="hibernate.c3p0.automatic_test_table">test_table</property>
  <property name="hibernate.c3p0.validate">true</property>
  <property name="hibernate.c3p0.propertyCycle">2</property>
  <property name="hibernate.c3p0.preferredTestQuery">select 1;</property>
  <property name="hibernate.c3p0.max_statements">100</property>
  <property name="hibernate.c3p0.max_size">200</property>
  <property name="hibernate.c3p0.min_size">15</property>
  <property name="hibernate.c3p0.maxConnectionAge">60</property>
  <property name="hibernate.c3p0.maxIdleTime">60</property>
  <property name="hibernate.c3p0.timeout">360</property>
  <property name="hibernate.c3p0.idle_test_period">180</property>
  <property name="hibernate.c3p0.acquire_increment">1</property>

 
 
 </session-factory>
</hibernate-configuration>
0
 
LVL 20

Expert Comment

by:Sathish David Kumar N
ID: 26295247
<property name="connection.username">'

dont use conection infront the name filed.. its predefinded one
<property name="username"> use like this for other flied also
0
 

Author Comment

by:osmendez
ID: 26295778
I have used this xml for 5 months, this error ocurred yestarday I don't undertand wich is the reason,  I'll try with your suggetion
0
 
LVL 86

Expert Comment

by:CEHJ
ID: 26295809
>>, this error ocurred yestarday

What changes have occurred recently?
0
 
LVL 20

Expert Comment

by:Sathish David Kumar N
ID: 26295862
<property name="hibernate.c3p0.preferredTestQuery">select 1;</property>

; is coming after the value check????????/
0
 

Author Comment

by:osmendez
ID: 26296905
I did not  any change, and this line <property name="hibernate.c3p0.preferredTestQuery">select 1;</property>
was in an example.  I don't know its funcionality
0
 
LVL 20

Expert Comment

by:a_b
ID: 26300304
By any chance have the hibernate jars been changed or upgraded?
0
 
LVL 20

Expert Comment

by:Sathish David Kumar N
ID: 26304275
Have u check that remove connection ??? in ur propert filed!!

0
 
LVL 11

Accepted Solution

by:
anilallewar earned 1000 total points
ID: 26311381
The TestQuery "Select 1;" is incorrect as you have not provided either a valid schema name or dual. Can you change it to the below and check? I really don't see that should cause a parsing error but give it a try nonetheless.

<property name="hibernate.c3p0.preferredTestQuery">select 1 from dual;</property>
0
 

Author Comment

by:osmendez
ID: 26346448
I can't understand why ocurred that error just one time. I think that  <property name="hibernate.c3p0.preferredTestQuery">select 1 from dual;</property> don't resolve my doubt because it just be a parameter, and the error it would be other, thanks four your help
0

Featured Post

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction This article is the last of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article covers our test design approach and then goes through a simple test case example, how …
In this post we will learn how to connect and configure Android Device (Smartphone etc.) with Android Studio. After that we will run a simple Hello World Program.
Video by: Michael
Viewers learn about how to reduce the potential repetitiveness of coding in main by developing methods to perform specific tasks for their program. Additionally, objects are introduced for the purpose of learning how to call methods in Java. Define …
Viewers will learn about arithmetic and Boolean expressions in Java and the logical operators used to create Boolean expressions. We will cover the symbols used for arithmetic expressions and define each logical operator and how to use them in Boole…
Suggested Courses
Course of the Month12 days, 21 hours left to enroll

579 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question