Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

COM4J.loadNativeLibrary() fails with ExceptionInInitializerError when com4j JAR is on UNC path #22

Closed
martian111 opened this issue Dec 20, 2013 · 1 comment

Comments

@martian111
Copy link
Contributor

When the com4j.jar file is located on an UNC path (for example: \host\share\foo\lib\com4j-20120426-2.jar), it will cause an ExceptionInInitializerError with root cause:
Caused by: java.lang.NullPointerException
at com4j.COM4J.loadNativeLibrary(COM4J.java:567)
at com4j.COM4J.(COM4J.java:522)
... 7 more

First the NPE is caused by using LOGGER before it's initialized (since both are part of the class's static init code and the LOGGER part is a the end) in the IOException catch block. The real root cause is a bug in the file path parsing code, causing the process that copies the DLL file to the filesystem to throw an IOException.

Found that if the COM4J.class URL is:

jar:file://host/share/foo/lib/com4j-20120426-2.jar!/com4j/COM4J.class

The dllFile will be:

\host\share\foo\lib\com4j-x86.dll

which is invalid. It should be:

\\host\share\foo\lib\com4j-x86.dll
kohsuke added a commit that referenced this issue Mar 27, 2014
Fixed Issue #22: COM4J.loadNativeLibrary() fails with ExceptionInInitializerError when com4j JAR is on UNC path
@kohsuke
Copy link
Owner

kohsuke commented Mar 27, 2014

Solved by the pull request.

@kohsuke kohsuke closed this as completed Mar 27, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants