Java Lang Error OSGI bundle - java

I have to implement an old peace of code as an OSGI bundle apparently this old code heavily depends on swing components even though I have included all of the swing dependencies to bundle manifest I still get the following exception, which is caused by jgraph, jgraph.jar is also included as a run time dependency. I am not very sure what is the problem. Any help will be appreciated
Caused by: java.lang.Error: Cannot load com.apple.laf.AquaLookAndFeel
at javax.swing.UIManager.initializeDefaultLAF(UIManager.java:1351)
at javax.swing.UIManager.initialize(UIManager.java:1459)
at javax.swing.UIManager.maybeInitialize(UIManager.java:1426)
at javax.swing.UIManager.getDefaults(UIManager.java:659)
at javax.swing.JComponent.setUI(JComponent.java:662)
at org.jgraph.JGraph.setUI(JGraph.java:792)
at org.jgraph.JGraph.updateUI(JGraph.java:806)
at org.jgraph.JGraph.<init>(JGraph.java:767)
at org.jgraph.JGraph.<init>(JGraph.java:721)
at org.jgraph.JGraph.<init>(JGraph.java:697)
at org.processmining.plugins.declareminer.visualizing.DGraph.<init>(DGraph.java:35)
at org.processmining.plugins.declareminer.visualizing.ModelView.<init>(ModelView.java:37)
at org.processmining.plugins.declareminer.visualizing.AssignmentModelView.<init>(AssignmentModelView.java:43)
at ee.ut.deviance.preprocessing.DeclareDevianceModelGenerator.generateModel(DeclareDevianceModelGenerator.java:405)
at ee.ut.cs.rum.declare.deviance.miner.plugin.v2.factory.RumPluginWorkerImpl.runWork(RumPluginWorkerImpl.java:177)
at ee.ut.cs.rum.declare.deviance.miner.plugin.v2.Activator.start(Activator.java:25)
at org.eclipse.osgi.framework.internal.core.BundleContextImpl$1.run(BundleContextImpl.java:711)
at java.security.AccessController.doPrivileged(Native Method)
at org.eclipse.osgi.framework.internal.core.BundleContextImpl.startActivator(BundleContextImpl.java:702)

Related

ExtendedLogService does not appear to start

I am attempting to run an Eclipse 3.x application using Equinox in Neon as initiated in this question.
It appears that my remaining issue is that the LogReaderService appears to not be available, as the second line below in org.eclipse.core.internal.runtime.InternalPlatform.getLog() appears to throw a NullPointerException:
ExtendedLogReaderService logReader = logReaderTracker.getService();
logReader.addLogListener(result, result);
An implementation of this class can be found in org.eclipse.osgi, which I am launching the application with. For whatever reason, though, the service is null, which causes a number of plug-ins to throw exceptions when logging since many of the plug-ins rely on getting the Logging service from the Activator.
Since org.eclipse.osgi contains the implementation in its internals, I assumed that it would also register the service. That does not appear to be the case. I have also tried including log4j and org.apache.felix.log and neither appear to resolve this problem.
There must be something simple that is missing here to get the LogService to start? Here's the stack trace:
Caused by: java.lang.ClassNotFoundException: An error occurred while automatically activating bundle org.eclipse.core.resources (44).
at org.eclipse.osgi.internal.hooks.EclipseLazyStarter.postFindLocalClass(EclipseLazyStarter.java:116)
at org.eclipse.osgi.internal.loader.classpath.ClasspathManager.findLocalClass(ClasspathManager.java:529)
at org.eclipse.osgi.internal.loader.ModuleClassLoader.findLocalClass(ModuleClassLoader.java:325)
at org.eclipse.osgi.internal.loader.BundleLoader.findLocalClass(BundleLoader.java:345)
at org.eclipse.osgi.internal.loader.sources.SingleSourcePackage.loadClass(SingleSourcePackage.java:36)
at org.eclipse.osgi.internal.loader.BundleLoader.findClassInternal(BundleLoader.java:419)
at org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:372)
at org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:364)
at org.eclipse.osgi.internal.loader.ModuleClassLoader.loadClass(ModuleClassLoader.java:161)
at java.lang.ClassLoader.loadClass(Unknown Source)
... 20 more
Caused by: org.osgi.framework.BundleException: Exception in org.eclipse.core.resources.ResourcesPlugin.start() of bundle org.eclipse.core.resources.
at org.eclipse.osgi.internal.framework.BundleContextImpl.startActivator(BundleContextImpl.java:795)
at org.eclipse.osgi.internal.framework.BundleContextImpl.start(BundleContextImpl.java:724)
at org.eclipse.osgi.internal.framework.EquinoxBundle.startWorker0(EquinoxBundle.java:932)
at org.eclipse.osgi.internal.framework.EquinoxBundle$EquinoxModule.startWorker(EquinoxBundle.java:309)
at org.eclipse.osgi.container.Module.doStart(Module.java:581)
at org.eclipse.osgi.container.Module.start(Module.java:449)
at org.eclipse.osgi.framework.util.SecureAction.start(SecureAction.java:470)
at org.eclipse.osgi.internal.hooks.EclipseLazyStarter.postFindLocalClass(EclipseLazyStarter.java:107)
... 29 more
Caused by: java.lang.NullPointerException
at org.eclipse.core.internal.runtime.InternalPlatform.getLog(InternalPlatform.java:353)
at org.eclipse.core.runtime.Platform.getLog(Platform.java:976)
at org.eclipse.core.internal.utils.Policy.log(Policy.java:159)
at org.eclipse.core.internal.resources.Workspace.setCrashed(Workspace.java:2302)
at org.eclipse.core.internal.resources.SaveManager.restoreSnapshots(SaveManager.java:963)
at org.eclipse.core.internal.resources.SaveManager.restore(SaveManager.java:720)
at org.eclipse.core.internal.resources.SaveManager.startup(SaveManager.java:1587)
at org.eclipse.core.internal.resources.Workspace.startup(Workspace.java:2399)
at org.eclipse.core.internal.resources.Workspace.open(Workspace.java:2156)
at org.eclipse.core.resources.ResourcesPlugin.start(ResourcesPlugin.java:464)
at org.eclipse.osgi.internal.framework.BundleContextImpl$3.run(BundleContextImpl.java:774)
at org.eclipse.osgi.internal.framework.BundleContextImpl$3.run(BundleContextImpl.java:1)
at java.security.AccessController.doPrivileged(Native Method)
at org.eclipse.osgi.internal.framework.BundleContextImpl.startActivator(BundleContextImpl.java:767)
... 36 more
I also added
Require-Capability: osgi.service;filter:="(objectClass=org.osgi.service.log.LogService)";effective:=active
To one of the dependent bnd files. This did not appear to solve the problem.
Edit: Because the OSGI Framework is set to org.eclipse.osgi in the bndrun file, is that preventing the logging from getting initialized? I have also tried adding org.apache.commons.logging as well as osgi.enroute.equinox.log.adapter and I am still getting NPEs when anything attempts to log. The org.eclipse.osgi bundle is already considered running by the time the RCP plugins get activated... yet there is no ExtendedLogReaderService. Do I need to find a way to install Felix as the Core Runtime in order to make org.eclipse.osgi able to get started by the framework in order for the ExtendedLogReaderServiceImpl to get registered?
I have found numerous examples of how to listen for the LogService... I'm not seeing how to start the ExtendedLogService.
Edit 2: I am able to suppress the LogService nulls issue by registering dummy ExtendedLogService implementations.
The problem has been resolved (finally), revisiting this now that our build system is in place the solution was likely that osgi.enterprise was not a Required-Bundle which also caused caused our OSGI-JDBC services to not work properly when testing the deployed target platforms.
Additionally, our primary RCP plug-in (containing the Application class, etc.) did not have a Bundle-ActivationPolicy: lazy clause in the *.bnd files used to generate the MANIFEST.MF file which lead to some other problems.
Just in case anyone else runs into such problems.

"No dependency satisfies type class org.neo4j.kernel.api.index.SchemaIndexProvider" when building über-jar

I have manually downloaded and added the libraries log4j, jsoup and neo4j for a project in Intellij Idea.
Before adding neo4j, I could build a jar as an artifact with all the libraries extracted to it so i could directly copy it somewhere and run with java -jar file.jar.
When I run the application in IntelliJ Idea it always works!
Now i get the following error when running the jar:
Error: A JNI error has occurred, please check your installation and try again Exception in thread "main" java.lang.SecurityException: Invalid signature file digest for Manifest main attributes
at sun.security.util.SignatureFileVerifier.processImpl(SignatureFileVerifier.java:314)
at sun.security.util.SignatureFileVerifier.process(SignatureFileVerifier.java:268)
at java.util.jar.JarVerifier.processEntry(JarVerifier.java:316)
at java.util.jar.JarVerifier.update(JarVerifier.java:228)
at java.util.jar.JarFile.initializeVerifier(JarFile.java:383)
at java.util.jar.JarFile.getInputStream(JarFile.java:450)
at sun.misc.JarIndex.getJarIndex(JarIndex.java:137)
at sun.misc.URLClassPath$JarLoader$1.run(URLClassPath.java:839)
at sun.misc.URLClassPath$JarLoader$1.run(URLClassPath.java:831)
at java.security.AccessController.doPrivileged(Native Method)
at sun.misc.URLClassPath$JarLoader.ensureOpen(URLClassPath.java:830)
at sun.misc.URLClassPath$JarLoader.<init>(URLClassPath.java:803)
at sun.misc.URLClassPath$3.run(URLClassPath.java:530)
at sun.misc.URLClassPath$3.run(URLClassPath.java:520)
at java.security.AccessController.doPrivileged(Native Method)
at sun.misc.URLClassPath.getLoader(URLClassPath.java:519)
at sun.misc.URLClassPath.getLoader(URLClassPath.java:492)
at sun.misc.URLClassPath.getNextLoader(URLClassPath.java:457)
at sun.misc.URLClassPath.getResource(URLClassPath.java:211)
at java.net.URLClassLoader$1.run(URLClassLoader.java:365)
at java.net.URLClassLoader$1.run(URLClassLoader.java:362)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:361)
at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:331)
at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
at sun.launcher.LauncherHelper.checkAndLoadMain(LauncherHelper.java:495)
I already searched for the error and found that a library seems to be signed and I can't just pack it into another jar, because it thinks it was modified then.
The suggested solution was to exclude the signing files through the build system.
I tried to manually delete the BCKEY.dsa and the BCKEY.sf files (only signing files in META-INF folder) in the resulting jar but then I get the following error:
Exception in thread "main" java.lang.RuntimeException: Error starting org.neo4j.kernel.impl.factory.CommunityFacadeFactory, /home/xuiqzy/Documents/uni/4.Semester/PRG_practicum/WikiXtractor/data
at org.neo4j.kernel.impl.factory.GraphDatabaseFacadeFactory.newFacade(GraphDatabaseFacadeFactory.java:144)
at org.neo4j.kernel.impl.factory.CommunityFacadeFactory.newFacade(CommunityFacadeFactory.java:40)
at org.neo4j.kernel.impl.factory.GraphDatabaseFacadeFactory.newFacade(GraphDatabaseFacadeFactory.java:108)
at org.neo4j.graphdb.factory.GraphDatabaseFactory.newDatabase(GraphDatabaseFactory.java:100)
at org.neo4j.graphdb.factory.GraphDatabaseFactory.lambda$createDatabaseCreator$0(GraphDatabaseFactory.java:89)
at org.neo4j.graphdb.factory.GraphDatabaseBuilder.newGraphDatabase(GraphDatabaseBuilder.java:183)
at org.neo4j.graphdb.factory.GraphDatabaseFactory.newEmbeddedDatabase(GraphDatabaseFactory.java:65)
at de.bened.wikixtractor.DatabaseManager.initialize(DatabaseManager.java:43)
at de.bened.wikixtractor.Main.main(Main.java:83)
Caused by: org.neo4j.kernel.lifecycle.LifecycleException: Component 'org.neo4j.kernel.NeoStoreDataSource#5c67716' was successfully initialized, but failed to start. Please see attached cause exception.
at org.neo4j.kernel.lifecycle.LifeSupport$LifecycleInstance.start(LifeSupport.java:444)
at org.neo4j.kernel.lifecycle.LifeSupport.start(LifeSupport.java:107)
at org.neo4j.kernel.impl.transaction.state.DataSourceManager.start(DataSourceManager.java:99)
at org.neo4j.kernel.lifecycle.LifeSupport$LifecycleInstance.start(LifeSupport.java:434)
at org.neo4j.kernel.lifecycle.LifeSupport.start(LifeSupport.java:107)
at org.neo4j.kernel.impl.factory.GraphDatabaseFacadeFactory.newFacade(GraphDatabaseFacadeFactory.java:140)
... 8 more
Caused by: org.neo4j.kernel.impl.util.UnsatisfiedDependencyException: No dependency satisfies type class org.neo4j.kernel.api.index.SchemaIndexProvider
at org.neo4j.kernel.impl.util.Dependencies.resolveDependency(Dependencies.java:71)
at org.neo4j.kernel.impl.util.Dependencies.resolveDependency(Dependencies.java:67)
at org.neo4j.kernel.NeoStoreDataSource.start(NeoStoreDataSource.java:418)
at org.neo4j.kernel.lifecycle.LifeSupport$LifecycleInstance.start(LifeSupport.java:434)
... 13 more
I also searched that error, a META-INF/services/org.neo4j.kernel.extension.KernelExtensionFactory file exists in my jar, there are also the jars lucene-analyzers-commen, lucene-codecs, lucene-core, lucene-queryparser, neo4j-lucene-index and neo4j-lucene-upgrade all integrated in the über-jar and the build in IntelliJ Idea seems to have enough dependencies, too.
So I'm a bit clueless why the jar doesn't work as opposed to the build in the IDE.
Long term I'm willing to switch to a build system but for now:
Is there a way to get the jar to run?
Any help or pointers in the right direction are appreciated! :)

java.lang.UnsatisfiedLinkError: cqjnilinuxproxy (Not found in java.library.path)

I have webservices deployed on WAS that use Clearquest jars to connect to Clearquest. At runtime, I get the following errors.
java.lang.Exception: Cannot parse the output since it has an error. Error = ReasonCode = conflictCRVAP0049E (internal-error): Cannot instantiate protocol provider: cqjnilinuxproxy (Not found in java.library.path)
...java.lang.reflect.InvocationTargetException:
at com.ibm.rational.stp.cs.internal.util.StpExceptionImpl.realException(StpExceptionImpl.java:493)
at com.ibm.rational.stp.cs.internal.util.StpExceptionImpl.<init>(StpExceptionImpl.java:572)
Caused by: java.lang.reflect.InvocationTargetException
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:56)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:39)
at java.lang.reflect.Constructor.newInstance(Constructor.java:527)
at com.ibm.rational.stp.client.internal.core.ProtocolSubprovider.setProtocolProvider(ProtocolSubprovider.java:614)
... 57 more
Caused by: java.lang.UnsatisfiedLinkError: cqjnilinuxproxy (Not found in java.library.path)
at java.lang.ClassLoader.loadLibraryWithPath(ClassLoader.java:1090)
at java.lang.ClassLoader.loadLibraryWithClassLoader(ClassLoader.java:1054)
at java.lang.System.loadLibrary(System.java:510)
at com.rational.clearquest.cqjni.CQJNIBaseObj.<clinit>(Unknown Source)
at java.lang.J9VMInternals.initializeImpl(Native Method)
at java.lang.J9VMInternals.initialize(J9VMInternals.java:235)
at java.lang.J9VMInternals.initialize(J9VMInternals.java:202)
at com.ibm.rational.stp.client.internal.cqjni.CqJniProtocol.<init>(CqJniProtocol.java:2343)
... 62 more
I followed the technote https://www-304.ibm.com/support/docview.wss?uid=swg21515079 - "An exception occurs on 64-bit WebSphere servers when running reports from ClearQuest data sources that require the Java Native Interface (JNI).
As suggested, WAS 32-bit was installed instead on 64 bit. But the error still occurs. Can you please let me know where this library is or what is going wrong?
Thanks,
Aarthi
The ClearQuest libraries and jars need to be placed on the path so WebSphere can pick them up. Did you source cq_setup.csh prior to starting the WebSphere profile? You would need to source cq_setup.csh and then start the profile in the same shell.

hadoop jaxb classpath issue

I am seeing this inside a hadoop job:
2014-08-21 09:26:57,216 ERROR org.apache.hadoop.mapred.Child: Error running child : java.lang.ExceptionInInitializerError
at com.sun.xml.internal.ws.client.sei.SyncMethodHandler.invoke(SyncMethodHandler.java:107)
at com.sun.xml.internal.ws.client.sei.SyncMethodHandler.invoke(SyncMethodHandler.java:78)
at com.sun.xml.internal.ws.client.sei.SEIStub.invoke(SEIStub.java:129)
at com.sun.proxy.$Proxy61.describeVehicle(Unknown Source)
at com.company.inventory.externalapi.externalsoapclient.ExternalClientImpl.getFromSoap(ExternalClientImpl.java:46)
at com.company.dataservices.external.hadoop.ExternalIngestionProcess.populateExternalCache(ExternalIngestionProcess.java:112)
at com.company.dataservices.external.hadoop.ExternalIngestionProcess.map(ExternalIngestionProcess.java:93)
at com.company.dataservices.external.hadoop.ExternalIngestionProcess.map(ExternalIngestionProcess.java:38)
at org.apache.hadoop.mapreduce.Mapper.run(Mapper.java:140)
at org.apache.hadoop.mapred.MapTask.runNewMapper(MapTask.java:672)
at org.apache.hadoop.mapred.MapTask.run(MapTask.java:330)
at org.apache.hadoop.mapred.Child$4.run(Child.java:268)
at java.security.AccessController.doPrivileged(Native Method)
at javax.security.auth.Subject.doAs(Subject.java:415)
at org.apache.hadoop.security.UserGroupInformation.doAs(UserGroupInformation.java:1438)
at org.apache.hadoop.mapred.Child.main(Child.java:262)
Caused by: java.lang.ClassCastException: com.sun.xml.bind.v2.runtime.JAXBContextImpl cannot be cast to com.sun.xml.internal.bind.api.JAXBRIContext
at com.sun.xml.internal.ws.fault.SOAPFaultBuilder.<clinit>(SOAPFaultBuilder.java:550)
... 16 more
This issue looks similar to this issue, except I am not supplying any jax-b dependencies on my classpath. However, it does look like hadoop does.
Is there a way to force hadoop to use the jdk jaxb jars or only use it's own supplied jaxb jars, but not mix both?
Frankly speaking, it doesn't sound like a Hadoop bug. Proper solution, as you've already mentioned, is to have classpath fixed, but try this:
-Djavax.xml.bind.JAXBContext=com.sun.xml.internal.bind.v2.ContextFactory
Additional details

java.lang.NoClassDefFoundError: org.eclipse.core.runtime.RegistryFactory

I'm trying to use DataObjects in Java:
DataFactory factory = DataFactory.INSTANCE;
in one java Project using:
import commonj.sdo.DataObject;
And I'm getting this error:
Exception in thread "main" java.lang.NoClassDefFoundError: org.eclipse.core.runtime.RegistryFactory
at org.eclipse.core.internal.runtime.InternalPlatform.getRegistry(InternalPlatform.java:671)
at org.eclipse.core.runtime.Platform.getExtensionRegistry(Platform.java:867)
at com.ibm.wsspi.sca.extensions.ServiceProviderRegistry.loadServiceProviders(ServiceProviderRegistry.java:167)
at com.ibm.wsspi.sca.extensions.ServiceProviderRegistry$1.run(ServiceProviderRegistry.java:88)
at java.security.AccessController.doPrivileged(AccessController.java:202)
at com.ibm.wsspi.sca.extensions.ServiceProviderRegistry.getServiceProviders(ServiceProviderRegistry.java:86)
at com.ibm.wsspi.sca.extensions.ServiceProviderRegistry.getServiceProvider(ServiceProviderRegistry.java:101)
at com.ibm.ws.sca.resources.loader.ClassLoaderRegistry.<clinit>(ClassLoaderRegistry.java:59)
at java.lang.J9VMInternals.initializeImpl(Native Method)
at java.lang.J9VMInternals.initialize(J9VMInternals.java:200)
at com.ibm.ws.sca.internal.container.impl.ContainerImpl.<clinit>(ContainerImpl.java:356)
at java.lang.J9VMInternals.initializeImpl(Native Method)
at java.lang.J9VMInternals.initialize(J9VMInternals.java:200)
at com.ibm.ws.sca.internal.container.impl.ContainerFactoryImpl.createContainer(ContainerFactoryImpl.java:70)
at com.ibm.ws.sca.internal.container.Container.<clinit>(Container.java:111)
at java.lang.J9VMInternals.initializeImpl(Native Method)
at java.lang.J9VMInternals.initialize(J9VMInternals.java:200)
Are you using Process Server? I'm pretty sure com.ibm.ws.sca.internal.container.impl.ContainerImpl is a Process Server class...
I think the application is based on EMF SDO?
Instead of Java application, you may run your application as a Eclipse application in your IDE, because the application require OSGi bundle loading mechanism to load the required bundle (i.e. org.eclipse.core.runtime) in the runtime.
I faced a similar issue when trying to instantiate the BOFactory class from JUnit. I was able to resolve it by adding org-eclipse-equinox-registry.jar files to my projects, along with the SDO jar files.
See also: Junit : Exception while creating BOFactory instance

Categories