Hello folks.
I have an J2EE application that uses JPA through hibernate to access to the database, directly, without a J2EE server. The application works fine when its running on the development enviroment. We deploy the application with java web start (jws), and here comes the problem. When its started from a remote workstation, the application stands frozen 2 minutes until it starts. Looking at the jws console i see that get frozens here:
...
XXX INFO Environment:627 - using JDK 1.4 java.sql.Timestamp handling
XXX INFO Version:14 - Hibernate Commons Annotations 3.1.0.GA
XXX INFO Version:16 - Hibernate EntityManager 3.4.0.GA
< frozen HERE....
XXX INFO AnnotationBinder:419 - Binding entity from annotated class: fac.vta.MovimientoEdicion
...
I have used the tcpdump tool, and i see that the application each time its started downloads AGAIN all our EJB jar files from the web server (they were downloaded the first time we started the application with jws). I did a debug and i see that they are downloaded when the function "doProcessElements" of org.hibernate.ejb.packaging.InputStreamZippedJarVisitor is executed, at this line:
jis = new JarInputStream( jarUrl.openStream() );
Here is my explanation: When you use jws, to this function arrives a jarUrl of this kind: "http://foobar.com/hello/file.jar". This URL was filtered by JarVisitorFactory.getJarURLFromURLEntry class. Initially it was "jar:http//foobar.com/hello/file.jar!/". When you get a url.openConnection() of a "jar:http//foobar.com/hello/file.jar!/" URL, its handled by jws and returns a jws internal CachedJarURLConnection to the locally downloaded JAR, but if you do the url.openConnection() from a "http://foobar.com/hello/file.jar", it returns a HttpURLConnection, and the JAR is downloaded again...
The natural solution should be change to
if( url.startsWith("http:") ) {
URL urlJarCheck = new URL("jar:" + url + "!/");
jis = new JarInputStream( urlJarCheck.openConnection() );
}
but this don't work due to jws sucks. It throws a "no entry name specified" IOException. It seem cannot return a InputStream of the whole jar file at any way i have tried.
The only way i have found to make it work is the one I have put on the attachment.
I have not tested it with the core v3.5.0, but i have checked the code and it seems having the same problem.
If this a good solution you should pay me a beer. lol.
Ubuntu 9.10 / Hibernate Annotations 3.4.0.GA / Hibernate 3.3.1.GA / Hibernate Commons Annotations 3.1.0.GA / Hibernate EntityManager 3.4.0.GA / mysql Ver 14.14 Distrib 5.1.37, for debian-linux-gnu (x86_64) / Java(TM) SE Runtime Environment (build 1.6.0_17-b04)
SORRY. Where it says J2EE, must be J2SE. The application is J2SE, not using J2EE server...
In an effort to clean up, in bulk, tickets that are most likely out of date, we're transitioning all ORM 3 tickets to an "Awaiting Test Case" state. Please see http://in.relation.to/Bloggers/HibernateORMJIRAPoliciesAndCleanUpTactics for more information.
If this is still a legitimate bug in ORM 4, please provide either a test case that reproduces it or enough detail (entities, mappings, snippets, etc.) to show that it still fails on 4. If nothing is received within 3 months or so, we'll be automatically closing them.
Thank you!
Bulk rejecting stale issues. If this is still a legitimate issue on ORM 4, feel free to comment and attach a test case. I'll address responses case-by-case. Thanks!