[hibernate-issues] [Hibernate-JIRA] Commented: (HHH-2108) org.hibernate.MappingNotFoundException: file:

Darryl Miles (JIRA) noreply at atlassian.com
Fri Oct 27 07:31:05 EDT 2006


    [ http://opensource.atlassian.com/projects/hibernate/browse/HHH-2108?page=comments#action_24998 ] 

Darryl Miles commented on HHH-2108:
-----------------------------------

http://opensource.atlassian.com/projects/hibernate/browse/HHH-2154 Duplicated this bug.

A test case was provided within 48 hours of Max's request in Sep and now one month on this problem still exists can the team please give it some attention as 3.2.0 can't be used in any enviroment using the addCacheableFile() api.


My comments copied from HHH-2154:

Was about to file this bug too. I think this change by max broke it.

http://fisheye.jboss.org/browse/Hibernate/branches/Branch_3_2/Hibernate3/src/org/hibernate/cfg/Configuration.java?r=10154#l336

I think the logic should be ...
if ( doc == null) {
    if(xmlFile.exists()) {
      // SNIPPED
    } else {
        throw new MappingNotFoundException("file", xmlFile.toString());
    }
}


>  org.hibernate.MappingNotFoundException: file:
> ----------------------------------------------
>
>          Key: HHH-2108
>          URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-2108
>      Project: Hibernate3
>         Type: Bug

>   Components: core
>     Versions: 3.2.0.cr4
>  Environment: Hibernate 3.2.0cr4, SQL Server 2000
>     Reporter: Courtney Arnold
>  Attachments: Configuration.hbm.xml, Configuration.java, Configuration.java, ConfigurationTest.java, hibernate3.jar
>
> Original Estimate: 5 minutes
>         Remaining: 5 minutes
>
> I receive the following error while trying to add a cacheable configuration file to the configuration:
> org.hibernate.InvalidMappingException: Could not parse mapping document from file F:\products\common\resources\hibernate\hbm\org\waterford\product\data\db\hibernate\Product.hbm.xml
> 	at org.hibernate.cfg.Configuration.addCacheableFile(Configuration.java:359)
> 	at org.hibernate.cfg.Configuration.addCacheableFile(Configuration.java:364)
> 	at org.waterford.common.data.db.hibernate.HibernateDbBroker._addMappings(HibernateDbBroker.java:568)
> 	at org.waterford.common.data.db.hibernate.HibernateDbBroker._getConfiguration(HibernateDbBroker.java:477)
> 	at org.waterford.common.data.db.hibernate.HibernateDbBroker._initSessionFactory(HibernateDbBroker.java:668)
> 	at org.waterford.common.data.db.hibernate.HibernateDbBroker.setDb(HibernateDbBroker.java:189)
> 	at org.waterford.sm.db.smdbinterface.HibSmDbInterface.connect(HibSmDbInterface.java:426)
> 	at org.waterford.sm.db.smdbinterface.HibSmDbInterface.<init>(HibSmDbInterface.java:333)
> 	at org.waterford.sm.db.smdbinterface.factory.HibSmDbInterfaceFactory._getInstance(HibSmDbInterfaceFactory.java:51)
> 	at org.waterford.sm.db.smdbinterface.factory.HibSmDbInterfaceFactory.getInstance(HibSmDbInterfaceFactory.java:24)
> 	at org.waterford.sm.license.LicenseManager._getDbInterface(LicenseManager.java:48)
> 	at org.waterford.sm.license.LicenseManager.loadFromDB(LicenseManager.java:218)
> 	at org.waterford.sm.license.LicenseManager.init(LicenseManager.java:183)
> 	at org.waterford.sm.license.LicenseManager.initLicensing(LicenseManager.java:118)
> 	at org.waterford.sm.SMFrame.init(SMFrame.java:284)
> 	at org.waterford.sm.SMApp.<init>(SMApp.java:76)
> 	at org.waterford.sm.SMApp.main(SMApp.java:213)
> Caused by: org.hibernate.MappingNotFoundException: file: F:\products\common\resources\hibernate\hbm\org\waterford\product\data\db\hibernate\Product.hbm.xml not found
> 	at org.hibernate.cfg.Configuration.addCacheableFile(Configuration.java:349)
> 	... 16 more
> I have looked at the source for org.hibernate.cfg.Configuration(addCacheableFile) and the problem lies in the if /else statement around  line 348. Prior to this statement a cached configuration file was loaded into the "doc" object. So the if statement "if (doc == null && xmlFile.exists())" will return false. Doing so, execution continues on the else statement that executes "throw new MappingNotFoundException("file", xmlFile.toString());". Due to this, no cached files can be loaded into the configuration, only uncached files can be loaded. The else statement needs to be modified to be "else if (doc == null)".

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://opensource.atlassian.com/projects/hibernate/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira




More information about the hibernate-issues mailing list