NoSuchFieldError while running NERDemo.java file - java

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.

Related

My Bukkit plugins has a plugin.yml but it gives this error [duplicate]

I am trying to create a Spigot plugin that allows players to use a compass to track other players. While exporting and running the server, I noticed that it was giving me an error:
[21:57:15 ERROR]: Could not load 'plugins\Manhunt.jar' in folder 'plugins'
org.bukkit.plugin.InvalidDescriptionException: Invalid plugin.yml
at org.bukkit.plugin.java.JavaPluginLoader.getPluginDescription(JavaPluginLoader.java:172) ~[patched_1.16.5.jar:git-Paper-683]
at org.bukkit.plugin.SimplePluginManager.loadPlugins(SimplePluginManager.java:148) ~[patched_1.16.5.jar:git-Paper-683]
at org.bukkit.craftbukkit.v1_16_R3.CraftServer.loadPlugins(CraftServer.java:389) ~[patched_1.16.5.jar:git-Paper-683]
at net.minecraft.server.v1_16_R3.DedicatedServer.init(DedicatedServer.java:252) ~[patched_1.16.5.jar:git-Paper-683]
at net.minecraft.server.v1_16_R3.MinecraftServer.w(MinecraftServer.java:1066) ~[patched_1.16.5.jar:git-Paper-683]
at net.minecraft.server.v1_16_R3.MinecraftServer.lambda$a$0(MinecraftServer.java:290) ~[patched_1.16.5.jar:git-Paper-683]
at java.lang.Thread.run(Unknown Source) [?:1.8.0_291]
Caused by: java.io.FileNotFoundException: Jar does not contain plugin.yml
... 7 more
I have never seen this error before and I'm not sure how to fix it. I have made sure to export the .yml file while in Eclipse, but it still shows me this error.
The plugin.yml file is a required part of a SpigotMC plugin that defines some basic information about the plugin like its name and the version of the Spigot API that it uses. For example, here's one for a Minecraft plugin I'm currently working on.
The error you're getting comes from that file not getting bundled into the jar. As a result, when the Spigot server tries to load your plugin, it can't find the plugin.yml because it's literally not present in your compiled jar.
I recommend setting up a build system like Gradle or Maven that will handle the complexities of building the jar for you independent of the IDE you use.
Set up a SpigotMC plugin using Maven
Set up a SpigotMC plugin using Gradle
I personally use Gradle, so feel free to see how I implemented it in one of my plugins. If you'd prefer Maven, there are many examples available including the popular Multiverse-Core.
You need the plugin.yml to run your plugin. If you're using spigot or bukkit, you should make your plugin.yml inside the src folder, in there, you need to include a minimum of:
name: (plugin name, no spaces allowed in name)
author: (your name)
version: (your plugin version)
api-version: (use 1.14)
main: (your main class)
description: (optional description, otherwise delete this line)
then you can export or rebuild the jar
This is an example of what my plugin.yml looks like:
name: ThornsPlugin
version: 1.0
author: MOREORLESS
api-version: 1.14
main: com.MOREORLESS.plugin.plugin
description: MC Stuff
Learn more about Plugin.yml here: https://www.spigotmc.org/wiki/plugin-yml/

ant error while compiling typedef A class needed by class IvyAntSettings cannot be found

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.

Error opening zip file or JAR manifest missing : \\ Error occurred during initialization of VM agent library failed to init: instrument

Error opening zip file or JAR manifest missing : C:\Users\rahul.m2\repository/org/aspectj/aspectjweaver/1.8.10/aspectjweaver-1.8.10.jar
Error occurred during initialization of VM
agent library failed to init: instrument
#java, #maven #TestNG #eclipse || OS == windows ||
I'm facing this problem,
I even tried reinstalling everything(java / maven / eclipse)enter image description here
also tried deleting all files -> .m2\repository and updating the maven project (forced), but it still didn't work.
can anyone please help me?
idk is it actual now but i found solution. change aspectj.version to an earlier version (for example: 1.9.5) in dependencies and properties.

Pitest (PIT Mutation Testing) exception with local dynamodb

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)

Consuming aars from eclipse does not work

*THIS PART WAS MY ORIGINAL STARTING PROBLEM. PLEASE READ THE UPDATES
I have imported an android project in eclipse that apparently depends on rengwuxian.
Since I could not find the jar and did not know how else to do it, I followed the instructions in consuming-aars-eclipse and imported a second project with the artifacts from the aar as an android eclipse project as well.
Then in my original project that I got compilation errors for com.rengwuxian.materialedittext.MaterialEditText in my layout files I added this newly created from the aar project as a reference (Project->Properties->Build Path->Add Project)
The compilation errors got resolved! But in my layout files now everywhere that is defined the element com.rengwuxian.materialedittext.MaterialEditText I get errors in the resource definitions.
Eg.the following:
error: No resource identifier found for attribute 'baseColor' in
package 'com.test
The attibute it seems to complaint about is:
<com.rengwuxian.materialedittext.MaterialEditText
android:id="#+id/client"
android:layout_width="match_parent"
android:layout_height="wrap_content"
.....
android:textColor="#color/text_color"
app:baseColor="#color/text_color"
app:primaryColor="#color/text_color" />
---> app:baseColor="#color/text_color"
This #color/text_color is defined in my original application in the original application's package and apparently the classes in the aar imported project (com.rengwuxian.materialedittext.MaterialEditText) can not see/access these resources.
How can I fix this? Or is there another better way for my problem?
Note: I also tried adding a source link to the folder of my project's res/ folder but did not solve this.
Update:
I removed the reference to the project and add the classes.jar to the build path (this jar was inside the aar project). Same issue
UPDATE 2:
I found this that helps to import aars to eclipse aar-for-eclipse. I copy/pasted the code snippets (task copyJarDependencies etc) in the folder but I got an exception:
No such property: libDir for class: org.gradle.api.tasks.Copy_Decorated
So I added a def in the line `libDir = new File(project.projectDir, '/libs')
Then this worked but I got:
Could not find property 'compile' on configuration container
How can fix this? I am not sure what to declare or what is missing
Update 3:
I added apply plugin: 'java' and the compile attribute is ok now but I get:
configurations.releaseCompile.filter {it.name.endsWith 'jar'}.each { File file -> moveJarIntoLibs(file)}
How can I fix this so that it works?
I am using this project ---> https://github.com/rengwuxian/MaterialEditText
And this post ---> http://www.nodeclipse.org/projects/gradle/android/aar-for-Eclipse
I've got a similar problem with gradle but on android studio. Solution for me was to use
configurations.releaseCompile.filter {it.name.endsWith 'jar'}.each {moveJarIntoLibs(it)}
instead of:
configurations.releaseCompile.filter {it.name.endsWith 'jar'}.each { File file -> moveJarIntoLibs(file)}
And remember not to apply java and android plugin in the same project, because it won't work (see gradle with --debug --stacktrace )

Categories

Resources