Hi Craig,
Thanks for the response,
The org.apache.axis2.util package is provided to the test bundle via the new
api-osgi(this is a bundle which is created from a custom api jar) bundle
which i am creating by including the set of dependent jars (which has axis 2
bundles in it).This bundle is deployed in karaf and it shows its active.Then i
install the test bundle which accesses the api bundle,Then i get the error
which i mentioned previously.FYI there is a warning when i compile the api-osgi
bundle
[WARNING] Bundle com.gh.referralnet:api-osgi:bundle:5.0-SNAPSHOT : Split
package org/apache/axis2/util
Use directive -split-package:=(merge-first|merge-last|error|first) on
Export/Private Package instruction to get rid of this warning
Package found in [Jar:axis2, Jar:axis2-kernel]
Is this be the cause of the issue as the package is found in multiple dependent
jars?Your inputs would be really helpful.
Thanks and RegardsShridhar Kabbur
From: craig niles <[email protected]>
To: [email protected]; [email protected]
Sent: Friday, 4 December 2015 8:16 PM
Subject: Re: NoClassDefFoundError in OSGI bundle
It looks like you aren't importing a required package in your bundle. Without
the import the framework is resolving the bundle and activating the bundle, but
the bundle still doesn't have access to the class. Is the
org.apache.axis2.util package provided through another bundle installed in
Karaf or is it included in the set of jars you're putting in your new bundle?
On Fri, Dec 4, 2015 at 5:26 AM, <[email protected]> wrote:
Hi Felix Forum,
I have created a OSGI bundle from a custom API jar,the jar depends on around 60
jars.
In the bundle I have created I have packaged the jars in a lib directory and
then included the jars in the classpath in the `maven pom.xml`. When I deploy
the bundle in Karaf the bundle starts and shows its active ,but when I try to
access the API bundle from another bundle say test I get `NoClassDefFoundError`
On investigation I found that there is a static initializer in the
`org.apache.axis2.util.XMLUtils` class which might be causing the error.
The Full error message is:
org.apache.karaf.shell.support.MultiException: Error executing command on
bundles:
Error starting bundle66: Activator start error in bundle com.rna.app
[66].
at
org.apache.karaf.shell.support.MultiException.throwIf(MultiException.java:61)
at
org.apache.karaf.bundle.command.BundlesCommand.doExecute(BundlesCommand.java:69)[23:org.apache.karaf.bundle.core:4.0.1]
at
org.apache.karaf.bundle.command.BundlesCommand.execute(BundlesCommand.java:54)[23:org.apache.karaf.bundle.core:4.0.1]
at
org.apache.karaf.shell.impl.action.command.ActionCommand.execute(ActionCommand.java:83)[43:org.apache.karaf.shell.core:4.0.1]
at
org.apache.karaf.shell.impl.console.osgi.secured.SecuredCommand.execute(SecuredCommand.java:67)[43:org.apache.karaf.shell.core:4.0.1]
at
org.apache.karaf.shell.impl.console.osgi.secured.SecuredCommand.execute(SecuredCommand.java:87)[43:org.apache.karaf.shell.core:4.0.1]
at
org.apache.felix.gogo.runtime.Closure.executeCmd(Closure.java:480)[43:org.apache.karaf.shell.core:4.0.1]
at
org.apache.felix.gogo.runtime.Closure.executeStatement(Closure.java:406)[43:org.apache.karaf.shell.core:4.0.1]
at
org.apache.felix.gogo.runtime.Pipe.run(Pipe.java:108)[43:org.apache.karaf.shell.core:4.0.1]
at
org.apache.felix.gogo.runtime.Closure.execute(Closure.java:182)[43:org.apache.karaf.shell.core:4.0.1]
at
org.apache.felix.gogo.runtime.Closure.execute(Closure.java:119)[43:org.apache.karaf.shell.core:4.0.1]
at
org.apache.felix.gogo.runtime.CommandSessionImpl.execute(CommandSessionImpl.java:94)[43:org.apache.karaf.shell.core:4.0.1]
at
org.apache.karaf.shell.impl.console.ConsoleSessionImpl.run(ConsoleSessionImpl.java:267)[43:org.apache.karaf.shell.core:4.0.1]
at java.lang.Thread.run(Thread.java:745)[:1.8.0_66]
Caused by: java.lang.Exception: Error starting bundle66: Activator start
error in bundle com.rna.app [66].
at
org.apache.karaf.bundle.command.BundlesCommand.doExecute(BundlesCommand.java:66)[23:org.apache.karaf.bundle.core:4.0.1]
... 12 more
Caused by: org.osgi.framework.BundleException: Activator start error in
bundle com.rna.app [66].
at
org.apache.felix.framework.Felix.activateBundle(Felix.java:2270)[org.apache.felix.framework-5.0.1.jar:]
at
org.apache.felix.framework.Felix.startBundle(Felix.java:2138)[org.apache.felix.framework-5.0.1.jar:]
at
org.apache.felix.framework.BundleImpl.start(BundleImpl.java:977)[org.apache.felix.framework-5.0.1.jar:]
at
org.apache.karaf.bundle.command.Start.executeOnBundle(Start.java:38)[23:org.apache.karaf.bundle.core:4.0.1]
at
org.apache.karaf.bundle.command.BundlesCommand.doExecute(BundlesCommand.java:64)[23:org.apache.karaf.bundle.core:4.0.1]
... 12 more
Caused by: java.lang.NoClassDefFoundError: Could not initialize class
org.apache.axis2.util.XMLUtils
at
org.apache.axis2.deployment.DescriptionBuilder.buildOM(DescriptionBuilder.java:97)
at
org.apache.axis2.deployment.AxisConfigBuilder.populateConfig(AxisConfigBuilder.java:88)
at
org.apache.axis2.deployment.DeploymentEngine.populateAxisConfiguration(DeploymentEngine.java:705)
at
org.apache.axis2.deployment.FileSystemConfigurator.getAxisConfiguration(FileSystemConfigurator.java:116)
at
org.apache.axis2.context.ConfigurationContextFactory.createConfigurationContext(ConfigurationContextFactory.java:64)
at
org.apache.axis2.context.ConfigurationContextFactory.createConfigurationContextFromFileSystem(ConfigurationContextFactory.java:206)
at com.rna.App.start(App.java:71)
at
org.apache.felix.framework.util.SecureAction.startActivator(SecureAction.java:697)
at org.apache.felix.framework.Felix.activateBundle(Felix.java:2220)
... 16 more
Any ideas on how to investigate further would be really helpful.
Thanks and RegardsShridhar