]
Toni Bennasar Obrador commented on HHH-5066:
--------------------------------------------
SORRY. Where it says J2EE, must be J2SE. The application is J2SE, not using J2EE
server...
EJB JARs are always re-downloaded on a J2EE application using Java
Web Start
----------------------------------------------------------------------------
Key: HHH-5066
URL:
http://opensource.atlassian.com/projects/hibernate/browse/HHH-5066
Project: Hibernate Core
Issue Type: Bug
Affects Versions: 3.3.1
Environment: 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)
Reporter: Toni Bennasar Obrador
Attachments: InputStreamZippedJarVisitor.java
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.
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: