Errors during export of osgi plugin for Domino - eclipse

I have developed an osgi plugin for Domino. It contains a servlet which needs to check ACL settings.
I have a target platform based on ...Domino/rcp/plugins and ...Domino/shared/plugins. The jre is the installed Domino jre.
The servlet imports lotus.domino and uses lotus.domino.ACL. The plugin manifest contains a dependancy on lotus.domino.
Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: MyServletPlugin
Bundle-SymbolicName: MyServletPlugin;singleton:=true
Bundle-Version: 1.0.1.20121026
Bundle-Activator: de.xyz.Activator
Bundle-ActivationPolicy: lazy
Bundle-RequiredExecutionEnvironment: JavaSE-1.6
Import-Package: lotus.domino,
org.osgi.framework;version="1.3.0"
Require-Bundle: org.eclipse.equinox.http.registry,
org.eclipse.equinox.http.servlet,
org.eclipse.osgi,
org.eclipse.osgi.services,
org.eclipse.osgi.util,
com.ibm.pvc.servlet;bundle-version="2.5.0"
Bundle-ClassPath: lib/gson-1.6.jar,
.
When I export the plugin using the Export Wizard I get an error.
Errors occured during the export operation.
The log file contains the following:
# 26.10.12 12:33:32 MESZ
# Eclipse Compiler for Java(TM) 0.B83_R37x, 3.7.2, Copyright IBM Corp 2000, 2011. All rights reserved.
----------
1. ERROR in D:\workspace\osgiservlet\WireitServletPlugin\src\de\xyz\AclServlet.java (at line 14)
import lotus.domino.ACL;
^^^^^
The import lotus cannot be resolved
----------
2. ERROR in D:\workspace\osgiservlet\WireitServletPlugin\src\de\xyz\AclServlet.java (at line 15)
import lotus.domino.ACLEntry;
^^^^^
The import lotus cannot be resolved
... and many more like this.
The Domino version is 8.5.3 and eclipse is Indigo SR2.

Add "com.ibm.notes.java.api" as a required plug-in and remove lotus.domino from the imported packages. That should solve the problem.

I think that I have found the cause.
When I set up the project I added a sepate project which just contained the Notes.jar. I assume this was recommended on blog or something.
It had worked ok so I'm not sure what went wrong. In any case, I removed the project and the export is now successful.

Related

How to use Java11 (Java10) with Eclipse Plugin?

If I specify JavaSE-10 as minimum execution environment in my Eclipse plugin:
I get following errors when starting my plugin as Eclipse Application:
org.osgi.framework.BundleException: Could not resolve module: org.treez.core [597]
Unresolved requirement: Require-Capability: osgi.ee; filter:="(&(osgi.ee=JavaSE)(version=10))"
Unresolved requirement: Require-Bundle: org.treez.javafxd3; visibility:="reexport"
-> Bundle-SymbolicName: org.treez.javafxd3; bundle-version="1.0.0.qualifier"; singleton:="true"
org.treez.javafxd3 [586]
Unresolved requirement: Require-Capability: osgi.ee; filter:="(&(osgi.ee=JavaSE)(version=10))"
at org.eclipse.osgi.container.Module.start(Module.java:444)
at org.eclipse.osgi.container.ModuleContainer$ContainerStartLevel.incStartLevel(ModuleContainer.java:1634)
at org.eclipse.osgi.container.ModuleContainer$ContainerStartLevel.incStartLevel(ModuleContainer.java:1613)
at org.eclipse.osgi.container.ModuleContainer$ContainerStartLevel.doContainerStartLevel(ModuleContainer.java:1585)
at org.eclipse.osgi.container.ModuleContainer$ContainerStartLevel.dispatchEvent(ModuleContainer.java:1528)
at org.eclipse.osgi.container.ModuleContainer$ContainerStartLevel.dispatchEvent(ModuleContainer.java:1)
at org.eclipse.osgi.framework.eventmgr.EventManager.dispatchEvent(EventManager.java:230)
at org.eclipse.osgi.framework.eventmgr.EventManager$EventThread.run(EventManager.java:340)
I checked that
Java10 is reverenced under Installed JREs
10 is selected as compliance level
I use Oxygen.3a Release (4.7.3a) Build id: 20180405-1200
=>Is this a bug in eclipse equinox?
=>What else can I check to resolve this issue?
If I remove JavaSE-10 from the minimum execution environment settings I am able to start the Eclipse Application and the plugin seems to work fine.
When I export the plugin I get following warning:
# 25.04.18, 12:25:40 MESZ
# Eclipse Compiler for Java(TM) v20180330-0919, 3.13.102, Copyright IBM Corp 2000, 2015. All rights reserved.
option -bootclasspath not supported at compliance level 9 and above
When I try to use the plugin after installing it from my update page, I get a ClassNotFoundException:
...
Caused by: java.lang.ClassNotFoundException: org.treez.views.tree.TreeViewPart cannot be found by org.treez.views_1.0.0.201804191641
at org.eclipse.osgi.internal.loader.BundleLoader.findClassInternal(BundleLoader.java:484)
at org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:395)
at org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:387)
at org.eclipse.osgi.internal.loader.ModuleClassLoader.loadClass(ModuleClassLoader.java:150)
at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:499)
at org.eclipse.osgi.internal.framework.EquinoxBundle.loadClass(EquinoxBundle.java:564)
at org.eclipse.core.internal.registry.osgi.RegistryStrategyOSGI.createExecutableExtension(RegistryStrategyOSGI.java:174)
... 114 more
If I use Java8 everything works fine.
Related questions:
Java 8 & Missing required capability Require-Capability: osgi.ee; filter="(&(osgi.ee=JavaSE)(version=1.8))"
How to set up java 10 in Eclipse Oxygen?
How to add org.eclipse.swt (and other plugin dependencies) as an automatic Java9 module?
It looks like Eclipse OSGi does not support Java SE 10 yet. I downloaded the latest Eclipse Oxygen 4.7.3a and opened plugins/org.eclipse.osgi_3.12.100.v20180210-1608.jar. The last supported profile was JavaSE-9.
So, you have two choices here:
Wait until OSGi officially supports JavaSE-10 profile.
If you really want to write a plugin with Java 10 and you have control over the plugins folder (e.g. you develop an Eclipse RCP application), open the OSGI jar and add a new profile JavaSE-10. To do this, you can copy JavaSE-9.profile to JavaSE-10.profile and fix corresponding lines in the new file. Also, you must add a new line to profile.list.
Since OSGi 4.3, the most appropriate way to specify a minimum Java version is using the Required-Capability header, as in:
Require-Capability: osgi.ee;filter:="(&(osgi.ee=JavaSE)(version>=1.10))"
I have had success fixing the reported error by replacing all occurrences of Bundle-RequiredExecutionEnvironment with the above line. In PDE, you may get a warning on the manifest file, but it can be safely ignored. Product validation and product exports seems to work without issue.
The semantic of the BREE header required that an execution environnement descriptor be provided by the OSGi implementation for each specific release of the JRE. In Equinox, this used to be defined through ".profile" files; these profiles have been supported by Equinox up to JavaSE-9, but it has been announced that Equinox they would no longer provide profiles for newer releases of Java.
The Tycho community has handled this issue on their side by creating their own Java 10 profile, but it can't be used directly from PDE. The P2 community is considering copying Tycho's Java 10 profile, but this has been stalled for a long time. I'm not sure how P2 reacts at present when fed bundles that do not contains the BREE header.
What worked for me as a work around was to
Remove the required version entries from the manifest files and ignore the corresponding warnings
Activate the option "Use class files compiled in the workspace" in the export wizard:
(Therefore I assume that something goes wrong during the compilation step of the export wizard if that option is not applied.)
I used Java 11.0.1 and Eclipse SimRel 2018-09 (plus Java11 support plugin)

Resource META-INF does not exist

I have tried to convert a regular Java project to an Eclipse plug-in with Tycho, but something went wrong, and I can't figure out what.
These are the problems (I'm just guessing they're related):
first of all: imports of other projects won't work, even if the other project is in the same workspace
when I open up the plug-in editor on the "Build" tab, I get the following exception: "Resource '/Project/target/classes/META-INF' does not exist."
after the multiple error dialogs with above message are gone, the trees of the "Build" tab are completely empty
I have no idea what could help figuring out that problem, so just ask if you have a hunch.
build.properties
source.. = src/
output.. = target/classes/
bin.includes = META-INF/,\
.
MANIFEST.MF
Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-SymbolicName: org.acme.project;singleton:=true
Bundle-Version: 1.2.3.qualifier
Bundle-Vendor: ACME
Bundle-RequiredExecutionEnvironment: JavaSE-1.8
Bundle-ActivationPolicy: lazy
Require-Bundle: [snip]
Import-Package: [snip]
How do I fix my plug-ins?
For reasons that are completely beyond me, there was the following line in the file .settings/org.eclipse.pde.core.prefs of the project:
BUNDLE_ROOT_PATH=target/classes/META-INF
I removed it and now everything works.
(To see the file, you need to either use the native file system or disable the ".* resources" filter of the Package Explorer.)

Cannot add an eclipse plugin, the plugin won't show up inEclipse

I am trying to add an eclipse Elugin (http://www.cs.wm.edu/semeru/TopicXP/) to my eclipse. I followed the instructions (copied the jar file into the plugins folder), but the plugin won't appear at all.
I do not have the LDA option in the right click menu
I do not have anything under Window > Show View > ...
I don't even see the plugin under Installation Details > plug-ins
I am in the Project Explorer, and using Eclipse Kepler Service Release 2. I did also try Eclipse Luna, as well as Eclipse 3.5 (the version of Eclipse that is mentioned in the plugin page) but none of these worked.
I did check the manifest and I have all required bundles. I also added Java 1.7 to it, since my environment is 1.7.
I cannot think of any reason, the plugin won't show up at all. I assumed that if there are some comparability issues, I will at least see the plugin or some errors related to loading it, but I see nothing.
Ideas?
Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: TopicXP
Bundle-SymbolicName: edu.wm.topicxp;singleton:=true
Bundle-Version: 0.2.4
Bundle-Activator: edu.wm.LDATopics.LDATopics
Require-Bundle: org.eclipse.ui,org.eclipse.core.runtime,org.apache.luc
ene,org.eclipse.jface,org.eclipse.ui.ide,org.eclipse.ui.workbench
Bundle-ActivationPolicy: lazy
Bundle-RequiredExecutionEnvironment: JavaSE-1.7, J2SE-1.5
Bundle-ClassPath: .,lib/args4j-2.0.6.jar,lib/JGibbLDA.jar
Import-Package: org.eclipse.core.resources,org.eclipse.draw2d,org.ecli
pse.draw2d.geometry,org.eclipse.jdt.core,org.eclipse.jdt.core.dom,org
.eclipse.jdt.ui,org.eclipse.jface.text,org.eclipse.ui,org.eclipse.ui.
ide,org.eclipse.ui.texteditor
Old question, but this may help someone still. This sounds very similar to a problem I struggled with. It's likely that the plugin you are trying to load has unresolved dependencies, and Eclipse doesn't show you anything in that case. But you can find out if that's the problem, and what dependencies may be missing by using the OSGI console.
First, invoke Eclipse from command line and add '-console' option.
Then in the OSGI console, use 'install' command to try to load your plugin. For instance, if you have placed com.my.plugin in the plugins folder of your Eclipse installation:
osgi> install reference:file:plugins/com.my.plugin.jar
That will give you a bundle ID in the output. Use that with the 'diag' command to see any missing dependencies.

java.lang.LinkageError while using JGit and Jsch for Eclipse plugin development

I am trying to develop an Eclipse plugin. This plugin uses jgit to accecc git repositories over ssh with ubuntu username and password. (Clone git repository over ssh with username and password by Java) Using jgit in this with NetbBeans works just fine. Without a problem it can clone, commit and push projects. However when I move the same code fragment into Eclipse jsch of jgit plugin and the jsch I've added to the project conflicts. If I remove the one I've I added then I cannot compile the code (I need to import com.jcraft.jsch.Session in a class). On the other hand, if it is added I've got the following error
java.lang.LinkageError:
loader constraint violation: loader
(instance of org/eclipse/osgi/internal/baseadaptor/DefaultClassLoader)
previously initiated loading for a different type with name
"com/jcraft/jsch/Session"
Is there a way out of this mess?
I am using jgit-3.2.0 and jsch-0.1.5.0
Eclipse version is Kepler.
My plugin manifest
Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: ****
Bundle-SymbolicName: ****;singleton:=true
Bundle-Version: 1.1.0513
Bundle-Activator: ****.Activator
Require-Bundle: org.eclipse.ui,
org.eclipse.core.runtime,
org.eclipse.ui.browser;bundle-version="3.4.100",
org.eclipse.core.resources;bundle-version="3.8.100",
org.eclipse.ui.ide;bundle-version="3.9.0",
org.eclipse.jdt.core;bundle-version="3.9.0",
org.eclipse.core.filesystem;bundle-version="1.4.0",
org.eclipse.team.core;bundle-version="3.7.0",
org.eclipse.jgit;bundle-version="3.2.0",
org.eclipse.jdt.launching;bundle-version="3.7.0"
Bundle-RequiredExecutionEnvironment: JavaSE-1.6
Bundle-ActivationPolicy: lazy
Bundle-ClassPath: .,
lib/commons-io-2.4.jar,
lib/zip4j_1.3.2.jar,
lib/jsch-0.1.50.jar
Most likely, the LinkageError occurs because there are two versions of class com.jcraft.jsch.Session (and other classes from JSch). One comes from the embedded library in your bundle, the other is provided by the com.jcraft.jsch bundle that is very likely present in your OSGi runtime.
Don't put JSch on your bundle-classpath. The JSch classes from your bundle-classpath will clash with the JSch bundle 'outside' .
Use Require-Bundle or Import-Package to declare the dependency. For example:
Require-Bundle: com.jcraft.jsch;bundle-version="[0.1.50,0.2.0)"

Equinox circular dependency

I have Eclipse for JEE with Libra installed.
I have 3 OSGI(+Dynamic Web Module Facet) bundles in my Eclipse workspace. The first(let's name it CORE) imports the other 2(DB and MVC) + 3 more packs. DB imports apache-commons(CORE too), MVC has not any imports. All bundles i need are in the Target platform - Gemini, apache-commons, javax.*, etc. When I try to add all the 3 bundles into the Runtime just to start and test them there is this problem.
In the MANIFEST these 2 packs do not import each others. When i try to add only the first bundle(CORE) to the Runtime eclipse crashes with stack overflow. In the server there are infinite dependencies in the DB and MVC bundles between them and i can not continue my work. When i remove the imports from the CORE I can add all 3 bundles without any problem and the runtime starts, CORE bundle is unusable(of course). I tried to create OSGI launcher. There everything works, but the problem is that Equinox OSGI Runtime can refresh(redeploy) my bundles without need to be restarted, but in the launcher i can not do this.
Any help?
Thanks.
EDIT: Some manifest properties
There are not plugins which require each other
CORE manifest:
Bundle-Name: org.proforge.bricks.core
Export-Package: org.proforge.bricks.core
Import-Package: org.apache.commons.configuration;version="1.10.0",
org.apache.commons.lang.exception;version="2.6.0",
org.osgi.framework;version="1.5.0",
org.proforge.bricks.db,
org.proforge.bricks.mvc
DB manifest:
Bundle-Name: org.proforge.bricks.db
Export-Package: org.proforge.bricks.db
Import-Package: org.apache.commons.configuration;version="1.10.0"
MVC manifest:
Bundle-Name: org.proforge.bricks.mvc
Export-Package: org.proforge.bricks.mvc
I put just export/import/name and miss the other properties