2

We are trying to migrate code from Liferay 6.2 to Liferay 7.2, but we've hit a wall when it comes to service builder. We've followed the guide (changing the dependency-injector to ds, adding the @Component to impl classes...) but when we run a ds:unsatisfied command in the gogo shell, this appears:

Declarative Service {id: 5522, name: foo.**PersistenceImpl, unsatisfied references: 
                {name: Configuration, target: (&(origin.bundle.symbolic.name=foo.service)(name=service))}
        }

Any ideas what is happening?

  • 1
    please elaborate the info .. Which instance is actually missing .. have you run service-builder before deploy .. its in your code .. so I can't see it ;-) – André Jul 19 '20 at 15:35
  • How did you pass over this ? I am having the same behavior here :( – Victor Nov 19 '20 at 09:09
  • @Victor posted the answer below, I can elaborate further later, but that should get you started. – EmiruTheKnight Nov 20 '20 at 11:09

2 Answers2

1

a couple of months late but here is what fixed our problems.

Basically we had to create a two new classes, one that implements org.osgi.framework.BundleActivator and another com.liferay.portal.upgrade.registry.UpgradeStepRegistrator.

Doing this, we force the table to update the version of the service and publish them to osgi.

1

A possible failure of "unsatisfied references" may be also in the case you used Service Builder and you changed the default package name (suggested by the process), but you did not update the other references manually.

In more details: I had the same issue, but after checking with Gogo Shell tool (Control Panel -> Gogo Shell and then write ds:unsatisfied), it figured out that there were some missing packages that should have been exported by the *-api component (hint: there is an *-api and a *-service component that are generated when you follow the Service Builder steps).

The fix

So, I went in the bnd.bnd file from the *-api component and checked the Export-Package entry. What I noticed was that, even though I have changed the package to totally something else, the Service Builder process did not care and used the same old default package (hint: it names them by appending to the name of the service the .exception, .model, .service and .service.persistence). Below is an example of my Export-Package property from the bnd.bnd file:

Export-Package:\
    <my_service_name>.exception,\
    <my_service_name>.model,\
    <my_service_name>.service,\
    <my_service_name>.service.persistence

Changind the <my_service_name> to the actually name of my package solved the issue.

Further reading: https://help.liferay.com/hc/en-us/articles/360018168891-Detecting-Unresolved-OSGi-Components

Victor
  • 1,001
  • 2
  • 14
  • 25