title: How can I deploy my Spring Boot Application in Equinox OSGi Container. Getting BundleException: Error loading bundle activator
body: <p>My Activator class:</p>
  
  <pre><code>package com.package.actprovider;
  import org.osgi.framework.BundleActivator;
  import org.osgi.framework.BundleContext;
  import org.osgi.framework.ServiceListener;
  import org.osgi.framework.ServiceRegistration;
  import com.package.Application;
  import org.osgi.framework.ServiceEvent;
  
  /**
  * This class implements a simple bundle that utilizes the OSGi
  * framework's event mechanism to listen for service events. Upontting 
  * receiving a service event, it prints out the event's details.
  **/
  
  public class Activator implements BundleActivator , ServiceListener{
  private ServiceRegistration registration;
  //private Application application;
  
  /**
   * Implements BundleActivator.start(). Prints
   * a message and adds itself to the bundle context as a service
   * listener.
   * @param context the framework context for the bundle.
  **/
  
  @Override
  public void start(BundleContext context)
  {
      System.out.println("Starting to listen for service events.++++");
      context.addServiceListener(this);
  
  }
  
  /**
   * Implements BundleActivator.stop(). Prints
   * a message and removes itself from the bundle context as a
   * service listener.
   * @param context the framework context for the bundle.
  **/
  @Override
  public void stop(BundleContext context)
  {
      context.removeServiceListener(this);
      System.out.println("Stopped listening for service events.");
  }
  
  /**
   * Implements ServiceListener.serviceChanged().
   * Prints the details of any service event from the framework.
   * @param event the fired service event.
  **/
  public void serviceChanged(ServiceEvent event)
  {
      String[] objectClass = (String[])
          event.getServiceReference().getProperty("objectClass");
  
      if (event.getType() == ServiceEvent.REGISTERED)
      {
          System.out.println(
              "Ex1: Service of type " + objectClass[0] + " registered.");
      }
      else if (event.getType() == ServiceEvent.UNREGISTERING)
      {
          System.out.println(
              "Ex1: Service of type " + objectClass[0] + " unregistered.");
      }
      else if (event.getType() == ServiceEvent.MODIFIED)
      {
          System.out.println(
              "Ex1: Service of type " + objectClass[0] + " modified.");
      }
  }
  
  }
  </code></pre>
  
  <p>MANIFEST.MF file that is read by the equinox container:</p>
  
  <pre><code>Manifest-Version: 1.0
  Bundle-Description: A bundle that displays messages at startup and whe
  n service events occur
  Bundle-Name: Service listener example
  Bundle-Version: 1.0.0
  Bundle-Activator: com.package.actprovider.Activator
  Bundle-Vendor: Apache Felix
  Import-Package: org.osgi.framework
  Created-By: 1.8.0_101 (Oracle Corporation)
  </code></pre>
  
  <p>Here Bundle-Activator: com.package.actprovider.Activator , but the activator.class file creating at /BOOT-INF/classes/package com.package.actprovider.Activator</p>
  
  <p>my pom.xml is as follows</p>
  
  <p>
  http://maven.apache.org/xsd/maven-4.0.0.xsd">
      4.0.0</p>
  
  <pre><code>&lt;groupId&gt;com.package&lt;/groupId&gt;
  &lt;artifactId&gt;myfoo&lt;/artifactId&gt;
  &lt;version&gt;0.1.0&lt;/version&gt;
  &lt;packaging&gt;bundle&lt;/packaging&gt;
  
  
  
  &lt;parent&gt;
      &lt;groupId&gt;org.springframework.boot&lt;/groupId&gt;
      &lt;artifactId&gt;spring-boot-starter-parent&lt;/artifactId&gt;
      &lt;version&gt;1.4.0.RELEASE&lt;/version&gt;
      &lt;relativePath /&gt;
  &lt;/parent&gt;
  
  &lt;build&gt;
      &lt;plugins&gt;
          &lt;plugin&gt;
              &lt;groupId&gt;org.springframework.boot&lt;/groupId&gt;
              &lt;artifactId&gt;spring-boot-maven-plugin&lt;/artifactId&gt;
              &lt;executions&gt;
              &lt;execution&gt;
                  &lt;phase&gt;none&lt;/phase&gt;
              &lt;/execution&gt;
          &lt;/executions&gt;
          &lt;/plugin&gt;
          &lt;!-- tag::plugin[] --&gt;
          &lt;plugin&gt;
              &lt;groupId&gt;com.spotify&lt;/groupId&gt;
              &lt;artifactId&gt;docker-maven-plugin&lt;/artifactId&gt;
              &lt;version&gt;0.4.9&lt;/version&gt;
              &lt;configuration&gt;
                  &lt;imageName&gt;${docker.image.prefix}/${project.artifactId}&lt;/imageName&gt;
                  &lt;dockerDirectory&gt;src/main/docker&lt;/dockerDirectory&gt;
                  &lt;resources&gt;
                      &lt;resource&gt;
                          &lt;targetPath&gt;/&lt;/targetPath&gt;
                          &lt;directory&gt;${project.build.directory}&lt;/directory&gt;
                          &lt;include&gt;${project.build.finalName}.jar&lt;/include&gt;
                      &lt;/resource&gt;
                  &lt;/resources&gt;
              &lt;/configuration&gt;
          &lt;/plugin&gt;
  
  
          &lt;!-- &lt;plugin&gt; &lt;groupId&gt;org.apache.maven.plugins&lt;/groupId&gt; &lt;artifactId&gt;maven-jar-plugin&lt;/artifactId&gt; 
              &lt;configuration&gt; &lt;archive&gt; &lt;manifestFile&gt;src/main/resources/META-INF/MANIFEST.MF&lt;/manifestFile&gt; 
              &lt;/archive&gt; &lt;/configuration&gt; &lt;/plugin&gt; --&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;archive&gt;
                      &lt;manifestFile&gt;${project.build.outputDirectory}/META-INF/MANIFEST.MF&lt;/manifestFile&gt;
                  &lt;/archive&gt;
              &lt;/configuration&gt;
          &lt;/plugin&gt;
  
      &lt;/plugins&gt;
  &lt;/build&gt;
  
  &lt;dependencies&gt;
      &lt;dependency&gt;
          &lt;groupId&gt;org.springframework.boot&lt;/groupId&gt;
          &lt;artifactId&gt;spring-boot-starter-web&lt;/artifactId&gt;
      &lt;/dependency&gt;
      &lt;dependency&gt;
          &lt;groupId&gt;org.springframework.boot&lt;/groupId&gt;
          &lt;artifactId&gt;spring-boot-starter-test&lt;/artifactId&gt;
          &lt;scope&gt;test&lt;/scope&gt;
      &lt;/dependency&gt;
      &lt;dependency&gt;
          &lt;groupId&gt;commons-collections&lt;/groupId&gt;
          &lt;artifactId&gt;commons-collections&lt;/artifactId&gt;
      &lt;/dependency&gt;
      &lt;dependency&gt;
          &lt;groupId&gt;sdp-api-java&lt;/groupId&gt;
          &lt;artifactId&gt;sdp-api-java&lt;/artifactId&gt;
          &lt;version&gt;1.0&lt;/version&gt;
      &lt;/dependency&gt;
      &lt;dependency&gt;
          &lt;groupId&gt;org.springframework.boot&lt;/groupId&gt;
          &lt;artifactId&gt;spring-boot-configuration-processor&lt;/artifactId&gt;
          &lt;optional&gt;true&lt;/optional&gt;
      &lt;/dependency&gt;
      &lt;dependency&gt;
          &lt;groupId&gt;org.springframework.boot&lt;/groupId&gt;
          &lt;artifactId&gt;spring-boot-starter-jersey&lt;/artifactId&gt;
      &lt;/dependency&gt;
      &lt;dependency&gt;
          &lt;groupId&gt;org.apache.felix&lt;/groupId&gt;
          &lt;artifactId&gt;org.apache.felix.framework&lt;/artifactId&gt;
          &lt;version&gt;2.0.4&lt;/version&gt;
      &lt;/dependency&gt;
  &lt;/dependencies&gt;
  </code></pre>
  
  <p></p>
  
  <p>please suggest how can I add spring-boot bundle inside osgi container</p>