Java Webstart with Tibco Native Libs - java-web-start

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.

Related

JBOSS 7.2.2 External Folder Linking

I have been searching around for this specific problem of mine. We have a folder that is on a shared folder on another server "\\server1\shares\web\images" and I want to link this folder into my web application in Jboss 7.2.2. I'm migrating from Jboss 4.2.2 to Jboss 7.2.2.
Here is my server.xml file from Jboss 4.2.2. You'll notice that the <Context> tag handles this link for me.
<Server>
<Service name="jboss.web">
<!-- ... -->
<Engine name="jboss.web" defaultHost="localhost">
<!-- ... -->
<Host name="myApp" autoDeploy="false" deployOnStartup="false"
deployXML="false" configClass="org.jboss.web.tomcat.security.config.JBossContextConfig">
<!-- ... -->
<Context path="/images" appBase="" docBase="\\server1\shares\web\images"
debug="99" reloadable="true" />
<!-- ... -->
</Host>
</Engine>
</Service>
My research has lead me to use modules, but I cannot figure out how to use the modules properly for this problem. Most examples shows how to provide some link to a folder on the same machine as the Jboss server is on.
So, am I suppose to use modules or is there another way of doing this?

No show anymore message of publisher Java Web Start

I have developed an application via Java Web Start more or less according to this: How do I fix "missing Codebase, Permissions, and Application-Name manifest attribute" in my JNLP app? I have packed the jar with manifest.txt, etc..but in this way I have resolved missing attributes problem, and now I have other problem this message is always showed!! I checked "No show again" and each time I press button to execute and always is showed!! I
Adicionally this is my manifest file:
Manifest-Version: 1.0
Class-Path: .
Main-Class: com.zkteco.biometric.AccesoBiometrioAS2
Permissions: all-permissions
Codebase: http://192.168.111.25:8180/pos-web/
Application-Name: Biometrico
And my Jnlp File this:
<?xml version="1.0" encoding="UTF-8"?>
<jnlp spec="1.0+" codebase="http://192.168.111.25:8180/pos-web/">
<information> <title>CajaPos</title> <vendor>xxx</vendor>
</information>
<security><all-permissions/>
</security>
<resources>
<j2se version="1.2+"/>
<jar href="xx.jar"
main="true" />
</resources
<application-desc main-class="ec.com.xx.pos" type="JavaFX">
<argument>XY</argument>
</application-desc>
</jnlp>
In this page after check the dialog is not showed again and works fine.
https://docs.oracle.com/javase/tutorial/deployment/webstart/deploying.html
Where XY change for each request because I generate jnlp-xml in a dynamically way with a servlet.
This is due to your Java settings. It is a security prompt. There’s nothing you can change in your application to prevent this dialog, it is up to the end-user to change their security settings to show/hide these dialog windows.
Edit: I also recommend migrating your app to a different delivery platform because Java Web Start is being violently turned off by Oracle.

Mule : How to share the same mule project between a JBoss AS and a CE runtime?

The objective I have is to develop a bus with Mule, to run it into a JBoss.
My IDE is eclipse kepler, I have the Anypoint Studio plugin installed, a JBoss 7.1.1, a 3.5 CE runtime, Maven etc etc.
I took a look a this page : Deploy War into Mule Standalone server but I don't see haw it could help.
Context :
- Jboss is an imposed choice. I know it exists an EE version of the runtime, specially for the HA ability (that I need), but it's not an option for my client.
As it's "easier" to test my flows on the standalone (CE) runtime, I wanted to find a way to develop one Mule project to execute it on a CE runtime during the developing phase, and on a JBoss AS during the integration phase.
To do that, I tried to define :
- a jar maven project which contains all the flow
- a "mule" maven project, with the previous jar as the dependency
- a war maven project which athe previous jar and all the module/transport mule jars as dependencies
When I build the mule zip, my jar is included inside, but when it's executed none of ny flew is registered. So it doesn't work.
When I execute the war on JBoss, everything looks fine for the "first" flow (the input one), but I have a crash when the second one is called using a VM connector (other issue, I'll make another request)
Is there a way to do something working with this approach?
I tried to define 2 pom for the same mule project (one pom which generate a war, and a standalone-pom which generate the mule zip), but this is not very "easy to use" for my team, as the eclipse integration of this kind of project is not very friendly.
The last thing I can try is to keep the mule project pom with a mule packaging, and add a maven assembly to build the jar I could include in my war, but I'd prefer a nicer solution...
Thanks for all of your ideas!
Ah, the test flew I'm trying to integrate.
I have 3 flew :
- The first one stands for the HTTP request (to call my CE runtime)
- The second one stands for the Servlet request (to call my JBoss)
- The third one is called by both my CE runtime and my JBoss input flow, throw the VM connector. I'm thinking replace the VM connector by a Flow Call, as the VM inbound-endpoint is not registered when it's embedded into my war (but it works when executed in a CE runtime...)
main file :
<flow name="muleFlow1" doc:name="muleFlow1">
<http:inbound-endpoint exchange-pattern="request-response"
host="localhost" port="8081" doc:name="HTTP" />
<echo-component doc:name="Echo" />
<vm:outbound-endpoint path="receiver"
exchange-pattern="request-response" responseTimeout="10000" doc:name="VM" />
</flow>
<flow name="muleFlow2" doc:name="muleFlow2">
<servlet:inbound-endpoint path="servlet"
responseTimeout="10000" doc:name="Servlet" />
<echo-component doc:name="Echo" />
<vm:outbound-endpoint path="receiver"
exchange-pattern="request-response" responseTimeout="10000" doc:name="VM" />
</flow>
second file :
<flow name="otroFlow1" doc:name="otroFlow1">
<vm:inbound-endpoint path="receiver"
exchange-pattern="request-response" responseTimeout="10000" doc:name="VM" />
<set-payload value="it works" doc:name="Set Payload" />
<echo-component doc:name="Echo" />
</flow>
Thanks !
I didn't find anything else, so I opted for an assembly descriptor...
<assembly
xmlns="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.2"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.2
http://maven.apache.org/xsd/assembly-1.1.2.xsd">
<id>mule</id>
<formats>
<format>zip</format>
</formats>
<includeBaseDirectory>false</includeBaseDirectory>
<fileSets>
<fileSet>
<directory>${project.build.directory}/classes</directory>
<outputDirectory>/</outputDirectory>
<includes>
<include>*.xml</include>
</includes>
</fileSet>
<fileSet>
<directory>${project.build.directory}</directory>
<outputDirectory>/</outputDirectory>
<includes>
<include>classes/**/*.class</include>
</includes>
</fileSet>
</fileSets>
<dependencySets>
<dependencySet>
<outputDirectory>/lib</outputDirectory>
<useProjectArtifact>false</useProjectArtifact>
<useTransitiveDependencies>true</useTransitiveDependencies>
<excludes>
<exclude>org.mule:mule-core</exclude>
<exclude>commons-cli:commons-cli</exclude>
<exclude>log4j:log4j</exclude>
<exclude>org.mule.mvel:mule-mvel2</exclude>
<exclude>org.mule.common:mule-common</exclude>
<exclude>org.mule.modules:mule-module-client</exclude>
<exclude>org.mule.modules:mule-module-spring-config</exclude>
<exclude>org.mule.modules:mule-module-annotations</exclude>
<exclude>org.mule.modules:mule-module-xml</exclude>
<exclude>org.mule.modules:mule-module-cxf</exclude>
<exclude>org.mule.modules:mule-module-spring-security</exclude>
<exclude>org.mule.transports:mule-transport-http</exclude>
<exclude>org.mule.transports:mule-transport-ssl</exclude>
<exclude>org.mule.transports:mule-transport-tcp</exclude>
<exclude>commons-codec:commons-codec</exclude>
<exclude>org.mule.modules:mule-module-spring-extras</exclude>
<exclude>org.mule.modules:mule-module-builders</exclude>
<exclude>org.mule.modules:mule-module-management</exclude>
<exclude>org.mule.modules:mule-module-scripting</exclude>
<exclude>org.mule.modules:mule-module-sxc</exclude>
<exclude>org.mule.tests:mule-tests-functional</exclude>
<exclude>org.mule:mule-core</exclude>
<exclude>org.mule.transports:mule-transport-file</exclude>
<exclude>org.mule.transports:mule-transport-jdbc</exclude>
<exclude>org.mule.transports:mule-transport-jms</exclude>
<exclude>org.mule.transports:mule-transport-servlet</exclude>
<exclude>org.mule.transports:mule-transport-vm</exclude>
</excludes>
</dependencySet>
</dependencySets>
</assembly>
My mule project is now a jar, which generate a jar file (for my webapp) and a zip file (for my runtime CE)
One important thing :
To realize the spring imports of each flow, we need to specify when mule is deployed in a web app, but the runtime expects to work. It can be done by creating a maven profile and enabling the resources filtering to determine when add "classpath:"...

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.

why do I get UnsupportedClassVersionError in jnlp?

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">