Openbravo Issue Tracking System - Tools
View Issue Details
0039557ToolsOtherspublic2018-10-29 16:422018-11-08 09:56
jarmendariz 
jarmendariz 
normalmajoralways
closedfixed 
5
alostale
0039557: Eclipse warnings task fails when processing log4j annotations
The project compiles without errors in Eclipse IDE. However, using the ecj batch compiler in the eclipse-warnings task it fails in the annotation processing step with the following message:

Processing annotations
java.lang.IllegalArgumentException: Unknown location : CLASS_OUTPUT
    at org.eclipse.jdt.internal.compiler.apt.util.EclipseFileManager.getFileForOutput(EclipseFileManager.java:436)
    at org.eclipse.jdt.internal.compiler.apt.dispatch.BatchFilerImpl.createResource(BatchFilerImpl.java:89)
    at org.apache.logging.log4j.core.config.plugins.processor.PluginProcessor.writeCacheFile(PluginProcessor.java:117)
    at org.apache.logging.log4j.core.config.plugins.processor.PluginProcessor.process(PluginProcessor.java:78)
    at org.eclipse.jdt.internal.compiler.apt.dispatch.RoundDispatcher.handleProcessor(RoundDispatcher.java:142)
    at org.eclipse.jdt.internal.compiler.apt.dispatch.RoundDispatcher.round(RoundDispatcher.java:124)
    at org.eclipse.jdt.internal.compiler.apt.dispatch.BaseAnnotationProcessorManager.processAnnotations(BaseAnnotationProcessorManager.java:162)
    at org.eclipse.jdt.internal.compiler.Compiler.processAnnotations(Compiler.java:940)
    at org.eclipse.jdt.internal.compiler.Compiler.compile(Compiler.java:450)
    at org.eclipse.jdt.internal.compiler.Compiler.compile(Compiler.java:426)
    at org.eclipse.jdt.internal.compiler.batch.Main.performCompilation(Main.java:4693)
    at org.eclipse.jdt.internal.compiler.batch.Main.compile(Main.java:1781)
    at org.eclipse.jdt.internal.compiler.batch.Main.main(Main.java:1485)
Processing annotations
No elements to process
1. ERROR: Unknown location : CLASS_OUTPUT
1 problem (1 error)

This issue has already been reported in:
- Stack Overflow: https://stackoverflow.com/questions/52998733/ecj-fails-with-illegalargumentexception-processing-log4j-annotations [^]
- Log4j Jira: https://issues.apache.org/jira/browse/LOG4J2-2487 [^]
- Eclipse issue tracker: https://bugs.eclipse.org/bugs/show_bug.cgi?id=540569 [^]
The following repository contains a minimal scenario to reproduce this issue:

https://github.com/katanagari7c1/ecj-error-log4j [^]

Just clone this repository and execute run-ecj.sh.
Until either Eclipse/Apache comes with a patch to solve this issue, log4j's annotation processor can be skipped in batch build by removing META-INF/services/javax.annotation.processing.Processor in log4j-core-x.y.z.jar.

This should be done only in eclipse-warnings task.
No tags attached.
related to feature request 0039504 closed jarmendariz Openbravo ERP Upgrade Log4j to version 2 
Issue History
2018-10-29 16:42jarmendarizNew Issue
2018-10-29 16:44jarmendarizRelationship addedrelated to 0039504
2018-10-29 16:45jarmendarizAssigned To => jarmendariz
2018-10-29 16:45jarmendarizStatusnew => scheduled
2018-10-30 14:28jarmendarizNote Added: 0107658
2018-10-30 14:28jarmendarizStatusscheduled => resolved
2018-10-30 14:28jarmendarizResolutionopen => fixed
2018-10-30 14:29jarmendarizReview Assigned To => alostale
2018-11-08 09:56alostaleStatusresolved => closed

Notes
(0107658)
jarmendariz   
2018-10-30 14:28   
Repository: ci/eclipse-warnings
Changeset: ada4fd8fd3c2
Author: Javier Armendáriz <javier.armendariz <at> openbravo.com>
Date: Mon, 29 Oct 2018 17:24:08 +0100
URL: https://code.openbravo.com/tools/ci/eclipse-warnings/rev/ada4fd8fd3c2 [^]

Fixed issue 39557: Ecj fails when processing log4j annotations

This replaces the log4j-core library in the classpath with a customized jar with
no annotation processing as a workaround until this bug is solved. Also wrapped all
js code in CDATA tags to avoid problems with the && operator.

---
M build-eclipse.xml
A log4j-core-2.11.1.jar
---