Java getResourceAsStream strange error

  1. In java agent getResourceAsStream() function returns the InputStream. Jar files are imported inside the agent resources.

  2. In LS2J agent getResourceAsStream() function returns null. Jar files are imported inside the java class. The function works only in case when jar files are in the jvm dir.

Same code, different behaviour. Any idea why?

Subject: Is this method on a Domino object?

  • If so you may be having re-entrance issues. Is there another way to acquire the InputStream you want?..

Subject: No …

It’t 7zip object, here’s line from code …

InputStream propertiesInputStream = SevenZip.class.getResourceAsStream(“/sevenzipjbinding-platforms.properties”);

In the java agent there is no problem with this line, in LS2J it returns error:

java.lang.RuntimeException: SevenZipJBinding couldn’t be initialized automaticly using initialization from platform depended JAR and the default temporary directory. Please, make sure the correct ‘sevenzipjbinding-.jar’ file is in the class path or consider initializing SevenZipJBinding manualy using one of the offered initialization methods: ‘net.sf.sevenzipjbinding.SevenZip.init*()’

at net.sf.sevenzipjbinding.SevenZip.ensureLibraryIsInitialized(Unknown Source)

at net.sf.sevenzipjbinding.SevenZip.openInArchive(Unknown Source)

at clsJavaUnZip.unzip(Unknown Source)

at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)

at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:37)

at java.lang.reflect.Method.invoke(Method.java:599)

at lotus.domino.JavaConnectInvoker.invoke(Unknown Source)

at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)

at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:37)

at java.lang.reflect.Method.invoke(Method.java:599)

at lotus.domino.JavaConnectLoader.invoke(Unknown Source)

Caused by: net.sf.sevenzipjbinding.SevenZipNativeInitializationException: Can’nt find 7-Zip-JBinding platform property file /sevenzipjbinding-platforms.properties. Make sure the ‘sevenzipjbinding-.jar’ file is in the class path or consider initializing SevenZipJBinding manualy using one of the offered initialization methods: ‘net.sf.sevenzipjbinding.SevenZip.init*()’

at net.sf.sevenzipjbinding.SevenZip.getPlatformList(Unknown Source)

at net.sf.sevenzipjbinding.SevenZip.getPlatformBestMatch(Unknown Source)

at net.sf.sevenzipjbinding.SevenZip.initSevenZipFromPlatformJARIntern(Unknown Source)

at net.sf.sevenzipjbinding.SevenZip.initSevenZipFromPlatformJAR(Unknown Source)

Subject: Now we’re getting somewhere, just nowhere I can help with…

  • I don’t know SevenZip, but it seems to be expecting some environment that Java gives it, but LS2J does not. I’m not too horribly surprised there, but sadly I couldn’t begin to say to address it. Hopefully someone from Lotus who actually knows LS2J internals will see your error listing and step in…