title: Glassfish - missing package=org.apache.commons.collections
body: <p>I'm developing OSGI bundle which uses RingFIFOBuffer from the package org.apache.commons.collections</p>
  
  <p>This is the souce code of the bundle:</p>
  
  <pre><code>package org.DX_57.osgi.NB_27.impl;
  
  import org.apache.commons.collections.Buffer;
  import org.apache.commons.collections.BufferUtils;
  import org.apache.commons.collections.buffer.CircularFifoBuffer;
  
  public class NetworkBuffer {
  
      public NetworkBuffer(){
      }
  
      Buffer fifo = (Buffer) BufferUtils.synchronizedBuffer(new CircularFifoBuffer(200));
  
      public String GetString(){        
          String Value = (String) fifo.get();        
         // fifo.remove(Value);                
          return Value;
      }
  
      public void InsertString(String Value){                
          fifo.add(Value);
         // fifo.remove("3");        
  
      }
  
      public String ClearBuffer(){        
          fifo.clear();        
          return "0";
      }
  
      public int BufferSize(){
          int Size = fifo.size();
          return Size;
      }
  
      public boolean ClearElement(String Value){
          boolean remove = fifo.remove(Value);
          return remove;
      }    
  
  }
  </code></pre>
  
  <p>This is the POM file:</p>
  
  <pre><code>&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/maven-v4_0_0.xsd"&gt;
      &lt;modelVersion&gt;4.0.0&lt;/modelVersion&gt;
      &lt;parent&gt;
          &lt;groupId&gt;org.DX_57.osgi.NB_27&lt;/groupId&gt;
          &lt;artifactId&gt;NB_27&lt;/artifactId&gt;
          &lt;version&gt;1.0-SNAPSHOT&lt;/version&gt;
          &lt;relativePath&gt;../pom.xml&lt;/relativePath&gt;
      &lt;/parent&gt;
      &lt;artifactId&gt;NB_27-impl&lt;/artifactId&gt;
      &lt;packaging&gt;bundle&lt;/packaging&gt;
      &lt;name&gt;NB_27-impl&lt;/name&gt;
      &lt;url&gt;http://maven.apache.org&lt;/url&gt;
      &lt;dependencies&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;junit&lt;/groupId&gt;
              &lt;artifactId&gt;junit&lt;/artifactId&gt;
              &lt;version&gt;3.8.1&lt;/version&gt;
              &lt;scope&gt;test&lt;/scope&gt;
          &lt;/dependency&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;org.apache.felix&lt;/groupId&gt;
              &lt;artifactId&gt;org.osgi.core&lt;/artifactId&gt;
              &lt;version&gt;1.0.0&lt;/version&gt;
          &lt;/dependency&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;${pom.groupId}&lt;/groupId&gt;
              &lt;artifactId&gt;NB_27-api&lt;/artifactId&gt;
              &lt;version&gt;1.0-SNAPSHOT&lt;/version&gt;
          &lt;/dependency&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;commons-collections&lt;/groupId&gt;
              &lt;artifactId&gt;commons-collections&lt;/artifactId&gt;
              &lt;version&gt;3.2&lt;/version&gt;
              &lt;type&gt;jar&lt;/type&gt;
          &lt;/dependency&gt;
  
  
      &lt;/dependencies&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;Import-Package&gt;${pom.groupId}.api, org.osgi.framework, org.apache.commons.collections, org.apache.commons.collections.buffer&lt;/Import-Package&gt;
                          &lt;Bundle-SymbolicName&gt;${pom.artifactId}&lt;/Bundle-SymbolicName&gt;
                          &lt;Bundle-Activator&gt;${pom.groupId}.impl.NetworkBridgeApp&lt;/Bundle-Activator&gt;
                      &lt;/instructions&gt;
                  &lt;/configuration&gt;
              &lt;/plugin&gt;
              &lt;plugin&gt;
                  &lt;groupId&gt;org.apache.maven.plugins&lt;/groupId&gt;
                  &lt;artifactId&gt;maven-compiler-plugin&lt;/artifactId&gt;
                  &lt;version&gt;2.3.2&lt;/version&gt;
                  &lt;configuration&gt;
                      &lt;source&gt;1.7&lt;/source&gt;
                      &lt;target&gt;1.7&lt;/target&gt;
                  &lt;/configuration&gt;
              &lt;/plugin&gt;
          &lt;/plugins&gt;
      &lt;/build&gt;
      &lt;groupId&gt;org.DX_57.osgi.NB_27&lt;/groupId&gt;
  &lt;/project&gt;
  </code></pre>
  
  <p>I can successfully compile the OSGI bundle with Netbeans but when I try to deploy the bundle on Glassfish I get this error:</p>
  
  <pre><code>[337]: Unable to resolve 337.0: missing requirement [337.0] package; (package=org.apache.commons.collections)
  org.osgi.framework.BundleException: Unresolved constraint in bundle NB_27-impl [337]: Unable to resolve 337.0: missing requirement [337.0] package; (package=org.apache.commons.collections)
      at org.apache.felix.framework.Felix.resolveBundle(Felix.java:3443)
      at org.apache.felix.framework.Felix.startBundle(Felix.java:1727)
      at org.apache.felix.framework.BundleImpl.start(BundleImpl.java:922)
      at org.glassfish.extras.osgicontainer.OSGiDeployedBundle.startBundle(OSGiDeployedBundle.java:107)
      at org.glassfish.extras.osgicontainer.OSGiDeployedBundle.resume(OSGiDeployedBundle.java:83)
      at org.glassfish.extras.osgicontainer.OSGiDeployedBundle.start(OSGiDeployedBundle.java:67)
      at org.glassfish.internal.data.EngineRef.start(EngineRef.java:130)
      at org.glassfish.internal.data.ModuleInfo.start(ModuleInfo.java:269)
      at org.glassfish.internal.data.ApplicationInfo.start(ApplicationInfo.java:294)
      at com.sun.enterprise.v3.server.ApplicationLifecycle.deploy(ApplicationLifecycle.java:462)
      at org.glassfish.deployment.admin.DeployCommand.execute(DeployCommand.java:384)
      at com.sun.enterprise.v3.admin.CommandRunnerImpl$1.execute(CommandRunnerImpl.java:355)
      at com.sun.enterprise.v3.admin.CommandRunnerImpl.doCommand(CommandRunnerImpl.java:370)
      at com.sun.enterprise.v3.admin.CommandRunnerImpl.doCommand(CommandRunnerImpl.java:1064)
      at com.sun.enterprise.v3.admin.CommandRunnerImpl.access$1200(CommandRunnerImpl.java:96)
      at com.sun.enterprise.v3.admin.CommandRunnerImpl$ExecutionContext.execute(CommandRunnerImpl.java:1244)
      at com.sun.enterprise.v3.admin.CommandRunnerImpl$ExecutionContext.execute(CommandRunnerImpl.java:1232)
      at org.glassfish.admin.rest.ResourceUtil.runCommand(ResourceUtil.java:202)
      at org.glassfish.admin.rest.ResourceUtil.runCommand(ResourceUtil.java:195)
      at org.glassfish.admin.rest.resources.TemplateListOfResource.createResource(TemplateListOfResource.java:148)
      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
      at java.lang.reflect.Method.invoke(Method.java:601)
      at com.sun.jersey.spi.container.JavaMethodInvokerFactory$1.invoke(JavaMethodInvokerFactory.java:60)
      at com.sun.jersey.server.impl.model.method.dispatch.AbstractResourceMethodDispatchProvider$ResponseOutInvoker._dispatch(AbstractResourceMethodDispatchProvider.java:205)
      at com.sun.jersey.server.impl.model.method.dispatch.ResourceJavaMethodDispatcher.dispatch(ResourceJavaMethodDispatcher.java:75)
      at com.sun.jersey.server.impl.uri.rules.HttpMethodRule.accept(HttpMethodRule.java:288)
      at com.sun.jersey.server.impl.uri.rules.SubLocatorRule.accept(SubLocatorRule.java:134)
      at com.sun.jersey.server.impl.uri.rules.RightHandPathRule.accept(RightHandPathRule.java:147)
      at com.sun.jersey.server.impl.uri.rules.SubLocatorRule.accept(SubLocatorRule.java:134)
      at com.sun.jersey.server.impl.uri.rules.RightHandPathRule.accept(RightHandPathRule.java:147)
      at com.sun.jersey.server.impl.uri.rules.ResourceClassRule.accept(ResourceClassRule.java:108)
      at com.sun.jersey.server.impl.uri.rules.RightHandPathRule.accept(RightHandPathRule.java:147)
      at com.sun.jersey.server.impl.uri.rules.RootResourceClassesRule.accept(RootResourceClassesRule.java:84)
      at com.sun.jersey.server.impl.application.WebApplicationImpl._handleRequest(WebApplicationImpl.java:1469)
      at com.sun.jersey.server.impl.application.WebApplicationImpl._handleRequest(WebApplicationImpl.java:1400)
      at com.sun.jersey.server.impl.application.WebApplicationImpl.handleRequest(WebApplicationImpl.java:1349)
      at com.sun.jersey.server.impl.application.WebApplicationImpl.handleRequest(WebApplicationImpl.java:1339)
      at com.sun.jersey.server.impl.container.grizzly.GrizzlyContainer._service(GrizzlyContainer.java:182)
      at com.sun.jersey.server.impl.container.grizzly.GrizzlyContainer.service(GrizzlyContainer.java:147)
      at org.glassfish.admin.rest.adapter.RestAdapter.service(RestAdapter.java:184)
      at com.sun.grizzly.tcp.http11.GrizzlyAdapter.service(GrizzlyAdapter.java:168)
      at com.sun.enterprise.v3.server.HK2Dispatcher.dispath(HK2Dispatcher.java:117)
      at com.sun.enterprise.v3.services.impl.ContainerMapper.service(ContainerMapper.java:238)
      at com.sun.grizzly.http.ProcessorTask.invokeAdapter(ProcessorTask.java:828)
      at com.sun.grizzly.http.ProcessorTask.doProcess(ProcessorTask.java:725)
      at com.sun.grizzly.http.ProcessorTask.process(ProcessorTask.java:1019)
      at com.sun.grizzly.http.DefaultProtocolFilter.execute(DefaultProtocolFilter.java:225)
      at com.sun.grizzly.DefaultProtocolChain.executeProtocolFilter(DefaultProtocolChain.java:137)
      at com.sun.grizzly.DefaultProtocolChain.execute(DefaultProtocolChain.java:104)
      at com.sun.grizzly.DefaultProtocolChain.execute(DefaultProtocolChain.java:90)
      at com.sun.grizzly.http.HttpProtocolChain.execute(HttpProtocolChain.java:79)
      at com.sun.grizzly.ProtocolChainContextTask.doCall(ProtocolChainContextTask.java:54)
      at com.sun.grizzly.SelectionKeyContextTask.call(SelectionKeyContextTask.java:59)
      at com.sun.grizzly.ContextTask.run(ContextTask.java:71)
      at com.sun.grizzly.util.AbstractThreadPool$Worker.doWork(AbstractThreadPool.java:532)
      at com.sun.grizzly.util.AbstractThreadPool$Worker.run(AbstractThreadPool.java:513)
      at java.lang.Thread.run(Thread.java:722)
  |#]
  </code></pre>
  
  <p>I added these lines into the POM file of the bundle:</p>
  
  <pre><code>        &lt;dependency&gt;
              &lt;groupId&gt;commons-collections&lt;/groupId&gt;
              &lt;artifactId&gt;commons-collections&lt;/artifactId&gt;
              &lt;version&gt;3.2&lt;/version&gt;
              &lt;type&gt;jar&lt;/type&gt;
          &lt;/dependency&gt;
  </code></pre>
  
  <p>But still the package <code>org.apache.commons.collections</code> is not found. Any idea what causes this problem?</p>
  
  <p>Best wishes</p>