AEM 6.5 uberjar: java.lang.NoSuchMethodError: org.apache.lucene.analysis.standard.StandardAnalyzer: method ()V

pablom63973339

16-04-2019

Hey all, daycare sent me this way

I'm updating our current code that uses uberjar 6.3.2 to use uberjar 6.5 and I found that some classes around org.apache.lucene were reporting with compile errors.

A particular one we use is org.apache.lucene.analysis.standard.StandardAnalyzer, and while my code compiles after changing the code, my components can't initialize in AEM 6.5 due to the following:

java.lang.NoSuchMethodError: org.apache.lucene.analysis.standard.StandardAnalyzer: method ()V not found at

............

...........

sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:498) at org.apache.felix.scr.impl.inject.methods.BaseMethod.invokeMethod(BaseMethod.java:228) at org.apache.felix.scr.impl.inject.methods.BaseMethod.access$500(BaseMethod.java:41) at org.apache.felix.scr.impl.inject.methods.BaseMethod$Resolved.invoke(BaseMethod.java:664) at org.apache.felix.scr.impl.inject.methods.BaseMethod.invoke(BaseMethod.java:510) at org.apache.felix.scr.impl.inject.methods.ActivateMethod.invoke(ActivateMethod.java:317) at org.apache.felix.scr.impl.inject.methods.ActivateMethod.invoke(ActivateMethod.java:307) at org.apache.felix.scr.impl.manager.SingleComponentManager.createImplementationObject(SingleComponentManager.java:340) at org.apache.felix.scr.impl.manager.SingleComponentManager.createComponent(SingleComponentManager.java:114) at org.apache.felix.scr.impl.manager.SingleComponentManager.getService(SingleComponentManager.java:982) at org.apache.felix.scr.impl.manager.SingleComponentManager.getServiceInternal(SingleComponentManager.java:955) at org.apache.felix.scr.impl.manager.AbstractComponentManager.activateInternal(AbstractComponentManager.java:756) at org.apache.felix.scr.impl.manager.AbstractComponentManager.enableInternal(AbstractComponentManager.java:666) at org.apache.felix.scr.impl.manager.AbstractComponentManager.enable(AbstractComponentManager.java:432) at org.apache.felix.scr.impl.manager.ConfigurableComponentHolder.enableComponents(ConfigurableComponentHolder.java:665) at org.apache.felix.scr.impl.BundleComponentActivator.initialEnable(BundleComponentActivator.java:338) at org.apache.felix.scr.impl.Activator.loadComponents(Activator.java:382) at org.apache.felix.scr.impl.Activator.access$200(Activator.java:49) at org.apache.felix.scr.impl.Activator$ScrExtension.start(Activator.java:264) at org.apache.felix.scr.impl.AbstractExtender.createExtension(AbstractExtender.java:196) at org.apache.felix.scr.impl.AbstractExtender.modifiedBundle(AbstractExtender.java:169) at org.apache.felix.scr.impl.AbstractExtender.modifiedBundle(AbstractExtender.java:49) at org.osgi.util.tracker.BundleTracker$Tracked.customizerModified(BundleTracker.java:488) at org.osgi.util.tracker.BundleTracker$Tracked.customizerModified(BundleTracker.java:420) at org.osgi.util.tracker.AbstractTracked.track(AbstractTracked.java:232) at org.osgi.util.tracker.BundleTracker$Tracked.bundleChanged(BundleTracker.java:450) at org.apache.felix.framework.EventDispatcher.invokeBundleListenerCallback(EventDispatcher.java:915) at org.apache.felix.framework.EventDispatcher.fireEventImmediately(EventDispatcher.java:834) at org.apache.felix.framework.EventDispatcher.fireBundleEvent(EventDispatcher.java:516) at org.apache.felix.framework.Felix.fireBundleEvent(Felix.java:4817) at org.apache.felix.framework.Felix.startBundle(Felix.java:2336) at org.apache.felix.framework.Felix.setActiveStartLevel(Felix.java:1539) at org.apache.felix.framework.FrameworkStartLevelImpl.run(FrameworkStartLevelImpl.java:308) at java.lang.Thread.run(Thread.java:748)

I have decompiled the class in 6.3.2 and the constructor is there (which is what is in Lucene 4.7.1 javadocs)

public StandardAnalyzer(Version matchVersion) {

  this(matchVersion, STOP_WORDS_SET);
}

While when decompiled on 6.5.0 is this (which is what you see on Lucene 5.0.0 & onwards javadocs)

public StandardAnalyzer() {

  this(STOP_WORDS_SET);
}

My understanding is that OAK in 6.4 and 6.5 hasn't changed, as in, both are Lucene 4.7.1 in it. Does anyone know why I'm seeing this error? could this be a 6.5 uberjar issue?

Accepted Solutions (1)

Accepted Solutions (1)

Gaurav-Behl

MVP

17-04-2019

I just validated that 6.5 still uses 4.7.1.  Your findings are correct about the constructor/latest version used in 6.5 uber.jar

I don't see any issue with using 6.4.4 to compile and deploy in 6.4/6.5.  At runtime, you'd still get 4.7.1 exported version and it should work.

Index of /repositories/releases/com/adobe/aem/uber-jar/6.4.4

https://lucene.apache.org/core/6_4_0/core/org/apache/lucene/util/Version.html#LATEST

I assume that you don't plan to use 6.5 uber.jar just to compile and still continue to deploy in 6.3.

Answers (1)

Answers (1)

pablom63973339

17-04-2019

Thanks for the reply, and yeah I guess I could do that for now

As to the actual issue, does it mean someone needs to do a fix in the uberjar lucene version being used, or is AEM 6.5 using the wrong version?