title: Do not run bundle org.osgi.framework.BundleException
body: <p>I created a small project that uses mail Apache Camel Mail. As usual, he started the project and works well, but as soon as I try to run it as a bundle, there is a problem:</p>
  
  <pre><code>java.lang.NoClassDefFoundError: org/osgi/framework/BundleActivator
  at java.lang.ClassLoader.defineClass1(Native Method)
  at java.lang.ClassLoader.defineClass(ClassLoader.java:760)
  at org.apache.felix.framework.BundleWiringImpl$BundleClassLoader.defineClass(BundleWiringImpl.java:2370)
  ERROR: Bundle org.camel.mail.org.camel.mail [4] Error starting file:/D:/Projects/CamelMail/target/org.camel.mail-1.0.jar (org.osgi.framework.BundleException: Activator start error in bundle org.camel.mail.org.camel.mail [4].)
  at org.apache.felix.framework.BundleWiringImpl$BundleClassLoader.findClass(BundleWiringImpl.java:2154)
  at org.apache.felix.framework.BundleWiringImpl.findClassOrResourceByDelegation(BundleWiringImpl.java:1542)
  at org.apache.felix.framework.BundleWiringImpl.access$400(BundleWiringImpl.java:79)
  at org.apache.felix.framework.BundleWiringImpl$BundleClassLoader.loadClass(BundleWiringImpl.java:2018)
  at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
  at org.apache.felix.framework.BundleWiringImpl.getClassByDelegation(BundleWiringImpl.java:1415)
  at org.apache.felix.framework.Felix.createBundleActivator(Felix.java:4468)
  at org.apache.felix.framework.Felix.activateBundle(Felix.java:2221)
  at org.apache.felix.framework.Felix.startBundle(Felix.java:2144)
  at org.apache.felix.framework.Felix.setActiveStartLevel(Felix.java:1371)
  at org.apache.felix.framework.FrameworkStartLevelImpl.run(FrameworkStartLevelImpl.java:308)
  at java.lang.Thread.run(Thread.java:745)
  Caused by: java.lang.ClassNotFoundException: org.osgi.framework.BundleActivator not found by org.camel.mail.org.camel.mail [4]
  at org.apache.felix.framework.BundleWiringImpl.findClassOrResourceByDelegation(BundleWiringImpl.java:1574)
  at org.apache.felix.framework.BundleWiringImpl.access$400(BundleWiringImpl.java:79)
  at org.apache.felix.framework.BundleWiringImpl$BundleClassLoader.loadClass(BundleWiringImpl.java:2018)
  at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
  ... 15 more
  </code></pre>
  
  <p>My file <code>pom.xml</code> looks like this:</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
  &lt;project xmlns="http://maven.apache.org/POM/4.0.0"
       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
       xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"&gt;
  &lt;modelVersion&gt;4.0.0&lt;/modelVersion&gt;
  
  &lt;groupId&gt;org.camel.mail&lt;/groupId&gt;
  &lt;artifactId&gt;org.camel.mail&lt;/artifactId&gt;
  &lt;version&gt;1.0&lt;/version&gt;
  &lt;packaging&gt;bundle&lt;/packaging&gt;
  &lt;build&gt;
      &lt;plugins&gt;
          &lt;plugin&gt;
              &lt;groupId&gt;org.apache.felix&lt;/groupId&gt;
              &lt;artifactId&gt;maven-bundle-plugin&lt;/artifactId&gt;
              &lt;extensions&gt;true&lt;/extensions&gt;
              &lt;configuration&gt;
                  &lt;instructions&gt;
                      &lt;Bundle-SymbolicName&gt;${pom.groupId}.${pom.artifactId}&lt;/Bundle-SymbolicName&gt;
                      &lt;Bundle-Name&gt;English dictionary&lt;/Bundle-Name&gt;
                      &lt;Bundle-Description&gt;A bundle that registers an English dictionary service&lt;/Bundle-Description&gt;
                      &lt;Bundle-Vendor&gt;Apache-Felix&lt;/Bundle-Vendor&gt;
                      &lt;Bundle-Version&gt;1.0.0&lt;/Bundle-Version&gt;
                      &lt;Bundle-Activator&gt;com.camel.mail.Activator&lt;/Bundle-Activator&gt;
                      &lt;Embed-Transitive&gt;true&lt;/Embed-Transitive&gt;
                      &lt;Import-Package&gt;!org.apache.camel;!org.osgi.framework;!org.apache.felix&lt;/Import-Package&gt;
                  &lt;/instructions&gt;
              &lt;/configuration&gt;
          &lt;/plugin&gt;
      &lt;/plugins&gt;
  &lt;/build&gt;
  &lt;dependencies&gt;
      &lt;dependency&gt;
          &lt;groupId&gt;org.apache.camel&lt;/groupId&gt;
          &lt;artifactId&gt;camel-mail&lt;/artifactId&gt;
          &lt;version&gt;${camel-mail.version}&lt;/version&gt;
      &lt;/dependency&gt;
      &lt;dependency&gt;
          &lt;groupId&gt;org.apache.camel&lt;/groupId&gt;
          &lt;artifactId&gt;camel-core-osgi&lt;/artifactId&gt;
          &lt;version&gt;2.17.1&lt;/version&gt;
      &lt;/dependency&gt;
      &lt;dependency&gt;
          &lt;groupId&gt;org.apache.camel&lt;/groupId&gt;
          &lt;artifactId&gt;camel-osgi&lt;/artifactId&gt;
          &lt;version&gt;2.3.0&lt;/version&gt;
      &lt;/dependency&gt;
      &lt;dependency&gt;
          &lt;groupId&gt;org.osgi&lt;/groupId&gt;
          &lt;artifactId&gt;org.osgi.core&lt;/artifactId&gt;
          &lt;version&gt;6.0.0&lt;/version&gt;
      &lt;/dependency&gt;
      &lt;dependency&gt;
          &lt;groupId&gt;org.apache.felix&lt;/groupId&gt;
          &lt;artifactId&gt;org.apache.felix.eventadmin&lt;/artifactId&gt;
          &lt;version&gt;1.4.6&lt;/version&gt;
      &lt;/dependency&gt;
  &lt;/dependencies&gt;
  &lt;properties&gt;
      &lt;camel-mail.version&gt;2.17.1&lt;/camel-mail.version&gt;
      &lt;!--&lt;log4j-core.version&gt;2.6.1&lt;/log4j-core.version&gt;--&gt;
  &lt;/properties&gt;
  </code></pre>
  
  <p></p>
  
  <p>The file <code>com.camel.mail.Activator</code>:</p>
  
  <pre><code>public class Activator implements BundleActivator {
  
  private CamelContext ctx = null;
  
  public void start(BundleContext bundleContext) throws Exception {
      ctx = new OsgiDefaultCamelContext(bundleContext);
      ctx.addRoutes(new RouteBuilder() {
          public void configure() {
              Processor myProcessor = new Processor()
              {
                  public void process (Exchange exchange)
                  {
                      exchange.getIn().getBody(String.class);
                  }
              };
  
              from("imaps://imap.yandex.ru?username=***&amp;password=*****&amp;delete=false&amp;peek=false&amp;unseen=true&amp;consumer.delay=6000&amp;closeFolder=false&amp;disconnect=false")
                      .process(myProcessor);
  
          }
      });
  
      ctx.start();
  }
  
  public void stop(BundleContext bundleContext) throws Exception {
      ctx.stop();
  }
  }
  </code></pre>
  
  <p>How can I resolve this error? Thank!</p>