[ mx4j-Bugs-1041478 ] Error in loading the dll using Mlet classloader
"SourceForge.net" <[email protected]>
| Newsgroups | gmane.comp.java.mx4j.devel |
|---|---|
| Message-ID | <[email protected]> |
Bugs item #1041478, was opened at 2004-10-06 06:57
Message generated for change (Tracker Item Submitted) made by Item Submitter
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=450647&aid=1041478&group_id=47745
Category: JMX implementation
Group: Release 2.0.1
Status: Open
Resolution: None
Priority: 5
Submitted By: Nobody/Anonymous (nobody)
Assigned to: Nobody/Anonymous (nobody)
Summary: Error in loading the dll using Mlet classloader
Initial Comment:
I am trying to load a dll using System.loadLibrary() in an
MBean loaded by MLet classloader. This works fine if the
dll is put inside a jar file. But if I directly specify
directory containing the dll, the loadLibrary will throw
the exception
java.lang.UnsatisfiedLinkError: C:\Program Files\HP
OpenView\bin\OvSvcdPb.dll: %1 is not a valid Win32
application
And the dll I am trying to load is overwritten by 0 length
file!!
This happens only when I am using the Mlet classloader.
Things are fine with system classloader.
So I had a look into the Mlet.java source code and found
the following code (in the copyLibrary()) bit confusing
is = getResourceAsStream(library);
if (is == null) return null;
is = new BufferedInputStream(is);
File file = new File(getLibraryDirectory(), library);
if (file.exists()) file.delete();
os = new BufferedOutputStream(new
FileOutputStream(file));
readFromAndWriteTo(is, os);
os.close();
is.close();
return file.getCanonicalPath();
Here what is the need to delete the file, when it already
exists?
First I thought this might be required in case the library
is in a jar file, in which case before loading it needs be
copied to some temporary location. I don't know much
about this as I was not able to locate the complete flow.
But still I feel this might be the problem area since I am
getting the exception only when the the dll is not in a
jar file.
----------------------------------------------------------------------
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=450647&aid=1041478&group_id=47745
-------------------------------------------------------
This SF.net email is sponsored by: IT Product Guide on ITManagersJournal
Use IT products in your business? Tell us what you think of them. Give us
Your Opinions, Get Free ThinkGeek Gift Certificates! Click to find out more
http://productguide.itmanagersjournal.com/guidepromo.tmpl