-->
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.  [ 5 posts ] 
Author Message
 Post subject: Eclipse RCP + InputStreamZippedJarVisitor problem
PostPosted: Fri Oct 20, 2006 3:41 am 
Newbie

Joined: Fri Oct 20, 2006 3:12 am
Posts: 2
Hi List!

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:

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

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


Top
 Profile  
 
 Post subject:
PostPosted: Fri Oct 20, 2006 3:54 am 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 6:10 am
Posts: 8615
Location: Neuchatel, Switzerland (Danish)
make sure you are using the latest versions and if it still fails report it to the hibernate annotations project. This should not fail (at least not with an exception)

_________________
Max
Don't forget to rate


Top
 Profile  
 
 Post subject:
PostPosted: Fri Oct 20, 2006 4:15 am 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 6:10 am
Posts: 8615
Location: Neuchatel, Switzerland (Danish)
make sure you are using the latest versions and if it still fails report it to the hibernate annotations project. This should not fail (at least not with an exception)

_________________
Max
Don't forget to rate


Top
 Profile  
 
 Post subject:
PostPosted: Fri Oct 20, 2006 4:49 am 
Newbie

Joined: Fri Oct 20, 2006 3:12 am
Posts: 2
Thank you for your reply

I'm using 3.2.0 GA, did you want me to try the head? (but 3.2.0 seems to be quite fresh). Also the change I did was to 3.2.0 GA and it still throws NPE in the place I shown, but after the fix it doesn't fail on it.

Also - sorry for asking - are you sure that it's a potential annotations bug? (not entitymanager related one?)

thank you again,
best regards,
Michal Kostrzewa


Top
 Profile  
 
 Post subject:
PostPosted: Fri Oct 20, 2006 4:51 am 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 6:10 am
Posts: 8615
Location: Neuchatel, Switzerland (Danish)
3.2 is ok.

and yes, entitymanager is the proper place - sorry fro that.

_________________
Max
Don't forget to rate


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