-->
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.  [ 1 post ] 
Author Message
 Post subject: Problem with auto discovery of orm.xml file
PostPosted: Mon Oct 15, 2007 11:06 am 
Newbie

Joined: Fri Oct 12, 2007 5:18 pm
Posts: 10
Hi,

I have a problem with the auto discovery of the orm.xml file. I'm running Glassfish v2 in a Windows environment. When I deploy my application as an exploded EAR, the org.hibernate.ejb.EJB3Configuration class cannot find the orm.xml in the META-INF directory of my EJB module. Looking at the code in EJB3Configuration, we can find the following:

Code:
private void scanForXmlFiles(URL jar, List<NamedInputStream> hbmxmls, final XML_SEARCH searchType) {
      if (searchType == XML_SEARCH.NONE) return;
      if (jar == null) log.error( "Container is providing a null PersistenceUnitRootUrl: discovery impossible");
      final boolean searchforORMFiles = searchType == XML_SEARCH.BOTH || searchType == XML_SEARCH.ORM_XML;
      final boolean searchforHBMFiles = searchType == XML_SEARCH.BOTH || searchType == XML_SEARCH.HBM;
      Iterator it = ArchiveBrowser.getBrowser(
            jar, new ArchiveBrowser.Filter() {
         public boolean accept(String filename) {
            return (searchforHBMFiles && filename.endsWith( ".hbm.xml" ) )
                  || (searchforORMFiles && filename.endsWith( META_INF_ORM_XML ) )
                  ;
         }
      }
      );

      while ( it.hasNext() ) {
         InputStream stream = (InputStream) it.next();
         hbmxmls.add( new NamedInputStream("", stream) );
      }
   }


In the anonymous implementation of the Archive.Filter class, we see that the file name has to end with "META-INF/orm.xml" (value of the META_INF_ORM_XML constant). In a Windows environment and when the ArchiveBrowser is an instance of the DirectoryArchiveBrowser, the file name is an absolute file path that uses the Windows path seperator (ex: C:\path\to\application\ejb3module\META-INF\orm.xml). Hence, the file isn't found even though it's there.

Does anyone know of a work around for this problem? Should the EJB3Configuration class be modified to handle this particular scenario or is this something the DirectoryArcrhiveBrowser should take care of (in which case I will redirect my query to the appropriate forum)?

Thanks for your help.


JBoss Common Core: 2.2.1 SNAPSHOT
Hibernate Core version: 3.2.5
Hibernate Entity Manager version: 3.3.1
Hibernate Annotations version: 3.3.0


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

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.