# Issue with an embedded OSGi bundle

**URL:** <https://bnd.discourse.group/t/issue-with-an-embedded-osgi-bundle/121>\
**Category:** DEVELOPMENT\
**Created:** [April 29, 2021, 1:16pm UTC](https://bnd.discourse.group/t/issue-with-an-embedded-osgi-bundle/121 "2021-04-29T13:16:08Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![strmecki](https://yyz2.discourse-cdn.com/free1/user_avatar/bnd.discourse.group/strmecki/32/86_2.png) [@strmecki](https://bnd.discourse.group/u/strmecki)\
**Post date:** [April 29, 2021, 1:16pm UTC](https://bnd.discourse.group/t/issue-with-an-embedded-osgi-bundle/121/1 "2021-04-29T13:16:08Z")

</div>

Hello,

I used the Include-Resource to embed an OSGi bundle into another bundle like this:  
`Include-Resource: target/dependency/onecms.core-${onecms.core.version}.jar;lib:=true`

Is it possible NOT to register services from an embedded OSGi bundle?

The problem I get is that all the services get registered twice: from the actual bundle installed in the OSGi container and the embedded one (dependency in another bundle).

BR,  
Daniel

---

<div class="post-metadata">

**Author:** ![bjhargrave](https://yyz2.discourse-cdn.com/free1/user_avatar/bnd.discourse.group/bjhargrave/32/10_2.png) [@bjhargrave](https://bnd.discourse.group/u/bjhargrave)\
**Post date:** [April 29, 2021, 2:24pm UTC](https://bnd.discourse.group/t/issue-with-an-embedded-osgi-bundle/121/2 "2021-04-29T14:24:48Z")

</div>

I assume you must be referring to Declarative Services (DS) components (or CDI beans) being processed. By default, Bnd will examine all classes in the Bundle-Classpath (`lib:=true`) for components and creating the metadata to process them at runtime. You can use the [`-dsannotations`](https://bnd.bndtools.org/instructions/dsannotations.html) or ([`-cdiannotations`](https://bnd.bndtools.org/instructions/cdiannotations.html)) instruction to control which classes Bnd will examine. So you can exclude any packages which you know are in the embedded jars.
