I'm recieving the following pi-test exception when I have local dynamoDB lib files in my java project with a gradle build. Seems pi-test tries to open the lib file. Could not find a way to exclude lib files from pi-test either.
:pitest
Exception in thread "main" org.pitest.util.PitError: error in opening zip file (/Users/user1/.gradle/caches/modules-2/files-2.1/com.almworks.sqlite4java/libsqlite4java-linux-i386/1.0.392/b193c62571061e68bddeaf8ee7d3a8569b945ea6/libsqlite4java-linux-i386-1.0.392.so)
How can I solve this issue and have the mutation test on the gradle project?
This issue supposed to be fixed in the PI-test Gradle plugin v 1.1.11
(issue open: https://github.com/szpak/gradle-pitest-plugin/issues/52)
Related
I have an ant project with build.xml and ivy.xml setup.
when I run the "ant" command line or I use intellij to build the jar (with -compile) I am getting this error:
BUILD FAILED
build.xml : the following error occurred while executing this line:
jar:file:/C:/java/jdk1.8.0_351/jre/lib/ext/ivy-2.3.0.jar!/org/apache/ivy/ant/antlib.xml:21: type def A class needed by class org.apache.ivy.IvySettings cannot be found: org/apache/tools/types/DataType using the classloader AntClassLoader[]
...
Caused by: java.lang.NoClassDefFoundError: org/apache/tools/types/DataType
I tried ivy version 2.3.0, 2.4.0, 2.5.0, 2.5.1, ant version 1.10.5, 1.10.10, 1.10.12.
My ANT_HOME and JAVA_*HOME are set properly and ANT_*HOME is in PATH
I can create run configuration and the service runs properly, I can access API/REST, no compile errors.
I am not sure what else to check
The problem is I had the jar files in multiple location. I removed it from the $ANT_HOME/lib/ant/lib folder and it worked.
I've a Spring Boot app written in Kotlin that I have deployed to AWS Beanstalk that is throwing the following exception:
Exception in thread "main" java.lang.NoSuchMethodException: com.prototype.demo.DemoApplication.main([Ljava.lang.String;)
at java.base/java.lang.Class.getDeclaredMethod(Class.java:2675)
at org.springframework.boot.loader.MainMethodRunner.run(MainMethodRunner.java:47)
Locally, when I run the app from IntelliJ I've no issues.
I have the spring-boot-maven-plugin and the kotlin-maven-plugin in my project.
Any ideas about what could be causing the issue? I previously built a similar app in Java but didn't run into this issue.
Thank you for your expertise and time.
Update: something interesting to notice is that I had to set in the properties of my POM the following line in order to make the project executable by IntelliJ during development (i had forgotten about it): <start-class>com.prototype.demo.DemoApplication</start-class>
Now I've removed it and I get a different error when running the jar file. I will spend some time on it and see if that's related or not and update the question accordingly.
Thank you!
The issue was raised by the following property declared in my POM file: <start-class>com.prototype.demo.DemoApplication</start-class>.
Once I removed it and added the open keyword to the Configuration annotated classes and to the DemoApplication(the class containing the main) it finally worked.
Solution for build.gradle.kts
I had the same problem when deploying my application to ECS.
First things first:
When you see such an error in AWS logs -> do as the author of the question has done and test the issue locally. Most probably if the application is failing on AWS, it will also fail on you local machine. To do so, you build a jar locally, the jar file is usually saved in build/libs/application-x.x.x-SNAPSHOT.jar and run java -jar application-x.x.x-SNAPSHOT.jar
Now you can fix your build task and test it locally before deploying it again.
Fix Gradle:
My main method was defined in MyApplication.kt file, but in the definition of the main class in gradle I had to set the following:
tasks.getByName<org.springframework.boot.gradle.tasks.bundling.BootJar>("bootJar") {
mainClass.set("com.company.app.MyApplicationKt")
}
Notice: MyApplicationKt
That is the only thing I had to change for me to fix this issue.
Getting
java.lang.NoClassDefFoundError error when running xml file using
testng.
Error details: java.lang.NoClassDefFoundError: Could not
initialize class com.listeners.ExtentTestManager at
com.listeners.Listeners.onTestFailure(Listeners.java:56)
I am using testng version 6.9.10 in pom.xml.
Hi, I am getting this error when I use listeners in my xml file. If I remove listeners and run the xml file, it is working. Please let me know if anything wrong with ExtentTestManager class or the dependencies. I am unable to add code in stackoverflow, so I have attached in this link: selenium99.com/java-lang-noclassdeffounderror Pls check.
You can try maven update project in eclipse after that use clean install, it should work.
Basically
NoClassDefFoundError can occur for multiple reasons like
ClassNotFoundException -- .class not found for that referenced class irrespective of whether it is available at compile time or not(i.e base/child class).
Class file located, but Exception raised while initializing static variables
Class file located, Exception raised while initializing static blocks
But in this case it looks like you are missing some dependency in the building.
you can try cleaning whole project and build again.
If it's a eclipse project
mvn clean eclipse:eclipse
mvn clean package
try above commands
I am trying to run this program on Eclipse and it is giving following error:
Loading classifier from E:\corenlp\stanford-ner-2015-01-29\stanford-ner-2015-01-30\classifiers\english.all.3class.distsim.crf.ser.gz ... done [6.8 sec].
Exception in thread "main" java.lang.NoSuchFieldError: wordFunction
at edu.stanford.nlp.sequences.ObjectBankWrapper.doBasicStuff(ObjectBankWrapper.java:136)
at edu.stanford.nlp.sequences.ObjectBankWrapper.processDocument(ObjectBankWrapper.java:93)
at edu.stanford.nlp.sequences.ObjectBankWrapper$WrappedIterator.next(ObjectBankWrapper.java:86)
at edu.stanford.nlp.sequences.ObjectBankWrapper$WrappedIterator.next(ObjectBankWrapper.java:50)
at edu.stanford.nlp.ie.AbstractSequenceClassifier.classifyToString(AbstractSequenceClassifier.java:542)
at edu.stanford.nlp.ie.AbstractSequenceClassifier.classifyToString(AbstractSequenceClassifier.java:588)
at NERDemo.main(NERDemo.java:87)
For clarity, line 87 is:
System.out.println(classifier.classifyToString(str));
I am using latest versions of all NLP tools and have included all jar files in Build Path option in Eclipse.
What should I do?
I was getting same error to execute ParserDemo.java code available in stanford-parser. In order to resolve it, I downloaded the latest parser from here. Extracted zip file into some folder. Then I imported that project into eclipse by following steps:
File -> New -> Project -> Java -> Java project from existing Ant File -> Specify the folder containing build.xml file
I specified stanford-parser-3.4.1-sources.jar and stanford-parser-3.4.1-models.jar using 'Build Path'.
I hope these steps may give some clue about the problem.
I just ruined my android project. I touched the Project structure added a dependency (for gdx-tools). There weren't any dependencies before. Now Gradle cannot find find any libraries.
Error:(32, 0) Gradle: A problem occurred evaluating project ':android'.
> Could not resolve all dependencies for configuration ':android:natives'.
> A problem occurred configuring project ':core'.
> Could not open buildscript class cache for build file '..\build.gradle' (..\.gradle\caches\1.11\scripts\build_5nf261mprglcnmchu7kvpoddt6\ProjectScript\buildscript).
> Timeout waiting to lock buildscript class cache for build file '..\core\build.gradle' (..\.gradle\caches\1.11\scripts\build_5nf261mprglcnmchu7kvpoddt6\ProjectScript\buildscript). It is currently in use by another Gradle instance.
Owner PID: unknown
Our PID: 3732
Owner Operation: unknown
Our operation: Initialize cache
Lock file: ..\.gradle\caches\1.11\scripts\build_5nf261mprglcnmchu7kvpoddt6\ProjectScript\buildscript\cache.properties.lock
Anyone knows how to fix this, without generating a new project?
Exit Android Studio, clear out the Gradle cache folder whose path is in the error message, and relaunch.
There is a cache which gradle maintain for all the dependancies which we add in build.gradle file in user's directory.
In Windows:
C:\Users\Administrator.gradle\caches
In Mac:
/Users/UserName/.gradle/caches
Delete the caches folder. Now next time when you run gradle sysc then it will download all dependencies again and the problem of lock should be resolved.
This problem is also reported as an issue: https://issues.gradle.org/browse/GRADLE-2795
This lock issue happened to me when I was running
gradle run
in another bash window.
I just had to stop that to get it working again.