Expand my Community achievements bar.

Nomination window for the Adobe Community Advisor Program, Class of 2025, is now open!
SOLVED

Service dependencies not getting injected using @reference

Avatar

Level 3

Hey Guys ,

 I was trying to implement logging on replication events  like, when my page is activated on author instance I would log the page name in logs . My Java code which is deployed as a bundle implements EventHandler and overrides handleEvent method . I initially tested it with skeleton code and I was able to log events . When I tried modifying the code to get handle to SlingRepository via @reference annotation  I get the following error in logs :

java.lang.VerifyError: Expecting a stackmap frame at branch target 13 in method com.training.ReplicationLogger.unbindRepository(Lorg/apache/sling/jcr/api/SlingRepository;)V at offset 5 ,

Has any one faced such error before ? I'm creating and installing bundle from CRXDE  (Tried several times by freshly installing the bundle , but received the same error)

Java code : @SuppressWarnings("deprecation") @Service(value = EventHandler.class) @Component(immediate = true) @Property(name = "event.topics", value = ReplicationAction.EVENT_TOPIC) public class ReplicationLogger implements EventHandler, JobProcessor { private static final Logger LOGGER = LoggerFactory .getLogger(ReplicationLogger.class); @Reference private SlingRepository repository; public void handleEvent(Event event) { LOGGER.debug("********handling event"); process(event); } public boolean process(Event event) { LOGGER.debug("********processing job"); return true; } Thanks in advance for your pointers . cheers
1 Accepted Solution

Avatar

Correct answer by
Former Community Member

This is a JDK version compatibility issue - if you google your error "Java.lang.VerifyError: Expecting a stackmap frame at branch target", there are lots of results that explain the background and workarounds. The short answer is to build with JDK 6 or to use the JVM parameter "-XX:-UseSplitVerifier"

View solution in original post

2 Replies

Avatar

Correct answer by
Former Community Member

This is a JDK version compatibility issue - if you google your error "Java.lang.VerifyError: Expecting a stackmap frame at branch target", there are lots of results that explain the background and workarounds. The short answer is to build with JDK 6 or to use the JVM parameter "-XX:-UseSplitVerifier"

Avatar

Level 3

Hi , 

    I  added the Jvm parameter in CRXDE  , but it still complained .  However when i tried the same from Eclipse it worked . Thanks for the pointers .

The following has evaluated to null or missing: ==> liqladmin("SELECT id, value FROM metrics WHERE id = 'net_accepted_solutions' and user.id = '${acceptedAnswer.author.id}'").data.items [in template "analytics-container" at line 83, column 41] ---- Tip: It's the step after the last dot that caused this error, not those before it. ---- Tip: If the failing expression is known to be legally refer to something that's sometimes null or missing, either specify a default value like myOptionalVar!myDefault, or use <#if myOptionalVar??>when-present<#else>when-missing. (These only cover the last step of the expression; to cover the whole expression, use parenthesis: (myOptionalVar.foo)!myDefault, (myOptionalVar.foo)?? ---- ---- FTL stack trace ("~" means nesting-related): - Failed at: #assign answerAuthorNetSolutions = li... [in template "analytics-container" at line 83, column 5] ----