-->
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.  [ 9 posts ] 
Author Message
 Post subject: Does Hibernate has some Expiary Date!!!?
PostPosted: Wed Sep 27, 2006 11:22 am 
Newbie

Joined: Fri Aug 25, 2006 6:53 am
Posts: 13
Hi,

I have been using hibernate for over a year now. Ihave developed an applicationusing Hibernate 3.0. I have deployed this application on Tomcat and left it there running. It worked fine till today (27th Septmeber 2006) afternoon. Basically it started giving me an exception as follows:

Caused by: org.hibernate.HibernateException: Could not parse configuration: /hib
ernate.cfg.xml

I could not understand the problem, and why it came out now!! I restarted tomcat several times, but still giave me the same exception. Thus I decided to compile the system again.

To my amazment neither on the development environment it wanted to work. It compiles fine, but when I run the web application it gave me the same EXACT exception.

I can not believe my eyes because untill this morning, the same application was working Just fine!!

I am connecting with Microsoft Sql Server 2000, but I also tried it with Microsoft Sql Server 2005 ... it did not work on both!!

Thanks for any replies.
Bormli

Please find the full exception trace below:

Code:
17:12:26,109 ERROR [STDERR] org.hibernate.HibernateException: Could not parse co
nfiguration: /hibernate.cfg.xml
        at org.hibernate.cfg.Configuration.doConfigure(Configuration.java:1376)
        at org.hibernate.cfg.Configuration.configure(Configuration.java:1310)
        at org.hibernate.cfg.Configuration.configure(Configuration.java:1296)
        at com.company.cvmanager.util.HibernateUtil.<clinit>(Unknown Source)
        at com.company.cvmanager.dao.DAOFactory.getSession(Unknown Source)
        at com.company.cvmanager.dao.DAOFactory.getAccountDAO(Unknown Source)
        at com.company.cvmanager.service.impl.BaseAccountService.findByUsernam
e(Unknown Source)
        at com.company.cvmanager.actions.LoginAction.getAccount(Unknown Source
)
        at com.company.cvmanager.actions.LoginAction.doLogin(Unknown Source)
        at com.company.cvmanager.actions.LoginAction.execute(Unknown Source)
        at org.apache.struts.action.RequestProcessor.processActionPerform(Reques
tProcessor.java:419)
        at org.apache.struts.action.RequestProcessor.process(RequestProcessor.ja
va:224)
        at org.apache.struts.action.ActionServlet.process(ActionServlet.java:119
6)
        at org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:432)

        at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:810)
        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Appl
icationFilterChain.java:252)
        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationF
ilterChain.java:173)
        at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFi
lter.java:81)
        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Appl
icationFilterChain.java:202)
        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationF
ilterChain.java:173)
        at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperV
alve.java:213)
        at org.apache.catalina.core.StandardContextValve.invoke(StandardContextV
alve.java:178)
        at org.jboss.web.tomcat.security.CustomPrincipalValve.invoke(CustomPrinc
ipalValve.java:39)
        at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(Securit
yAssociationValve.java:159)
        at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValv
e.java:59)
        at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.j
ava:126)
        at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.j
ava:105)
        at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineVal
ve.java:107)
        at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.jav
a:148)
        at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java
:856)
        at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.proce
ssConnection(Http11Protocol.java:744)
        at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpo
int.java:527)
        at org.apache.tomcat.util.net.MasterSlaveWorkerThread.run(MasterSlaveWor
kerThread.java:112)
        at java.lang.Thread.run(Thread.java:595)
Caused by: org.dom4j.DocumentException: Connection reset Nested exception: Conne
ction reset
        at org.dom4j.io.SAXReader.read(SAXReader.java:484)
        at org.hibernate.cfg.Configuration.doConfigure(Configuration.java:1366)
        ... 34 more
17:12:26,125 ERROR [[action]] Servlet.service() for servlet action threw excepti
on
java.lang.ExceptionInInitializerError
        at com.company.cvmanager.util.HibernateUtil.<clinit>(Unknown Source)
        at com.company.cvmanager.dao.DAOFactory.getSession(Unknown Source)
        at com.company.cvmanager.dao.DAOFactory.getAccountDAO(Unknown Source)
        at com.company.cvmanager.service.impl.BaseAccountService.findByUsernam
e(Unknown Source)
        at com.company.cvmanager.actions.LoginAction.getAccount(Unknown Source
)
        at com.company.cvmanager.actions.LoginAction.doLogin(Unknown Source)
        at com.company.cvmanager.actions.LoginAction.execute(Unknown Source)
        at org.apache.struts.action.RequestProcessor.processActionPerform(Reques
tProcessor.java:419)
        at org.apache.struts.action.RequestProcessor.process(RequestProcessor.ja
va:224)
        at org.apache.struts.action.ActionServlet.process(ActionServlet.java:119
6)
        at org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:432)

        at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:810)
        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Appl
icationFilterChain.java:252)
        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationF
ilterChain.java:173)
        at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFi
lter.java:81)
        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Appl
icationFilterChain.java:202)
        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationF
ilterChain.java:173)
        at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperV
alve.java:213)
        at org.apache.catalina.core.StandardContextValve.invoke(StandardContextV
alve.java:178)
        at org.jboss.web.tomcat.security.CustomPrincipalValve.invoke(CustomPrinc
ipalValve.java:39)
        at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(Securit
yAssociationValve.java:159)
        at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValv
e.java:59)
        at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.j
ava:126)
        at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.j
ava:105)
        at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineVal
ve.java:107)
        at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.jav
a:148)
        at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java
:856)
        at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.proce
ssConnection(Http11Protocol.java:744)
        at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpo
int.java:527)
        at org.apache.tomcat.util.net.MasterSlaveWorkerThread.run(MasterSlaveWor
kerThread.java:112)
        at java.lang.Thread.run(Thread.java:595)
Caused by: org.hibernate.HibernateException: Could not parse configuration: /hib
ernate.cfg.xml
        at org.hibernate.cfg.Configuration.doConfigure(Configuration.java:1376)
        at org.hibernate.cfg.Configuration.configure(Configuration.java:1310)
        at org.hibernate.cfg.Configuration.configure(Configuration.java:1296)
        ... 32 more
Caused by: org.dom4j.DocumentException: Connection reset Nested exception: Conne
ction reset
        at org.dom4j.io.SAXReader.read(SAXReader.java:484)
        at org.hibernate.cfg.Configuration.doConfigure(Configuration.java:1366)
        ... 34 more
17:13:11,296 INFO  [Log4jService$URLWatchTimerTask] Configuring from URL: resour
ce:log4j.xml
17:14:11,296 INFO  [Log4jService$URLWatchTimerTask] Configuring from URL: resour
ce:log4j.xml
17:15:11,296 INFO  [Log4jService$URLWatchTimerTask] Configuring from URL: resour
ce:log4j.xml


And this is my configuration file:

Code:
<?xml version='1.0' encoding='UTF-8'?>
<!DOCTYPE hibernate-configuration PUBLIC
          "-//Hibernate/Hibernate Configuration DTD 2.0//EN"
          "http://hibernate.sourceforge.net/hibernate-configuration-2.0.dtd">

<hibernate-configuration>
   <!-- a SessionFactory instance listed as /jndi/name -->
   <session-factory name="cvmgrSessionFactory">
   
   <!-- SQL Server (Local) Connection properties -->

   <property name="connection.driver_class">com.microsoft.jdbc.sqlserver.SQLServerDriver</property>
     <property name="connection.url">jdbc:microsoft:sqlserver://localhost:1433;databaseName=cvmgr</property>
     <property name="connection.username">cvmgr</property>
   <property name="connection.password">password</property>
   <property name="dialect">org.hibernate.dialect.SQLServerDialect</property>      
   <property name="show_sql">true</property>
   
   <!-- mapping files -->
   <mapping resource="com/company/cvmanager/common/impl/BaseAccount.hbm.xml"/>
   <mapping resource="com/company/cvmanager/common/impl/BaseResource.hbm.xml"/>
   <mapping resource="com/company/cvmanager/common/impl/BaseContact.hbm.xml"/>
   <mapping resource="com/company/cvmanager/common/impl/BaseAddress.hbm.xml"/>
   <mapping resource="com/company/cvmanager/common/impl/BaseEmployment.hbm.xml"/>
   <mapping resource="com/company/cvmanager/common/impl/BaseProject.hbm.xml"/>
   <mapping resource="com/company/cvmanager/common/impl/BaseSkillDefinition.hbm.xml"/>
   <mapping resource="com/company/cvmanager/common/impl/BaseSkill.hbm.xml"/>
   <mapping resource="com/company/cvmanager/common/impl/BaseAnnotation.hbm.xml"/>
   
</session-factory>
</hibernate-configuration>


And the following is my util class used to get the session:

Code:
package com.company.cvmanager.util;

import org.hibernate.SessionFactory;
import org.hibernate.cfg.Configuration;

/**
* Basic Hibernate helper class for Hibernate configuration and startup.
*
* @author Simon J. Aquilina
*
*/
public class HibernateUtil {

    private static Configuration configuration;
    private static SessionFactory sessionFactory;
   
    static {
       try {
          // Karl: Instantiating the configuration object
          configuration = new Configuration();
          
          // Configure ORM from the default configuration file.
          configuration.configure();
          
          // Create the session factory.
            sessionFactory = configuration.buildSessionFactory();
        } catch (Throwable ex) {
          ex.printStackTrace();
          throw new ExceptionInInitializerError(ex);
        }
    }
   
    /**
     * Returns the global SessionFactory.
     *
     * @return SessionFactory
     */
    public static SessionFactory getSessionFactory() {
       return sessionFactory;
    }
}



Top
 Profile  
 
 Post subject:
PostPosted: Wed Sep 27, 2006 11:36 am 
Hibernate Team
Hibernate Team

Joined: Mon Aug 25, 2003 9:11 pm
Posts: 4592
Location: Switzerland
Code:
<!DOCTYPE hibernate-configuration PUBLIC
          "-//Hibernate/Hibernate Configuration DTD 2.0//EN"
          "http://hibernate.sourceforge.net/hibernate-configuration-2.0.dtd">


This is the wrong DTD.


Top
 Profile  
 
 Post subject:
PostPosted: Thu Sep 28, 2006 3:19 am 
Newbie

Joined: Fri Aug 25, 2006 6:53 am
Posts: 13
So if it is wrong, why was it working and all of a sudden it is no longer working ... I did not change and library!

Please do not get me wrong, I will go and search and fix that out. I am only asking because I am a little confused on how all of a sudden that error came out.

Thank You for your help
bormli


Top
 Profile  
 
 Post subject: XDoclet Also?
PostPosted: Thu Sep 28, 2006 3:31 am 
Newbie

Joined: Fri Aug 25, 2006 6:53 am
Posts: 13
I have updated the DocType. Tried running XDoclet for my classes, and Iget this error for each class that should be persisted.

Code:
XJavaDoc Ignoring class com.sixpmodel.cvmanager.Global in C:\Java\cvmgr\src\java\com\sixpmodel\cvmanager\Global.java. It was generated (Thu Jun 22 16:30:58 CEST 2006) after XJavaDoc's timestamp was reset (Wed Sep 28 09:26:33 CEST 2005)


I really can't understand these errors! Please give me something to read to solve these problems (I really can not understand why everything burst out all of a sudden :( )

bormli


Top
 Profile  
 
 Post subject:
PostPosted: Thu Sep 28, 2006 10:59 am 
Newbie

Joined: Fri Aug 25, 2006 6:53 am
Posts: 13
I repeat .. all this code was working fine!!! Now I even tried to run an old version of my application using Hibernate and XDoclet. XDoclet gives me the same error mentioned above on all objects I have persistance on ... Thus I can not create a build to test!! ... I really can not understand how a peace of code that was not touched was previously working fine and now it is not! :( .. Please any help!? I am inclined to change all the code that needs changing if it means making the system work fine again! However do not know what needs changing .. I am thinking of going to annotaions!!

I am clueless on what happened and that is what is making me feel so bad about the whole issue!!

Regards,
bormli


Top
 Profile  
 
 Post subject:
PostPosted: Thu Sep 28, 2006 11:10 am 
Newbie

Joined: Wed Sep 27, 2006 1:15 pm
Posts: 10
would you double-check the presence of hibernate.cfg.xml?


Top
 Profile  
 
 Post subject:
PostPosted: Thu Sep 28, 2006 1:22 pm 
Regular
Regular

Joined: Tue Sep 26, 2006 11:37 am
Posts: 115
Location: Sacramento, CA
Maybe your system did not have outgoing internet connectivity and was not downloading + validating the DTD. Somebody fixed the routing or DNS on the system (default gateway) or on the LAN and now it gets outgoing connectivity. Some validating XML parser is downloading the DTD and it's not happy...

Just a wild guess :)

Marius


Top
 Profile  
 
 Post subject:
PostPosted: Fri Sep 29, 2006 2:44 am 
Newbie

Joined: Fri Aug 25, 2006 6:53 am
Posts: 13
So basically I have two problems.

Problem 1:
My application that was running on the server started to validate the dtd, I had a wrong dtd and thus it broke up!! (am I write?)

Problem 2:
XDoclet is no longer generating the *.hbm.xml for each my persisted objects and is giving me the error I mentioned in my previous post.

I can try to solve problem 1 by changing the dtd directly into my war file where I already have all the *.hbm.xml files in place!! .. not sure if this would work, but I will give it a try.

The second problem is stopping me from actually doing another build of my web application. I am seriously thinking to upgrade to hibernate version 3.2.0 Cr4 and use annotations .. does anyone think it is a bad idea?

Thanks for the info, at least, I am learning something from all this bad luck! :)

Regards and many thanks,
bormli


Top
 Profile  
 
 Post subject:
PostPosted: Sat Sep 30, 2006 5:04 am 
Newbie

Joined: Fri Aug 25, 2006 6:53 am
Posts: 13
Trying to change the dtd in the WAR file still did not work out :( and all my *.hbm.xml files have the correct dtd reference .. that is a dtd for version 3.0!! However I get an exception telling me that tag hibernate-mapping needs to be closed with a '>'!! believe me, all tags are properly closed :(

What should I do?


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 9 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.