[hibernate-issues] [Hibernate-JIRA] Created: (EJB-242) Eclipse RCP + InputStreamZippedJarVisitor problem

Michał Kostrzewa (JIRA) noreply at atlassian.com
Fri Oct 20 05:02:04 EDT 2006


Eclipse RCP + InputStreamZippedJarVisitor problem
-------------------------------------------------

         Key: EJB-242
         URL: http://opensource.atlassian.com/projects/hibernate/browse/EJB-242
     Project: Hibernate Entity Manager
        Type: Bug

  Components: EntityManager  
    Versions: 3.2.0.ga    
 Environment: Hibernate 3.2.0 GA, postgres (but I guess not relevant here)
    Reporter: Michał Kostrzewa


Hi, 

Max from user list kindly redirected me to fill a bug here. Here it goes as I described it on list. I didn't attached a test case b/c doing it is non-trivial, maybe you'll just know what is the problem and I provided a patch that works for me. But if test case is needed - I'll do it.

--------------

I'm having problems with bundling hibernate and my ejb model in eclipse RCP application. I managed to solve all classloading problems but one, related to InputStreamZippedJarVisitor class. 

Simplifying things I have: 

hibernate plugin which registers itself for buddy classloading policy 

dbmodel plugin which depends on hibernate and is a buddy of hibernate 

application plugin which depends on hibernate and dbmodel and is a buddy of hibernate. This application plugin has hibernate.cfg.xml in self. 


When I run this project from eclipse IDE, all is fine except the warning message in logs while creating EntityManager: 

2006-10-20 09:07:23 org.hibernate.ejb.packaging.InputStreamZippedJarVisitor doProcessElements 
WARNING: Unable to find file (ignored): bundleresource://101 
java.io.FileNotFoundException: C:\Documents and Settings\mkostrze\sv-head2\com.pentacomp.dbmodel (Access denied) 
   at java.io.FileInputStream.open(Native Method) 
   at java.io.FileInputStream.<init>(FileInputStream.java:106) 
   at org.eclipse.osgi.framework.util.SecureAction.getFileInputStream(SecureAction.java:99) 
   at org.eclipse.osgi.baseadaptor.bundlefile.FileBundleEntry.getInputStream(FileBundleEntry.java:50) 
   at org.eclipse.osgi.framework.internal.core.BundleURLConnection.connect(BundleURLConnection.java:53) 
   at org.eclipse.osgi.framework.internal.core.BundleURLConnection.getInputStream(BundleURLConnection.java:99) 
   at java.net.URL.openStream(URL.java:1007) 
   at org.hibernate.ejb.packaging.InputStreamZippedJarVisitor.doProcessElements(InputStreamZippedJarVisitor.java:33) 
   at org.hibernate.ejb.packaging.JarVisitor.getMatchingEntries(JarVisitor.java:215) 
   at org.hibernate.ejb.Ejb3Configuration.addMetadataFromVisitor(Ejb3Configuration.java:253) 
   at org.hibernate.ejb.Ejb3Configuration.configure(Ejb3Configuration.java:229) 
   at org.hibernate.ejb.HibernatePersistence.createEntityManagerFactory(HibernatePersistence.java:120) 
   at javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:51) 
   at com.pentacomp.dicom.viewer.ViewerContstants.createEntityManager(ViewerContstants.java:170) 
   at com.pentacomp.dicom.viewer.DicomViewerMainFrame$InitRepositoriesTask.call(DicomViewerMainFrame.java:146) 



I suppose hibernate tries to inspect the model jar for some reason, but in IDE this jar location is resolved to directory containing the plugin. 

But things get worse when I export the project into java webstart application. I'm getting NullPointerException instead of warning in the same place. I investigated the source and the problem is here: 


protected void doProcessElements() throws IOException { 
      JarInputStream jis; 
      try { 
         jis = new JarInputStream( jarUrl.openStream() ); 
      } 
    catch (IOException ze) { 
         log.warn( "Unable to find file (ignored): " + jarUrl, ze ); 
         return; 
      } 
 


The jarUrl is a bundleresource:// url which resolves to DirZipBundleEntry which in turn returns null in getInputStream(). Thus JarInputStream thows NPE. 

Here's what I've tried to solve this: 
- configure the dbmodel to be unpacked or packed after install 
- tried dbmodel with jar inside or with unpacked classes inside 
- set hibernate.archive.autodetection to 'none'. (I did it passing parameters map to createEntityManager method) 
- change the hibernate sources and replace IOException with Exception in doProcessElement method. This one worked 

I guess most likely I did something wrong to my deploy - any ideas please? But if not, perhaps such a change in code may make hibernate more robust (?) 


Hibernate version: 3.2.0 GA 


best regards, 
Michal Kostrzewa

-- 
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