0

According this documentation link:

apidocs

SlingScriptHelper.getService returns null if service is not availibale.

Can you explain conditions when service is unavailble and how to force it to become availible ?

edit:

components view: enter image description here

relevant log:

22.09.2014 19:13:17.077 *ERROR* [FelixStartLevel] ****** bind method [bindResolverFactory] not found; Component will fail
22.09.2014 19:13:17.078 *ERROR* [FelixStartLevel] ****** Error during instantiation of the implementation object (java.lang.VerifyError: Expecting a stackmap frame at branch target 13
Exception Details:
  Location:
    *******.unbindConfigurator(L********Configurator;)V @5: if_acmpne
  Reason:
    Expected stackmap frame at this location.
  Bytecode:
    0000000: 2ab4 0086 2ba6 0008 2a01 b500 86b1     
) java.lang.VerifyError: Expecting a stackmap frame at branch target 13
Exception Details:
  Location:
    *****.unbindConfigurator(L*****;)V @5: if_acmpne
  Reason:
    Expected stackmap frame at this location.
  Bytecode:
    0000000: 2ab4 0086 2ba6 0008 2a01 b500 86b1     
gstackoverflow
  • 36,709
  • 117
  • 359
  • 710
  • 1
    Check the following links which seems to address similar problems. http://stackoverflow.com/questions/25982555/cq5-sling-servlet-with-querybuilder and http://stackoverflow.com/questions/22259579/how-do-i-add-the-command-xx-usesplitverifier-to-an-osgi-bundle-built-in-crxde-l – rakhi4110 Sep 23 '14 at 04:58
  • 1
    @rakhi4110 looks like this: https://issues.apache.org/jira/browse/FELIX-3568 – gstackoverflow Sep 23 '14 at 07:31

2 Answers2

0

I see a few reasons when a service might not be available:

  1. The Bundle implementing the service interface isn't deployed
  2. The Bundle is deployed but cannot be started (usually some dependency is missing)
  3. The Component could not be started because the activate method threw an exception

You can check 1 and 2 in the OSGi Console, for 3 you'll need to check the logs. To fix it, 1 is obvious, install the bundle. For 2 you need to check what dependency can not be resolved, then you need to check if the bundle exporting the dependency is running. For 3 it may be a problem in the code or an invalid configuration or a referenced service isn't availabl, which could again be any of the three reasons.

Thomas
  • 6,325
  • 4
  • 30
  • 65
0

It looks like a java compatibility issue. Java 7 introduce new validation for the class file. If the method are generated at runtime via bytecode that could cause issue if the bytecode version does not match.

which version of cq are you running? which version of java are you compiling for? you can try compiling with a java 6 target.

user3996996
  • 342
  • 3
  • 5
  • cq 5.6.1. I compile with java 7. I didn't understand this: **you can try compiling with a java 6 target** – gstackoverflow Sep 29 '14 at 13:59
  • you can specify for which bytecode version you are compiling the code. If the bytecode generator try to match the version of the bytecode it's trying to instrument then it will solve it. If you use maven you need to configure the compiler plugin org.apache.maven.plugins maven-compiler-plugin 3.1 1.6 1.6 – user3996996 Sep 30 '14 at 14:55