Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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?

like image 264
pjp Avatar asked Sep 09 '09 12:09

pjp


1 Answers

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!

like image 182
pjp Avatar answered Sep 22 '22 11:09

pjp