You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@karaf.apache.org by bonomat <ph...@gmail.com> on 2011/07/20 10:27:49 UTC

NoClassDefFoundError CommandProcessor/ not found by pax-exam-probe

Hello

I would like to extend the karaf console commands.
But I have some problems writing integration tests:
I have the same setup like the the CoreTest in the package
org.apache.karaf.shell.itests, [1]
but when I try to get the CommandProcessor via :         
CommandProcessor cp = getOsgiService(CommandProcessor.class);
i get the following error: 
java.lang.NoClassDefFoundError:
org/apache/felix/service/command/CommandProcessor.

I have compared the loaded bundles of my karaf instance with an "clean"
karaf and as far as I can see are all necessary bundles present. The whole
stacktrace is at the end of this post.

It must be some kind of ClassLoader Issue and I don't know if I should ask
here or at Ops4J, so I made a double post also at the ops4j mailing-list.

java.lang.NoClassDefFoundError:
org/apache/felix/service/command/CommandProcessor
	at my.packe.MyTestClass.myTest(MyTestClass.java:34)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
	at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
	at java.lang.reflect.Method.invoke(Method.java:597)
	at
org.ops4j.pax.exam.junit.extender.impl.internal.CallableTestMethodImpl.injectContextAndInvoke(CallableTestMethodImpl.java:143)
	at
org.ops4j.pax.exam.junit.extender.impl.internal.CallableTestMethodImpl.call(CallableTestMethodImpl.java:105)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
	at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
	at java.lang.reflect.Method.invoke(Method.java:597)
	at
org.ops4j.pax.exam.rbc.internal.RemoteBundleContextImpl.remoteCall(RemoteBundleContextImpl.java:80)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
	at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
	at java.lang.reflect.Method.invoke(Method.java:597)
	at sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:305)
	at sun.rmi.transport.Transport$1.run(Transport.java:159)
	at java.security.AccessController.doPrivileged(Native Method)
	at sun.rmi.transport.Transport.serviceCall(Transport.java:155)
	at sun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.java:535)
	at
sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run0(TCPTransport.java:790)
	at
sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport.java:649)
	at
java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
	at
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
	at java.lang.Thread.run(Thread.java:662)
Caused by: java.lang.ClassNotFoundException:
org.apache.felix.service.command.CommandProcessor not found by
pax-exam-probe [153]
	at
org.apache.felix.framework.ModuleImpl.findClassOrResourceByDelegation(ModuleImpl.java:787)
	at org.apache.felix.framework.ModuleImpl.access$400(ModuleImpl.java:71)
	at
org.apache.felix.framework.ModuleImpl$ModuleClassLoader.loadClass(ModuleImpl.java:1768)
	at java.lang.ClassLoader.loadClass(ClassLoader.java:247)
	... 26 more


thanks for your help
kind regards
philipp


[1]https://svn.apache.org/repos/asf/karaf/trunk/itests/tests/src/test/java/org/apache/karaf/shell/itests/CoreTest.java


--
View this message in context: http://karaf.922171.n3.nabble.com/NoClassDefFoundError-CommandProcessor-not-found-by-pax-exam-probe-tp3184861p3184861.html
Sent from the Karaf - User mailing list archive at Nabble.com.

Re: NoClassDefFoundError CommandProcessor/ not found by pax-exam-probe

Posted by Ioannis Canellos <io...@gmail.com>.
By default your probe, will dynamically import all packages.
All ? Well ... not all! Packages that are exported with provisional status
will not be imported by default.
You will have to modify your probe, like this:

probe.setHeader(Constants.DYNAMICIMPORT_PACKAGE,
"*,org.apache.felix.service.*;status=provisional");

And sorry for the late response !

-- 
*Ioannis Canellos*
*
FuseSource <http://fusesource.com>

**
Blog: http://iocanel.blogspot.com
**
Apache Karaf <http://karaf.apache.org/> Committer & PMC
Apache Camel <http://camel.apache.org/> Committer
Apache ServiceMix <http://servicemix.apache.org/>  Committer
Apache Gora <http://incubator.apache.org/gora/> Committer
Apache DirectMemory <http://incubator.apache.org/directmemory/> Committer
*