Eclipse Plugin Dev: Unable to resolve dependencies - java

Based on this simple tutorial, I am trying to display pop-ups notifications, as part of the org.eclipse.mylyn.commons.ui dependency. So I have added this dependency to my plugin.xml as such:
Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: Roll and Scroll Recorder
Bundle-SymbolicName: ATF_Recorder_Plugin;singleton:=true
Bundle-Version: 0.0.502
Bundle-Activator: com.jcraft.eclipse.jcterm.JCTermPlugin
Require-Bundle: org.eclipse.ui,
org.eclipse.core.runtime,
com.jcraft.jsch;bundle-version="0.1.31",
org.eclipse.core.resources;bundle-version="3.7.101",
org.eclipse.jsch.core;bundle-version="1.1.300",
com.jcraft.eclipse.jsch.core,
org.eclipse.mylyn.commons.ui;bundle-version="3.6.1"
Bundle-ActivationPolicy: lazy
Bundle-RequiredExecutionEnvironment: JavaSE-1.6
Bundle-Vendor: OSEHRA
Additionally I clicked compute dependencies within my Feature project and now have this updated into my feature.xml file:
<requires>
<import plugin="org.eclipse.ui"/>
<import plugin="org.eclipse.core.runtime"/>
<import plugin="com.jcraft.jsch" version="0.1.31" match="greaterOrEqual"/>
<import plugin="org.eclipse.core.resources" version="3.7.101" match="greaterOrEqual"/>
<import plugin="org.eclipse.jsch.core" version="1.1.300" match="greaterOrEqual"/>
<import plugin="com.jcraft.eclipse.jsch.core"/>
<import plugin="org.eclipse.mylyn.commons.ui" version="3.6.1" match="greaterOrEqual"/>
</requires>
However when I installed my custom plugin, and go to show it's view, the dependency is never being resolved:
java.lang.ClassNotFoundException: org.eclipse.mylyn.internal.provisional.commons.ui.AbstractNotificationPopup
at org.eclipse.osgi.internal.loader.BundleLoader.findClassInternal(BundleLoader.java:513)
at org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:429)
at org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:417)
at org.eclipse.osgi.internal.baseadaptor.DefaultClassLoader.loadClass(DefaultClassLoader.java:107)
at java.lang.ClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClass(Unknown Source)
at org.eclipse.osgi.internal.baseadaptor.DefaultClassLoader.defineClass(DefaultClassLoader.java:188)
at org.eclipse.osgi.baseadaptor.loader.ClasspathManager.defineClassHoldingLock(ClasspathManager.java:626)
at org.eclipse.osgi.baseadaptor.loader.ClasspathManager.defineClass(ClasspathManager.java:601)
at org.eclipse.osgi.baseadaptor.loader.ClasspathManager.findClassImpl(ClasspathManager.java:562)
at org.eclipse.osgi.baseadaptor.loader.ClasspathManager.findLocalClassImpl(ClasspathManager.java:486)
at org.eclipse.osgi.baseadaptor.loader.ClasspathManager.findLocalClass(ClasspathManager.java:459)
at org.eclipse.osgi.internal.baseadaptor.DefaultClassLoader.findLocalClass(DefaultClassLoader.java:216)
at org.eclipse.osgi.internal.loader.BundleLoader.findLocalClass(BundleLoader.java:400)
at org.eclipse.osgi.internal.loader.BundleLoader.findClassInternal(BundleLoader.java:476)
at org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:429)
at org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:417)
at org.eclipse.osgi.internal.baseadaptor.DefaultClassLoader.loadClass(DefaultClassLoader.java:107)
at java.lang.ClassLoader.loadClass(Unknown Source)
at com.jcraft.eclipse.jcterm.JCTermView.createPartControl(JCTermView.java:189)
at org.eclipse.ui.internal.ViewReference.createPartHelper(ViewReference.java:375)
at org.eclipse.ui.internal.ViewReference.createPart(ViewReference.java:229)
at org.eclipse.ui.internal.WorkbenchPartReference.getPart(WorkbenchPartReference.java:595)
at org.eclipse.ui.internal.Perspective.showView(Perspective.java:2245)
...

And the lesson from this question is
Don't ever use non-API classes, unless you don't care if your plug-in breaks in future versions.
I guess you have to build your plug-in twice, if you absolutely need backward compatibility.
But, since
you are targeting Indigo (3.7)
the bug, in the context of which the provisional packages became API, is Bug 360301
this bug fix was included in Mylyn 3.7
you are probably best of requiring org.eclipse.mylyn.commons.ui, version 3.7 and later.
Since you are using Eclipse 3.6 for development, you will have to set up a target platform including a 3.7 installation.

Are you sure you're running the plugin against the same version of mylyn that you built against? In newer versions of mylyn (3.8.0 for example) that class has been moved to package org.eclipse.mylyn.commons.ui.dialog.

Issue: Even though the "same" Indigo SR 2 version of Eclipse is being used, they are not equal. Some of them have 3.6 version of org.eclipse.mylyn.commons.ui other have 3.8 (which is supposed to be in Juno only...).

Related

Quick re-install remotely the needed plugins when upgrading Eclipse

I moved from Indigo to Luna Eclipse. Indigo and Luna are located in different area, meaning most of the plugins which my tool uses does not exists in the new Eclipse.
So I get errors for places like:
import org.eclipse.jface.resource.ImageDescriptor;
import org.eclipse.ui.plugin.AbstractUIPlugin;
import org.osgi.framework.BundleContext;
And also in the plugin.xml file:
<extension
id="application"
point="org.eclipse.core.runtime.applications">
<application>
<run
class="Application">
</run>
</application>
</extension>
<extension
point="org.eclipse.ui.perspectives">
<perspective
name="RCP Perspective"
class="Perspective"
id="MyFirstRCP.perspective">
</perspective>
</extension>
So I hope someone can answer the following questions:
Is there a quick way to re-download the needed plugins using the Eclipse (without third-party tools)?
If not, is it safe to just copy the needed plugins from the old directory to the new one?
The MAINFEST.MF file looks as follows:
Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: [TOOL_NAME]
Bundle-SymbolicName: com.[TOOL_NAME];singleton:=true
Bundle-Version: 3.6.4
Bundle-Activator: com.[TOOL_NAME].core.Activator
Require-Bundle: com.[PATH].util;bundle-version="1.0.0",
com.[TOOL_NAME].commons;bundle-version="1.0.0",
com.[TOOL_NAME].commons.testmanagement;bundle-version="1.0.0",
com.[TOOL_NAME].testlevel.ui;bundle-version="1.0.0",
com.[TOOL_NAME].report;bundle-version="1.0.0",
org.apache.commons.io;bundle-version="1.4.0",
org.eclipse.core.runtime,
org.eclipse.ui,
com.[TOOL_NAME].console;bundle-version="1.0.0",
com.[TOOL_NAME].scm;bundle-version="1.0.0",
com.[TOOL_NAME].preferences;bundle-version="1.0.0",
com.[TOOL_NAME].scm.testio;bundle-version="1.0.0",
com.[TOOL_NAME].disk;bundle-version="1.0.0",
Bundle-ActivationPolicy: lazy
Bundle-RequiredExecutionEnvironment: JavaSE-1.6
I replaced the tool name and its path with [TOOL_NAME] so it will be more readable. I have problems with org.eclipse.core.runtime and org.eclipse.ui.
Eclipse Luna requires a minimum of Java 7 to run, it will not run on Java 6. This applies to RCPs built on this platform as well as Eclipse itself.
Your errors are because the Bundle-RequiredExecutionEnvironment levels for some of the core Eclipse plug-ins are not being meet.

JAXBContextFactory hell - java.lang.ClassNotFoundException: com.ibm.xml.xlxp2.jaxb.JAXBContextFactory

I keep getting the following error in my dev environment. I use
Eclipse Mars 4.5.1
Oracle JDK 1.7 (build 1.7.0_79-b15) or 1.8 (build 1.8.0_65-b17)
Apache Ant to run the code as well as Eclipse to run the code
Ivy for dependency management where I include the following
<!-- 3rd party dependencies -->
<dependency org="log4j" name="log4j" rev="1.2.16" conf="test->default"/>
<dependency org="commons-httpclient" name="commons-httpclient" rev="3.1" conf="compile->default"/>
<dependency org="org.jvnet.jaxb2_commons" name="jaxb2-basics-runtime" rev="0.6.4" conf="default->runtime"/>
<dependency org="org.jvnet.jaxb2_commons" name="jaxb2-basics-tools" rev="0.6.4" conf="default->runtime"/>
<dependency org="org.jvnet.jaxb2_commons" name="jaxb2-basics" rev="0.6.4" conf="default->runtime"/>
I've seen the other posts on this topic but their answers don't help much. I tried using a jaxb.properties but that did not change the behavior.
javax.xml.bind.context.factory=com.sun.tools.xjc.runtime.JAXBContextFactory
Exception in thread "main" javax.xml.bind.JAXBException
- with linked exception:
[java.lang.ClassNotFoundException: com.ibm.xml.xlxp2.jaxb.JAXBContextFactory]
at javax.xml.bind.ContextFinder.newInstance(ContextFinder.java:227)
at javax.xml.bind.ContextFinder.find(ContextFinder.java:432)
at javax.xml.bind.JAXBContext.newInstance(JAXBContext.java:637)
at javax.xml.bind.JAXBContext.newInstance(JAXBContext.java:584)
at com.acme.merge.util.ProjectsInformation.unMarshal(ProjectsInformation.java:24)
at com.acme.merge.controller.MergeController.main(MergeController.java:44)
Caused by: java.lang.ClassNotFoundException: com.ibm.xml.xlxp2.jaxb.JAXBContextFactory
at java.net.URLClassLoader$1.run(URLClassLoader.java:366)
at java.net.URLClassLoader$1.run(URLClassLoader.java:355)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:354)
at java.lang.ClassLoader.loadClass(ClassLoader.java:425)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308)
at java.lang.ClassLoader.loadClass(ClassLoader.java:358)
at javax.xml.bind.ContextFinder.safeLoadClass(ContextFinder.java:563)
at javax.xml.bind.ContextFinder.newInstance(ContextFinder.java:225)
... 5 more
What am I overlooking?
I found the root cause. Some of my dependencies in ivy have transitive dependencies that bring in some IBM WS libraries. These libraries override my settings and force the use of com.ibm.xml.xlxp2.jaxb.JAXBContextFactory. Excluding these resolved my issue.
The conflicting jar is from package com.ibm.ws and is called runtime.jar.
The solution that seem to work for me :
https://java.wekeepcoding.com/article/19606872/Issue+in+creating+an+instance+of+JAX-WS+client+to+access+the+service
The Missing class "com.ibm.xml.xlxp2.jaxb.JAXBContextFactory" is available in the jar "com.ibm.jaxws.thinclient_8.5.0.jar" which will be available in the server runtime directory for Websphere App server : C:\Program Files\IBM\WebSphere\AppServer\runtimes.
Please include this jar for compile purpose only and donot include this in your WAR or EAR as it will conflict with your server runtime library jar.
For server WAS 8.0 the path jar would be "com.ibm.jaxws.thinclient_8.0.0.jar".

java.lang.NoClassDefFoundError: org/apache/poi/xssf/usermodel/XSSFWorkbook

I was getting this exception but I am not able to understand what is happening there.
Because on compilation time my class able access apache POI classes but on runtime my classes throws exception that he is not able find
org.apache.poi.xssf.usermodel.XSSFWorkbook.
Till now whatever solution is provided on net I have tried everything but not understanding what I am missing.
And weird thing is same code and same Apache POI library working on my friend's eclipse. We both have identical projects. Don't understand what is going on there.
I checked all folder's access where I am referring libraries.
Please share if you have any suggestion.
I am getting the following exception.
!MESSAGE Unhandled event loop exception
!STACK 0
java.lang.NoClassDefFoundError: org/apache/poi/xssf/usermodel/XSSFWorkbook
at com.herzog.pmide.mergedconfigxml.ui.editors.DocumentGenerator.prepareScadaIOListExcel(DocumentGenerator.java:94)
at com.herzog.pmide.mergedconfigxml.ui.editors.DocumentGenerator.scadaIOList(DocumentGenerator.java:77)
at com.herzog.pmide.mergedconfigxml.ui.actions.DocumentGeneratorAction.run(DocumentGeneratorAction.java:47)
at org.eclipse.ui.internal.PluginAction.runWithEvent(PluginAction.java:253)
at org.eclipse.jface.action.ActionContributionItem.handleWidgetSelection(ActionContributionItem.java:595)
at org.eclipse.jface.action.ActionContributionItem.access$2(ActionContributionItem.java:511)
at org.eclipse.jface.action.ActionContributionItem$5.handleEvent(ActionContributionItem.java:420)
at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:84)
at org.eclipse.swt.widgets.Display.sendEvent(Display.java:4353)
at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1061)
at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:4172)
at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3761)
at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine$9.run(PartRenderingEngine.java:1151)
at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:331)
at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.run(PartRenderingEngine.java:1032)
at org.eclipse.e4.ui.internal.workbench.E4Workbench.createAndRunUI(E4Workbench.java:148)
at org.eclipse.ui.internal.Workbench$5.run(Workbench.java:636)
at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:331)
at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:579)
at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:150)
at com.herzog.pmide.application.Application.start(Application.java:20)
at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:196)
at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:134)
at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:104)
at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:380)
at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:235)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:483)
at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:648)
at org.eclipse.equinox.launcher.Main.basicRun(Main.java:603)
at org.eclipse.equinox.launcher.Main.run(Main.java:1465)
at org.eclipse.equinox.launcher.Main.main(Main.java:1438)
Caused by: java.lang.ClassNotFoundException: org.apache.poi.xssf.usermodel.XSSFWorkbook cannot be found by com.herzog.pmide.mergedconfigxml.ui_1.0.0.qualifier
at org.eclipse.osgi.internal.loader.BundleLoader.findClassInternal(BundleLoader.java:432)
at org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:345)
at org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:337)
at org.eclipse.osgi.internal.loader.ModuleClassLoader.loadClass(ModuleClassLoader.java:160)
at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
MANIFEST.MF as follow
Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: Ui
Bundle-SymbolicName: com.herzog.pmide.mergedconfigxml.ui;singleton:=true
Bundle-Version: 1.0.0.qualifier
Bundle-Activator: com.herzog.pmide.mergedconfigxml.ui.Activator
Bundle-Vendor: Example
Require-Bundle: org.eclipse.ui,
org.eclipse.core.runtime,
org.eclipse.core.resources,
org.eclipse.emf.ecore.xmi,
org.eclipse.emf.edit.ui,
com.herzog.pmide.machinelib.model.edit,
org.eclipse.ui.forms,
org.eclipse.ui.workbench,
org.eclipse.ui.ide,
com.herzog.pmide.mergedconfigxml.model.edit,
org.eclipse.gef,
com.herzog.pmide.tools.importutility,
com.herzog.pmide.machinelib.model,
org.eclipse.swt,
org.eclipse.emf.query,
com.herzog.pmide.mergedconfigxml.model,
org.eclipse.ui.editors,
org.eclipse.emf.validation,
org.eclipse.emf.validation.ui,
org.slf4j.api,
org.junit,
org.eclipse.emf.compare,
org.eclipse.emf.compare.edit,
org.eclipse.emf.compare.ide.ui,
org.eclipse.compare,
org.apache.commons.io,
org.eclipse.core.filesystem,
de.vonloesch.pdf4Eclipse,
de.vonloesch.pdf4eclipse.help,
com.herzog.pmide.routingline.model
Bundle-ActivationPolicy: lazy
Bundle-ClassPath: .
Export-Package: com.herzog.pmide.mergedconfigxml.ui,
com.herzog.pmide.mergedconfigxml.ui.editors.unitconfig,
com.herzog.pmide.mergedconfigxml.ui.views
Bundle-Localization: OSGI-INF/l10n/message
build.properties as follow
source.. = src/
output.. = bin/
bin.includes = META-INF/,\
.,\
plugin.xml,\
icons/,\
OSGI-INF/l10n/message.properties
A plugin can only access classes in other plugins or in jars included in the plugin which are included in the bundle class path. Setting the Java Build Path properties does not configure the plugin correctly.
Add all the jars you need to the plugin, usually these are put in a 'lib' directory.
Update the build.properties to include these jars in the 'bin.includes' section. For example:
source.. = src/
output.. = bin/
bin.includes = META-INF/,\
.,\
plugin.properties,\
plugin.xml,\
lib/,\
lib/jogg-0.0.7.jar,\
lib/jorbis-0.0.15.jar,\
lib/vorbisspi1.0.2.jar
Here I have 3 jars in a lib directory (these are not the POI jars, this is just an example from one of my projects).
Update the MANIFEST.MF and set the Bundle-Classpath to include the jars. You can do this in the MANIFEST.MF editor in the 'Runtime' tab in the 'Classpath' section (use the Add... button to the right of the list and choose the libraries in the plugin). Be sure to leave the entry for '.'. Your MANIFEST.MF should end up containing a `Bundle-Classpath' entry like this:
Bundle-ClassPath: .,
lib/jogg-0.0.7.jar,
lib/jorbis-0.0.15.jar,
lib/vorbisspi1.0.2.jar

Jboss 6.4 Infinispan 8.2 and JGroups - ClassNotFoundException

I need some features from Infinispan 8+. Therefore I have updated my company app pom.xml with the newest Infinispan pom.
It was quite straightforward, but the app uses jgroups (or its default config in default-configs/default-jgroups-udp.xml - this location is different from previous versions of infinispan). The default versions have some parameters (and the XSD from Jgroups version 3.6) - so I also bumped jgroups to 3.6.8.Final as it looks like it is the intended version (and the version that does not complain about unknown parameters in default config in infinispan 8.2)
so the pom is the following:
<dependency>
<groupId>org.jgroups</groupId>
<artifactId>jgroups</artifactId>
<version>3.6.8.Final</version>
</dependency>
<dependency>
<groupId>org.infinispan</groupId>
<artifactId>infinispan-core</artifactId>
<version>8.2.0.Final</version>
</dependency>
Anyway - this application starts with no problems using spring-boot with Jetty. I am pretty sure it would start on any application server.
But then I have no choice but to run it on JBoss 6.4.
There I got an exception involving some jboss.as classes (this is kind of unexpected) during the deployment:
Caused by: org.infinispan.commons.CacheException: Unable to invoke method public void org.infinispan.remoting.transport.jgroups.JGroupsTransport.start() on object of type JGroupsTransport
at org.infinispan.commons.util.ReflectionUtil.invokeAccessibly(ReflectionUtil.java:172)
at org.infinispan.factories.AbstractComponentRegistry$PrioritizedMethod.invoke(AbstractComponentRegistry.java:859)
at org.infinispan.factories.AbstractComponentRegistry.invokeStartMethods(AbstractComponentRegistry.java:628)
at org.infinispan.factories.AbstractComponentRegistry.internalStart(AbstractComponentRegistry.java:617)
at org.infinispan.factories.AbstractComponentRegistry.start(AbstractComponentRegistry.java:542)
at org.infinispan.factories.GlobalComponentRegistry.start(GlobalComponentRegistry.java:234)
... 141 more
Caused by: java.lang.ExceptionInInitializerError
at org.jgroups.conf.XmlConfigurator.<clinit>(XmlConfigurator.java:35)
at org.jgroups.conf.ConfiguratorFactory.getStackConfigurator(ConfiguratorFactory.java:62)
at org.jgroups.JChannel.<init>(JChannel.java:129)
at org.infinispan.remoting.transport.jgroups.JGroupsTransport.buildChannel(JGroupsTransport.java:419)
at org.infinispan.remoting.transport.jgroups.JGroupsTransport.initChannel(JGroupsTransport.java:320)
at org.infinispan.remoting.transport.jgroups.JGroupsTransport.initChannelAndRPCDispatcher(JGroupsTransport.java:366)
at org.infinispan.remoting.transport.jgroups.JGroupsTransport.start(JGroupsTransport.java:190)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.infinispan.commons.util.ReflectionUtil.invokeAccessibly(ReflectionUtil.java:168)
... 146 more
Caused by: java.lang.RuntimeException: java.lang.ClassNotFoundException: org.jboss.as.clustering.jgroups.LogFactory from [Module "deployment.mymodule-5.0.0.0-SNAPSHOT.ear.appName.war:main" from Service Module Loader]
at org.jgroups.logging.LogFactory.<clinit>(LogFactory.java:31)
... 158 more
Caused by: java.lang.ClassNotFoundException: org.jboss.as.clustering.jgroups.LogFactory from [Module "deployment.mymodule-5.0.0.0-SNAPSHOT.ear.appName.war:main" from Service Module Loader]
at org.jboss.modules.ModuleClassLoader.findClass(ModuleClassLoader.java:213)
at org.jboss.modules.ConcurrentClassLoader.performLoadClassUnchecked(ConcurrentClassLoader.java:459)
at org.jboss.modules.ConcurrentClassLoader.performLoadClassChecked(ConcurrentClassLoader.java:408)
at org.jboss.modules.ConcurrentClassLoader.performLoadClass(ConcurrentClassLoader.java:389)
at org.jboss.modules.ConcurrentClassLoader.loadClass(ConcurrentClassLoader.java:134)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Unknown Source)
at org.jgroups.logging.LogFactory.<clinit>(LogFactory.java:28)
... 158 more
My guess is that org.jgroups.logging.LogFactory somehow discovers that is is running on a Jboss and tries to use org.jboss.as.clustering.jgroups.LogFactory but this version of Jboss does not have one. (the server directory EAP-6.4.0\modules\system\layers\base\org\jgroups\main contains jgroups version 3.2.X).
Is there any walkaround to use this jgroups version (and so Infinispan 8.2) in Jboss 6.4?
This is (the application) an ear file so I can manipulate jboss-deployment-structure.xml file, but so far I only came with excluding Jboss original jgroups, and this did not help.
<exclusions>
<module name="org.jgroups"/>
</exclusions>
This is currently bug with Infinispan 8 + EAP 6.4 combination. The reason is exactly as #Flavius says in comments. Currently there is discussion where to fix it, but it'll mostly likely be fixed in EAP 6.4. I'm sure it will be done soon.
I can only offer you a working workarounds.
Use WildFly - the issue is not present there anymore
Little nasty workaround, but it works:
Call System.clearProperty("jgroups.logging.log_factory_class"); in the deployment
Include JBoss Logging of version specified in infinispan-bom in your deployment (e.g. add jboss-logging Maven dependency in your pom.xml)
Provide jboss-deployment-structure.xml to your deployment, which excludes the server's JBoss logging, see below:
<jboss-deployment-structure>
<deployment>
<exclusions>
<module name="org.jboss.logging" />
</exclusions>
</deployment>
</jboss-deployment-structure>
Another possibility if none of the above workarounds work (for instance the app uses other log mechanisms) is to implement an own
http://www.jgroups.org/javadoc/org/jgroups/logging/CustomLogFactory.html
The log factory must return a log instance, implementing it for any other logger is straightforward with methods trace/error/debug etc.
Then this logger class can be set with System.setProperty("jgroups.logging.log_factory_class","my.company.logging.MyJgroupsLog");

OSGi bundle's Activator class not found

I have an OSGi bundle, which has an activator class. I embedded Equinox in my webapp, and installed my bundle in it. The installation goes well, but when I try to start the bundle, the following error comes:
org.osgi.framework.BundleException: The activator com.rr.fr.base.barcode.activator.Activator for bundle fr-base-barcode is invalid
at org.eclipse.osgi.framework.internal.core.AbstractBundle.loadBundleActivator(AbstractBundle.java:171)
at org.eclipse.osgi.framework.internal.core.BundleContextImpl.start(BundleContextImpl.java:679)
at org.eclipse.osgi.framework.internal.core.BundleHost.startWorker(BundleHost.java:381)
at org.eclipse.osgi.framework.internal.core.AbstractBundle.start(AbstractBundle.java:299)
at org.eclipse.osgi.framework.internal.core.AbstractBundle.start(AbstractBundle.java:291)
at com.rr.fr.base.osgi.BundleStarter.launch(BundleStarter.java:43)
at com.rr.fr.base.osgi.OsgiInitServletContextListener.contextInitialized(OsgiInitServletContextListener.java:41)
at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4210)
at org.apache.catalina.core.StandardContext.start(StandardContext.java:4709)
at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1060)
at org.apache.catalina.core.StandardHost.start(StandardHost.java:822)
at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1060)
at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:463)
at org.apache.catalina.core.StandardService.start(StandardService.java:525)
at org.apache.catalina.core.StandardServer.start(StandardServer.java:759)
at org.apache.catalina.startup.Catalina.start(Catalina.java:595)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:497)
at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:289)
at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:414)
Caused by: java.lang.ClassNotFoundException: com.rr.fr.base.barcode.activator.Activator
at org.eclipse.osgi.internal.loader.BundleLoader.findClassInternal(BundleLoader.java:513)
at org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:429)
at org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:417)
at org.eclipse.osgi.internal.baseadaptor.DefaultClassLoader.loadClass(DefaultClassLoader.java:107)
at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
at org.eclipse.osgi.internal.loader.BundleLoader.loadClass(BundleLoader.java:345)
at org.eclipse.osgi.framework.internal.core.BundleHost.loadClass(BundleHost.java:229)
at org.eclipse.osgi.framework.internal.core.AbstractBundle.loadBundleActivator(AbstractBundle.java:164)
... 21 more
I can see that my activator class was not found. I searched for a solution and find some interesting thing here in SO, but none of them helped me.
Here is my manifest:
Manifest-Version: 1.0
Bnd-LastModified: 1431100911346
Build-Jdk: 1.6.0_45
Bundle-Activator: com.rr.fr.base.barcode.activator.Activator
Bundle-ManifestVersion: 2
Bundle-SymbolicName: fr-base-barcode;singleton:=true
Bundle-Version: 0.1.2.SNAPSHOT
Created-By: Apache Maven Bundle Plugin
Import-Package: com.rr.fr.base.barcode.qrcode.interfaces,com.rr.fr.base.
exception,com.rr.fr.base.messages,com.rr.fr.base.system,com.rr.fr.base.
types,com.rr.fr.interfaces,com.rr.fr.interfaces.eb.rms,com.rr.fr.ui.htt
p,hu.posta.rsaqrgen,javax.servlet,javax.servlet.http,org.apache.avalon.
framework.configuration,org.apache.commons.logging,or
g.krysalis.barcode4j,org.krysalis.barcode4j.output,org.krysalis.barcode
4j.output.bitmap,org.krysalis.barcode4j.output.eps,org.osgi.framework,org.osgi.service.http,org.osgi.util.
tracker
I can include my Activator, but I don't think it would help since it isn't even found so I don't think its source has anything to do with the error.
My bundle's library structure inside the JAR is the following:
META-INF
/MANIFEST.MF
target
/classes
/com
/rr
/fr
/base
/barcode
...
fr-base-barcode.jar
plugin.xml
I create my bundle with Eclipse PDE: Export.../Deployable Plug-ins and fragments
My build.properties includes the META-INF and target libraries, a JAR and plugin.xml as it can be seen in the bundle structure.
Any help would be appreciated.
I'm going to restate bkail's suggestion as the answer. When your packages are included in the "target/classes" folder, they are essentially in that package:
target.classes.com.rr.fr.base.barcode.*
The root of your package structure (com) should be a peer of META-INF and/or OSGI-INF, etc.
From : https://netbeans.org/kb/docs/javaee/maven-osgiservice-cdi.html#Exercise_3
<plugin>
<artifactId>maven-war-plugin</artifactId>
<configuration>
<archive>
<manifestFile>${project.build.outputDirectory}/META-INF/MANIFEST.MF</manifestFile>
<manifestEntries>
<Bundle-ClassPath>WEB-INF/classes/</Bundle-ClassPath>
</manifestEntries>
</archive>
</configuration>
</plugin>

Categories

Resources