Your exception probably means that you are missing an Import-Package header with javax.xml.bind.

The problem might be that you declared some imports in the maven-bundle-plugin config. If you do not add ",*" at the end then this will turn off the automatic Import-Package creation.

Normally it is not necessary to declare any imports. So either add the ,* or even try without a manual setting which will mean the same a "*".

Christian

On 23.11.2015 10:50, Ravi Nallappan wrote:
Hi,

One of my bundle requires jaxb library. I get following error when try to
start the bundle.

[
Karaf 4.0.1
Camel 2.16,
java version "1.7.0_79"
OpenJDK Runtime Environment (IcedTea 2.5.5) (7u79-2.5.5-0ubuntu0.14.04.2)
OpenJDK 64-Bit Server VM (build 24.79-b02, mixed mode)
]

----------------------------------------------------------------------------
----------------------------------------karaf@root()> bundle:install -s
mvn:com.acme.mediation/mobiroute/1.3.1-SNAPSHOT
ERROR: Bundle com.acme.mediation.mobiroute [183] EventDispatcher: Error
during dispatch. (java.lang.NoClassDefFoundError:
javax/xml/bind/JAXBException)
java.lang.NoClassDefFoundError: javax/xml/bind/JAXBException
:
:
        at java.lang.Thread.run(Thread.java:745)
Caused by: java.lang.ClassNotFoundException: javax.xml.bind.JAXBException
not found by com.acme.mediation.mobihttp [182]
        at
org.apache.felix.framework.BundleWiringImpl.findClassOrResourceByDelegation(
BundleWiringImpl.java:1558)
        at
org.apache.felix.framework.BundleWiringImpl.access$400(BundleWiringImpl.java
:79)
        at
org.apache.felix.framework.BundleWiringImpl$BundleClassLoader.loadClass(Bund
leWiringImpl.java:1998)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:358)
----------------------------------------------------------------------------
----------------------------------------
        
com.acme.mediation.mobihttp bundle plugin configured as :
----------------------------------------------------------------------------
----------------------------------------                        <plugin>
                                <groupId>org.apache.felix</groupId>
                                <artifactId>maven-bundle-plugin</artifactId>
                                <version>2.5.4</version>
                                <extensions>true</extensions>
                                <configuration>
                                        <instructions>
        
<Bundle-SymbolicName>${project.groupId}.${project.artifactId}</Bundle-Symbol
icName>
        
<Bundle-Name>${project.artifactId}</Bundle-Name>
        
<Bundle-Version>${project.version}</Bundle-Version>
                                                <Import-Package>
                                                        org.apache.camel.*,
                                                        org.apache.http.*,
                                                        org.slf4j,
                                                        com.acme.mediation,
        
com.acme.mediation.bean,
        
com.acme.mediation.exception,
        
com.acme.mediation.helper
                                                </Import-Package>
                                                <Export-Package>
        
com.acme.mediation.mobi.http,
        
com.acme.mediation.mobi.http.bean
                                                </Export-Package>
                                        </instructions>
                                </configuration>
                        </plugin>
----------------------------------------------------------------------------
----------------------------------------
jre.properties configured as
----------------------------------------------------------------------------
----------------------------------------
# Standard package set.  Note that:
#   - javax.transaction* is exported with a mandatory attribute
jre-1.7= \
  javax.accessibility, \
  javax.activation;version="1.1", \
  javax.activity, \
  javax.annotation;version="1.0", \
  javax.annotation.processing;version="1.0", \
  javax.crypto, \
  javax.crypto.interfaces, \
  javax.crypto.spec, \
:
:
  javax.xml, \
  javax.xml.bind;version="2.2.1", \
  javax.xml.bind.annotation;version="2.2.1", \
  javax.xml.bind.annotation.adapters;version="2.2.1", \
  javax.xml.bind.attachment;version="2.2.1", \
  javax.xml.bind.helpers;version="2.2.1", \
  javax.xml.bind.util;version="2.2.1", \
  javax.xml.crypto, \
:
:
----------------------------------------------------------------------------
----------------------------------------
karaf@root()> package:exports | grep "javax.xml.bind"
javax.xml.bind.annotation.adapters             | 2.2.1   | 0  |
org.apache.felix.framework
javax.xml.bind.annotation                      | 2.2.1   | 0  |
org.apache.felix.framework
javax.xml.bind.attachment                      | 2.2.1   | 0  |
org.apache.felix.framework
javax.xml.bind.helpers                         | 2.2.1   | 0  |
org.apache.felix.framework
javax.xml.bind.util                            | 2.2.1   | 0  |
org.apache.felix.framework
javax.xml.bind                                 | 2.2.1   | 0  |
org.apache.felix.framework
----------------------------------------------------------------------------
----------------------------------------
I even tried to install jaxb manually, the issue still persists
----------------------------------------------------------------------------
----------------------------------------bundle:install -s
mvn:org.apache.servicemix.bundles/org.apache.servicemix.bundles.jaxb-impl/2.
2.1.1_2
----------------------------------------------------------------------------
----------------------------------------
I googled around, I noticed some suggestions to disable jre.properties's
javax.xml.bind to have other implementation. In my case, I am fine with jre
implementation for jaxb as it passes all Junit tests in eclipse. In fact, I
don't quite understand the reason behind disable jre's to progress further.

How to resolve this? Appreciate your input in this.

Thanks and regards,
Ravi Nallappan



--
Christian Schneider
http://www.liquid-reality.de

Open Source Architect
http://www.talend.com

Reply via email to