0

I am doing some maintenance to a JAVA backend written using bundles. When running the code after doing some software upgrade, I get that error at first:

! java.lang.NoSuchMethodError: org.osgi.framework.BundleContext.registerService (Ljava/lang/Class;Lorg/osgi/framework/ServiceFactory;Ljava/util/Dictionary;) Lorg/osgi/framework/ServiceRegistration;

When running it a second time, it gives me the following error:

! java.lang.NoClassDefFoundError: Could not initialize class com.sap.hilo.orchestration.workspace.HiloWorkspaceFactory

Then, it keeps showing the second error for any extra code runs. Any clues how resolve this issue?

Donia Zaela
  • 317
  • 1
  • 4
  • 15
  • 1
    [Maybe this can help with the second error](https://stackoverflow.com/questions/34413/why-am-i-getting-a-noclassdeffounderror-in-java) – meyi Oct 24 '18 at 14:19
  • 1
    It seems your new version of `osgi` has `org.osgi.framework.BundleContext.registerService.registerService` with different signature. You need to update your code. – Ilya Oct 24 '18 at 14:31
  • @llya how can I update the code whereas I do not even run this method. – Donia Zaela Oct 25 '18 at 19:37

1 Answers1

0

Regarding:

java.lang.NoSuchMethodError: org.osgi.framework.BundleContext.registerService

I found an answer to a similar question here: OSGi: servicereference.getBundle().getVersion() - No such method error

In the Import-Package section of the pom.xml file you'll need to change the org.osgi.framework version to at least 1.6 or give it a range [1.6,2.0)

JamesP
  • 602
  • 6
  • 12