We help IT Professionals succeed at work.

tomcat jnlp

tbboyett
tbboyett asked
on
1,320 Views
Last Modified: 2008-02-01
I am using sigar api from http://sigar.hyperic.com to retrieve information on cpu's and such.  it runs fine from when launched from the IDE.  However, the issue that I'm having is when i add the jar files to tomcat and lauch the application with my jnlp file i get the following error.

org.hyperic.sigar.SigarException: no libsigar-universal-macosx.dylib in java.library.path
      at org.hyperic.sigar.Sigar.loadLibrary(Sigar.java:160)
      at org.hyperic.sigar.Sigar.<clinit>(Sigar.java:90)
      at Client.threads.CPUThread.run(CPUThread.java:24)
Exception in thread "Thread-21" java.lang.UnsatisfiedLinkError: getCpuInfoList
      at org.hyperic.sigar.Sigar.getCpuInfoList(Native Method)
      at Client.threads.CPUThread.run(CPUThread.java:25)

It appears that I need to do something with the file libsigar-universal-macosx.dylib.
Do i need to add it as a resource somehow to the .jnlp file or place it somewhere else?

Thanks in advance for all the help

sigar = new Sigar();
infos = sigar.getCpuInfoList();

Open in new window

Comment
Watch Question

CERTIFIED EXPERT
Top Expert 2016

Commented:
You need to name the jar with the native code in a <native> element in the JNLP - see docs

Author

Commented:
did you see this in the documentation? i can't seem to locate it.  

Author

Commented:
if i understand you correctly, I need to modify the jar resource to have a native tag?
<jar href="/sigar.jar"/> 

Open in new window

CERTIFIED EXPERT
Top Expert 2016

Commented:
Illustration by example - here's one:
<?xml version="1.0" encoding="UTF-8"?>
<jnlp spec="1.0+" codebase="file:/C:/NetBeansProjects/Spy/test/" href="launch.jnlp">
    <information>
        <title>Spy</title>
        <vendor>Charles</vendor>
        <description>Spy</description>
        <description kind="short">Spy</description>
        <homepage href=""/>
        <offline-allowed/>
    </information>
    <resources>
        <j2se version="1.5+"/>
        <jar href="../Spy-saved.jar" main="true" download="eager"/>
        <jar href="../dist/lib/log4j-1.3alpha-8.jar" download="eager"/>
        <jar href="../dist/lib/Protean.jar" download="eager"/>
    </resources>
    <resources os="windows">
        <nativelib href="../dist/lib/beep.jar" download="eager"/>
    </resources>
    <security>
        <all-permissions />
    </security>
 
    <application-desc main-class="spy.Watcher">
    </application-desc>
</jnlp>

Open in new window

Author

Commented:
My jnlp file looks almost identical to the one you have above.  I tried adding a seperate resource section and put the file as a nativelib resource like below and got an error.

Bad MIME type returned from server when accessing resource:
http://myip:8080/JDASH/libsigar-universal-macosx.dylib - null
<resources os="Mac OS X">
	<nativelib href="/libsigar-universal-macosx.dylib"/>
</resources>

Open in new window

CERTIFIED EXPERT
Top Expert 2016

Commented:
I missed the reply. The native lib needs to be in a jar
CERTIFIED EXPERT
Top Expert 2016

Commented:
I missed the reply. The native lib needs to be in a jar

Author

Commented:
Thank you CEHJ for the reply.

I'll give that a try

Author

Commented:
I still get the same error.

I added the libsigar-universal-macosx.dylib to a jar file and signed the jar. Then I added it to same location as the other jar files.

Below are the two ways I have tried to add it to the jnlp file
<jar href="dylib.jar"/>
 
 
 
<resources os="Mac OS X">
    <nativelib href="dylib.jar"/>
</resources>

Open in new window

CERTIFIED EXPERT
Top Expert 2016

Commented:
Are you sure that OS attribute is correct? What error do you get now? Make sure there are no old deployments knocking around, including in caches

Author

Commented:
Hi CEHJ

I did a System.getProperty("os.name") to verify the os attribute is correct.    I cleared the caches and even did a reboot of the machine and still got the same error as in the initial post of this question.

Should i try placing the libsigar-universal-macosx.dylib in the actually library path of the client?

When i do System.getProperty("java.library.path") i get the following, and it appears that other .dylib files are located there.
.:/Library/Java/Extensions:/System/Library/Java/Extensions:/usr/lib/java
CERTIFIED EXPERT
Top Expert 2016
Commented:
This one is on us!
(Get your first solution completely free - no credit card required)
UNLOCK SOLUTION

Author

Commented:
the paths in the jnlp file are all correct, should i place the jar with the native library in a different location than the others?
CERTIFIED EXPERT
Top Expert 2016

Commented:
I don't think the location is that important - as long as it's correct. I've no other suggestion that i can think of at the moment

Author

Commented:
Ok, well i have posted a question on their forum in hopes of some help from there.  I'll leave the question up a little longer to see if anyone has anything they can add.
CERTIFIED EXPERT
Top Expert 2016

Commented:

Well it's a pity to leave you without it leaving. If the worst comes to the worst, since you have a signed app, you *could* copy the library into java.library.path and load it later
CERTIFIED EXPERT
Top Expert 2016

Commented:
>>Well it's a pity to leave you without it leaving

LOL - that was meant to say

Well it's a pity to leave you without it working
Unlock the solution to this question.
Join our community and discover your potential

Experts Exchange is the only place where you can interact directly with leading experts in the technology field. Become a member today and access the collective knowledge of thousands of technology experts.

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

OR

Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.