It looks there are some bundle which exports the package
"org.apache.felix.fileinstall" is not installed. It's Apache Felix File
Install (3.0.0)
You may need to go through the karaf etc/startup.properties to check if
there are some basic bundle is missing.
Servicemix features are based on karaf stared up rightly, you may need
to install the karaf basic bundles at the first time.
BTW, From Camel 2.3.0, we removed the dependency of karaf feature from
camel feature, so you can deploy the camel feature into different
version of karaf.
Willem
Christian Mueller wrote:
Inspired from Camels OSGiIntegrationTestSupport, I plan also to test my
routes with Pax Exam, because all our routes will be deployed into
ServiceMix (FUSE ESB 4.2.0-fuse-02-00 - Camel 2.2.0-fuse-02-00).
My first Pax Exam test
{code:java}
@RunWith(JUnit4TestRunner.class)
public class OsgiPaxExamIntegrationTest extends CamelTestSupport {
@Inject
protected BundleContext bundleContext;
@EndpointInject(uri = "mock:result")
private MockEndpoint resultEndpoint;
@Test
public void testSendMessage() throws Exception {
resultEndpoint.expectedBodiesReceived("Hello World");
template.sendBody("seda:foo", "Hello World");
assertMockEndpointsSatisfied();
}
protected RouteBuilder createRouteBuilder() throws Exception {
return new RouteBuilder() {
public void configure() {
from("seda:foo").to("mock:result");
}
};
}
protected CamelContext createCamelContext() throws Exception {
setThreadContextClassLoader();
CamelContextFactory factory = new CamelContextFactory();
factory.setBundleContext(bundleContext);
return factory.createContext();
}
protected void setThreadContextClassLoader() {
// set the thread context classloader current bundle classloader
Thread.currentThread().setContextClassLoader(
this.getClass().getClassLoader());
}
public static UrlReference getCamelKarafFeatureUrl() {
return mavenBundle().groupId("org.apache.camel.karaf")
.artifactId("apache-camel").type("xml").classifier("features")
.version("2.2.0-fuse-02-00");
}
public static UrlReference getServicemixFeatureUrl() {
return mavenBundle().groupId("org.apache.servicemix")
.artifactId("apache-servicemix").type("xml")
.classifier("features").version("4.2.0-fuse-02-00");
}
@Configuration
public static Option[] configure() throws Exception {
Option[] options = options(
// install the spring dm profile
profile("spring.dm").version("1.2.0"),
org.ops4j.pax.exam.CoreOptions.systemProperty(
"org.ops4j.pax.logging.DefaultServiceLog.level").value(
"INFO"),
org.ops4j.pax.exam.CoreOptions.systemProperty(
"org.apache.camel.jmx.disable").value("true"),
repositories("http://repo.fusesource.com/maven2/",
"http://repository.ops4j.org/maven2/"),
scanFeatures(getCamelKarafFeatureUrl(),
"camel-core",
"camel-osgi", "camel-spring",
"camel-test",
"camel-jaxb", "camel-cxf"),
/*
* scanFeatures(getServicemixFeatureUrl(),
"camel-activemq"),
*/
workingDirectory("target/paxrunner/"), felix(),
waitForFrameworkStartupFor(30000));
return options;
}
}
{code}
The test succeed, but in the log I see the following error message:
{code}
ERROR: Error starting
file:bundles/org.apache.felix.karaf.deployer.spring_1.4.0.fuse-02-00.jar
(org.osgi.framework.BundleException: Unresolved constraint in bundle
org.apache.felix.karaf.deployer.spring [21]: package;
(&(package=org.apache.felix.fileinstall)(version>=3.0.0)(!(version>=4.0.0))))
org.osgi.framework.BundleException: Unresolved constraint in bundle
org.apache.felix.karaf.deployer.spring [21]: package;
(&(package=org.apache.felix.fileinstall)(version>=3.0.0)(!(version>=4.0.0)))
at org.apache.felix.framework.Felix.resolveBundle(Felix.java:3263)
at org.apache.felix.framework.Felix.startBundle(Felix.java:1597)
at org.apache.felix.framework.Felix.setActiveStartLevel(Felix.java:1077)
at
org.apache.felix.framework.StartLevelImpl.run(StartLevelImpl.java:264)
at java.lang.Thread.run(Thread.java:637)
{code}