NoSuchMethodError in jna-platform - java

I wanna make a new release of the application but when starting it it throws NoSuchMethodError
java.lang.NoSuchMethodError: com.sun.jna.Native.load(Ljava/lang/String;Ljava/lang/Class;Ljava/util/Map;)Lcom/sun/jna/Library;
at com.sun.jna.platform.win32.Shell32.<clinit>(Shell32.java:45)
at com.sun.jna.platform.win32.Shell32Util.getFolderPath(Shell32Util.java:54)
at com.sun.jna.platform.win32.Shell32Util.getFolderPath(Shell32Util.java:71)
at com.faforever.client.preferences.PreferencesService.<clinit>(PreferencesService.java:78)
at com.faforever.client.FafClientApplication.main(FafClientApplication.java:55)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.base/java.lang.reflect.Method.invoke(Unknown Source)
at com.exe4j.runtime.LauncherEngine.launch(LauncherEngine.java:85)
at com.exe4j.runtime.WinLauncher.main(WinLauncher.java:94)
at com.install4j.runtime.launcher.WinLauncher.main(WinLauncher.java:25)
Similar to
NoSuchMethodError using JNA User32 platform map
However I do have version 5.0.0 of both libaries.
It is about this project https://github.com/FAForever/downlords-faf-client it uses gradle as a build tool...
Also I decompiled the installed program and found the method that java claims is not present in the jna libary. Which I find super weird.
Also I check no other dependency has a dependency on jna.
But the thing that is the strangest is it work when I run it all from intelij (oracle jdk 10) but then if I build the installer(openjdk 10 on travis) it does not (same machine).
Also it worked before and we did not change anything about the code related to jna nor the library version. What might have changed is the openjdk version travis uses, but I can not see how that would be related.
Does anybody have an idea what might cause this....
This is the actual code that fails:
Paths.get(Shell32Util.getFolderPath(ShlObj.CSIDL_COMMON_APPDATA), "FAForever")
Even though I thik it is not the problem...
This is the jvm log https://drive.google.com/file/d/11RpxvFubYM7vCoAE-Kx_6EkIKADPQofE/view?usp=sharing
Of which this is probably the important part :
[3.689s][debug][class,resolve ] com.sun.jna.Native java.lang.Object (super)
[3.689s][debug][class,resolve ] com.sun.jna.Native com.sun.jna.Version (interface)
[3.689s][debug][class,resolve ] com.sun.jna.platform.win32.Shell32 com.sun.jna.Native Shell32.java:45 (explicit)
[3.689s][debug][protectiondomain ] Checking package access
[3.689s][debug][protectiondomain ] class loader: a 'jdk/internal/loader/ClassLoaders$AppClassLoader'{0x00000000ee70de08} protection domain: a 'java/security/ProtectionDomain'{0x00000000ef103908} loading: 'com/sun/jna/Native'
[3.689s][debug][protectiondomain ] granted
[3.689s][trace][protectiondomain ] pd set count = #1
[3.689s][debug][class,resolve ] com.sun.jna.platform.win32.Shell32 com.sun.jna.Native Shell32.java:45
[3.689s][info ][stacktrace ] java.lang.NoSuchMethodError, 12
[3.689s][info ][exceptions ] Exception <a 'java/lang/NoSuchMethodError'{0x00000000ef00dd70}: com.sun.jna.Native.load(Ljava/lang/String;Ljava/lang/Class;Ljava/util/Map;)Lcom/sun/jna/Library;> (0x00000000ef00dd70)
thrown [t:/workspace/open/src/hotspot/share/interpreter/linkResolver.cpp, line 741]
for thread 0x00000000031a5000
Probably the discord library I added also contains jna, see log from jvm:
[3.689s][info ][class,load ] com.sun.jna.Native source: file:/E:/DownlordClient%20RC/Downlord's%20FAF%20Client/lib/discord-rpc-1.6.2.jar

The NoSuchMethodError related to JNA is almost always related to having an older version of JNA somewhere in your dependency list, even if you also have the current version.
Your comment here gives the hint:
Probably the discord library I added also contains jna, see log from jvm
Looking at that library's POM we see:
<name>DiscordRPC</name>
<version>1.6.2</version>
...
<dependencies>
<dependency>
<groupId>net.java.dev.jna</groupId>
<artifactId>jna</artifactId>
<version>4.5.1</version>
<scope>compile</scope>
</dependency>
...
</dependencies>
So you are likely in a situation where Gradle's dependency resolution has chosen to use the older jna even though you have both available, and you likely have jna-platform version 5.0.0 and jna version 4.5.1.
You should update your build script to force use of version 5.0.0 (or more recent) for both jna and jna-platform.

Related

Could not load FFI provider when using module-info.java

my Linux Java application uses bluetooth devices. I use this library in order to communicate with bluez stack : https://github.com/hypfvieh/bluez-dbus.
It worked very well until I added module-info.java to my client code. Suddenly I got this error:
Exception in thread "main" java.lang.UnsatisfiedLinkError: could not load FFI provider jnr.ffi.provider.jffi.Provider
at jnr.ffi#2.1.15/jnr.ffi.provider.InvalidRuntime.newLoadError(InvalidRuntime.java:101)
at jnr.ffi#2.1.15/jnr.ffi.provider.InvalidRuntime.findType(InvalidRuntime.java:42)
at jnr.ffi#2.1.15/jnr.ffi.Struct$NumberField.(Struct.java:872)
at jnr.ffi#2.1.15/jnr.ffi.Struct$Unsigned16.(Struct.java:1240)
at jnr.unixsocket#0.33/jnr.unixsocket.SockAddrUnix$DefaultSockAddrUnix.(SockAddrUnix.java:209)
at jnr.unixsocket#0.33/jnr.unixsocket.SockAddrUnix.create(SockAddrUnix.java:174)
at jnr.unixsocket#0.33/jnr.unixsocket.UnixSocketAddress.(UnixSocketAddress.java:53)
at dbus.java#3.2.3/org.freedesktop.dbus.connections.transports.UnixSocketTransport.(UnixSocketTransport.java:32)
at dbus.java#3.2.3/org.freedesktop.dbus.connections.transports.TransportFactory.createTransport(TransportFactory.java:37)
at dbus.java#3.2.3/org.freedesktop.dbus.connections.AbstractConnection.(AbstractConnection.java:161)
at dbus.java#3.2.3/org.freedesktop.dbus.connections.impl.DBusConnection.(DBusConnection.java:334)
at dbus.java#3.2.3/org.freedesktop.dbus.connections.impl.DBusConnection.getConnection(DBusConnection.java:149)
at dbus.java#3.2.3/org.freedesktop.dbus.connections.impl.DBusConnection.getConnection(DBusConnection.java:169)
at dbus.java#3.2.3/org.freedesktop.dbus.connections.impl.DBusConnection.getConnection(DBusConnection.java:219)
at dbus.java#3.2.3/org.freedesktop.dbus.connections.impl.DBusConnection.getConnection(DBusConnection.java:184)
at bluez.dbus#0.1.3/com.github.hypfvieh.bluetooth.DeviceManager.createInstance(DeviceManager.java:74)
at ...
Caused by: java.lang.UnsatisfiedLinkError: could not get native definition for type POINTER, original error message follows: java.lang.UnsatisfiedLinkError: could not locate stub library in jar file. Tried [jni/x86_64-Linux/libjffi-1.2.so, /jni/x86_64-Linux/libjffi-1.2.so]
at jffi#1.2.23/com.kenai.jffi.internal.StubLoader.getStubLibraryStream(StubLoader.java:450)
at jffi#1.2.23/com.kenai.jffi.internal.StubLoader.loadFromJar(StubLoader.java:375)
at jffi#1.2.23/com.kenai.jffi.internal.StubLoader.load(StubLoader.java:278)
at jffi#1.2.23/com.kenai.jffi.internal.StubLoader.(StubLoader.java:487)
at java.base/java.lang.Class.forName0(Native Method)
at java.base/java.lang.Class.forName(Class.java:427)
at jffi#1.2.23/com.kenai.jffi.Init.load(Init.java:68)
at jffi#1.2.23/com.kenai.jffi.Foreign$InstanceHolder.getInstanceHolder(Foreign.java:49)
at jffi#1.2.23/com.kenai.jffi.Foreign$InstanceHolder.(Foreign.java:45)
at jffi#1.2.23/com.kenai.jffi.Foreign.getInstance(Foreign.java:103)
at jffi#1.2.23/com.kenai.jffi.Type$Builtin.lookupTypeInfo(Type.java:242)
at jffi#1.2.23/com.kenai.jffi.Type$Builtin.getTypeInfo(Type.java:237)
at jffi#1.2.23/com.kenai.jffi.Type.resolveSize(Type.java:155)
at jffi#1.2.23/com.kenai.jffi.Type.size(Type.java:138)
at jnr.ffi#2.1.15/jnr.ffi.provider.jffi.NativeRuntime$TypeDelegate.size(NativeRuntime.java:178)
at jnr.ffi#2.1.15/jnr.ffi.provider.AbstractRuntime.(AbstractRuntime.java:48)
at jnr.ffi#2.1.15/jnr.ffi.provider.jffi.NativeRuntime.(NativeRuntime.java:57)
at jnr.ffi#2.1.15/jnr.ffi.provider.jffi.NativeRuntime.(NativeRuntime.java:41)
at jnr.ffi#2.1.15/jnr.ffi.provider.jffi.NativeRuntime$SingletonHolder.(NativeRuntime.java:53)
at jnr.ffi#2.1.15/jnr.ffi.provider.jffi.NativeRuntime.getInstance(NativeRuntime.java:49)
at jnr.ffi#2.1.15/jnr.ffi.provider.jffi.Provider.(Provider.java:29)
at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
at java.base/jdk.internal.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.base/java.lang.reflect.Constructor.newInstanceWithCaller(Constructor.java:500)
at java.base/java.lang.reflect.ReflectAccess.newInstance(ReflectAccess.java:124)
at java.base/jdk.internal.reflect.ReflectionFactory.newInstance(ReflectionFactory.java:346)
at java.base/java.lang.Class.newInstance(Class.java:604)
at jnr.ffi#2.1.15/jnr.ffi.provider.FFIProvider$SystemProviderSingletonHolder.getInstance(FFIProvider.java:68)
at jnr.ffi#2.1.15/jnr.ffi.provider.FFIProvider$SystemProviderSingletonHolder.(FFIProvider.java:57)
at jnr.ffi#2.1.15/jnr.ffi.provider.FFIProvider.getSystemProvider(FFIProvider.java:35)
at jnr.ffi#2.1.15/jnr.ffi.Runtime$SingletonHolder.(Runtime.java:82)
at jnr.ffi#2.1.15/jnr.ffi.Runtime.getSystemRuntime(Runtime.java:67)
at jnr.unixsocket#0.33/jnr.unixsocket.SockAddrUnix.(SockAddrUnix.java:46)
at jnr.unixsocket#0.33/jnr.unixsocket.SockAddrUnix$DefaultSockAddrUnix.(SockAddrUnix.java:208)
at jnr.unixsocket#0.33/jnr.unixsocket.SockAddrUnix.create(SockAddrUnix.java:174)
at jnr.unixsocket#0.33/jnr.unixsocket.UnixSocketAddress.(UnixSocketAddress.java:53)
at dbus.java#3.2.3/org.freedesktop.dbus.connections.transports.UnixSocketTransport.(UnixSocketTransport.java:32)
at ...
I tried to require everything related to this error in the module-info.java without success:
module org.example {
requires dbus.java;
requires dbus.java.nativefd;
requires bluecove.linux.custom;
requires bluez.dbus;
requires jnr.ffi;
requires jnr.x86asm;
requires jnr.posix;
requires jnr.enxio;
requires jnr.unixsocket;
requires jnr.constants;
requires jnr.a64asm;
}
Thank you in advance.
TL;DR
This worked for me…
java --patch-module jffi={{your.own.location}}/com/github/jnr/jffi/1.3.0/jffi-1.3.0-native.jar …
The long version
I downloaded this example project. It's not a JPMS project. But I added module-info.java files to each of the four sub-projects.
I updated the project's com.github.jnr:jnr-ffi dependency from 2.0.9 to 2.1.5 to match the version I see in your stack trace. And I added the following dependencies…
…
<dependency>
<groupId>com.github.hypfvieh</groupId>
<artifactId>dbus-java</artifactId>
<version>3.2.3</version>
</dependency>
<dependency>
<groupId>com.github.hypfvieh</groupId> <artifactId>bluez-dbus</artifactId>
<version>0.1.3</version>
</dependency>
<dependency>
<groupId>com.rm5248</groupId>
<artifactId>dbus-java-nativefd</artifactId>
<version>1.0</version>
</dependency>
…
Those were added so that I could then define each one of my four module-info.java descriptors to be pretty much exactly like yours…
module get.pid{
exports getpid;
requires dbus.java;
requires dbus.java.nativefd;
requires bluez.dbus;
requires jnr.ffi;
requires jffi;
requires jnr.x86asm;
requires jnr.posix;
requires jnr.enxio;
requires jnr.unixsocket;
requires jnr.constants;
requires jnr.a64asm;
}
Before I did the --patch-module, I ran one of the example projects and got the exact same error you got.
But with the following command, all the example applications ran perfectly fine as modules…
java --patch-module jffi={{your.own.location}}/com/github/jnr/jffi/1.3.0/jffi-1.3.0-native.jar --add-modules org.objectweb.asm --add-exports org.objectweb.asm/org.objectweb.asm=jnr.ffi --add-exports org.objectweb.asm/org.objectweb.asm.signature=jnr.ffi --module-path {{path.to.all.the.jars}} -m get.pid/getpid.Getpid
The add-modules and add-exports are crucial too. So don't leave those out.

Java Application Client Freezed with an JNIWrapper exception

I am implementing java application to communicate with windows dll files through a C++ JNI bridge.
Some point, with the following error, my java application is getting freezed.
java.lang.NoSuchMethodException: java.lang.System.getCallerClass()
at java.lang.Class.getDeclaredMethod(Class.java:2130) ~[na:1.8.0_121]
at com.jniwrapper.Library.unloadNativeCode(SourceFile:181) ~[jniwrap-3.8.4.jar:na]
at com.jniwrapper.NativeResourceCollector.d(SourceFile:252) [jniwrap-3.8.4.jar:na]
at com.jniwrapper.NativeResourceCollector.a(SourceFile:77) [jniwrap-3.8.4.jar:na]
at com.jniwrapper.NativeResourceCollector.c(SourceFile:22) [jniwrap-3.8.4.jar:na]
at com.jniwrapper.n.run(SourceFile:141) [jniwrap-3.8.4.jar:na]
This method was removed in JDK8, while it was still there in JDK7.
As jniwrapper is a commercial product, you should ask them for an updated version. From the release notes, version 3.10 should do the trick.

Spring Boot + DB2 + Java8 = ClassNotFoundException: sun.io.ByteToCharConverter When Connection Pool Created [duplicate]

With InterClient 7.5.1 and 8.1.5, the creation of a new JDBC connection in Java 8 fails with
java.lang.NoClassDefFoundError: sun/io/ByteToCharConverter
This class seems to be referenced or used by the InterClient JDBC library.
The error does not occur with Java 7. Is there a way to work around this error?
This code reproduces the problem on Java 8:
package com.example.so25365952;
import java.sql.DriverManager;
import java.sql.SQLException;
import java.util.logging.Level;
import java.util.logging.Logger;
public class Main {
interbase.interclient.Connection conn;
public static void main(String[] args) {
try {
Class.forName("interbase.interclient.Driver");
DriverManager.getConnection("jdbc:interbase://localhost/data/mydb.gdb", "sysdba", "password123");
} catch (ClassNotFoundException | SQLException ex) {
Logger.getLogger(Main.class.getName()).log(Level.SEVERE, null, ex);
}
}
}
Output:
Exception in thread "main" java.lang.NoClassDefFoundError:
sun/io/ByteToCharConverter at
interbase.interclient.Connection.connect(Unknown Source) at
interbase.interclient.Connection.(Unknown Source) at
interbase.interclient.Driver.connect(Unknown Source) at
java.sql.DriverManager.getConnection(DriverManager.java:664) at
java.sql.DriverManager.getConnection(DriverManager.java:247) at
com.example.so25365952.Main.main(Main.java:14) Caused by:
java.lang.ClassNotFoundException: sun.io.ByteToCharConverter at
java.net.URLClassLoader$1.run(URLClassLoader.java:372) at
java.net.URLClassLoader$1.run(URLClassLoader.java:361) at
java.security.AccessController.doPrivileged(Native Method) at
java.net.URLClassLoader.findClass(URLClassLoader.java:360) at
java.lang.ClassLoader.loadClass(ClassLoader.java:424) at
sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308) at
java.lang.ClassLoader.loadClass(ClassLoader.java:357) ... 6 more
Use db2jcc4.jar which is latest version. If you changed your mind to use Java 8 you need to use this.
I have the similiar problem and this change help me to fix the error.
The sun.* and sunw.* packages are internal and should not be used for exactly this reason. Seems like someone at InterClient screwed up. I'd advise you to contact them with a bug report, so they'll know to fix this for future releases.
If you can't wait for a future release, and are willing to break some licences (which I don't recommend of course). You may be able to create your own sun.io.ByteToCharConverter by copying the code from here, and adding it to the bootstrap classpath with -Xbootclasspath, but that would be a last resort.
sun.io.ByteToCharConvertor was deprecated in java 7. and it seems they remove it in java 8.
The answer to the question interbase.interclient.UnlicensedComponentException with the latest interclient.jar IB (v7.5.80) seems to work for me too. It suggests to use version 1.5 of the JDBC driver for Firebird. Fortunately this driver does not rely on deprecated sun classes and works with JRE 8.
I agree with Sergio, this is now an even older question! :-) But at my workplace, too, we are unfortunately as of 2018 for various reasons still using a super-old Interbase (v9, 2009). So at some point I too was unable to continue using the interclient.jar packaged with IBv9, because I would receive this same sun.io.ByteToCharConverter error. No doubt this was because the Java on my client machine was so much newer now. After all, it is 9 years later. But I did not want in my case to go with the solution of installing a legacy Java on my machine, as has worked for others.
So as a solution, on my client machine (Linux/Debian x64), I installed Interbase 2017, the latest at the time(*). But when installing, I only installed the IB Client (not Server + Client). The /opt/interbase/lib/interclient.jar that is packaged with the IB 2017 client works just fine now (no sun.io error). And yes, this IB 2017 (v13) interclient.jar works just fine connecting to our old IB 2009 server.
(I have to hand it to Embarcadero: They are still 'supporting' being able to connect to older versions -- at least in their interclient.jar and libgds.so. This makes sense as useful of course for those sysadmins who want to migrate from older systems to newer ones.)
(*) You can get a free trial version of Interbase from embarcadero. As far as I can tell, though, when you install it, if you install the Client only and use the interclient.jar, this does not require a license. Only installing the IB server (and depending on number of users/connections, etc) but that is nothing new to IB users/admins.
Works for us, at least, until we upgrade our server's IB version, or move to Firebird.
Hope this helps at least one other person out there.
This is an old question, but in case this helps someone:
Find the Java 7 rt.jar in the lib folder.
Open the file, and go to the folder sun/io.
Find the Java 8 rt.jar in the lib folder.
Open the file, and go to the folder sun/io.
Move all the .class files in the folder sun/io from the Java 7 to the Java 8 sun/io folder, except for Win32ErrorMode.class (this class was in both jar files).
Save the Java 8 rt.jar with the added classes.
This worked for me, using an old jdbc driver for SQL Server.
use
<!-- https://mvnrepository.com/artifact/com.ibm.db2.jcc/db2jcc -->
<dependency>
<groupId>com.ibm.db2.jcc</groupId>
<artifactId>db2jcc</artifactId>
<version>db2jcc4</version>
</dependency>
replace
<dependency>
<groupId>com.ibm.db2.jcc</groupId>
<artifactId>db2jcc</artifactId>
<version>10.1</version>
</dependency>
can Solve the problem

Use incompatible versions of JiBX Runtime

I want to use 2 libraries that have been built with different and incompatible versions of JiBX.
Lib #1 runs with JiBX Runtime 1.0.1
Lib #2 runs with JiBX Runtime 1.2.6
The current version number is coded in the interface : org.jibx.runtime.IBindingFactory#CURRENT_VERSION_NUMBER .
When calling org.jibx.runtime.BindingDirectory#getFactory(), there's a compatibility test.
If the generated class and the runtime are incompatible, we got an exception like this :
Caused by: org.jibx.runtime.JiBXException: Binding information for
class Xxxx must be
regenerated with current binding compiler at
org.jibx.runtime.BindingDirectory.getFactoryFromName(Unknown Source)
at org.jibx.runtime.BindingDirectory.getFactory(Unknown Source)
EDIT - 29/07/2015
Another possible exception :
Caused by: org.jibx.runtime.JiBXException: Binding information for
class
Yyyyy must
be recompiled with current binding compiler (compiled with jibx_1_0_1,
runtime is jibx_1_2_5_SNAPSHOT) at
org.jibx.runtime.BindingDirectory.getFactoryFromName(BindingDirectory.java:125)
at
org.jibx.runtime.BindingDirectory.getFactory(BindingDirectory.java:178)
at
org.jibx.runtime.BindingDirectory.getFactory(BindingDirectory.java:197)
Is it possible to make it work ?
I've looked at the doc about JiBX Runtime but didn't found anything.
JiBX Runtime on Maven Central Repo.

Plugin inside Sametime with Lotus Notes Classess - The Whole Story

It's gonna be a long read so Thanks for being patient :).
I have been trying to develop a plugin to be executed inside Lotus Sametime. The idea of this plugin is to extract the calendar entries for a given date and then display it in sametime. Simple isn't it, i thought so too. Apparently I was wrong and grossly misunderstood the JVM version compatibility issues. I first did an independent test in the default Java 1.6 and it worked fine, I got the entries and got the code ready to move to the Sametime Development environment.
I moved to the plugin development environment to insert my code.My first issue came, when I added the Notes.jar to the External jar list and the import lotus.domino line. The IDE told me this
The type org.omg.CORBA.UserException cannot be resolved. It is indirectly referenced from required .class files
After some googling , i referenced the ibmorbapi.jar in the project and got it running. Unfortunately for me even that didn't work out. The plugin itself failed to load and this is what i got
java.lang.NoClassDefFoundError: lotus.notes.Session
at java.lang.J9VMInternals.verifyImpl(Native Method)
at java.lang.J9VMInternals.verify(J9VMInternals.java:59)
at java.lang.J9VMInternals.initialize(J9VMInternals.java:120)
at java.lang.Class.newInstanceImpl(Native Method)
at java.lang.Class.newInstance(Class.java:1244)
at org.eclipse.core.internal.registry.osgi.RegistryStrategyOSGI.createExecutableExtension(RegistryStrategyOSGI.java:157)
at org.eclipse.core.internal.registry.ExtensionRegistry.createExecutableExtension(ExtensionRegistry.java:759)
at org.eclipse.core.internal.registry.ConfigurationElement.createExecutableExtension(ConfigurationElement.java:243)
at org.eclipse.core.internal.registry.ConfigurationElementHandle.createExecutableExtension(ConfigurationElementHandle.java:51)
at com.ibm.collaboration.realtime.imhub.ImHub.loadMiniAppExtensions(ImHub.java:416)
at com.ibm.collaboration.realtime.imhub.ImHub.getMiniApps(ImHub.java:356)
at com.ibm.collaboration.realtime.imhub.workbench.ImHubWorkbenchWindowAdvisorShelf.transformMiniApps(ImHubWorkbenchWindowAdvisorShelf.java:354)
at com.ibm.collaboration.realtime.imhub.workbench.ImHubWorkbenchWindowAdvisorShelf.createWindowContents(ImHubWorkbenchWindowAdvisorShelf.java:179)
at org.eclipse.ui.internal.WorkbenchWindow.createContents(WorkbenchWindow.java:938)
at org.eclipse.jface.window.Window.create(Window.java:426)
at org.eclipse.ui.internal.Workbench.busyOpenWorkbenchWindow(Workbench.java:805)
at org.eclipse.ui.internal.Workbench.doOpenFirstTimeWindow(Workbench.java:1453)
at org.eclipse.ui.internal.Workbench.openFirstTimeWindow(Workbench.java:1404)
at org.eclipse.ui.internal.WorkbenchConfigurer.openFirstTimeWindow(WorkbenchConfigurer.java:190)
at org.eclipse.ui.application.WorkbenchAdvisor.openWindows(WorkbenchAdvisor.java:708)
at org.eclipse.ui.internal.Workbench.init(Workbench.java:1101)
at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:1863)
at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:422)
at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:149)
at com.ibm.collaboration.realtime.ui.WorkbenchAdapter.createAndRunWorkbench(WorkbenchAdapter.java:103)
at com.ibm.collaboration.realtime.ui.WorkbenchAdapter.run(WorkbenchAdapter.java:85)
at com.ibm.collaboration.realtime.application.RTCApplication.run(RTCApplication.java:765)
at org.eclipse.core.internal.runtime.PlatformActivator$1.run(PlatformActivator.java:78)
at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:92)
at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:68)
at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:400)
at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:177)
at java.lang.reflect.AccessibleObject.invokeL(AccessibleObject.java:211)
at java.lang.reflect.Method.invoke(Method.java:272)
at org.eclipse.core.launcher.Main.invokeFramework(Main.java:336)
at org.eclipse.core.launcher.Main.basicRun(Main.java:280)
at org.eclipse.core.launcher.Main.run(Main.java:977)
at org.eclipse.core.launcher.Main.main(Main.java:952)
Since that was not gonna work. I thought why not create the NotesCalendarExtraction part into a separate jar execution file and get a xml file with the calendar entries in it and then give it to the plugin to show the entries. I know it was not the best solution but i was desperate and wanted to get this working. In anycase, the idea kinda worked well when I had hardcoded the jar file and and the path to the generated xml file. Btw I was executing the jar file using the getRuntime.exec module in java. Time came to get it running generically and unfortunately for me the exec module was not accepting spaces in its path so program files was out of question. I was not sure if this was right method but then the jar as such was not executing either for some reason. I tried putting in a bat file with the appropriate command line parameters and it generated the xml when executed in the command line but not when running from the eclipse ide for reasons known only to the IDE. I was out of options at this point and I got my hands on another plugin which did exactly the same thing with regard to getting the calendar entries. I decompiled plugin and checked out the source code and saw the code was using a class loader to do the job. A new hope got into me when i saw this code. After some googling i put together some code which did the job for me. Time came for the acid test, i put the code into the plugin env and this is what I got.
!ENTRY org.eclipse.ui 4 0 2009-09-27 22:05:55.996
!MESSAGE (org/omg/CORBA/UserException) bad major version at offset=6
!STACK 0
java.lang.UnsupportedClassVersionError: (org/omg/CORBA/UserException) bad major version at offset=6
at java.lang.ClassLoader.defineClassImpl(Native Method)
at java.lang.ClassLoader.defineClass(ClassLoader.java:246)
at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:109)
at java.net.URLClassLoader.findClassImpl(URLClassLoader.java:1028)
at java.net.URLClassLoader$4.run(URLClassLoader.java:549)
at java.security.AccessController.doPrivileged(AccessController.java:213)
at java.net.URLClassLoader.findClass(URLClassLoader.java:547)
at java.lang.ClassLoader.loadClass(ClassLoader.java:625)
at java.lang.ClassLoader.loadClass(ClassLoader.java:582)
at java.lang.ClassLoader.defineClassImpl(Native Method)
at java.lang.ClassLoader.defineClass(ClassLoader.java:246)
at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:109)
at java.net.URLClassLoader.findClassImpl(URLClassLoader.java:1028)
at java.net.URLClassLoader$4.run(URLClassLoader.java:549)
at java.security.AccessController.doPrivileged(AccessController.java:213)
at java.net.URLClassLoader.findClass(URLClassLoader.java:547)
at java.lang.ClassLoader.loadClass(ClassLoader.java:625)
at java.lang.ClassLoader.loadClass(ClassLoader.java:582)
at java.lang.J9VMInternals.verifyImpl(Native Method)
at java.lang.J9VMInternals.verify(J9VMInternals.java:59)
at java.lang.J9VMInternals.initialize(J9VMInternals.java:120)
at java.lang.reflect.AccessibleObject.initializeClass(Native Method)
at java.lang.reflect.Method.invoke(Method.java:248)
at com.ibm.collaboration.realtime.lotusnotes.LotusNotes.getNotesSession(LotusNotes.java:179)
at com.ibm.notes.sametime.calendar.hack.SpeakUpMiniApp.createControl(SpeakUpMiniApp.java:58)
at com.ibm.collaboration.realtime.miniapp.MiniAppViewPart.createPartControl(MiniAppViewPart.java:41)
at com.ibm.rcp.ui.internal.shelf.ShelfViewReference.createPartHelper(ShelfViewReference.java:330)
at com.ibm.rcp.ui.internal.shelf.ShelfViewReference.createPart(ShelfViewReference.java:201)
at org.eclipse.ui.internal.WorkbenchPartReference.getPart(WorkbenchPartReference.java:566)
at com.ibm.rcp.ui.shelf.ShelfPage.activatePart(ShelfPage.java:1168)
at com.ibm.rcp.ui.shelf.ShelfPage.access$10(ShelfPage.java:1159)
at com.ibm.rcp.ui.shelf.ShelfPage$7.handleEvent(ShelfPage.java:1312)
at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:66)
at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:938)
at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:962)
at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:947)
at org.eclipse.swt.widgets.Widget.notifyListeners(Widget.java:706)
at com.ibm.rcp.swt.swidgets.SViewForm.toggleMaximize(SViewForm.java:1501)
at com.ibm.rcp.swt.swidgets.SViewStack.expand(SViewStack.java:596)
at com.ibm.rcp.swt.swidgets.SViewStack.toggleMaximize(SViewStack.java:526)
at com.ibm.rcp.swt.swidgets.SViewStack$5.handleEvent(SViewStack.java:312)
at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:66)
at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:938)
at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:962)
at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:947)
at org.eclipse.swt.widgets.Widget.notifyListeners(Widget.java:706)
at com.ibm.rcp.swt.swidgets.SViewForm.onMouseUpMaximize(SViewForm.java:1437)
at com.ibm.rcp.swt.swidgets.SViewForm.onMouseUp(SViewForm.java:1127)
at com.ibm.rcp.swt.swidgets.SViewForm$4.handleEvent(SViewForm.java:421)
at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:66)
at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:938)
at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:3673)
at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3284)
at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.java:1930)
at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:1894)
at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:422)
at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:149)
at com.ibm.collaboration.realtime.ui.WorkbenchAdapter.createAndRunWorkbench(WorkbenchAdapter.java:103)
at com.ibm.collaboration.realtime.ui.WorkbenchAdapter.run(WorkbenchAdapter.java:85)
at com.ibm.collaboration.realtime.application.RTCApplication.run(RTCApplication.java:765)
at org.eclipse.core.internal.runtime.PlatformActivator$1.run(PlatformActivator.java:78)
at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:92)
at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:68)
at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:400)
at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:177)
at java.lang.reflect.AccessibleObject.invokeL(AccessibleObject.java:211)
at java.lang.reflect.Method.invoke(Method.java:272)
at org.eclipse.core.launcher.Main.invokeFramework(Main.java:336)
at org.eclipse.core.launcher.Main.basicRun(Main.java:280)
at org.eclipse.core.launcher.Main.run(Main.java:977)
at org.eclipse.core.launcher.Main.main(Main.java:952)
It's really frustrating again to the version error. The sametime plugin dev environment runs on J9 JVM and the for some reason that is not enough for notes.jar ibmorbapi.jar i guess. Atleast that is what my assumption is about the error.
I would appreciate any help on this from you guys. "org/omg/CORBA/UserException" seems to be crux of the issue and I am simply not able to get over it. I can get the external jar execution working in some complex way but I don't want to do it as i feel its the best way to get calendar entries from notes. I am sure it has to be reasonably simple and any help on this would be appreciated.
There are two jars that are related to talking to a Notes application.
Notes.jar - This is a JNI wrapper for LSXBE classes. In order for it to work correctly you will need Lotus Notes installed on the machine and the main directory on the system PATH.
NCSO.jar - This is for making DIIOP connections to a Domino server. This does not require Lotus Notes to be installed. It does require a Domino server you can connect to which has DIIOP enabled on it.
It is unclear if you have Notes installed?
The jars are also specific to certain JVM versions.
Java 6 - Notes 8.5.1
Java 5 - Notes 8.x
Java 1.4.2 - Notes 7.x
Java 1.3 - Notes 6.x
"bad major version at offset" means your are running the wrong jar for the JVM (eg. 851 jar on 1.4.2).
To rule out any configuration issues first I recommend creating just a simple java application which makes a connection to Notes/Domino. Once that works then you know your paths/jars are all set up correctly.
Looks like CORBA classes are compiled for a newer JDK. You need to find an older version of the JAR, or, alternatively, get the sources and compile them under your JDK (J9?). From what I see from a brief Google search, J9 is either 1.4 or even 1.3 compatible.
Also, make sure that all the code you compile yourself has the same target Java version, i.e. 1.4 (1.3?) in this case.

Categories