why do I get UnsupportedClassVersionError in jnlp? - java-web-start

I get an UnsupportedClassVersionError thrown when launching jnlp, however when I try to run the relevant jar files from command line everything works fine. I tried setting j2se versions to 1.5+, 1.6+, using signed/unsigned jar files, but all that doesn't help.
I'm trying to launch my own jar file with two supporting jar files (mysql-connector.jar and swingx.jar). My jar file has been compiled with 1.6 compliance settings in Eclipse and built into a jar with ant. Since I can launch the 3 jars from command line using java 1.6 I'm a bit baffled that jnlp fails. Any help is appreciated.
Here is the jnlp file:
<?xml version="1.0" encoding="utf-8"?>
<!-- JNLP File -->
<jnlp spec="1.5+" codebase="http://www.etc.com/p" href="demo-daily.jnlp">
<information>
<title>demo: daily stock charting utility</title>
<offline-allowed/>
</information>
<security>
</security>
<resources>
<j2se href="http://java.sun.com/products/autodl/j2se" version="1.6+" />
<jar href="demo-daily.jar" main="true" />
<jar href="swingx.jar" main="false" />
<jar href="mysql-connector.jar" main="false" />
</resources>
<application-desc main-class="quipu.viewers.charts.stockcharts.daily"/>
</jnlp>
The error I get is:
java.lang.UnsupportedClassVersionError: Bad version number in .class file
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClass(ClassLoader.java:675)
at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:124)
at java.net.URLClassLoader.defineClass(URLClassLoader.java:260)
at java.net.URLClassLoader.access$100(URLClassLoader.java:56)
at java.net.URLClassLoader$1.run(URLClassLoader.java:195)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:188)
at com.sun.jnlp.JNLPClassLoader.findClass(JNLPClassLoader.java:256)
at java.lang.ClassLoader.loadClass(ClassLoader.java:316)
at java.lang.ClassLoader.loadClass(ClassLoader.java:251)
at com.sun.javaws.Launcher.doLaunchApp(Launcher.java:1052)
at com.sun.javaws.Launcher.run(Launcher.java:105)
at java.lang.Thread.run(Thread.java:613)

First, open a CMD window or a shell window (as appropriate to the OS you're using) and type this:
java -version
to ensure that the version you're running is the version you expect to be running. Then, again from the command line, issue the command:
javaws http://host/path/to/your.jnlp
If you cannot run javaws from the command line, then you'll have to find out where it's installed and use the full path to the executable. Under Windows, this will be something like
C:\Program Files\Java\jre1.6.0_14\bin\javaws.exe
and under Linux it may be /usr/bin/javaws or it may be in another directory.
I know under Windows, at any rate, when you run any Java Web Start app, the JNLP loader is used from the most recent Java version installed. Or at least it's supposed to do this. I haven't experimented under Linux (or MacOS) to see how it works there. But it's always possible that something has gotten messed up and when you launch a JNLP you are accidentally running a Java 1.5 JNLP launcher.
You can always try to uninstall and re-install the most recent version of Java to ensure that the latest and greatest version is properly installed. This may fix things. You may also want to check your $PATH (or %PATH%) to ensure that the correct version of Java is on the path. (This is not always necessary ... but if any version of Java is on the path, ensure that it's the version you want.) Check the environment variable JAVA_HOME to make sure it points where you think it does.

Just a guess, but update the opening tag to reference spec="1.6+"
<jnlp spec="1.6+" codebase="http://www.etc.com/p" href="demo-daily.jnlp">

Related

Eclipse IvyDE managed libraries not exported into runnable JAR file

The problem
So far, Eclipse has exported IvyDE managed libraries into a runnable JAR file, but I'm not sure why it has stopped working recently.
What's wrong? How can I fix the issue?
ivy.xml
<?xml version="1.0" encoding="UTF-8"?>
<ivy-module version="2.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation= "http://ant.apache.org/ivy/schemas/ivy.xsd">
<info organisation="com.example" module="eclipse-ivyde-export-issue" />
<dependencies>
<dependency org="org.json" name="json" rev="20220320"/>
</dependencies>
</ivy-module>
Steps for reproducing the issue
Clone the project:
git clone git#github.com:haba713/eclipse-ivyde-export-issue.git
Import the cloned project into Eclipse workspace.
Right-click the class src/com.example/Main.java in the project tree and
choose Run as → Java Application. See the output: {"key":"value"}.
Right-click the project and choose Export → Java → Runnable JAR file.
Choose the launch configuration for the class com.example.Main and
Library handling: [x] Extract required libraries into generated JAR. Click
Finish.
Try to run the generated JAR file:
$ java -jar eclipse-ivyde-export-issue.jar
Exception in thread "main" java.lang.NoClassDefFoundError: org/json/JSONObject
at com.example.Main.main(Main.java:8)
Caused by: java.lang.ClassNotFoundException: org.json.JSONObject
at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:641)
at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:188)
at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:520)
... 1 more
Environment
Eclipse 2022-06 M2 (4.24.0 M2)
IvyDE 2.2.0.final-201311091524-RELEASE
OpenJDK 17.0.3+7-Debian-1deb11u1
Debian GNU/Linux 11 (Bullseye)
Eclipse 2020-06 with OpenJDK 8 works fine
I tested the same project with Eclipse 2020-06 and OpenJDK 8. JAR export gives a warning "This operation repacks referenced libraries" and IvyDE managed classes are included into the generated JAR file.
(The question was posted also to Eclipse Community Forums.)
Workaround
I think that this is a JDT or IvyDE bug. Workaround is to use JRE System Library 1.8 instead of 17. See the note at the end of README for more information.
The chosen Launch configuration must have JDK 1.8 as a runtime environment.

JBoss EAP 6.4: NoClassDefFoundError on class sun.security.jca.GetInstance

I have a deployment that calls javax.crypto.SecretKeyFactory.getInstance.
The class javax.crypto.SecretKeyFactory appears to load correctly, but when the method tries to create an instance it throws a NoClassDefFoundError on sun/security/jca/GetInstance
Looking at the OpenJDK8 sources shows that relevant javax.crypto.SecretKeyFactory constructor refers explicitly to a method in sun.security.jca.GetInstance, so it's normal that it tries to load it.
What's odd is that both javax/crypto/SecretKeyFactory.class and sun/security/jca/GetInstance.class are present in /usr/lib/jvm/java-1.8.0-openjdk-1.8.0.91-1.b14.el6.x86_64/jre/lib/rt.jar but that only the former is found by the classloader.
What is the jboss module classloader playing at and how can I get it to stop it?
Thanks for suggestions.
Not all JDK classes are exposed to a deployment by default. If your deployment uses JDK classes that are not exposed you can get access to them using jboss-deployment-structure.xml with system dependencies:
<jboss-deployment-structure xmlns="urn:jboss:deployment-structure:1.1">
<deployment>
<dependencies>
<system export="true">
<paths>
<path name="sun/security/jca"/>
</paths>
</system>
</dependencies>
</deployment>
</jboss-deployment-structure>
Another alternative you can import the whole system module adding the following line to MANIFEST.MF:
Dependencies: system
Ref: Class Loading and Modules
In your JBoss installation, go to directory modules/sun/jdk/main and edit the module.xml file there. In <dependencies>/<system>/<paths> add an element <path name="sun/security/jca"/>. Restart your JBoss instance and retry.
I finally fixed my problem, though not quite in the ways suggested above. I wouldn't have got there without the help though (thanks guys).
I did manage to fix the sun/security/jca access problem but it then threw up another problem of a similar type, but with a javax class. I found an ugly fix for that by removing a jar from module org/jboss/genericjms and letting the jdk version get picked up, but I felt that that was playing around too much with stuff that I couldn't predict the consequences of.
The fix I have finally settled on is to put the provided jar that references javax/crypto/SecretKeyFactory in a new module all of its own and then to pull in the classes it needs via:
<system export="true">
<paths>
<path name="java/sql"/>
<path name="javax/crypto"/>
<path name="javax/crypto/spec"/>
<path name="javax/crypto/interfaces"/>
<path name="javax/management"/>
<path name="javax/security/auth/login"/>
<path name="sun/security/jca"/>
<path name="org/ietf/jgss"/>
</paths>
</system>
in the module.xml. When I reference this new module from my code it works (I pulled it in by making it a global module in standalone.xml in fact).
Problem solved. Though I have to say that after this experience of the jboss modular class loader, give me a hierarchical one any day.
Thanks again for the help.

Eclipse FeatureNotFoundException

I have built my project with maven
All builds successful and eclipse properties generation is also successful
But when I open the project in Eclipse 4, I am getting this error
An internal error occurred during: "Loading descriptor for SALYExplorer.".
org.eclipse.emf.ecore.xmi.FeatureNotFoundException: Feature 'taglib' not found. (platform:/resource/SALYExplorer/src/main/webapp/WEB-INF/web.xml, 313, 10)
At that location I have some properties
Though the project runs smoothly and everything is fine, just while exploring the project in Navigation pane, Eclipse always throws this error box (quite annoying).
COde at that location
<taglib>
<taglib-uri>xx.tld</taglib-uri>
<taglib-location>/WEB-INF/tld/xx.tld</taglib-location>
</taglib>
and xx definations int it's file
<!DOCTYPE taglib PUBLIC "-//Sun Microsystems, Inc.//DTD JSP Tag Library 1.2//EN"
"http://java.sun.com/j2ee/dtds/web-jsptaglibrary_1_2.dtd">
<taglib>
<tlib-version>1.0</tlib-version>
<jsp-version>1.2</jsp-version>
.........
</taglib>
The problem is not the taglib at all, it's just a bad error description by Eclipse.
it is the project facet vs. web.xml dtd.. their versions must match!
if the web.xml says:
<!DOCTYPE web-app PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN" "http://java.sun.com/dtd/web-app_2_3.dtd">
but the project has a
"Dynamic Web Module 2.5"
then this error will occur.. change facet to 2.3 or web.xml to 2.5... in other words: they must match..
I ran into this error while trying to update a maven project in Eclipse (ALT+F5).
web.xml
<web-app xmlns="http://java.sun.com/xml/ns/javaee" version="3.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
schemaLocation="http://java.sun.com/xml/ns/javaee
http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd">
and project facet
Dynamic Web Modul 3.0
Here is how I could fix it:
Removed all xmls-schema definition from the web-app element
<web-app>
then update the maven project (ALT+F5).
Re-insert the schema definitions and re-update project (ALT+F5).
According to jsp_2_1.xsd included from web-app_2_5.xsd, taglib tag should be in jsp-config tag:
<xsd:complexType name="jsp-configType">
<xsd:annotation>
<xsd:documentation>
The jsp-configType is used to provide global configuration
information for the JSP files in a web application. It has
two subelements, taglib and jsp-property-group.
</xsd:documentation>
</xsd:annotation>
<xsd:sequence>
<xsd:element name="taglib"
type="javaee:taglibType"
minOccurs="0"
maxOccurs="unbounded"/>
<xsd:element name="jsp-property-group"
type="javaee:jsp-property-groupType"
minOccurs="0"
maxOccurs="unbounded"/>
</xsd:sequence>
<xsd:attribute name="id" type="xsd:ID"/>
When I wrapped taglib in js-config, the error disappeared.
<jsp-config>
<taglib>
<taglib-uri>http://www.springframework.org/tags/form</taglib-uri>
<taglib-location>/WEB-INF/taglibs/spring-form.tld</taglib-location>
</taglib>
</jsp-config>
Previous parsers were probably more lenient. My config: Eclipse Luna, built-in maven 3.2.1, web.xml 2.5, Dynamic Web Project facet 2.5.
For the time being if it's just the annoying Error Message that you want to fix, then as a short-term fix take a look at disabling validation here : Eclipse 'loading descriptor' takes ages
If the above does not work, an alternative would be to use AHK (Autohotkey) which would take slightly more work at your end. (I have been using an AHK script for a couple of years now to get rid of the Eclipse Error popups that I don't care about)
Eclipse Bug 198630 was raised almost 5 years back and in that there is a comment which has an almost identical error message as the OP. (The bug itself was finally closed as not being reproducible).
I have the following questions for you :
Would it be possible for you to show us the Error log ? (To get at the error log you can either take a look at the Error Log View or by looking at the actual file : WORKSPACE_HOME/.metadata/.log. Please take a look at this for more detailed information. )
Are you using any specific Server Adapters like WebLogic or Glassfish ?
I have the following recommendations :
In the eclipse bug thread, the problem was fixed at least once by updating to a specific JST version. Hence, would it be possible for you to run an Eclipse update and see whether the problem is resolved ? (This can be done by going to Help -> Check for Updates)
Would it be possible to try importing the project in Eclipse Indigo (instead of
Juno, which you currently have) and see whether you can reproduce
the problem ? (Eclipse Indigo downloads are available here and I believe you would need the Java EE version)
I just got the same symptoms, with a web-app project using maven. In my case, was related to struts taglib tags in web.xml, and the project having a struts v1.2.9 dependency. I solved the problem by switching to struts v1.3.10. Don't ask why this solved the problem.
If you are in the same situation and you upgrade your struts dependency from 1.2.9 to 1.3.10, be sure to use at least dtd v2.3 in the DOCTYPE declaration of your web.xml:
!DOCTYPE web-app PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN" "http://java.sun.com/j2ee/dtds/web-app_2_3.dtd"
or you'll get another problem (your webapp won't startup without an internet connection)
Hope this helps
I suspect that the problem is with Eclipse web Tools Platform and Java EMF Model. Here is an image of a list of plugins including Java EMF Model and JEM stuff from Eclipse Web Tools Platform:
https://stackoverflow.com/users/1503535/nitin-gurram, does your stack trace look like this?
!ENTRY org.eclipse.core.jobs 4 2 2012-09-28 12:10:00.554
!MESSAGE An internal error occurred during: "Loading descriptor for grch97.".
!STACK 0
org.eclipse.emf.ecore.resource.impl.ResourceSetImpl$1DiagnosticWrappedException: org.eclipse.emf.ecore.xmi.FeatureNotFoundException: Feature 'taglib' not found. (platform:/resource/grch97/WEB-INF/web.xml, 891, 11)
at org.eclipse.emf.ecore.resource.impl.ResourceSetImpl.handleDemandLoadException(ResourceSetImpl.java:319)
at org.eclipse.emf.ecore.resource.impl.ResourceSetImpl.demandLoadHelper(ResourceSetImpl.java:278)
at org.eclipse.jem.internal.util.emf.workbench.ProjectResourceSetImpl.getResource(ProjectResourceSetImpl.java:1003)
at org.eclipse.jst.jee.model.internal.JEE5ModelProvider.getModelResource(JEE5ModelProvider.java:169)
at org.eclipse.jst.jee.model.internal.Web25ModelProvider.getModelObject(Web25ModelProvider.java:44)
at org.eclipse.jst.jee.model.internal.JEE5ModelProvider.getModelObject(JEE5ModelProvider.java:215)
at org.eclipse.jst.jee.model.internal.common.AbstractMergedModelProvider.loadProviders(AbstractMergedModelProvider.java:261)
at org.eclipse.jst.jee.model.internal.common.AbstractMergedModelProvider.access$2(AbstractMergedModelProvider.java:255)
at org.eclipse.jst.jee.model.internal.common.AbstractMergedModelProvider$LoadModelsWorkspaceRunnable.run(AbstractMergedModelProvider.java:278)
at org.eclipse.core.internal.resources.Workspace.run(Workspace.java:2344)
at org.eclipse.jst.jee.model.internal.common.AbstractMergedModelProvider.loadModel(AbstractMergedModelProvider.java:249)
at org.eclipse.jst.jee.model.internal.common.AbstractMergedModelProvider.getMergedModel(AbstractMergedModelProvider.java:219)
at org.eclipse.jst.jee.model.internal.common.AbstractMergedModelProvider.getModelObject(AbstractMergedModelProvider.java:139)
at org.eclipse.jst.jee.ui.internal.navigator.Web25ContentProvider.getNewContentProviderInstance(Web25ContentProvider.java:69)
at org.eclipse.jst.jee.ui.internal.navigator.LoadingJeeDDJob.run(LoadingJeeDDJob.java:50)
at org.eclipse.core.internal.jobs.Worker.run(Worker.java:54)
Caused by: org.eclipse.emf.ecore.xmi.FeatureNotFoundException: Feature 'taglib' not found. (platform:/resource/grch97/WEB-INF/web.xml, 891, 11)
at org.eclipse.emf.ecore.xmi.impl.XMLHandler.reportUnknownFeature(XMLHandler.java:1985)
at org.eclipse.emf.ecore.xmi.impl.XMLHandler.handleUnknownFeature(XMLHandler.java:1949)
at org.eclipse.emf.ecore.xmi.impl.XMIHandler.handleUnknownFeature(XMIHandler.java:145)
at org.eclipse.emf.ecore.xmi.impl.XMLHandler.handleFeature(XMLHandler.java:1893)
at org.eclipse.emf.ecore.xmi.impl.XMLHandler.processElement(XMLHandler.java:1017)
at org.eclipse.emf.ecore.xmi.impl.XMIHandler.processElement(XMIHandler.java:81)
at org.eclipse.emf.ecore.xmi.impl.XMLHandler.startElement(XMLHandler.java:995)
at org.eclipse.emf.ecore.xmi.impl.XMLHandler.startElement(XMLHandler.java:706)
at org.eclipse.emf.ecore.xmi.impl.XMIHandler.startElement(XMIHandler.java:163)
at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.startElement(Unknown Source)
at com.sun.org.apache.xerces.internal.impl.dtd.XMLDTDValidator.startElement(Unknown Source)
at com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScannerImpl.scanStartElement(Unknown Source)
at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl$FragmentContentDriver.next(Unknown Source)
at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl.next(Unknown Source)
at com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScannerImpl.next(Unknown Source)
at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanDocument(Unknown Source)
at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(Unknown Source)
at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(Unknown Source)
at com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(Unknown Source)
at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.parse(Unknown Source)
at com.sun.org.apache.xerces.internal.jaxp.SAXParserImpl$JAXPSAXParser.parse(Unknown Source)
at javax.xml.parsers.SAXParser.parse(Unknown Source)
at org.eclipse.emf.ecore.xmi.impl.XMLLoadImpl.load(XMLLoadImpl.java:175)
at org.eclipse.emf.ecore.xmi.impl.XMLResourceImpl.doLoad(XMLResourceImpl.java:240)
at org.eclipse.emf.ecore.resource.impl.ResourceImpl.load(ResourceImpl.java:1505)
at org.eclipse.emf.ecore.resource.impl.ResourceImpl.load(ResourceImpl.java:1284)
at org.eclipse.emf.ecore.resource.impl.ResourceSetImpl.demandLoad(ResourceSetImpl.java:259)
at org.eclipse.jem.internal.util.emf.workbench.ProjectResourceSetImpl.demandLoad(ProjectResourceSetImpl.java:811)
at org.eclipse.emf.ecore.resource.impl.ResourceSetImpl.demandLoadHelper(ResourceSetImpl.java:274)
... 14 more
I managed to fix this by removing the validator out of the .project file for each of the projects that had the issue.
I had a similar error using eclipse 4.3 (Kepler), maven 3.1.0, tomcat 6.0.37 and jdk7 (have also jre6 installed), and found a solution to fix it or at least to get rid of the tedious errors by configuring tomcat in eclipse.
In Preferences->Server-> Runtime Environments, define a new run time environment "Apache Tomcat 6.0" and select the jre6 installation from the installed JREs.
Then review the Targeted Runtimes in the project's properties. Apache Tomcat v6.0 should be associated with Java Runtime Environment v1.6 (if not yet defined press new and check that the selected JRE is a java 1.6 runtime).
Hope it helps
I was able to update the project Java facet to 1.5 and the errors stopped.
In my case, this problem got resolved by using the version
org.eclipse.emf.ecore.xmi_2.10.2.v20150123-0348 and org.eclipse.emf.ecore.xmi.source_2.10.2.v20150123-0348 and
org.eclipse.emf.ecore.xmi_2.10.2.v20150123-0348 and
org.eclipse.emf.ecore.xmi.source_2.10.2.v20150123-0348 and
org.eclipse.emf.common_2.10.1.v20150123-0348
jars in the build path.
Earlier jars of old version were being used inspite of new version present.
Right click on the project in Eclipse -> Build Path -> Configure Build Path -> Project Facets -> Uncheck Dynamic Web Module
Note: This approach is good as long you dont plan to run the web-app from within eclipse thru an embedded app server.

How to deploy a desktop JavaFx 2.0 application correctly using jnlp for 32 and 64 bit?

I have a jnlp file for deploying my javafx 2.0 application, however, how do I make sure that the users have the correct javafx runtime (32 or 64 bit depending on the jvm present on the machine) and if not, download it and run the application.
Assuming that the user does not have a javafx runtime currently installed, the problems that I'm facing mostly with a 64 bit machine with either 32-bit, 64-bit or both JRE's are:
1) The Javafx swing deployment guide mentions to use the <jfx:javafx-runtime version /> tag to download the appropriate jfx runtime, but JRE below 1.7 doesn't understand this tag/namespace.
2) If a 32-bit jre is installed on a 64-bit machine, then how do I install my application to the "Program Files(x86)" folder, download and use 32-bit javafx runtime.
3) If a 64-bit jre is installed on a 64-bit machine, then how do I install my application to the "Program Files" folder, download and use 64-bit javafx runtime.
Here is how my jnlp file looks currently:
<?xml version="1.0" encoding="UTF-8"?>
<jnlp spec="1.0+" codebase="file:///C%3A/Program%20Files/HP/Pulse/PulseLite"href="iMonLauncher.jnlp">
<information>
<title>iMonLauncher</title>
<vendor>Administrator</vendor>
<homepage href="file:///C%3A/Program%20Files/HP/Pulse/PulseLite"/>
<description>iMonLauncher</description>
<offline-allowed/>
</information>
<security>
<all-permissions/>
</security>
<resources>
<j2se version="1.6+" href="http://java.sun.com/products/autodl/j2se"/>
<jar href="iMon.jar" size="428419"/>
<jar href="lib/ibase-core.jar" size="197029"/>
<jar href="lib/ibase-fx.jar" size="210175"/>
<jar href="lib/imonDB.jar" main="true" size="156616"/>
<jar href="lib/imon-service.jar" main="true" size="73190"/>
</resources>
<application-desc name="iMon" main-class="imon.Main" >
</application-desc>
<update check="always"/>
The codebase changes automatically, to point to the correct program files folder depending on the architecture.
Thanks in advance !
You miss xmlns:jfx namespace in your jnlp. It should starts with
<jnlp spec="1.0" xmlns:jfx="http://javafx.com" href="iMonLauncher.jnlp">
Once user has regular java installed and clicked on such jnlp file he would be presented with automatic download message for FX. It will find out which java is used, download and install approprivate javafx version.

Java Webstart with Tibco Native Libs

I am trying to deploy an application that uses the native implementation of Tibrv through the TibrvJ library using Java Webstart.
I have packaged up all of the Windows dlls from inside c:\tibco\tibrv\bin into a Jar file and have added these to the nativelib element in the JNLP file.
I was hoping that webstart would take the dll files from thetibco-7.5.1-nativelibs.jar file and allow them to be loaded via System.loadLibrary which is called from Tibrv.open(). However it doesn't seem to want to work properly.
My JNLP file looks like this:
<?xml version="1.0" encoding="utf-8"?><!DOCTYPE jnlp PUBLIC "-//Sun Microsystems, Inc//DTD JNLP Descriptor 6.0//EN" "http://java.sun.com/dtd/JNLP-6.0.dtd">
<jnlp spec="6.0+"
codebase="http://somewhere:8080/my-gui/application"
href="launch.jnlp">
<information>
<title>My GUI</title>
<vendor>Technology</vendor>
<description>Dashboard</description>
<description kind="short">Dashboard</description>
<icon href="icon/Stocks-128x128.png" />
<offline-allowed />
<shortcut online="true">
<desktop />
<menu submenu="Dashboard" />
</shortcut>
</information>
<security>
<all-permissions />
</security>
<update check="always" policy="prompt-update" />
<resources>
<j2se version="1.6+" href="http://java.sun.com/products/autodl/j2se"
java-vm-args="-Xmx120M -ea />
<property name="log4j.configuration" value="live/log4j.xml" />
<property name="swing.aatext" value="true" />
<jar href="tibrvj-7.5.1.jar" />
<jar href="dashboard-gui.jar" main="true" />
</resources>
<resources>
<nativelib href="nativelib/tibco-7.5.1-nativelibs.jar" />
</resources>
<application-desc main-class="com.somewhere.Main">
<argument>classpath:/live/client.xml</argument>
<argument>/live/live.properties</argument>
</application-desc>
</jnlp>
The application launches but as soon as a call is made to open tib then it falls apart with an error along the lines of:
[Root exception is TibrvException[error=22,message=Version mismatch: libtibrv version 7.4 does not match version of tibrvj shared library 7.5]]
TibrvException[error=901,message=Library not found: tibrvj]]
The users have a variety of Tib installations already on their PCs from Tib 7.2 through to 7.5. The Webstart Application only works correctly on a machine with 7.5 installed which matches the Jar file inside the package. So it doesn't appear to do anything with the nativelib jar.
I would like to avoid having to deploy 3 versions of the web start application for the different versions of Tib that the users have installed.
Has anyone else managed to get this combination of TibrvJ and Webstart working?
I've managed to get it working. The trouble is that the call to System.loadLibrary when using Webstart doesn't load in the dependencies of the specified library even if they have been packaged up into a nativelib jar.
See http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6191612 for more info.
To get around this problem it is necessary to explicity load all of the dependencies in the correct order. It is also necessary to put each dll library into its own jar file.
So to use native TibrvJ you need to make the following calls before any calls to Tibrv.Open.
System.loadLibrary("msvcr71");
System.loadLibrary("tibrv");
System.loadLibrary("tibrvcm");
System.loadLibrary("tibrvft");
System.loadLibrary("tibrvcmq");
System.loadLibrary("tibrvj");
Happy Days!
I think you have encountered a problem with Webstart.
Some years ago, I had a Webstart application using Java 3D that didn't work on Macs. Eventually I found that all Macs some with an old version of Java 3D installed, and that already installed version was used over the newer version that I had included in the in my JNLP file. Your problem sounds almost exactly like this, so it could very well be the same problem.

Categories