JavaFX native bundle exe is throwing "JavaFx launcher Exception" where as Executable Jar file is perfectly running - deployment

For long time I was facing an issue while running the application jar -
I am obfuscating the JAR using Proguard and that JAR file also contains some resource files like images, .version file, etc along with publicCerts.store file.
So to include resource file into final JAR I had specified all the resource files as
-adaptresourcefilecontents **.fxml,**.properties,META-INF/MANIFEST.MF,images/*.jar,*.version,publicCerts.store
but while running my application JAR I was getting execption -
Exception in Application start method
java.lang.reflect.InvocationTargetException
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at com.javafx.main.Main.a(Main.java:642)
at com.javafx.main.Main.main(Main.java:805)
Caused by: java.lang.RuntimeException: Exception in Application start method
at com.sun.javafx.application.LauncherImpl.launchApplication1(LauncherIm
pl.java:403)
at com.sun.javafx.application.LauncherImpl.access$000(LauncherImpl.java:
47)
at com.sun.javafx.application.LauncherImpl$1.run(LauncherImpl.java:115)
at java.lang.Thread.run(Unknown Source)
Caused by: java.lang.AssertionError: java.security.KeyStoreException: Uninitiali
zed keystore
at de.schlichtherle.license.LicenseNotary.getPublicKey(Unknown Source)
at de.schlichtherle.license.LicenseNotary.verify(Unknown Source)
at de.schlichtherle.license.LicenseManager.verify(Unknown Source)
at de.schlichtherle.license.LicenseManager.verify(Unknown Source)
at com.sun.javafx.application.LauncherImpl$5.run(LauncherImpl.java:319)
at com.sun.javafx.application.PlatformImpl$5.run(PlatformImpl.java:206)
at com.sun.javafx.application.PlatformImpl$4.run(PlatformImpl.java:173)
at com.sun.glass.ui.win.WinApplication._runLoop(Native Method)
at com.sun.glass.ui.win.WinApplication.access$100(WinApplication.java:29
)
at com.sun.glass.ui.win.WinApplication$3$1.run(WinApplication.java:73)
... 1 more
Caused by: java.security.KeyStoreException: Uninitialized keystore
at java.security.KeyStore.isKeyEntry(Unknown Source)
... 17 more
I thought the obfuscation corrupting the publicCerts.store so use another obfuscation option for publicCerts.store
-adaptresourcefilenames publicCerts.store
-adaptresourcefilecontents **.fxml,**.properties,META-INF/MANIFEST.MF,images/*.jar,.version
and it works. When I used to double click on by application jar it is showing my application window but now the native bundle executable (exe) is showing me this dialog in the same case at the same condition.
Edited -
I have debugged the issue and found that it's throwing exception -
java.lang.AssertionError: java.security.NoSuchAlgorithmException: PBEWithMD5AndDES SecretKeyFactory not available java.security.NoSuchAlgorithmException: PBEWithMD5AndDES SecretKeyFactory not available
I wonder the native bundle executable (exe) is made up from the same executable but the exe is not working. Here is ANT step to deploy the application and create the native bundle exe.
<target name="CreatingExe" depends="SignedJar">
<fx:deploy width="800" height="600" nativeBundles="all" outdir="${dist}" outfile="${app.name}">
<fx:info title="${app.title}"/>
<fx:application name="${app.title}" mainClass="${main.class}"/>
<fx:resources>
<fx:fileset dir="${distBI}" includes="*.jar"/>
<fx:fileset dir="${WorkingFolder}/temp"/>
</fx:resources>
</fx:deploy>
</target>
FYI : I am running my build on Windows 8 O.S., 64 bit machine. I am deploying my JavaFX application in following steps-
Compiling JavaFX Code.
Creating JAR.
Obfuscating code.
Signing Jar
Creating Executable.
Signing Executable.
Build was successful.
How to exclude publicCerts.store from obfuscation? Why the final exe is not working even the application jar is working? Do I need to specify any thing else in fx:deploy task?

When building a JavaFx native bundle the ext folder under <JDK.HOME> doesn't get included. What this folder contain is mostly the security stuff.
<!--Copy the ext library to the runtime lib-->
<copydir src="${java.home}/lib/ext"
dest="${dist.jar.dir}/bundles/{YOUR.PACKAGE.NAME}/runtime/jre/lib/ext"
includes="**/*"
/>

Related

Error during starting Jboss 4.3 while binding default hsql datasource

I get below error during JBoss start up.
[ServiceController] Problem starting service jboss:service=Hypersonic,database=localDB
java.lang.NoSuchMethodError: org.hsqldb.DatabaseURL.parseURL(Ljava/lang/String;ZZ)Lorg/hsqldb/persist/HsqlProperties;
at org.hsqldb.jdbc.JDBCDriver.getConnection(Unknown Source)
at org.hsqldb.jdbc.JDBCDriver.connect(Unknown Source)
at java.sql.DriverManager.getConnection(DriverManager.java:664)
at java.sql.DriverManager.getConnection(DriverManager.java:247)
at org.jboss.jdbc.HypersonicDatabase.getConnection(HypersonicDatabase.java:768)
at org.jboss.jdbc.HypersonicDatabase.startStandaloneDatabase(HypersonicDatabase.java:618)
at org.jboss.jdbc.HypersonicDatabase.startService(HypersonicDatabase.java:564)
at org.jboss.system.ServiceMBeanSupport.jbossInternalStart(ServiceMBeanSupport.java:289)
at org.jboss.system.ServiceMBeanSupport.jbossInternalLifecycle(ServiceMBeanSupport.java:245)
at sun.reflect.GeneratedMethodAccessor3.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:155)
at org.jboss.mx.server.Invocation.dispatch(Invocation.java:94)
at org.jboss.mx.server.Invocation.invoke(Invocation.java:86)
at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:264)
at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:659)
at org.jboss.system.ServiceController$ServiceProxy.invoke(ServiceController.java:978)
at com.sun.proxy.$Proxy0.start(Unknown Source)
at org.jboss.system.ServiceController.start(ServiceController.java:417)
Background: I have added a new MS Access DB data source. For that, i am using ucanaccess library. Now, to bundle my code, i have created an executable uber jar which contains my main test program along with dependencies. Dependencies include following jars:
ucanaccess-4.0.1.jar
commons-lang-2.6.jar
commons-logging-1.1.3.jar
hsqldb-2.3.1.jar
jackcess-2.1.6.jar
Further, I have configured my data source in MSAccess-ds.xml and deployed in deploy folder. And i have kept my uber jar named "Service-MSAccessDB.jar" inside server lib folder as well as Ear/lib. Now, on server startup i get above error.
Now, if i rename my jar to "EService-MSAccessDB.jar", The error goes away.
The issue I feel is that JBoss server lib already contains hsqldb.jar. And when i place my uber jar, it causes some conflict. On startup, it tries to find a method i.e. DatabaseURL.parseURL(Ljava/lang/String;ZZ)Lorg/hsqldb/persist/HsqlProperties; which is present in my uber jar but not in hsqldb.jar. And when i rename my uber jar such that it is alphabetically higher in order with respect to hsqldb.jar, issue goes away.
Now, my question is, why is it looking for such a method while configuring DefaultDS which is default configuration of JBoss. How to resolve this issue without renaming my Uber jar as appending "E" in front of my Jar name does not make sense.
This JBoss server contains a copy of hsqldb.jar version 1.8.0.x for its internal use. You can replace it with a copy of hsqldb-2.3.1.jar (renamed to the name of the original jar) to avoid the conflict.

Only in Eclipse: java.lang.IllegalStateException: No WebApplicationContext found: no ContextLoaderListener registered?

Actually I'm introducing myself into JSF. For that reason I copied the project from this location:
http://www.concretepage.com/spring-4/spring-4-jsf-2-integration-example-using-autowired-annotation
Setup:
OpenSUSE 13.2
JDK-1.8.0_77
Gradle 3.0
Spring 4
JSF-2
Apache Tomcat 8.0.33
Eclipse MARS 2 (4.5.2)
Building this project with "gradle build" and deploy it manually to Tomcat and access an URL works just fine. So this project seems to be OK.
So I try the same procedure inside eclipse with a configurated server. But as soon as I access the same URL, I'm getting an IllegalStateException (No WebApplicationContext found: no ContextLoaderListener registered?).
java.lang.IllegalStateException: No WebApplicationContext found: no ContextLoaderListener registered?
org.springframework.web.jsf.FacesContextUtils.getRequiredWebApplicationContext(FacesContextUtils.java:81)
org.springframework.web.jsf.el.SpringBeanFacesELResolver.getWebApplicationContext(SpringBeanFacesELResolver.java:90)
org.springframework.web.jsf.el.SpringBeanFacesELResolver.getBeanFactory(SpringBeanFacesELResolver.java:78)
org.springframework.beans.factory.access.el.SpringBeanELResolver.getValue(SpringBeanELResolver.java:49)
com.sun.faces.el.DemuxCompositeELResolver._getValue(Unknown Source)
com.sun.faces.el.DemuxCompositeELResolver.getValue(Unknown Source)
org.apache.el.parser.AstIdentifier.getValue(AstIdentifier.java:94)
org.apache.el.parser.AstValue.getValue(AstValue.java:137)
org.apache.el.ValueExpressionImpl.getValue(ValueExpressionImpl.java:184)
com.sun.faces.facelets.el.TagValueExpression.getValue(Unknown Source)
javax.faces.component.ComponentStateHelper.eval(Unknown Source)
javax.faces.component.ComponentStateHelper.eval(Unknown Source)
javax.faces.component.UIOutput.getValue(Unknown Source)
javax.faces.component.UIInput.getValue(Unknown Source)
com.sun.faces.renderkit.html_basic.HtmlBasicInputRenderer.getValue(Unknown Source)
com.sun.faces.renderkit.html_basic.HtmlBasicRenderer.getCurrentValue(Unknown Source)
com.sun.faces.renderkit.html_basic.HtmlBasicRenderer.encodeEnd(Unknown Source)
javax.faces.component.UIComponentBase.encodeEnd(Unknown Source)
javax.faces.component.UIComponent.encodeAll(Unknown Source)
javax.faces.render.Renderer.encodeChildren(Unknown Source)
javax.faces.component.UIComponentBase.encodeChildren(Unknown Source)
javax.faces.component.UIComponent.encodeAll(Unknown Source)
javax.faces.component.UIComponent.encodeAll(Unknown Source)
javax.faces.component.UIComponent.encodeAll(Unknown Source)
com.sun.faces.application.view.FaceletViewHandlingStrategy.renderView(Unknown Source)
com.sun.faces.application.view.MultiViewHandler.renderView(Unknown Source)
com.sun.faces.lifecycle.RenderResponsePhase.execute(Unknown Source)
com.sun.faces.lifecycle.Phase.doPhase(Unknown Source)
com.sun.faces.lifecycle.LifecycleImpl.render(Unknown Source)
javax.faces.webapp.FacesServlet.service(Unknown Source)
org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
I think this exception is already seen pretty often. I've tried serveral confirmed solutions, but all of them mess up the simplicity of the project. Also the manual deployment is working, so I don't think there is something wrong with the project itself. (e.g. adding a context-listener,...)
I'm pretty sure, there is something wrong with the configuration of the server or the project inside eclipse.
I compared several settings against the standalone-tomcat:
Usage of the same JRE
configuration of project's libs and deployment-assembly
eclipse launch-configuration by ps -Af
Also neither warnings nor errors are printed into the console-log.
I added a breakpoint to WebAppInitializer.onStartup. This breakpoint was not visited.
Do you have other suggestions what to check or even a solution for this?
-- Solution --
Could it be that simple?
Next day I started the enviroment again.
I added an index.jsp (I didn't configure the web.xml) started the tomcat inside eclipse. It worked.
Afterwards I removed the index.jsp restarted my complete enviroment, redeployed and it is still working.
I think the solution is a simple restart (simple eclipse-caching-problem).
I don't get the point, why adding a file should influence the bootstrap.
Thanks in advice
Mike
It seems to be a simple eclipse-chaching-problem. Here is the reason why (additionally I added this information to the question)
Next day I started the enviroment again. I added an index.jsp (I didn't configure the web.xml) started the tomcat inside eclipse. It worked. Afterwards I removed the index.jsp restarted my complete enviroment, redeployed and it is still working.
I think the solution is a simple restart.

gwtbootstrap3 available at compile time but not at runtime?

question is about gwtbootstap3 error that I am receiving when trying to run my GWT application. Everything mentioned here Initial Setup is being done and my code compiles and gets installed using maven. Dependency scope is provided so should I manually copy jar to application server? I am using JBoss 6.1.0 Final. If JAR file needs to be copied manually, where do I put it? Below is error that I receive,
unning GPE launcher for GWT-2.6.x version.
Runing CodeServer with parameters: [-noprecompile, -port, 9876, -bindAddress, 127.0.0.1, com.HouseKeepingGWT]
workDir: /tmp/gwt-codeserver-1867973844823357957.tmp
Loading modules
com.HouseKeepingGWT
Loading inherited module 'com.HouseKeepingGWT'
Loading inherited module 'org.gwtbootstrap3.GwtBootstrap3'
Loading inherited module 'com.HouseKeepingGWT'
[ERROR] Unable to find 'org/gwtbootstrap3/GwtBootstrap3.gwt.xml' on your classpath; could be a typo, or maybe you forgot to include a classpath entry for source?
Loading inherited module 'org.gwtbootstrap3.GwtBootstrap3'
[ERROR] Unable to find 'org/gwtbootstrap3/GwtBootstrap3.gwt.xml' on your classpath; could be a typo, or maybe you forgot to include a classpath entry for source?
[ERROR] Line 17: Unexpected exception while processing element 'inherits'
[ERROR] Line 17: Unexpected exception while processing element 'inherits'
com.google.gwt.core.ext.UnableToCompleteException: (see previous log entries)
com.google.gwt.core.ext.UnableToCompleteException: (see previous log entries)
at com.google.gwt.dev.cfg.ModuleDefLoader.nestedLoad(ModuleDefLoader.java:328)
at com.google.gwt.dev.cfg.ModuleDefLoader.nestedLoad(ModuleDefLoader.java:328)
at com.google.gwt.dev.cfg.ModuleDefSchema$BodySchema.__inherits_begin(ModuleDefSchema.java:497)
at com.google.gwt.dev.cfg.ModuleDefSchema$BodySchema.__inherits_begin(ModuleDefSchema.java:497)
at sun.reflect.GeneratedMethodAccessor1.invoke(Unknown Source)
at sun.reflect.GeneratedMethodAccessor1.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:606)
at java.lang.reflect.Method.invoke(Method.java:606)
at com.google.gwt.dev.util.xml.HandlerMethod.invokeBegin(HandlerMethod.java:230)
at com.google.gwt.dev.util.xml.HandlerMethod.invokeBegin(HandlerMethod.java:230)
at com.google.gwt.dev.util.xml.ReflectiveParser$Impl.startElement(ReflectiveParser.java:294)
at com.google.gwt.dev.util.xml.ReflectiveParser$Impl.startElement(ReflectiveParser.java:294)
at org.apache.xerces.parsers.AbstractSAXParser.startElement(Unknown Source)
at org.apache.xerces.parsers.AbstractSAXParser.startElement(Unknown Source)
at org.apache.xerces.parsers.AbstractXMLDocumentParser.emptyElement(Unknown Source)
at org.apache.xerces.parsers.AbstractXMLDocumentParser.emptyElement(Unknown Source)
at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanStartElement(Unknown Source)
at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl$FragmentContentDispatcher.dispatch(Unknown Source)
at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanStartElement(Unknown Source)
at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanDocument(Unknown Source)
Looks like, JAR is not available at run time that is why I am receiving error. Please suggest. GwtBootstrap3.gwt.xml is in gwtbootstrap3 jar.
Check this tutorial for configuring JBoss shared libs folder (or find another one on the web, it shouldn't be too hard). However, why are you using the provided scope? If this application is the only one using gwtBootstrap you can remove it so that Maven can package the jar directly inside your application's war.

Unable to find 'com/extjs/gxt/ui/GXT.gwt.xml' in GXT sample application

I'm trying to run a sample application using GXT (ExtJS + GWT) as described in the tutorial at
http://www.sencha.com/learn/setting-up-your-first-ext-gwt-project-in-eclipse
When I try to run the application in eclipse, I get the error
Loading modules
com.hello.gxt.HelloGXT
Loading inherited module 'com.extjs.gxt.ui.GXT'
[ERROR] Unable to find 'com/extjs/gxt/ui/GXT.gwt.xml' on your classpath; could be a typo, or maybe you forgot to include a classpath entry for source?
[ERROR] Line 15: Unexpected exception while processing element 'inherits'
My build path looks like this
and the build path of the run configuration looks like this
Here's the source: https://dl.dropbox.com/u/11776689/2012_09_27_HelloGXT.zip
How can I fix the problem?
'Update 29.09.2012': The former error is fixed, but now I get another one:
Loading modules
com.hello.gxt.HelloGXT
Loading inherited module 'com.sencha.gxt.ui.GXT'
Loading inherited module 'com.sencha.gxt.data.Data'
Loading inherited module 'com.sencha.gxt.core.Core'
[ERROR] Unexpected error while processing XML
java.lang.NoClassDefFoundError: com/google/gwt/core/ext/Generator
at java.lang.ClassLoader.findBootstrapClass(Native Method)
at java.lang.ClassLoader.findBootstrapClassOrNull(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
Change your *.gwt.xml file from:
<inherits name="com.extjs.gxt.ui.GXT" />
to
<inherits name='com.sencha.gxt.ui.GXT' />
The tutorial you used is definitely for version 2.0. From GXT 3.0, the namespace changed to com.sencha.gxt...
UPDATE - to answer the next issue:
I think you are missing gwt-dev.jar
See this for reference: http://www.sencha.com/forum/showthread.php?73617-GWT-1.64-Class-not-found-exception-GXT-module-declaration-is.

eclipselink PersistenceUnitLoadingEception in executable JAR

I am developing a stand-alone java application which uses eclipselink. It is all fine when I execute the app from eclipse IDE. But I've exported an executable JAR file, and since than I can not make eclipseLink work.
I have found similar issue in the Eclipse community forum here, but yet not too handy:
Please help,
My exception is the following:
01 dec. 2010 22:47:31,199 INFO Configuration:97 - Iniciate database
Exception in thread "main" java.lang.reflect.InvocationTargetException
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.eclipse.jdt.internal.jarinjarloader.JarRsrcLoader.main(JarRsrcLoa
der.java:56)
Caused by: Exception [EclipseLink-30005] (Eclipse Persistence Services - 2.0.2.v
20100323-r6872): org.eclipse.persistence.exceptions.PersistenceUnitLoadingExcept
ion
Exception Description: An exception was thrown while searching for persistence a
rchives with ClassLoader: java.net.URLClassLoader#61de33
Internal Exception: Exception [EclipseLink-30004] (Eclipse Persistence Services
- 2.0.2.v20100323-r6872): org.eclipse.persistence.exceptions.PersistenceUnitLoad
ingExceptionException Description: An exception was thrown while processing persistence.xml
from URL: rsrc:../
Internal Exception: java.net.MalformedURLException
at org.eclipse.persistence.exceptions.PersistenceUnitLoadingException.ex
ceptionSearchingForPersistenceResources(PersistenceUnitLoadingException.java:126
)
at org.eclipse.persistence.jpa.PersistenceProvider.createEntityManagerFa
ctory(PersistenceProvider.java:133)
at org.eclipse.persistence.jpa.PersistenceProvider.createEntityManagerFa
ctory(PersistenceProvider.java:65)
at javax.persistence.Persistence.createEntityManagerFactory(Persistence.
java:51)
at javax.persistence.Persistence.createEntityManagerFactory(Persistence.
java:33)
at eu.agilelabs.pillAgent.db.dam.DataManagerImplJPA.(DataManagerIm
plJPA.java:36)
at eu.agilelabs.pillAgent.db.dam.DataManagerImplJPA.getInstance(DataMana
gerImplJPA.java:47)
at eu.agilelabs.configuration.Configuration.(Configuration.java:98
)
at eu.agilelabs.configuration.Configuration.getInstance(Configuration.ja
va:119)
at eu.agilelabs.pillAgent.core.Main.main(Main.java:15)
... 5 more
Caused by: Exception [EclipseLink-30004] (Eclipse Persistence Services - 2.0.2.v
20100323-r6872): org.eclipse.persistence.exceptions.PersistenceUnitLoadingExcept
ion
Exception Description: An exception was thrown while processing persistence.xml
from URL: rsrc:../
Internal Exception: java.net.MalformedURLException
at org.eclipse.persistence.exceptions.PersistenceUnitLoadingException.ex
ceptionProcessingPersistenceXML(PersistenceUnitLoadingException.java:117)
at org.eclipse.persistence.internal.jpa.deployment.PersistenceUnitProces
sor.processPersistenceXML(PersistenceUnitProcessor.java:444)
at org.eclipse.persistence.internal.jpa.deployment.PersistenceUnitProces
sor.processPersistenceArchive(PersistenceUnitProcessor.java:401)
at org.eclipse.persistence.internal.jpa.deployment.PersistenceUnitProces
sor.getPersistenceUnits(PersistenceUnitProcessor.java:310)
at org.eclipse.persistence.internal.jpa.deployment.JPAInitializer.findPe
rsistenceUnitInfoInArchive(JPAInitializer.java:149)
at org.eclipse.persistence.internal.jpa.deployment.JPAInitializer.findPe
rsistenceUnitInfoInArchives(JPAInitializer.java:136)
at org.eclipse.persistence.internal.jpa.deployment.JPAInitializer.findPe
rsistenceUnitInfo(JPAInitializer.java:125)
at org.eclipse.persistence.jpa.PersistenceProvider.createEntityManagerFa
ctory(PersistenceProvider.java:98)
... 13 more
Caused by: java.net.MalformedURLException
at java.net.URL.(Unknown Source)
at java.net.URL.(Unknown Source)
at java.net.URL.(Unknown Source)
at com.sun.org.apache.xerces.internal.impl.XMLEntityManager.setupCurrent
Entity(Unknown Source)
at com.sun.org.apache.xerces.internal.impl.XMLVersionDetector.determineD
ocVersion(Unknown Source)
at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(U
nknown Source)
at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(U
nknown Source)
at com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(Unknown So
urce)
at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.parse(Un
known Source)
at com.sun.org.apache.xerces.internal.jaxp.SAXParserImpl$JAXPSAXParser.p
arse(Unknown Source)
at org.eclipse.persistence.internal.jpa.deployment.PersistenceUnitProces
sor.processPersistenceXML(PersistenceUnitProcessor.java:442)
... 19 more
I think this line must be the key:
Internal Exception: Exception [EclipseLink-30004] (Eclipse Persistence Services
- 2.0.2.v20100323-r6872): org.eclipse.persistence.exceptions.PersistenceUnitLoad
ingExceptionException Description: An exception was thrown while processing persistence.xml
from URL: rsrc:../
I have managed to solve it. I changed the way eclipse exports the jar file. If it extracts required libraries into the jar everything works great. Thank you anyway!
Some background info
As the link you've provided says, EclipseLink doesn't seem to support loading persistence.xml when the EclipseLink jar is embedded in your app's jar.
As I understand it, standard non-customized Java doesn't support runnable jars that load classes from embedded jars. The runnable jar that Eclipse creates is able to overcome that limitation by adding a custom classloader (org.eclipse.jdt.internal.jarinjarloader.JarRsrcLoader) to your app's jar. The custom classloader apparently is where EclipseLink runs into this issue.
With that said, in Eclipse Helios, I've found it more manageable to "Copy required libraries into a sub-folder next to the generated JAR" rather than to "Extract required libraries into generated JAR."
Choosing the copy option keeps the eclipselink jar intact, as opposed to Eclipse extracting the various .class files and cluttering your application's jar. True, your app will no longer be distributable as a single jar, but from a manageability standpoint, this seems better than the extract-libraries option.
I found the respective solution (that is if you are not using EclipseLink 2.3.2), as mentioned by GaDo in Bug 364748, the solution is to add the following line into MANIFEST.MF
Eclipse-BundleShape: dir
This leads to the plug-in being exported as directory instead as JAR file, which makes persistence.xml accessible.
I was using EclipseLink 2.3.2, with Eclipse Indigo, and was still getting the error.
Then, like a fool, I realized that I was choosing "Package required libraries into generated JAR" instead of "Extract required libraries into generated JAR" works.
Not sure what the difference is, although I've noticed that some of my JARs only work when I create when using "Package required...", and others only work when I create them using "Extract required...".
Not sure why that is. Ultimately, I don't really care, as long as the resulting JAR has no external dependencies.
BTW, the other option that was proposed (modifying the JAR's manifest file) didn't work for me. I extracted the manifext (jar xf MYJAR.jar META-INF/MANIFEST.MF), added Eclipse-BundleShape: dir, injected it into the jar (jar umf META-INF/MANIFEST.MF MYJAR.jar), and verified that the manifest changed. Same error.
Right click on the project -> Properties -> Java Build Path -> Order and Export, and select the libraries
Right click on the project -> Export... -> Runnable JAR file -> Copy required libraries into a sub-folder next to the generated JAR
This worked for me.
This issue has been fixed in EclipseLink 2.3.2
I upgraded and it went away