Eclipselink with Java Web Start [message #389402] |
Wed, 03 June 2009 17:43  |
Eclipse User |
|
|
|
Hi
I've created application that uses Eclipselink for persistence and Java
Web Start for installation and updates. Application works "normally" when
I'm online, but when I'm offline and I start the application from Java
Cache Viewer with "Run Offline" it breaks with following exception.
When online, application hangs for few minutes on
javax.persistence.Persistence.createEntityManagerFactory("").createEntityManager()
while downloading something, than continues normally.
Application: http://www.pro3x.com/jws/launch.jnlp
Source code: http://www.pro3x.com/jws/src.zip
Please help. Thank you.
- - - - - -
Local Exception Stack:
Exception [EclipseLink-30005] (Eclipse Persistence Services -
1.1.1.v20090430-r4097):
org.eclipse.persistence.exceptions.PersistenceUnitLoadingExc eption
Exception Description: An exception was thrown while searching for
persistence archives with ClassLoader: com.sun.jnlp.JNLPClassLoader@6f7ce9
Internal Exception: Exception [EclipseLink-30004] (Eclipse Persistence
Services - 1.1.1.v20090430-r4097):
org.eclipse.persistence.exceptions.PersistenceUnitLoadingExc eption
Exception Description: An exception was thrown while processing
persistence.xml from URL: http://www.pro3x.com/jws/pro3.jar
Internal Exception: java.net.MalformedURLException
at
org.eclipse.persistence.exceptions.PersistenceUnitLoadingExc eption.exceptionSearchingForPersistenceResources(Persistence UnitLoadingException.java:121)
at
org.eclipse.persistence.jpa.PersistenceProvider.createEntity ManagerFactory(PersistenceProvider.java:133)
at
org.eclipse.persistence.jpa.PersistenceProvider.createEntity ManagerFactory(PersistenceProvider.java:67)
at
javax.persistence.Persistence.createEntityManagerFactory(Per sistence.java:123)
at
javax.persistence.Persistence.createEntityManagerFactory(Per sistence.java:99)
at Acosoft.Processing.PregledRacuna.initComponents(PregledRacun a.java:64)
at Acosoft.Processing.PregledRacuna.<init>(PregledRacuna.java:45)
at Acosoft.Processing.Pro3View.OtvoriStorniranjeRacuna(Pro3View .java:673)
at Acosoft.Processing.Pro3View.access$2400(Pro3View.java:41)
at Acosoft.Processing.Pro3View$19.actionPerformed(Pro3View.java :483)
at javax.swing.AbstractButton.fireActionPerformed(Unknown Source)
at javax.swing.AbstractButton$Handler.actionPerformed(Unknown Source)
at javax.swing.DefaultButtonModel.fireActionPerformed(Unknown Source)
at javax.swing.DefaultButtonModel.setPressed(Unknown Source)
at javax.swing.AbstractButton.doClick(Unknown Source)
at javax.swing.plaf.basic.BasicMenuItemUI.doClick(Unknown Source)
at javax.swing.plaf.basic.BasicMenuItemUI$Handler.mouseReleased (Unknown
Source)
at java.awt.Component.processMouseEvent(Unknown Source)
at javax.swing.JComponent.processMouseEvent(Unknown Source)
at java.awt.Component.processEvent(Unknown Source)
at java.awt.Container.processEvent(Unknown Source)
at java.awt.Component.dispatchEventImpl(Unknown Source)
at java.awt.Container.dispatchEventImpl(Unknown Source)
at java.awt.Component.dispatchEvent(Unknown Source)
at java.awt.LightweightDispatcher.retargetMouseEvent(Unknown Source)
at java.awt.LightweightDispatcher.processMouseEvent(Unknown Source)
at java.awt.LightweightDispatcher.dispatchEvent(Unknown Source)
at java.awt.Container.dispatchEventImpl(Unknown Source)
at java.awt.Window.dispatchEventImpl(Unknown Source)
at java.awt.Component.dispatchEvent(Unknown Source)
at java.awt.EventQueue.dispatchEvent(Unknown Source)
at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)
at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.run(Unknown Source)
Caused by: Exception [EclipseLink-30004] (Eclipse Persistence Services -
1.1.1.v20090430-r4097):
org.eclipse.persistence.exceptions.PersistenceUnitLoadingExc eption
Exception Description: An exception was thrown while processing
persistence.xml from URL: http://www.pro3x.com/jws/pro3.jar
Internal Exception: java.net.MalformedURLException
at
org.eclipse.persistence.exceptions.PersistenceUnitLoadingExc eption.exceptionProcessingPersistenceXML(PersistenceUnitLoad ingException.java:112)
at
org.eclipse.persistence.internal.jpa.deployment.PersistenceU nitProcessor.processPersistenceXML(PersistenceUnitProcessor. java:357)
at
org.eclipse.persistence.internal.jpa.deployment.PersistenceU nitProcessor.processPersistenceArchive(PersistenceUnitProces sor.java:314)
at
org.eclipse.persistence.internal.jpa.deployment.PersistenceU nitProcessor.getPersistenceUnits(PersistenceUnitProcessor.ja va:237)
at
org.eclipse.persistence.internal.jpa.deployment.JPAInitializ er.initPersistenceUnits(JPAInitializer.java:155)
at
org.eclipse.persistence.internal.jpa.deployment.JPAInitializ er.initialize(JPAInitializer.java:144)
at
org.eclipse.persistence.jpa.PersistenceProvider.createEntity ManagerFactory(PersistenceProvider.java:105)
... 35 more
Caused by: java.net.MalformedURLException
at java.net.URL.<init>(Unknown Source)
at java.net.URL.<init>(Unknown Source)
at java.net.URL.<init>(Unknown Source)
at
com.sun.org.apache.xerces.internal.impl.XMLEntityManager.set upCurrentEntity(Unknown
Source)
at
com.sun.org.apache.xerces.internal.impl.XMLVersionDetector.d etermineDocVersion(Unknown
Source)
at
com.sun.org.apache.xerces.internal.parsers.XML11Configuratio n.parse(Unknown
Source)
at
com.sun.org.apache.xerces.internal.parsers.XML11Configuratio n.parse(Unknown
Source)
at com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(U nknown
Source)
at
com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser .parse(Unknown
Source)
at
com.sun.org.apache.xerces.internal.jaxp.SAXParserImpl$JAXPSA XParser.parse(Unknown
Source)
at
org.eclipse.persistence.internal.jpa.deployment.PersistenceU nitProcessor.processPersistenceXML(PersistenceUnitProcessor. java:355)
... 40 more
|
|
|
|
Re: Eclipselink with Java Web Start [message #389459 is a reply to message #389425] |
Thu, 11 June 2009 12:24  |
Eclipse User |
|
|
|
Hello. Thank you for your reply.
I have located cause of my problems. The function in URLArchive class (see
below) causes redownload of jar file that contains persistence.xml file.
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
public InputStream getEntry(String entryPath) throws IOException
{
URL subEntry = new URL(url, entryPath);
InputStream is = null; stari kod
try {
is = subEntry.openStream();
} catch (IOException ioe) {
// we return null when entry does not exist
}
return is;
}
Since I have only one persistence.xml file I replaced function with
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
public InputStream getEntry(String entryPath) throws IOException
{
InputStream is = Thread.currentThread()
.getContextClassLoader().getResourceAsStream(entryPath);
return is;
}
I've changed AchiveFactoryImpl function to use only URLArchive class.
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
public Archive createArchive(URL url) throws URISyntaxException,
IOException {
logger.entering("ArchiveFactoryImpl", "createArchive", new
Object[]{url});
Archive result = null;
String protocol = url.getProtocol();
logger.logp(Level.FINER, "ArchiveFactoryImpl", "createArchive",
"protocol = {0}", protocol);
// if ("file".equals(protocol)) {
// URI uri = Helper.toURI(url);
//
// File f;
// try {
// // Attempt to create the file with the uri. The
pre-conditions
// // are checked in the constructor and an exception is
thrown
// // if the uri does not meet them.
// f = new File(uri);
// } catch (IllegalArgumentException e) {
// // Invalid uri for File. Go our back up route of using
the
// // path from the url.
// f = new File(url.getPath());
// }
//
// if (f.isDirectory()) {
// // e.g. file:/tmp/a_ear/ejb_jar
// result = new DirectoryArchive(f);
// } else {
// // e.g. file:/tmp/a_ear/lib/pu.jar
// // It's not a directory. Then it must be a jar file.
// result = new JarFileArchive(new JarFile(f));
// }
// } else if ("jar".equals(protocol)) { // NOI18N
// JarURLConnection conn =
JarURLConnection.class.cast(url.openConnection());
// JarEntry je = conn.getJarEntry();
// if (je == null) {
// // e.g. jar:file:/tmp/a_ear/lib/pu.jar!/
// // No entryName specified, hence URL points to a JAR
file and
// // not to any entry inside it. Ideally this should have
been
// // file:/tmp/a_ear/lib/pu.jar,
// // but containers (e.g.) WebLogic return this kind of
URL,
// // so we better handle this in our code to imrove
pluggability.
// // Read the entire jar file.
// result = new JarFileArchive(conn.getJarFile());
// } else if (je.isDirectory()) {
// // e.g. jar:file:/tmp/a_ear/b.war!/WEB-INF/classes/
// // entryName [je.getName()] is a directory
// result = new DirectoryInsideJarURLArchive(url);
// } else {
// // some URL (e.g.)
jar:file:/tmp/a_ear/b.war!/WEB-INF/lib/pu.jar
// // entryName [je.getName()] is a file, so treat this URL
as a
// // URL from which a JAR format InputStream can be
obtained.
// result = new JarInputStreamURLArchive(url);
// }
// } else if (isJarInputStream(url) || false){
// result = new JarInputStreamURLArchive(url);
// } else {
// result = new URLArchive(url);
// }
result = new URLArchive(url);
logger.exiting("ArchiveFactoryImpl", "createArchive", result);
return result;
}
This is just a dirty hack until this is solved. I'dont use Eclipse and
Maven, so I used bundled sources with dependent jar files and compiled it
with Netbeans.
The problem can only be traced in "http://" deployment, because in
"file://" deployment it works fast because it reads local file system.
Should I report this as a bug? I think that the problem is only in Java
1.6 version because of the changes to getResources (I found some post on
the forums that talked about this). I didn't test my application with Java
1.5 so I can't confirm this.
Thank you. Bye.
|
|
|
Powered by
FUDForum. Page generated in 0.03783 seconds