NPE during invocation of maven-war-plugin - eclipse

During a multimodule build, an error is surfaced in eclipse as follows:
Execution default of goal org.apache.maven.plugins:maven-war-plugin:3.3.1:exploded failed. (org.apache.maven.plugins:maven-war-plugin:3.3.1:exploded:default:process-resources)
The stack trace for this error is
org.apache.maven.plugin.PluginExecutionException: Execution default of goal org.apache.maven.plugins:maven-war-plugin:3.3.1:exploded failed.
at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:148)
at org.eclipse.m2e.core.internal.embedder.MavenImpl.execute(MavenImpl.java:332)
at org.eclipse.m2e.core.internal.embedder.MavenImpl.lambda$8(MavenImpl.java:1380)
at org.eclipse.m2e.core.internal.embedder.MavenExecutionContext.executeBare(MavenExecutionContext.java:179)
at org.eclipse.m2e.core.internal.embedder.MavenExecutionContext.execute(MavenExecutionContext.java:114)
at org.eclipse.m2e.core.internal.embedder.MavenImpl.execute(MavenImpl.java:1379)
at org.eclipse.m2e.core.project.configurator.MojoExecutionBuildParticipant.build(MojoExecutionBuildParticipant.java:54)
at org.eclipse.m2e.core.internal.builder.MavenBuilderImpl.build(MavenBuilderImpl.java:135)
at org.eclipse.m2e.core.internal.builder.MavenBuilder$1.method(MavenBuilder.java:169)
at org.eclipse.m2e.core.internal.builder.MavenBuilder$1.method(MavenBuilder.java:1)
at org.eclipse.m2e.core.internal.builder.MavenBuilder$BuildMethod.lambda$1(MavenBuilder.java:114)
at org.eclipse.m2e.core.internal.embedder.MavenExecutionContext.executeBare(MavenExecutionContext.java:179)
at org.eclipse.m2e.core.internal.embedder.MavenExecutionContext.execute(MavenExecutionContext.java:114)
at org.eclipse.m2e.core.internal.builder.MavenBuilder$BuildMethod.lambda$0(MavenBuilder.java:105)
at org.eclipse.m2e.core.internal.embedder.MavenExecutionContext.executeBare(MavenExecutionContext.java:179)
at org.eclipse.m2e.core.internal.embedder.MavenExecutionContext.execute(MavenExecutionContext.java:153)
at org.eclipse.m2e.core.internal.embedder.MavenExecutionContext.execute(MavenExecutionContext.java:101)
at org.eclipse.m2e.core.internal.builder.MavenBuilder$BuildMethod.execute(MavenBuilder.java:88)
at org.eclipse.m2e.core.internal.builder.MavenBuilder.build(MavenBuilder.java:197)
at org.eclipse.core.internal.events.BuildManager$2.run(BuildManager.java:832)
at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:45)
at org.eclipse.core.internal.events.BuildManager.basicBuild(BuildManager.java:220)
at org.eclipse.core.internal.events.BuildManager.basicBuild(BuildManager.java:263)
at org.eclipse.core.internal.events.BuildManager$1.run(BuildManager.java:316)
at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:45)
at org.eclipse.core.internal.events.BuildManager.basicBuild(BuildManager.java:319)
at org.eclipse.core.internal.events.BuildManager.basicBuildLoop(BuildManager.java:371)
at org.eclipse.core.internal.events.BuildManager.build(BuildManager.java:392)
at org.eclipse.core.internal.resources.Workspace.buildInternal(Workspace.java:515)
at org.eclipse.core.internal.resources.Workspace.build(Workspace.java:405)
at org.eclipse.ui.actions.GlobalBuildAction$1.run(GlobalBuildAction.java:180)
at org.eclipse.core.internal.jobs.Worker.run(Worker.java:63)
Caused by: java.lang.NullPointerException
at org.apache.maven.plugins.war.AbstractWarMojo$DefaultWarPackagingContext$1.visitFile(AbstractWarMojo.java:661)
at org.apache.maven.plugins.war.AbstractWarMojo$DefaultWarPackagingContext$1.visitFile(AbstractWarMojo.java:656)
at java.base/java.nio.file.Files.walkFileTree(Files.java:2804)
at java.base/java.nio.file.Files.walkFileTree(Files.java:2876)
at org.apache.maven.plugins.war.AbstractWarMojo$DefaultWarPackagingContext.<init>(AbstractWarMojo.java:655)
at org.apache.maven.plugins.war.AbstractWarMojo.buildWebapp(AbstractWarMojo.java:520)
at org.apache.maven.plugins.war.AbstractWarMojo.buildExplodedWebapp(AbstractWarMojo.java:453)
at org.apache.maven.plugins.war.WarExplodedMojo.execute(WarExplodedMojo.java:43)
at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:137)
... 31 more
pom.xml /my-legacy-app line 1753 Maven Build Problem
I've debugged into AbstractWarMojo.visitFile, and there session.getStartTime() is null, so the call to getTime() throws an NPE.
Attempting to track down why the start time is null led me to MavenImpl, at which point I've gotten a bit stuck trying to
further track down the issue. I think it was pointing to something in MavenExecutionContext, but I'm not entirely sure.
How do I go about solving this problem?
Eclipse Version: 20200910-1200
m2e Version: 1.16.1.20200710-1008

This was due to code introduced in version 3.3.1 of the maven-war-plugin, using 3.3.0 solves the problem.

Related

Groovy:General error during semantic analysis: java.lang.NoSuchMethodError:

Imported the gradle project from the "complete" folder and received the following error:
Groovy:General error during semantic analysis:
java.lang.NoSuchMethodError: 'org.codehaus.groovy.ast.expr.Expression org.codehaus.groovy.ast.tools.GeneralUtils.propX(org.codehaus.groovy.ast.expr.Expression, java.lang.String)'
I am using the latest version of Eclipse, 2020-12, with groovy tools installed.
From grails guide
https://guides.grails.org/gorm-without-grails/guide/index.html
Downloaded code sample from github
https://github.com/grails-guides/gorm-without-grails.git
It seems likely to be a version mismatch, but I cannot determine how to correct this problem.
I have tried to delete the offending file, src/main/groovy/demo/domain/Manufacturer.groovy, and the error appears on the file in this package on line 1.
The error does not appear in any other package. I have done the usual internet searches for resolutions that apply, but have thus far been unable to find a suitable solution. I am hopeful for a suggestion?
I think this error comes from an AST transform that references the older signature of GeneralUtils#propX. This method used to return Expression and was changed to return PropertyExpression.
The bridge method for binary compatibility was missing in groovy-eclipse. https://github.com/groovy/groovy-eclipse/commit/f6f448675d95f858b4ec65b6fc8e55f27ccaaa94

How to remedy error caused by guava: Program type already present: com.google.common.util.concurrent.internal.InternalFutures

An AAR library already uses com.google.guava.
If an app includes the following in its build.gradle:
api 'com.google.guava:guava:27.0-android'
Building the app generates the following error:
Execution failed for task ':app:transformDexArchiveWithExternalLibsDexMergerForDebug'.
> com.android.builder.dexing.DexArchiveMergerException: Error while merging dex archives: ...
Learn how to resolve the issue at https://developer.android.com/studio/build/dependencies#duplicate_classes.
Program type already present: com.google.common.util.concurrent.internal.InternalFutures
If I do not include "api 'com.google.guava:guava:27.0-android'", the app can be built, but it has runtime error of java.lang.NoClassDefFoundError when it reaches the point of using the Guava method: Iterables.find
I had to update to version 27.0.1, at the time of writing they still haven't updated the README with this new version.
implementation 'com.google.guava:guava:27.0.1-android'
Since Guava 27.0, ListenableFuture is located in separate artifact, see the announcement. You can try two things (one at a time):
Exclude "listenablefuture" module (group "com.google.guava") and build your project again.
I don't know the AAR specifics, but it could be that 27.0-android doesn't work with AAR, so you should try 26.0-android instead.

AEM6.2: com.day.cq.wcm.tags.IncludeTag Error

We have AEM6.2 node environment and we are trying to access login.html but getting error as below.
After searching I came to know that java version could be one of the possible reason but I am already using Java 8 for this application. I am out of ideas. Any suggestions greatly appreciated.
14.09.2018 14:08:40.299 *ERROR* [192.156.110.11 [1536948520114] GET /content/en/account/login.html HTTP/1.1] com.day.cq.wcm.tags.IncludeTag Error while executing script defaulttopnav
org.apache.sling.api.scripting.ScriptEvaluationException:
at org.apache.sling.scripting.core.impl.DefaultSlingScript.call(DefaultSlingScript.java:416)
at org.apache.sling.scripting.core.impl.DefaultSlingScript.eval(DefaultSlingScript.java:184)
at org.apache.sling.scripting.core.impl.DefaultSlingScript.service(DefaultSlingScript.java:491)
at com.day.cq.wcm.tags.IncludeTag.includeScript(IncludeTag.java:178)
at com.day.cq.wcm.tags.IncludeTag.doEndTag(IncludeTag.java:95)
at org.apache.jsp.apps.components.navigation.topnavigation_jsp._jspService(navigation_jsp.java:329)
at org.eclipse.jetty.io.AbstractConnection$2.run(AbstractConnection.java:544)
at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:635)
at org.eclipse.jetty.util.thread.QueuedThreadPool$3.run(QueuedThreadPool.java:555)
at java.lang.Thread.run(Thread.java:748)
Caused by: org.apache.sling.api.SlingException:
at org.apache.sling.scripting.jsp.jasper.servlet.JspServletWrapper.handleJspExceptionInternal(JspServletWrapper.java:691)
at org.apache.sling.scripting.jsp.jasper.servlet.JspServletWrapper.handleJspException(JspServletWrapper.java:608)
at org.apache.sling.scripting.jsp.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:533)
at org.apache.sling.scripting.jsp.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:449)
at org.apache.sling.scripting.jsp.JspScriptEngineFactory.callJsp(JspScriptEngineFactory.java:284)
at org.apache.sling.scripting.jsp.JspScriptEngineFactory.access$100(JspScriptEngineFactory.java:102)
at org.apache.sling.scripting.jsp.JspScriptEngineFactory$JspScriptEngine.eval(JspScriptEngineFactory.java:536)
at org.apache.sling.scripting.core.impl.DefaultSlingScript.call(DefaultSlingScript.java:388)
... 201 common frames omitted
Caused by: java.lang.NullPointerException: null
at org.apache.jsp.apps.components.topnavigation.defaulttopnav_jsp._jspService(defaulttopnav_jsp.java:347)
at org.apache.sling.scripting.jsp.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:725)
at org.apache.sling.scripting.jsp.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:502)
... 206 common frames omitted
Thank you.
General solution for errors are thrown by servlets compiled from jsp files, is to recompile the jsp again.
Goto system/console and verify if all bundles are in active state
Goto sling --> jsp and recompile all jsps.
This works if errors are thrown from otb jsp. However when custom application jsps throw error, you ll need to fix the custom jsp code by handling the error.
Another foolproof way to clear cached jsp class files is to delete /var/classes
The stacktrace indicates the NPE is stemming from defaulttopnav_jsp.java, line 347. Analysing the generated java file is the way to go.
Since AEM 6.1, the default ClassLoader was replaced by FSClassLoader and the generated .java files are no longer stored under /var/classes.
To locate the .java file you will need to locate the bundle ID for the FSClassLoader bundle, then the java files will be located at:
[AEM_INSTALL_DIR]/crx-quickstart/launchpad/felix/bundle[BUNDLE_ID]/data/classes
There is also a sling plugin which will help you view the generated java file from OSGi console. Check out these posts for that.

How to fix Eclipse error: 'Path must include project and resource name'?

My Wind River Workbench project reports error:
java.lang.IllegalArgumentException: Path must include project and resource name: /LedaAP
at org.eclipse.core.runtime.Assert.isLegal(Assert.java:63)
at org.eclipse.core.internal.resources.Workspace.newResource(Workspace.java:2068)
at org.eclipse.core.internal.resources.Container.getFolder(Container.java:202)
at com.windriver.pb.core.build.model.WRTgtCentricBuildImpl.refreshMakeFileFolder(WRTgtCentricBuildImpl.java:539)
at com.windriver.pb.core.build.model.WRTgtCentricBuildImpl.generateMakefiles(WRTgtCentricBuildImpl.java:532)
at com.windriver.pb.core.build.model.WRBuild.generateMakefiles(WRBuild.java:408)
at com.windriver.pb.core.build.builder.WRBuilder.prepareToBuild(WRBuilder.java:40)
at com.windriver.pb.core.api.build.WRAbstractBuilder.build(WRAbstractBuilder.java:338)
at org.eclipse.core.internal.events.BuildManager$2.run(BuildManager.java:735)
at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:42)
at org.eclipse.core.internal.events.BuildManager.basicBuild(BuildManager.java:206)
at org.eclipse.core.internal.events.BuildManager.basicBuild(BuildManager.java:330)
at org.eclipse.core.internal.events.BuildManager.build(BuildManager.java:405)
at org.eclipse.core.internal.resources.Project$1.run(Project.java:551)
at org.eclipse.core.internal.resources.Workspace.run(Workspace.java:2240)
at org.eclipse.core.internal.resources.Project.internalBuild(Project.java:529)
at org.eclipse.core.internal.resources.Project.build(Project.java:120)
at com.windriver.pb.ui.actions.build.WRBuildAction$4.doRunBuild(WRBuildAction.java:454)
at com.windriver.pb.core.api.build.WRBuildJob.run(WRBuildJob.java:66)
at org.eclipse.core.internal.jobs.Worker.run(Worker.java:55)
WR Workbench uses Eclipse 4.6.3.v20170301 and Eclipse CDT.
Searching on the net it seems that this error can arise for various reasons. Any advice for how to diagnose this problem please?
I notice that the Resource Path is '/LedaAP'. Where would that be set?

Distriqt Facebook ANE won't compile for Android

I am having trouble compiling the Distriqt Facebook ANE for Android.
It works fine on iOS but not on Android.
The error message is:
dx tool failed:
UNEXPECTED TOP-LEVEL ERROR: java.lang.OutOfMemoryError: Java heap
space at
com.android.dx.cf.code.ExecutionStack.copy(ExecutionStack.java:66) at
com.android.dx.cf.code.Frame.copy(Frame.java:98) at
com.android.dx.cf.code.Ropper.processBlock(Ropper.java:786) at
com.android.dx.cf.code.Ropper.doit(Ropper.java:742) at
com.android.dx.cf.code.Ropper.convert(Ropper.java:349) at
com.android.dx.dex.cf.CfTranslator.processMethods(CfTranslator.java:280)
at
com.android.dx.dex.cf.CfTranslator.translate0(CfTranslator.java:137)
at com.android.dx.dex.cf.CfTranslator.translate(CfTranslator.java:93)
at com.android.dx.command.dexer.Main.processClass(Main.java:729) at
com.android.dx.command.dexer.Main.processFileBytes(Main.java:673) at
com.android.dx.command.dexer.Main.access$300(Main.java:83) at
com.android.dx.command.dexer.Main$1.processFileBytes(Main.java:602)
at
com.android.dx.cf.direct.ClassPathOpener.processArchive(ClassPathOpener.java:284)
at
com.android.dx.cf.direct.ClassPathOpener.processOne(ClassPathOpener.java:166)
at
com.android.dx.cf.direct.ClassPathOpener.process(ClassPathOpener.java:144)
at com.android.dx.command.dexer.Main.processOne(Main.java:632) at
com.android.dx.command.dexer.Main.processAllFiles(Main.java:510) at
com.android.dx.command.dexer.Main.runMonoDex(Main.java:280) at
com.android.dx.command.dexer.Main.run(Main.java:246) at
com.android.dx.command.dexer.Main.main(Main.java:215) at
com.android.dx.command.Main.main(Main.java:106)
ADT command line:
...
Tried with AIR18 and AIR 16 (updated dx.jar from distriqt tutorial).
My manifest includes all 3 needed extensions:
<extensionID>com.distriqt.Core</extensionID>
<extensionID>com.distriqt.GooglePlayServices</extensionID>
<extensionID>com.distriqt.FacebookAPI</extensionID>
Removing GooglePlayServices makes compilation possible but app crashes when initializing the FacebokAPI.
Using AIR16 without the updated dx.jar also crashes the app directly at startup. The catlog states the following exception:
08-23 14:53:14.793 E/AndroidRuntime(3178): java.lang.RuntimeException:
Unable to get provider com.facebook.FacebookContentProvider:
java.lang.ClassNotFoundException: com.facebook.FacebookContentProvider
in loader
dalvik.system.PathClassLoader[/data/app/air.my.com.zas.lefiner-1.apk]
08-23 14:53:14.793 E/AndroidRuntime(3178): Caused by:
java.lang.ClassNotFoundException: com.facebook.FacebookContentProvider
in loader
dalvik.system.PathClassLoader[/data/app/air.my.com.zas.lefiner-1.apk]
Oddly enough the Distriqt GooglePlusANE which uses Core and GooglePlayServices works fine on both platforms. So i strongly assume there is something wrong with the FacebookAPI extension.
Any help is very much appreciated!
If You are using Intellij IDEA increase Compiler heap size in Actionscript & Flex compiler. This fixed the issue for me.