ECJ fails with IllegalArgumentException processing log4j annotations - java

I'm using log4j 2.11.1 in my project and created some custom appenders and configuration factories using the #Plugin annotation.
This compiles just fine without errors both in Eclipse 4.9 and with IntelliJ. However, running the Eclipse batch compiler the same code fails with a IllegalArgumentException:
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)
In this repo I made a minimal project to reproduce this issue. I tried using versions 4.7 and 4.9 of ECJ and tried with Java 8 OpenJDK and Oracle, all of it in a Ubuntu 18.04 machine.
Any clue of what could be happening here?
Edit:
Tried using Java10 on a OSX machine and the same error appears.

Related

Wix embedded mysql does not start due CommandFailedException due 'Stream closed'

Trying to run my embedded mysql based Unit tests I get an exception with this part:
Failed to instantiate [com.wix.mysql.EmbeddedMysql]: Factory method 'getEmbeddedMysql' threw exception; nested exception is com.wix.mysql.exceptions.CommandFailedException: Command 'CREATE USER 'sa'#'%' IDENTIFIED BY '';' on schema 'information_schema' failed with message 'Stream closed'
The same unit test and environment setup work on my MacBook
This machine with the error is an Ubuntu 20.04
Wix version is 4.6.2; Java 8, mysql.connector 8.0.24
I tried changing the dependencies versions and also tried with Java 11.
Run from within IntelliJ and on the command line. Same result.
Let me put the full comment I found in Github which helped me to fix this and I'm pretty sure most of the people seeing this in Ubuntu will find this as the solution:
I had this same issue with MySQL 5.7, while working on another open source project. I cloned the wix-embedded-mysql repository and ran the tests using the master branch, which also failed in the exact same way, except that I received a longer, more thorough message in the catch.
The issue was that I was on Ubuntu and did not have the ncurses 5 shared library installed. On ubuntu, I installed libncurses5 (apt install libncurses5) and everything started working (all tests on wix, and on my project).
I hope this helps resolve the issue.
Thanks to https://github.com/codesplode

Error linking JNA library on AdoptOpenJDK on MacOS

I am trying to run some JUnit tests over cassandra. But I get the following error:
[08/12/19 10:48:40:411](main)([]) INFO - c.h.c.c.e.EmbeddedCassandra - Starting embedded Cassandra server.
8/12/19 10:48:41:497](main)([]) ERROR - o.a.c.u.NativeLibraryDarwin - Failed to link the C library against JNA. Native methods will be unavailable.
java.lang.UnsatisfiedLinkError: /private/var/folders/ty/wl4gxf352m328101m101hwh40000gn/T/jna--321969061/jna10641195286884112036.tmp: dlopen(/private/var/folders/ty/wl4gxf352m328101m101hwh40000gn/T/jna--321969061/jna10641195286884112036.tmp, 1): no suitable image found. Did find:
/private/var/folders/ty/wl4gxf352m328101m101hwh40000gn/T/jna--321969061/jna10641195286884112036.tmp: code signature in (/private/var/folders/ty/wl4gxf352m328101m101hwh40000gn/T/jna--321969061/jna10641195286884112036.tmp) not valid for use in process using Library Validation: mapped file has no cdhash, completely unsigned? Code has to be at least ad-hoc signed.
It was running well until I changed to mac mojave and re-setup everything. I think it is an issue related to permissions may be or JNA?
IDE: IntelliJ
Java: AdoptOpenJDK 11.0.4
JNA: 4.2.2
Any kind of help will be highly appreciated!
This is the result of a bug in AdoptOpenJDK jdk-11.0.4+11 on macOS, persisting through 11.2.
It will be fixed in the jdk-11.0.4+11.3 release.
If you can't wait for the new release you can temporarily resolve by downgrading to 11.0.3+7
What version of cassandra unit? Support for java 11 (https://issues.apache.org/jira/browse/CASSANDRA-9608) isn't in until cassandra 4 and I dont think embedded cassandra is setup for that yet

java.lang.ClassFormatError: JVMCFRE074 no Code attribute specified; class=javax/ejb/RemoveException, method=<init>()V, pc=0

I am getting the below error while trying to publish the application EAR in the server.
Deployment from com.ibm.etools.ejbdeploy.EJBDeployer had errors:
RMIC Command returns RC = MyApplicationEJB. The problems which stopped RMIC are displayed, and have also been recorded in the .log file in error: An error has occurred in the compiler; please file a bug report (http://java.sun.com/cgi-bin/bugreport.cgi).
java.lang.ClassFormatError: JVMCFRE074 no Code attribute specified; class=javax/ejb/RemoveException, method=<init>()V, pc=0
at java.lang.ClassLoader.defineClass(ClassLoader.java:275)
at java.lang.ClassLoader.defineClass(ClassLoader.java:212)
at com.ibm.tools.rmic.iiop.DirectoryLoader.loadClass(DirectoryLoader.java:149)
at com.ibm.tools.rmic.iiop.CompoundType.loadClass(CompoundType.java:354)
at com.ibm.tools.rmic.iiop.Type.initClass(Type.java:1008)
at com.ibm.tools.rmic.iiop.Type.setRepositoryID(Type.java:1025)
at com.ibm.tools.rmic.iiop.CompoundType.initialize(CompoundType.java:762)
at com.ibm.tools.rmic.iiop.ValueType.initialize(ValueType.java:323)
at com.ibm.tools.rmic.iiop.ValueType.forValue(ValueType.java:131)
at com.ibm.tools.rmic.iiop.CompoundType.getMethodExceptions(CompoundType.java:1678)
at com.ibm.tools.rmic.iiop.CompoundType$Method.<init>(CompoundType.java:2457)
at com.ibm.tools.rmic.iiop.CompoundType.addAllMethods(CompoundType.java:1308)
at com.ibm.tools.rmic.iiop.RemoteType.isConformingRemoteInterface(RemoteType.java:222)
at com.ibm.tools.rmic.iiop.RemoteType.initialize(RemoteType.java:171)
at com.ibm.tools.rmic.iiop.RemoteType.forRemote(RemoteType.java:90)
at com.ibm.tools.rmic.iiop.CompoundType.makeType(CompoundType.java:852)
at com.ibm.tools.rmic.iiop.CompoundType$Method.<init>(CompoundType.java:2408)
at com.ibm.tools.rmic.iiop.CompoundType.addAllMethods(CompoundType.java:1308)
at com.ibm.tools.rmic.iiop.RemoteType.isConformingRemoteInterface(RemoteType.java:222)
at com.ibm.tools.rmic.iiop.RemoteType.initialize(RemoteType.java:171)
at com.ibm.tools.rmic.iiop.RemoteType.forRemote(RemoteType.java:90)
at com.ibm.tools.rmic.iiop.CompoundType.addRemoteInterfaces(CompoundType.java:1455)
at com.ibm.tools.rmic.iiop.ImplementationType.initialize(ImplementationType.java:166)
at com.ibm.tools.rmic.iiop.ImplementationType.forImplementation(ImplementationType.java:92)
at com.ibm.tools.rmic.iiop.CompoundType.makeType(CompoundType.java:892)
at com.ibm.tools.rmic.iiop.ClassType.initParents(ClassType.java:197)
at com.ibm.tools.rmic.iiop.ImplementationType.initialize(ImplementationType.java:156)
at com.ibm.tools.rmic.iiop.ImplementationType.forImplementation(ImplementationType.java:92)
at com.ibm.tools.rmic.iiop.StubGenerator.getTopType(StubGenerator.java:151)
at com.ibm.tools.rmic.iiop.Generator.generate(Generator.java:285)
at sun.rmi.rmic.Main.doCompile(Main.java:547)
at sun.rmi.rmic.Main.compile(Main.java:148)
at sun.rmi.rmic.Main.main(Main.java:786)
1 error
Can anybody please help me out in this.
I am using - Websphere 9.1 and jdk 1.6. Interesting thing is my colleagues who have a lower version of Websphere - 8.0, do not get this error.
UPDATE: My Websphere's Runtime Environment is - WebSphere Application Server v7.0
In general a ClassFormatError means that the class with the error was compiled at a java level that is greater than the java level being used at runtime.
In the case of WebSphere v9.0 (which only support Java 8+), the javax/ejb/RemoveException class is compiled at the Java 7 level, so running WAS on Java 6 with a class compiled at the Java 7 or higher level will result in a ClassFormatError.
Update:
You have mentioned in the comments that you are using WAS v7.0 and not WAS v9. The overall explanation is the same regardless of what version of WAS you are using, namely, you can't run on a lower java level than what the classes were compiled with.
I recommend checking what java version the javax/ejb/RemoveException class in your WAS install was compiled at, and compare it to the java level you are running on.

Configuring project for Java 8 in Eclipse

I am attempting to set up a Jetty Webapp project in Eclipse Neon and am getting the following error:
Generated servlet error: The type java.lang.CharSequence cannot be resolved
Based on this related post and a few others, I’ve been led to believe this being caused by a version mismatch between Java 7 and Java 8. The project also runs properly on other machines, which also would imply the issue is with my configuration. The accepted answer to the linked post is to either roll back to Java 7, or change the source level of the project to 8. Rolling back to 7 is not an option for me, as the project makes use of Java 8 features.
Im pretty sure I have everything set up for Java 8, but I’m not real experienced in Eclipse, so there could be a setting Im missing. I have set:
in Eclipse->Preferences->Java->Compiler->Compiler compliance level: 1.8
in Project->Preferences->Java Compiler->Compiler compliance level: 1.8
in Project->Preferences->Java Build Path->Libraries the JRE System Library is 1.8.0_77
in Run->Run Configurations->Jetty Webapp:
Jetty Version is Jetty 7.6.8v20121106
JRE is Project JRE (1.8.0_77)
I have also cleaned, rebuilt, removed and reimported the project, and restarted Eclipse.
Are there any settings I am missing that might still be set to Java 7?
Or is there some other reason why I would be getting this error?
the full error message is:
org.apache.jasper.JasperException: PWC6033: Unable to compile class for JSP||PWC6197: An error occurred at line: 17 in the jsp file: /WEB-INF/jsp/dashboard/showfilters.jsp|PWC6199: Generated servlet error:|The type java.lang.CharSequence cannot be resolved. It is indirectly referenced from required .class files||PWC6197: An error occurred at line: 17 in the jsp file: /WEB-INF/jsp/dashboard/showfilters.jsp|PWC6199: Generated servlet error:|The method replace(char, char) in the type String is not applicable for the arguments (String, String)||
at org.apache.jasper.compiler.DefaultErrorHandler.javacError(DefaultErrorHandler.java:123)
Also, the line in question is:
<a title=" <%= request.getAttribute("title").toString().replace("],", "\n") %>"></a>

Jmeter error trying to record a sample java.lang.IllegalArgumentException: Failed marshalling

I have one Linux VPS dedicated just for running a jmeter. The tests run fine, but failed requests are not written to error.jtl with SimpleDataWriter. Java error is written to jmeter.log instead.
I run the tests in non-gui mode:
jmeter -n -t om5.jmx -j results-tmp1/t3-l1-jmeter.log
The error
2016/07/08 16:59:35 ERROR - jmeter.reporters.ResultCollector:
Error trying to record a sample java.lang.IllegalArgumentException: Failed marshalling:class:class
org.apache.jmeter.samplers.SampleResult,content:org.apache.jmeter.samplers.SampleResult#1f605bfa[saveConfig=org.apache.jmeter.samplers.SampleSaveConfiguration#b4a9237e,parent=<null>,
responseData={},responseCode=500,label=03 add to cart,resultFileName=,samplerData=<null>,threadName=Thread Group 1-149,responseMessage=Number of samples in transaction : 2, number of failing samples : 1,
responseHeaders=,contentType=,requestHeaders=,timeStamp=1467989884109,startTime=1467989884109,endTime=1467989975286,idleTime=1001,pauseTime=0,assertionResults=<null>,subResults=[reset basketItems, /some-page],
dataType=,success=false,files=[res-tmp/t400-l5-errors.jtl],dataEncoding=<null>,elapsedTime=90176,latency=0,connectTime=0,startNextThreadLoop=false,stopThread=false,stopTest=false,
stopTestNow=false,isMonitor=false,sampleCount=1,bytes=806,headersSize=192,bodySize=614,groupThreads=400,allThreads=400,nanoTimeOffset=1467988012523,useNanoTime=true,nanoThreadSleep=5000,location=<null>]
at org.apache.jmeter.save.SaveService.saveSampleResult(SaveService.java:345)
at org.apache.jmeter.reporters.ResultCollector.sampleOccurred(ResultCollector.java:557)
at org.apache.jmeter.threads.ListenerNotifier.notifyListeners(ListenerNotifier.java:67)
at org.apache.jmeter.threads.JMeterThread.notifyListeners(JMeterThread.java:819)
at org.apache.jmeter.threads.JMeterThread.doEndTransactionSampler(JMeterThread.java:534)
at org.apache.jmeter.threads.JMeterThread.triggerEndOfLoopOnParentControllers(JMeterThread.java:342)
at org.apache.jmeter.threads.JMeterThread.run(JMeterThread.java:258)
at java.lang.Thread.run(Thread.java:745)
Caused by: java.lang.NullPointerException
I cannot find what is wrong. It is only that one machine, that gives me this error. Everywhere else I try it, it works correctly.
The OS is Debian Jessie (8.5) - minimal from official repositories. I tried many different versions of java (1.7, 1.8) - currently running on the latest 1.8 (1.8.0_92-b14) and I have the latest apache-jmeter 3.0 r1743807, but previously I used 2.13 r1665067. I don't use any third-party plugins.
I didn't notice exactly when it stopped working, what change was done (some os update, maybe some change in jmx), but I have my tests in git, so I checked out older version from the date of my last full error.jtl and it is not writing the errors to jtl as well.
I reinstalled the Debian to Ubuntu 16.04 and nothing changed.
I don't know how to debug that problem, what should I do, because on any other machine I have an access to, it works fine.
I don't know if you've fixed this problem until now?
I had the same issue, and I fixed it just now.
I guess in your jmeter script, you checked the hostname to record sample result, in jmeter.log, you could find such message: jmeter couldn't get the linux Local IP, so hostname is Null, exception threw out.
So what you need to do is remove 'Save Hostname' from 'Sample Result Save Configuration' tab.

Categories

Resources