-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 4 posts ] 
Author Message
 Post subject: could not parse config hibernate.cfg.xml
PostPosted: Sat Mar 10, 2012 8:47 am 
Newbie

Joined: Mon Mar 05, 2012 10:28 am
Posts: 3
hi i am new in hibernate and manage to setup hibernate with eclipse by using hibernate version 3.3.2GA but my problem is when i go offline i get this error

Initial SessionFactory creation failed.org.hibernate.HibernateException: Could not parse configuration: /hibernate.cfg.xml

i google up and heard that it is trying to get dtd online...now i try to google abt setting hibernate to read locally dtd...i saw few result and still confuese what should i do..can anyone kind enough to help me out in this?

my hibernateUtil.java i am using

Code:
import org.hibernate.SessionFactory;
import org.hibernate.cfg.AnnotationConfiguration;

public class HibernateUtil {
   
    private static final SessionFactory sessionFactory = buildSessionFactory();

    private static SessionFactory buildSessionFactory() {
        try {
            // Create the SessionFactory from hibernate.cfg.xml
            return new AnnotationConfiguration().configure().buildSessionFactory();

        }
        catch (Throwable ex) {
            // Make sure you log the exception, as it might be swallowed
            System.err.println("Initial SessionFactory creation failed." + ex);
            throw new ExceptionInInitializerError(ex);
        }
    }

    public static SessionFactory getSessionFactory() {
        return sessionFactory;
    }

    public static void shutdown() {
       // Close caches and connection pools
       getSessionFactory().close();
    }

}


Top
 Profile  
 
 Post subject: Re: could not parse config hibernate.cfg.xml
PostPosted: Mon Mar 12, 2012 3:19 am 
Expert
Expert

Joined: Tue Jun 16, 2009 3:36 am
Posts: 990
Is your hibernate.cfg.xml reachable from your classpath?
Can you reports the content of you hibernate.cfg.xml


Top
 Profile  
 
 Post subject: Re: could not parse config hibernate.cfg.xml
PostPosted: Thu Apr 26, 2012 4:49 am 
Newbie

Joined: Mon Mar 05, 2012 10:28 am
Posts: 3
pb00067 wrote:
Is your hibernate.cfg.xml reachable from your classpath?
Can you reports the content of you hibernate.cfg.xml


sorry for the long reply but i do still need help regarding this part cause i am abit worry that when the day i need to present my project i requires internet which i hope i have and also hope jboss is not in maintenance mode as well..btw here is my xml file code

Code:
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE hibernate-configuration PUBLIC
"-//Hibernate/Hibernate Configuration DTD 3.0//EN"
"http://www.hibernate.org/dtd/hibernate-configuration-3.0.dtd">
<hibernate-configuration>
<session-factory>
  <!-- Database connection settings -->
  <property name="connection.driver_class">com.mysql.jdbc.Driver</property>
  <property name="connection.url">jdbc:mysql://localhost:3306/global_data</property>
  <property name="connection.username">root</property>
  <property name="connection.password">pass</property>
   
  <!-- JDBC connection pool (use the built-in) -->
  <property name="connection.pool_size">1</property>
   
  <!-- SQL dialect -->
  <property name="dialect">org.hibernate.dialect.MySQLDialect</property>
   
  <!-- Enable Hibernate's automatic session context management -->
  <property name="current_session_context_class">thread</property>

  <!-- Disable the second-level cache -->
  <property name="cache.provider_class">org.hibernate.cache.NoCacheProvider</property>
   
  <!-- Echo all executed SQL to stdout -->
  <property name="show_sql">true</property>
   
  <!-- Drop and re-create the database schema on startup -->
  <property name="hbm2ddl.auto">update</property>
   
   <mapping class="Doctors"></mapping>
</session-factory>
</hibernate-configuration>


i am using eclipse IDE and setting them up with the hibernate lib by using the build path and import my user lib that is from hibernate lib..so is there anyway to load them offline? when jboss is down for maintenance few weeks ago i still have that problem


Top
 Profile  
 
 Post subject: Re: could not parse config hibernate.cfg.xml
PostPosted: Tue May 01, 2012 5:59 am 
Newbie

Joined: Mon Mar 05, 2012 10:28 am
Posts: 3
erm any help regarding this issue?


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 4 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.