Hello everyone!

When I'm starting a OSGI bundle in my Apache Felix container, I have a ClassNotFoundException. This is the output that I have:

start file:/C:/Users/Pierre-Alexandre/Documents/NetBeansProjects/Prototype1/src/Prototype1Client.jar
23-Sep-2010 10:43:12 AM org.apache.cxf.dosgi.discovery.local.LocalDiscoveryService bundleChanged
INFO: bundle changed: null
23-Sep-2010 10:43:12 AM org.apache.cxf.dosgi.discovery.local.LocalDiscoveryService bundleChanged
INFO: bundle changed: null
23-Sep-2010 10:43:12 AM org.apache.cxf.dosgi.discovery.local.LocalDiscoveryService bundleChanged
INFO: bundle changed: null
org.osgi.framework.BundleException: Activator start error in bundle [131].
        at org.apache.felix.framework.Felix.activateBundle(Felix.java:1864)
        at org.apache.felix.framework.Felix.startBundle(Felix.java:1734)
        at org.apache.felix.framework.BundleImpl.start(BundleImpl.java:905)
        at org.apache.felix.gogo.command.Basic.start(Basic.java:758)
        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.apache.felix.gogo.runtime.Reflective.method(Reflective.java:136)
        at org.apache.felix.gogo.runtime.CommandProxy.execute(CommandProxy.java:82)
        at org.apache.felix.gogo.runtime.Closure.execute(Closure.java:421)
        at org.apache.felix.gogo.runtime.Closure.executeStatement(Closure.java:335)
        at org.apache.felix.gogo.runtime.Pipe.run(Pipe.java:108)
        at org.apache.felix.gogo.runtime.Closure.execute(Closure.java:184)
        at org.apache.felix.gogo.runtime.Closure.execute(Closure.java:121)
        at org.apache.felix.gogo.runtime.CommandSessionImpl.execute(CommandSessionImpl.java:78)
        at org.apache.felix.gogo.shell.Console.run(Console.java:62)
        at org.apache.felix.gogo.shell.Shell.console(Shell.java:197)
        at org.apache.felix.gogo.shell.Shell.gosh(Shell.java:123)
        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.apache.felix.gogo.runtime.Reflective.method(Reflective.java:136)
        at org.apache.felix.gogo.runtime.CommandProxy.execute(CommandProxy.java:82)
        at org.apache.felix.gogo.runtime.Closure.execute(Closure.java:421)
        at org.apache.felix.gogo.runtime.Closure.executeStatement(Closure.java:335)
        at org.apache.felix.gogo.runtime.Pipe.run(Pipe.java:108)
        at org.apache.felix.gogo.runtime.Closure.execute(Closure.java:184)
        at org.apache.felix.gogo.runtime.Closure.execute(Closure.java:121)
        at org.apache.felix.gogo.runtime.CommandSessionImpl.execute(CommandSessionImpl.java:78)
        at org.apache.felix.gogo.shell.Activator.run(Activator.java:72)
        at java.lang.Thread.run(Unknown Source)
Caused by: java.lang.NoClassDefFoundError: javax/xml/ws/Service
        at java.lang.ClassLoader.defineClass1(Native Method)
        at java.lang.ClassLoader.defineClassCond(Unknown Source)
        at java.lang.ClassLoader.defineClass(Unknown Source)
        at org.apache.felix.framework.ModuleImpl$ModuleClassLoader.findClass(ModuleImpl.java:1829)
        at org.apache.felix.framework.ModuleImpl.findClassOrResourceByDelegation(ModuleImpl.java:716)
        at org.apache.felix.framework.ModuleImpl.access$200(ModuleImpl.java:73)
        at org.apache.felix.framework.ModuleImpl$ModuleClassLoader.loadClass(ModuleImpl.java:1690)
        at java.lang.ClassLoader.loadClass(Unknown Source)
        at java.lang.Class.getDeclaredConstructors0(Native Method)
        at java.lang.Class.privateGetDeclaredConstructors(Unknown Source)
        at java.lang.Class.getConstructor0(Unknown Source)
        at java.lang.Class.newInstance0(Unknown Source)
        at java.lang.Class.newInstance(Unknown Source)
        at org.apache.felix.framework.Felix.createBundleActivator(Felix.java:3659)
        at org.apache.felix.framework.Felix.activateBundle(Felix.java:1812)
        ... 32 more
Caused by: java.lang.ClassNotFoundException: javax.xml.ws.Service
        at org.apache.felix.framework.ModuleImpl.findClassOrResourceByDelegation(ModuleImpl.java:772)
        at org.apache.felix.framework.ModuleImpl.access$200(ModuleImpl.java:73)
        at org.apache.felix.framework.ModuleImpl$ModuleClassLoader.loadClass(ModuleImpl.java:1690)
        at java.lang.ClassLoader.loadClass(Unknown Source)
        ... 47 more

This is the content of my manifest file.

Bundle-Name: Prototype 1 Client
Bundle-Description: A bundle that calls a Web service published by a server.
Bundle-Vendor: Apache Felix
Bundle-Version: 1.0.0
Bundle-Activator: prototype1.client.Prototype1ClientActivator
Import-Package: org.osgi.framework,javax.xml.*
Export-Package: javax.xml.ws.Service

My additions to Import-Package and Export-Package are attempts to make it work.

This is what I do to build the jar:

PS C:\Users\Pierre-Alexandre\Documents\NetBeansProjects\Prototype1\src> javac -cp "C:\Program Files\felix-framework-3.0.
2\bin\felix.jar;C:\Sun\jwsdp-2.0\jaxws\lib\jaxws-api.jar" .\prototype1\client\*.java

PS C:\Users\Pierre-Alexandre\Documents\NetBeansProjects\Prototype1\src> jar cfm Prototype1Client.jar .\prototype1\client
\manifest.mf .\prototype1\client\*.class

When I'm looking in the jar file, I don't see any indication that the javax.xml.ws.Service class is included.

Can you tell me how to solve this problem?

I have found a solution to my own problem:

I changed the manifest.mf file for the following:

Bundle-Name: Prototype 1 Client
Bundle-Description: A bundle that calls a Web service published by a server.
Bundle-Vendor: Apache Felix
Bundle-Version: 1.0.0
Bundle-Activator: prototype1.client.Prototype1ClientActivator
Import-Package: org.osgi.framework,javax.xml.ws,javax.xml.namespace
Bundle-ClassPath: lib/jaxb-api.jar,
 .

Hope that this solution helps someone in the future.

This question has already been answered. Start a new discussion instead.