UnsatisfiedLinkError + JNLP + Applet + DLL - java

I have created a JNLP to load the applet and some native DLL files. Following are the codes of each components
JNLP
<?xml version="1.0" encoding="UTF-8"?>
<!-- href attribute contains relative path;
codebase attribute not specified -->
<jnlp href="myKad.jnlp">
<information>
<title>MyKad Reader Applet</title>
<vendor>MyKad</vendor>
</information>
<security>
<all-permissions/>
</security>
<resources>
<!-- Application Resources -->
<j2se version="1.6+" href="http://java.sun.com/products/autodl/j2se" />
<jar href="HLB_Mykad-0.0.1-SNAPSHOT.jar" main="true"/>
<nativelib href="HLB_Mykad-0.0.1-SNAPSHOT.jar" download="eager"/>
</resources>
<applet-desc
name="MyKad Applet"
main-class="com.glexim.applet.GleximApplet"
width="1"
height="1">
</applet-desc>
<update check="background"/>
</jnlp>
JAR (HLB_Mykad-0.0.1-SNAPSHOT.jar) Structure (JAR's are Packaged at top lavel)
com.glexim.applet.GleximApplet
META-INF
Sample.dll
HTML Code
<applet jnlp_href="./applet/myKad.jnlp"
code="com.glexim.applet.GleximApplet" id="gleximApplet"
mayscript="true" width="0px" style="" />
While loading applet I am getting following exception in applet console:
java.lang.RuntimeException: java.lang.UnsatisfiedLinkError: no Sample in java.library.path
at sun.plugin2.applet.Plugin2Manager.createApplet(Unknown Source)
at sun.plugin2.applet.Plugin2Manager$AppletExecutionRunnable.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
Caused by: java.lang.UnsatisfiedLinkError: no Sample in java.library.path
at java.lang.ClassLoader.loadLibrary(Unknown Source)
at java.lang.Runtime.loadLibrary0(Unknown Source)
at java.lang.System.loadLibrary(Unknown Source)
at com.glexim.zf1.MyKad$1.run(MyKad.java:19)
at java.security.AccessController.doPrivileged(Native Method)
at com.glexim.zf1.MyKad.<clinit>(MyKad.java:13)
at com.glexim.applet.GleximApplet.<init>(GleximApplet.java:43)
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)
at java.lang.reflect.Constructor.newInstance(Unknown Source)
at java.lang.Class.newInstance0(Unknown Source)
at java.lang.Class.newInstance(Unknown Source)
at sun.plugin2.applet.Plugin2Manager$12.run(Unknown Source)
at java.awt.event.InvocationEvent.dispatch(Unknown Source)
at java.awt.EventQueue.dispatchEventImpl(Unknown Source)
at java.awt.EventQueue.access$400(Unknown Source)
at java.awt.EventQueue$2.run(Unknown Source)
at java.awt.EventQueue$2.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.security.AccessControlContext$1.doIntersectionPrivilege(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)
Exception: java.lang.RuntimeException: java.lang.UnsatisfiedLinkError: no Sample in java.library.path
My Applet is signed applet and all the DLL files inside applet are also signed with same signature.

Create other section in your JNLP file describing the native resources:
<resources os="Windows" arch="x86">
<nativelib href="jar-with-nativelibs.jar"/>
</resources>
(You don't have to use one jar for each os and architecture supported, but it's recommended)
And after that, define the java.library.path property:
<property key="java.library.path" value="." />
And you're good to go.

Related

Java jnlp application blocked by Security settings

I have an enterprise java application that has plenty of jars that are downloaded to the client's jvm cache by a jnlp file. When I start the application I get the following stack trace on Java Console:
Exception in thread "AWT-EventQueue-1" java.lang.NullPointerException
at com.sun.deploy.ui.DialogTemplate.imageAvailable(Unknown Source)
at com.sun.deploy.ui.DialogTemplate.finalImageAvailable(Unknown Source)
at com.sun.deploy.ui.ImageLoader$2.run(Unknown Source)
at java.awt.event.InvocationEvent.dispatch(Unknown Source)
at java.awt.EventQueue.dispatchEventImpl(Unknown Source)
at java.awt.EventQueue.access$200(Unknown Source)
at java.awt.EventQueue$3.run(Unknown Source)
at java.awt.EventQueue$3.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.security.ProtectionDomain$1.doIntersectionPrivilege(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)
Exception in thread "AWT-EventQueue-1" java.lang.NullPointerException
at com.sun.deploy.ui.DialogTemplate.imageAvailable(Unknown Source)
at com.sun.deploy.ui.DialogTemplate.finalImageAvailable(Unknown Source)
at com.sun.deploy.ui.ImageLoader$2.run(Unknown Source)
at java.awt.event.InvocationEvent.dispatch(Unknown Source)
at java.awt.EventQueue.dispatchEventImpl(Unknown Source)
at java.awt.EventQueue.access$200(Unknown Source)
at java.awt.EventQueue$3.run(Unknown Source)
at java.awt.EventQueue$3.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.security.ProtectionDomain$1.doIntersectionPrivilege(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)
#### Java Web Start Error:
#### The Java security settings have prevented this application from running. You may change this behavior in the Java Control Panel.
My JNLP File is like the following with some censored descriptions:
<?xml version="1.0" encoding="utf-8"?>
<jnlp spec="1.0+" codebase="http://10.100.10.9/ikarusdelhitest/" href="ikarus.jnlp">
<information>
<title>ikarus</title>
<vendor>my company</vendor>
<homepage href="http://www.mycompanyaddress.com" />
<description>My enterprise java ee swing application</description>
<icon href="ikarus.jpg" />
<offline-allowed />
</information>
<security>
<all-permissions />
</security>
<resources>
<jar href="jars/ikarus/ikarusClient.jar" />
<jar href="jars/ikarus/ikarusDelegators.jar" />
<jar href="jars/ikarus/clientRules.jar" />
<jar href="jars/ikarus/ruleImps.jar" />
<jar href="jars/ikarus/ikarusUtil.jar" />
<jar href="jars/ikarus/ikarusResources.jar" />
<jar href="jars/ikarus/domain.jar" />
<jar href="jars/ikarus/domain_repository.jar" />
<jar href="jars/ikarus/domain_service.jar" />
<jar href="jars/ikarus/app_repository.jar" />
<jar href="jars/ikarus/app_service.jar" />
<jar href="jars/ikarus/infrastructure.jar" />
<jar href="jars/ikarus/integration_domain.jar" />
<jar href="jars/jboss_ejb_auth/ejb3-persistence.jar" />
<jar href="jars/jboss_ejb_auth/jboss-ejb3x.jar" />
<jar href="jars/jboss_ejb_auth/jbossall-client.jar" />
<jar href="jars/jasper/commons-beanutils-1.8.0.jar" />
<jar href="jars/jasper/commons-collections-3.2.1.jar" />
<jar href="jars/jasper/commons-digester-1.7.jar" />
<jar href="jars/jasper/commons-logging-1.1.jar" />
<jar href="jars/jasper/iText-2.1.0.jar" />
<jar href="jars/jasper/jasperreports-3.6.0.jar" />
<jar href="jars/jasper/poi-3.2-FINAL-20081019.jar" />
<property name="jnlp.localization" value="Delhi"/>
</resources>
<application-desc main-class="com.celebi.ikarus.main.Ikarus" />
ALso note that I get some different exception details on the more information panel:
com.sun.deploy.security.BlockedException: The Java security settings have prevented this application from running. You may change this behavior in the Java Control Panel.
at com.sun.deploy.security.SandboxSecurity.showBlockedDialog(Unknown Source)
at com.sun.javaws.security.AppPolicy.grantUnrestrictedAccess(Unknown Source)
at com.sun.javaws.security.AppPolicy.addPermissions(Unknown Source)
at com.sun.jnlp.JNLPClassLoader.getTrustedCodeSources(Unknown Source)
at com.sun.deploy.security.CPCallbackHandler$ParentCallback.strategy(Unknown Source)
at com.sun.deploy.security.CPCallbackHandler$ParentCallback.openClassPathElement(Unknown Source)
at com.sun.deploy.security.DeployURLClassPath$JarLoader.getJarFile(Unknown Source)
at com.sun.deploy.security.DeployURLClassPath$JarLoader.access$1000(Unknown Source)
at com.sun.deploy.security.DeployURLClassPath$JarLoader$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at com.sun.deploy.security.DeployURLClassPath$JarLoader.ensureOpen(Unknown Source)
at com.sun.deploy.security.DeployURLClassPath$JarLoader.<init>(Unknown Source)
at com.sun.deploy.security.DeployURLClassPath$3.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at com.sun.deploy.security.DeployURLClassPath.getLoader(Unknown Source)
at com.sun.deploy.security.DeployURLClassPath.getLoader(Unknown Source)
at com.sun.deploy.security.DeployURLClassPath.getResource(Unknown Source)
at java.net.URLClassLoader$1.run(Unknown Source)
at java.net.URLClassLoader$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(Unknown Source)
at com.sun.jnlp.JNLPClassLoader.findClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClass(Unknown Source)
at java.security.SecureClassLoader.defineClass(Unknown Source)
at java.net.URLClassLoader.defineClass(Unknown Source)
at java.net.URLClassLoader.access$100(Unknown Source)
at java.net.URLClassLoader$1.run(Unknown Source)
at java.net.URLClassLoader$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(Unknown Source)
at com.sun.jnlp.JNLPClassLoader.findClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at com.sun.javaws.Launcher.doLaunchApp(Unknown Source)
at com.sun.javaws.Launcher.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
Caused by: java.lang.SecurityException: Invalid Permissions value: all-permissions
at com.sun.deploy.security.DeployManifestChecker.verify(Unknown Source)
at com.sun.deploy.security.DeployManifestChecker.verify(Unknown Source)
... 39 more
I dont have any security restrictions for security on java control panel. It is at the medium level as follows:
Thanks for any help
New Edit: I got more explanatory stacktrace when I tried to run this jnlp from a jvm 1.6 machine as follows:
java.lang.NoClassDefFoundError: javax/ejb/EJBAccessException
at java.lang.Class.getDeclaredMethods0(Native Method)
at java.lang.Class.privateGetDeclaredMethods(Unknown Source)
at java.lang.Class.getMethod0(Unknown Source)
at java.lang.Class.getMethod(Unknown Source)
at com.sun.javaws.Launcher.executeApplication(Unknown Source)
at com.sun.javaws.Launcher.executeMainClass(Unknown Source)
at com.sun.javaws.Launcher.doLaunchApp(Unknown Source)
at com.sun.javaws.Launcher.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
Caused by: java.lang.ClassNotFoundException: javax.ejb.EJBAccessException
at java.net.URLClassLoader$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(Unknown Source)
at com.sun.jnlp.JNLPClassLoader.findClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
I fixed this by going into the Java Control Panel (Start Menu > All Programs > Java > Configure Java) and adding two URLs to the Security Edit Site List.
http://code.google.com
http://androidscreencast.googlecode.com
For Mac System Preferences > Java
Where to add these sites
Java Control Panel > Security Tab > Edit Site List > Add > Apply > Ok
I tried to add the item file:/ and worked.
I recommend you to enable tracing and logging, see here how:
And then run the application from command line.
javaws -verbose AppName.jnlp
Then you could check for clues in log and trace files stored in this path
\Documents and Settings\<USERNAME>\Application Data\Sun\Java\Deployment\log
img source:
http://www.cisco.com/c/en/us/support/docs/security/hostscan/117097-trouble-java7-00.html
I had a very similar problem (Correctly signed JNLP application prevented from running in Java 7)
I fixed it by ensuring
I compiled using 1.7
I updated my JNLP file to enforce 1.7
<resources>
<j2se version="1.7*" java-vm-args="-Xmx32m" max-heap-size="32m" href="http://java.sun.com/products/autodl/j2se"/>
We saw this problem with Java 1.8u60 caused by dead references to icons in the JNLP file. Previously the missing icons were ignored, but now we are seeing failures with the stack trace in the question. Removing the references to the icons fixed our problem.
Here are the two references we removed:
<icon href="ORCL.jpg" kind="splash"/>
<icon href="ORCS.jpg" kind="default"/>
Hope that helps.
You can also try enabling the checkbox under Advanced tab of java (in controlpanel) and check mark the Always allow option under JNLP file section
On an Arch Linux system, I found the Java Control Panel to be accessible at /opt/java7/jre/bin/ControlPanel (a symlink to jcontrol). By running it, I was able to access the Security tab, and then crank down the Security Level to Medium. Then I'm prompted about accepting a security warning upon starting something like /opt/java7/bin/javaws.

Java Web Start Jar signing Issue?

I'm trying to run this Java application (jar) via Java Web Start and am having an incredibly difficult time.
Here's my current JNLP source:
<?xml version="1.0" encoding="utf-8"?>
<jnlp spec="1.0+" codebase="http://localhost:8080/" href="Test.jnlp">
<information>
<title>Jnlp Testing</title>
<vendor>YONG MOOK KIM</vendor>
<homepage href="http://localhost:8080/" />
<description>Testing Testing</description>
</information>
<security>
<all-permissions/>
</security>
<resources>
<j2se version="1.6+" />
<jar href="TestJnlp.jar" />
<jar href="lib/appframework-1.0.3.jar"/>
<jar href="lib/junit-4.7.jar"/>
<jar href="lib/org.eclipse.swt.win32.win32.x86_64_3.100.0.v4233d.jar"/>
<jar href="lib/org-netbeans-modules-java-j2seproject-copylibstask.jar"/>
<jar href="lib/sqlite-jdbc-3.7.2.jar"/>
<jar href="lib/swing-worker-1.1.jar"/>
</resources>
<application-desc main-class="proteotypic.ProteotypicQuantificationApp" />
</jnlp>
Upon running the JNLP file, I get the following Error:
JNLPException[category: Launch File Error : Exception: null : LaunchDesc:
---- here the JNLP ----
at com.sun.javaws.security.JNLPSignedResourcesHelper.checkSignedResourcesHelper(Unknown Source)
at com.sun.javaws.security.JNLPSignedResourcesHelper.checkSignedResources(Unknown Source)
at com.sun.javaws.Launcher.prepareResources(Unknown Source)
at com.sun.javaws.Launcher.prepareAllResources(Unknown Source)
at com.sun.javaws.Launcher.prepareToLaunch(Unknown Source)
at com.sun.javaws.Launcher.prepareToLaunch(Unknown Source)
at com.sun.javaws.Launcher.launch(Unknown Source)
at com.sun.javaws.Main.launchApp(Unknown Source)
at com.sun.javaws.Main.continueInSecureThread(Unknown Source)
at com.sun.javaws.Main$1.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
I have signed all the jars except lib/org.eclipse.swt.win32.win32.x86_64_3.100.0.v4233d.jar - if I sign that one too, I get a different exception:
com.sun.deploy.net.FailedDownloadException: Unable to load resource: http://localhost:8080/lib/org.eclipse.swt.win32.win32.x86_64_3.100.0.v4233d.jar
at com.sun.deploy.net.DownloadEngine.actionDownload(Unknown Source)
at com.sun.deploy.net.DownloadEngine.getCacheEntry(Unknown Source)
at com.sun.deploy.net.DownloadEngine.getCacheEntry(Unknown Source)
at com.sun.deploy.net.DownloadEngine.getResourceCacheEntry(Unknown Source)
at com.sun.deploy.net.DownloadEngine.getResourceCacheEntry(Unknown Source)
at com.sun.deploy.net.DownloadEngine.getResource(Unknown Source)
at com.sun.javaws.LaunchDownload$DownloadTask.call(Unknown Source)
at java.util.concurrent.FutureTask$Sync.innerRun(Unknown Source)
at java.util.concurrent.FutureTask.run(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
java.io.IOException: invalid SHA1 signature file digest for org/eclipse/swt/awt/SWT_AWT$4.class
at com.sun.deploy.cache.CacheEntry$9.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at com.sun.deploy.cache.CacheEntry.writeFileToDisk(Unknown Source)
at com.sun.deploy.cache.Cache.downloadResourceToTempFile(Unknown Source)
at com.sun.deploy.cache.Cache.downloadResourceToCache(Unknown Source)
at com.sun.deploy.net.DownloadEngine.actionDownload(Unknown Source)
at com.sun.deploy.net.DownloadEngine.getCacheEntry(Unknown Source)
at com.sun.deploy.net.DownloadEngine.getCacheEntry(Unknown Source)
at com.sun.deploy.net.DownloadEngine.getResourceCacheEntry(Unknown Source)
at com.sun.deploy.net.DownloadEngine.getResourceCacheEntry(Unknown Source)
at com.sun.deploy.net.DownloadEngine.getResource(Unknown Source)
at com.sun.javaws.LaunchDownload$DownloadTask.call(Unknown Source)
at java.util.concurrent.FutureTask$Sync.innerRun(Unknown Source)
at java.util.concurrent.FutureTask.run(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
After doing "javaws -viewer" and re-running the JNLP, I get:
https://gist.github.com/3183636
You have to sign the jar file. You can do this yourself using keytool, but if you plan on deploying this, I would recommend getting it signed by Verisign or a company like it.
If you just need a temporary fix, signing it yourself for testing is fine.
Here is an easy to use tutorial.
All jars must be signed with the same signature.
All jars in one jnlp need to be signed with the same signature, use an extension with its own jnlp for jars that are signed by third parties.
Some jars use the original signature in the jar for crypto (the JDBC driver for SQL server) others do not work when re-signed (javahelp.jar)
You can also save the trouble signing them by including this in your application's jnlp:
<extension name="javahelp" href="javahelp.jnlp"/>

Jnlp Could not parse launch file. Error at line 0

I have searched the web and have found no definitive solution, so here goes:
I made a JNLP file to launch a JAR in the same folder, however it fails to launch and gives the error "Could not parse launch file. Error at line 0."
Here's DevChat.jnlp:
<?xml version="1.0" encoding="utf-8"?>
<!-- JNLP to Launch DevChat -->
<jnlp
spec="1.0+"
href="DevChat.jnlp">
<information>
<title>DevChat</title>
<vendor>Dev Team</vendor>
</information>
<security>
<all-permissions/>
</security>
<resources>
<j2se version="1.4.2"/>
<jar href="DevSuite.jar" main="true" />
<jar href="commons-net-3.0.1.jar" />
</resources>
<application-desc
main-class="DevChat"
name="DevChat"
</application-desc>
</jnlp>
And the exception:
JNLParseException[ Could not parse launch file. Error at line 0.]
at com.sun.javaws.jnl.XMLFormat.parse(Unknown Source)
at com.sun.javaws.jnl.LaunchDescFactory.buildDescriptor(Unknown Source)
at com.sun.javaws.jnl.LaunchDescFactory.buildDescriptor(Unknown Source)
at com.sun.javaws.jnl.LaunchDescFactory.buildDescriptor(Unknown Source)
at com.sun.javaws.Main.launchApp(Unknown Source)
at com.sun.javaws.Main.continueInSecureThread(Unknown Source)
at com.sun.javaws.Main$1.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
And the wrapped exception:
java.lang.NullPointerException
at com.sun.deploy.xml.XMLParser.parseXMLAttribute(Unknown Source)
at com.sun.deploy.xml.XMLParser.parseXMLElement(Unknown Source)
at com.sun.deploy.xml.XMLParser.parseXMLElement(Unknown Source)
at com.sun.deploy.xml.XMLParser.parseXMLElement(Unknown Source)
at com.sun.deploy.xml.XMLParser.parseXMLElement(Unknown Source)
at com.sun.deploy.xml.XMLParser.parseXMLElement(Unknown Source)
at com.sun.deploy.xml.XMLParser.parse(Unknown Source)
at com.sun.javaws.jnl.XMLFormat.parse(Unknown Source)
at com.sun.javaws.jnl.LaunchDescFactory.buildDescriptor(Unknown Source)
at com.sun.javaws.jnl.LaunchDescFactory.buildDescriptor(Unknown Source)
at com.sun.javaws.jnl.LaunchDescFactory.buildDescriptor(Unknown Source)
at com.sun.javaws.Main.launchApp(Unknown Source)
at com.sun.javaws.Main.continueInSecureThread(Unknown Source)
at com.sun.javaws.Main$1.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
Running from console shows nothing at all. Any help would be appreciated!
I guess that this XML is malformed:
<application-desc
main-class="DevChat"
name="DevChat"
</application-desc>
you need to close the open tag like this:
<application-desc
main-class="DevChat"
name="DevChat">
</application-desc>

can I launch one-jar using java web start

I am trying to lunch one-jar using web start and I am getting error -
Java.lang.reflect.InvocationTargetException
at com.sun.deploy.util.DeployAWTUtil.invokeAndWait(Unknown Source)
at sun.plugin2.applet.Plugin2Manager.runOnEDT(Unknown Source)
at sun.plugin2.applet.Plugin2Manager.createApplet(Unknown Source)
at sun.plugin2.applet.Plugin2Manager$AppletExecutionRunnable.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
Caused by: java.lang.ClassCastException: com.simontuffs.onejar.Boot cannot be cast to java.applet.Applet
at sun.plugin2.applet.Plugin2Manager$12.run(Unknown Source)
at java.awt.event.InvocationEvent.dispatch(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)
Exception: java.lang.reflect.InvocationTargetException
JNLP contains --
<?xml version="1.0" encoding="UTF-8"?>
<jnlp spec="1.0+" codebase="" href="">
<information>
<title>Applet Takes Params</title>
<vendor>Protype example</vendor>
</information>
<resources>
<!-- Application Resources -->
<j2se version="1.5+"
href="http://java.sun.com/products/autodl/j2se"/>
<jar href="Application.jar" main="true" />
</resources>
<applet-desc
name="Application"
main-class="com.simontuffs.onejar.Boot"
width="800"
height="50">
<param name="userName" value="Ashish"/>
</applet-desc>
<update check="background"/>
</jnlp>
I am trying to launch a Application.jar directly and com.simontuffs.onejar.Boot is the main class specify for JAR.
Since you're using the applet-desc tag, your Boot class must extend Applet (or JApplet). Based on the stack trace, it would appear that that class does not extend either of those.
If it's not an applet, use application-desc instead of applet-desc

org.springframework.beans.factory.BeanDefinitionStoreException: Unexpected exception parsing XML document from class path resource

Hi I am developing a RIA application using SWING as client,Java WebStart JNLP and Spring on server side using HTTPInvoker.
I am getting the below error message when I am trying to Launch & Run my application from JNLP. But if I run the same as java application it workes fine and communicate with server and fetch data using spring bean.
My client.xml file is in a client package and looked by jnlp.
Here is my JNLP file :
<?xml version="1.0" encoding="utf-8"?>
<jnlp spec="1.0+" codebase="http://localhost:9080/fawsServer" href="fawsWebstart.jnlp">
<information>
<title>Force Analyst</title>
<vendor>***</vendor>
<description>Force Analyst</description>
<description kind="short">
A demo of the capabilities of JAVA WebStart.
</description>
<offline-allowed>false</offline-allowed>
</information>
<resources>
<j2se version="1.5+" href="http://java.sun.com/products/autodl/j2se"/>
<jar href="fawsClient.jar" download="eager" main="true"/>
<jar href="fawsModel.jar" download="eager" main="false"/>
<jar href="fawsIcons.jar" download="eager" main="false"/>
<jar href="spring-core.jar" download="eager" main="false"/>
<jar href="commons-logging-1.0.4.jar" download="eager" main="false"/>
<jar href="spring-2.5.6.jar" download="eager" main="false"/>
</resources>
<application-desc
name="Force Analyst Application"
main-class="com.att.edge.fawsclient.main.SplashWindow"
width="710"
height="380">
</application-desc>
<update check="background"/>
</jnlp>
ERROR :
Exception in thread "AWT-EventQueue-0" java.lang.ExceptionInInitializerError
at com.att.edge.fawsclient.dao.factory.DAOFactory.getMessagesDAO(DAOFactory.java:110)
at com.att.edge.fawsclient.comm.messages.ReadMessagesFrame.<init>(ReadMessagesFrame.java:114)
at com.att.edge.fawsclient.comm.messages.ReadMessagesFrame.getReadMessagesFrame(ReadMessagesFrame.java:87)
at com.att.edge.fawsclient.main.ForceAnalystPalette.getMessageFrame(ForceAnalystPalette.java:306)
at com.att.edge.fawsclient.main.ForceAnalystPalette.actionPerformed(ForceAnalystPalette.java:1173)
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.plaf.basic.BasicButtonListener.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: org.springframework.beans.factory.BeanDefinitionStoreException: Unexpected exception parsing XML document from class path resource [fawsClient-client.xml]; nested exception is java.lang.NoSuchMethodError: org.springframework.util.ReflectionUtils.makeAccessible(Ljava/lang/reflect/Constructor;)V
at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.doLoadBeanDefinitions(XmlBeanDefinitionReader.java:420)
at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:342)
at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:310)
at org.springframework.beans.factory.xml.XmlBeanFactory.<init>(XmlBeanFactory.java:73)
at org.springframework.beans.factory.xml.XmlBeanFactory.<init>(XmlBeanFactory.java:61)
at com.att.edge.fawsclient.dao.factory.DAOFactory$BeanFactoryHolder.<clinit>(DAOFactory.java:40)
... 30 more
Caused by: java.lang.NoSuchMethodError: org.springframework.util.ReflectionUtils.makeAccessible(Ljava/lang/reflect/Constructor;)V
at org.springframework.beans.BeanUtils.instantiateClass(BeanUtils.java:99)
at org.springframework.beans.BeanUtils.instantiateClass(BeanUtils.java:78)
at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.createBeanDefinitionDocumentReader(XmlBeanDefinitionReader.java:518)
at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.registerBeanDefinitions(XmlBeanDefinitionReader.java:505)
at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.doLoadBeanDefinitions(XmlBeanDefinitionReader.java:398)
... 35 more
The relevant class (org.springframework.util.ReflectionUtils) exists in both sping-2.5.6.jar and in spring-core.jar, and I guess it causes a mix up. As a start, I would drop spring-core.jar, as it is included in the big spring.jar.

Categories

Resources