简体   繁体   中英

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, ie 1.4 (1.3?) in this case.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM