org.osgi.framework.ServiceRegistration unsatisfied Dependencyorg.osgi.framework.ServiceRegistration unsatisfied Dependencyhttps://liferay.dev/en/c/message_boards/find_thread?p_l_id=119785333&threadId=1196761392024-03-29T09:09:49Z2024-03-29T09:09:49ZRE: org.osgi.framework.ServiceRegistration unsatisfied DependencyAndre Kreienbringhttps://liferay.dev/en/c/message_boards/find_message?p_l_id=119785333&messageId=1196950442020-08-03T13:59:12Z2020-08-03T13:59:12Z<html><head></head><body>Still scratching my head about this.... :-(<br>Does anybody know how the "com.liferay.registry.api" fits into this?<br>In the com.liferay.registry.api.jar there's an interface class named " ServiceRegistration". And apps with a working Indexer have <br><pre><code>compileOnly project(":core:registry-api")
</code></pre>in ther build.gradle files.<br>Unfortunatly it does not take me any further when I add <br><pre><code>compileOnly group: "com.liferay", name: "com.liferay.registry.api"
</code></pre>to mine.</body></html>Andre Kreienbring2020-08-03T13:59:12ZRE: org.osgi.framework.ServiceRegistration unsatisfied DependencyAndre Kreienbringhttps://liferay.dev/en/c/message_boards/find_message?p_l_id=119785333&messageId=1196854832020-07-31T15:03:47Z2020-07-31T15:03:47Z<html><head></head><body>Hello Olaf,<br>yes, and I do it exactly the same way. <br>In the meantime I inspected the OSGI modules that use the indexing functionality with GoGo shell to find any difference to my own service.<br>I did not find a solution but I may be on the right track.<br>First of all I can see that these modules import "org.osgi.framework" and also "com.liferay.portal.search.spi.model.registrar" (inspected with the "equinox:b bundleId" command)<br>But mine does too! Even the versions are the same.<br>BUT: The working services USE <br><pre><code>{com.liferay.portal.search.spi.model.registrar.ModelSearchRegistrarHelper}
</code></pre>but mine does'nt :-(<br>So I think that the original error about a missing dependency of " org.osgi.framework.ServiceRegistration" was misleading.<br>Digging deeper I found that <br><br><pre><code>[code]Component Description: com.liferay.portal.search.internal.indexer.ModelSearchRegistrarHelperImpl
================================================================================================
Class:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; com.liferay.portal.search.internal.indexer.ModelSearchRegistrarHelperImpl
Bundle:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 735 (com.liferay.portal.search:7.0.11)
Enabled:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; true
Immediate:&nbsp;&nbsp;&nbsp;&nbsp; true
Services:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; [com.liferay.portal.search.spi.model.registrar.ModelSearchRegistrarHelper]
</code></pre>is an active component (GoGo "scr:info 2134") So why can't I inject it? <br>I do it exactly like all the working modules:<br><pre><code>import com.liferay.portal.search.spi.model.registrar.ModelSearchRegistrarHelper;
...
</code></pre><pre><code>@Component(immediate = true, service = {})
public class DeviceSearchRegistrar {
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; @Activate
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; protected void activate(BundleContext bundleContext) {
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; _serviceRegistration = _modelSearchRegistrarHelper.register(
</code></pre><pre><code>[code]&nbsp;&nbsp;&nbsp; ....
&nbsp; &nbsp; )}
...
@Reference
protected ModelSearchRegistrarHelper _modelSearchRegistrarHelper;
</code></pre><br>And in my build.gradle I've:<br><pre><code>&nbsp;&nbsp;&nbsp; compileOnly group: "com.liferay", name: "com.liferay.portal.search.spi"
&nbsp;&nbsp; &nbsp;compileOnly group: "com.liferay", name: "com.liferay.portal.search.api"
</code></pre>with "liferay.workspace.target.platform.version = 7.3.2" in the gradle.properties of my module.</body></html>Andre Kreienbring2020-07-31T15:03:47ZRE: org.osgi.framework.ServiceRegistration unsatisfied DependencyOlaf Kockhttps://liferay.dev/en/c/message_boards/find_message?p_l_id=119785333&messageId=1196838542020-07-31T12:39:42Z2020-07-31T12:39:42Z<html><head></head><body><div class="quote-title">Andre Kreienbring:</div><blockquote><br>From the JavaDoc of org.osgi.framework:<br>Framework Package Version 1.8.Bundles wishing to use this package must list the package in the Import-Package header of the bundle's manifest.Example import for consumers using the API in this package:<pre><code>Import-Package: org.osgi.framework; version="[1.8,2.0)"</code></pre><br>When I put this line into the bnd.bnd file of my service it makes things even worse! Lots of ClassNotFoundException's to other Liferay classes...</blockquote>None of the code that I've looked at explicitly declared a dependency on "org.osgi.framework" (the bundle, not the package name), despite using code from the package org.osgi.framework. Nor does it declare any explicit Import-Package that bnd can't figure out itself.<br>Also, I'm using the target platform, as to never needing to bother about versions: see <a href="https://github.com/olafk/controlpanel-documentation-web/blob/master/build.gradle">https://github.com/olafk/controlpanel-documentation-web/blob/master/build.gradle</a> and <a href="https://github.com/olafk/controlpanel-documentation-web/blob/master/src/main/java/de/olafkock/liferay/documentation/osgi/tracker/ControlPanelDocumentationServiceTrackerActivator.java#L8">https://github.com/olafk/controlpanel-documentation-web/blob/master/src/main/java/de/olafkock/liferay/documentation/osgi/tracker/ControlPanelDocumentationServiceTrackerActivator.java#L8</a></body></html>Olaf Kock2020-07-31T12:39:42ZRE: org.osgi.framework.ServiceRegistration unsatisfied DependencyAndre Kreienbringhttps://liferay.dev/en/c/message_boards/find_message?p_l_id=119785333&messageId=1196822992020-07-31T10:59:09Z2020-07-31T10:59:09Z<html><head></head><body>From the JavaDoc of org.osgi.framework:<br>Framework Package Version 1.8.Bundles wishing to use this package must list the package in the Import-Package header of the bundle's manifest.Example import for consumers using the API in this package:<pre><code>Import-Package: org.osgi.framework; version="[1.8,2.0)"</code></pre><br>When I put this line into the bnd.bnd file of my service it makes things even worse! Lots of ClassNotFoundException's to other Liferay classes...</body></html>Andre Kreienbring2020-07-31T10:59:09ZRE: org.osgi.framework.ServiceRegistration unsatisfied DependencyAndre Kreienbringhttps://liferay.dev/en/c/message_boards/find_message?p_l_id=119785333&messageId=1196765082020-07-30T17:17:43Z2020-07-30T17:17:43Z<html><head></head><body>BTW: adding<br><pre><code>compileOnly group: "org.osgi", name: "org.osgi.framework", version: "1.9.0"</code></pre><br>to the build.gradle of my service did NOT help. The dependency is still unsatisfied.</body></html>Andre Kreienbring2020-07-30T17:17:43Zorg.osgi.framework.ServiceRegistration unsatisfied DependencyAndre Kreienbringhttps://liferay.dev/en/c/message_boards/find_message?p_l_id=119785333&messageId=1196761382020-07-30T16:25:45Z2020-07-30T16:25:45Z<html><head></head><body>Using Liferay 7.3.2 GA I wrote a [MyEntitiy]SearchRegistrar Class that imports "org.osgi.framework.ServiceRegistration"<br>But the <br> <pre><code>&nbsp; @Activate
&nbsp;&nbsp; &nbsp;protected void activate(BundleContext bundleContext) {</code></pre><br>method get's never called :-(<br>Now GoGo Shell tells me that <br><pre><code>[code]- _serviceRegistration: org.osgi.framework.ServiceRegistration UNSATISFIED 1..1 static
</code></pre>the dependeny is unsatisfied. <br>How to solve this? <br>Looking into the source code of Liferay Portal 7.3 I could'nt find a build.gradle that defines a dependency on "org.osgi.framework" But the legacy apps that implement a search / indexing functionality simply import that class and are working. T