Stanford OpenIE example code compile error - java

http://nlp.stanford.edu/software/openie.shtml generates compile time error :
SemanticGraphCoreAnnotations.EnhancedDependenciesAnnotation cannot be resolved to a type
I am running java-8 under eclipse 2016. corenlp-full-2015-12-01.zip, openie.jar, openie-models.jar are in included in my eclipse project.
Error generated by line of:
System.out.println(sentence.get(SemanticGraphCoreAnnotations.EnhancedDependenciesAnnotation.class).toString(SemanticGraph.OutputFormat.LIST));
thanks

If I were to guess, this sounds like a classpath issue. What happens if you remove either openie.jar or the corenlp distribution? In theory, openie.jar should contain everything you need to run the Open IE system.

I have the same error.
What does this package edu.stanford.nlp.naturalli; in the first line of the code snippet mean?
I do not have much Java knowledge, I just created a Java project somewhere and included the same files as WH Sweet did.
I just found that within the corenlp project subfolder naturalli there is a OpenIEDemo.java already. Maybe the explanation for this would solve the initial problem..

Related

Error during SonarScanner execution after executing SonarScanner.MSBuild.exe end command

Sonarqube Version -7.9.5
SonarQube Scanner - sonar-scanner-msbuild-5.0.4.24009-net46
Source code contains - C#, angular.js, html5, javascript.
Hi,
I executed the following commands and after executing the 3rd command I am getting execution failure error.
The command I executed in the CMD prompt are browsing to the path where solution is present are,
SonarScanner.MSBuild.exe begin /k:"Demo" /d:sonar.host.url="http://localhost:9000" /d:sonar.login="TokenID_ABC"
MsBuild.exe /t:Rebuild
SonarScanner.MSBuild.exe end /d:sonar.login="TokenID_ABC"
ERROR: Error during SonarScanner execution
org.sonar.java.AnalysisException: Please provide compiled classes of your project with sonar.java.binaries property
I found one similar kind of issue reported where it is said that due to .java file present in the code the issue occurs, in our code as well .java files are present, not sure the use of them. How can I exclude those .java files while SonarQube analysis is performed and in which file do I need to add exclusion code?
Also, if there is some another solution to resolve this issue, then please let me know as I have very limited knowledge of Sonar.
Link of similar issue -
https://community.sonarsource.com/t/error-while-running-sonar-scanner-please-provide-compiled-classes-of-your-project-with-sonar-java-binaries-property/30027/2
You can exclude arbitrary files by going to your project settings in SonarQube -> Analysis Scope -> Source File Exclusions. Use regex to match your java files, i.e. *.java.

JavaBuilder handling CoreException

I am working with Eclipse. All was right during I was developing, but I have two days with some strange problems. I have a subproject with several packages. I want to use some classes between packages and Eclipse recognizes the imports. However, when I try to import, it shows that the import cannot be resolved. I saw the log file and I get the next lines:
org.eclipse.core.runtime.CoreException: File not found: E:\eclipse\PasarelaCARTIF\classes\es\cartif\zigbee\driver\Controller.class.
at org.eclipse.core.internal.filesystem.Policy.error(Policy.java:55)
at org.eclipse.core.internal.filesystem.local.LocalFile.openInputStream(LocalFile.java:371)
at org.eclipse.core.internal.localstore.FileSystemResourceManager.read(FileSystemResourceManager.java:702)
at org.eclipse.core.internal.resources.File.getContents(File.java:293)
at org.eclipse.jdt.internal.core.util.Util.getResourceContentsAsByteArray(Util.java:1131)
at org.eclipse.jdt.internal.core.builder.IncrementalImageBuilder.writeClassFileCheck(IncrementalImageBuilder.java:875)
at org.eclipse.jdt.internal.core.builder.IncrementalImageBuilder.writeClassFileContents(IncrementalImageBuilder.java:817)
at org.eclipse.jdt.internal.core.builder.AbstractImageBuilder.writeClassFile(AbstractImageBuilder.java:823)
at org.eclipse.jdt.internal.core.builder.AbstractImageBuilder.acceptResult(AbstractImageBuilder.java:187)
at org.eclipse.jdt.internal.compiler.Compiler.compile(Compiler.java:504)
at org.eclipse.jdt.internal.core.builder.AbstractImageBuilder.compile(AbstractImageBuilder.java:364)
at org.eclipse.jdt.internal.core.builder.IncrementalImageBuilder.compile(IncrementalImageBuilder.java:321)
at org.eclipse.jdt.internal.core.builder.AbstractImageBuilder.compile(AbstractImageBuilder.java:301)
at org.eclipse.jdt.internal.core.builder.IncrementalImageBuilder.build(IncrementalImageBuilder.java:134)
at org.eclipse.jdt.internal.core.builder.JavaBuilder.buildDeltas(JavaBuilder.java:265)
at org.eclipse.jdt.internal.core.builder.JavaBuilder.build(JavaBuilder.java:193)
at org.eclipse.core.internal.events.BuildManager$2.run(BuildManager.java:629)
at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:42)
at org.eclipse.core.internal.events.BuildManager.basicBuild(BuildManager.java:172)
at org.eclipse.core.internal.events.BuildManager.basicBuild(BuildManager.java:203)
at org.eclipse.core.internal.events.BuildManager$1.run(BuildManager.java:255)
at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:42)
at org.eclipse.core.internal.events.BuildManager.basicBuild(BuildManager.java:258)
at org.eclipse.core.internal.events.BuildManager.basicBuildLoop(BuildManager.java:311)
at org.eclipse.core.internal.events.BuildManager.build(BuildManager.java:343)
at org.eclipse.core.internal.events.AutoBuildJob.doBuild(AutoBuildJob.java:144)
at org.eclipse.core.internal.events.AutoBuildJob.run(AutoBuildJob.java:242)
at org.eclipse.core.internal.jobs.Worker.run(Worker.java:54)
It is the first time it occurs. What is the problem?
Thanks a lot! Have a nice day!
A long shot! Try clean in eclipse then build your projects. Starting with the project which have the class files needed later in the next compilation.
More than often eclipse messes up your project and you have to resort to strange methods such as the one described above. It's not unheard of to be forced to create a new workspace and import you project there and then it magically starts working again.
Look if your .java file from the project you have dependencies on really compiles to and creates a .class file at the desired folder indicated by the error message from the other project.
Another long shot:
I think your hard drive may be crashing.
I've had the same experience, along with bad sectors crashing my VM, etc for the past few days. Thus, checking out a new workspace can be short term solution.
Performing a Clean resolved this issue for me, but only after I physically deleted the bin directory first.

AdaptRecursive StackOverflowError

While compiling my project I get:
The system is out of resources.
Consult the following stack trace for details.
java.lang.StackOverflowError
at com.sun.tools.javac.code.Type$WildcardType.isSuperBound(Type.java:435)
at com.sun.tools.javac.code.Types$1.visitWildcardType(Types.java:102)
at com.sun.tools.javac.code.Types$1.visitWildcardType(Types.java:98)
at com.sun.tools.javac.code.Type$WildcardType.accept(Type.java:416)
at com.sun.tools.javac.code.Types$MapVisitor.visit(Types.java:3232)
at com.sun.tools.javac.code.Types.upperBound(Types.java:95)
at com.sun.tools.javac.code.Types.adaptRecursive(Types.java:2986)
at com.sun.tools.javac.code.Types.adapt(Types.java:3016)
at com.sun.tools.javac.code.Types.adaptRecursive(Types.java:2977)
at com.sun.tools.javac.code.Types.adaptRecursive(Types.java:2986)
at com.sun.tools.javac.code.Types.adapt(Types.java:3016)
at com.sun.tools.javac.code.Types.adaptRecursive(Types.java:2977)
at com.sun.tools.javac.code.Types.adaptRecursive(Types.java:2986)
at com.sun.tools.javac.code.Types.adapt(Types.java:3016)
at com.sun.tools.javac.code.Types.adaptRecursive(Types.java:2977)
at com.sun.tools.javac.code.Types.adaptRecursive(Types.java:2986)
at com.sun.tools.javac.code.Types.adapt(Types.java:3016)
...
How do you find the root of the problem?
I have found a bug report...
The bug report you linked to indicates that the bug was fixed in JDK 6. Which version of the JDK are you using to build?
If you can't identify the part of your source that is causing the problem, perhaps you could try compiling with JDK 6 to see if it can identify the problem without crashing.
Otherwise, I would use the "divide and conquer" approach: Remove half your source code, compile, and see if it still crashes. Depending on whether it does or not, you will know which half the problem is in. Repeat.
I would start by running javac with the -verbose option to see which .java file was causing the problem.
What about trying a different compiler, like the one in Eclipse? It's error messages are at least different, in my experience often more to the point. Also I haven't seen compilation failures like this yet.

taskdef A class needed by class org.apache.jasper.JspC cannot be found: Could not initialize class org.apache.jasper.JspC

Hi I am getting the error taskdef A class needed by class org.apache.jasper.JspC cannot be found: Could not initialize class org.apache.jasper.JspC when I tried to build the build.xml file. can anyone please give me a solution. Thanks in advance
I added the following to my ant classpath:
/usr/local/apache-tomcat-7/bin/tomcat-juli.jar
I had this problem too, but it was a long time ago and unfortunately my memory has become quite foggy on the subject.
As I recall, you need to start ANT with the -lib command line switch and have it point to some jar files that are needed by Jasper's JSP compiler. Again, I don't remember exactly which ones, but I think the JDK's tools.jar was one of them, as well as all the jars with jasper in the names, and commons-logging.jar and commons-el.jar. You'll have to do some experimenting :).
Do you have the required Jasper libraries in your classpath?
That is a relatively high level exception. If you would like to know more detail about what is missing from your classpath, you can run ant with the -verbose flag on the commandline.
It would be good to see the build.xml that you are using. Apache has put an example out here, which sounds similar to what you are using. If so, it requires that you specify some vars.
For this example Apache suggests:
The following command line can be used to run the script (replacing the tokens with the Tomcat base path and the path to the webapp which should be precompiled):
$ANT_HOME/bin/ant -Dtomcat.home=<$TOMCAT_HOME> -Dwebapp.path=<$WEBAPP_PATH>
If you are getting this error in eclipse "taskdef A class needed by class org.apache.jasper.JspC cannot be found: Could not initialize class org.apache.jasper.JspC",
jasper-compiler.jar consists of "org.apache.jasper.JspC", so please copy the commons-collections.jar in the same dirctory.
jasper-compiler.jar will be in C:\jboss-4.0.2\server\default\deploy\jbossweb-tomcat55.sar.
Hope it will resolve the issue.

Class file name must end with .class exception in Java Search

I was hoping someone could help me out with a problem I'm having using the java search function in Eclipse on a particular project.
When using the java search on one particular project, I get an error message saying Class file name must end with .class (see stack trace below). This does not seem to be happening on all projects, just one particular one, so perhaps there's something I should try to get rebuilt?
I have already tried Project -> Clean... and Closing Eclipse, deleting all the built class files and restarting Eclipse to no avail.
The only reference I've been able to find on Google for the problem is at http://www.crazysquirrel.com/computing/java/eclipse/error-during-java-search.jspx, but unfortunately his solution (closing, deleting class files, restarting) did not work for me.
If anyone can suggest something to try, or there's any more info I can gather which might help track it's down, I'd greatly appreciate the pointers.
Version: 3.4.0
Build id: I20080617-2000
Also just found this thread - http://www.myeclipseide.com/PNphpBB2-viewtopic-t-20067.html - which indicates the same problem may occur when the project name contains a period. Unfortunately, that's not the case in my setup, so I'm still stuck.
Caused by: java.lang.IllegalArgumentException: Class file name must end with .class
at org.eclipse.jdt.internal.core.PackageFragment.getClassFile(PackageFragment.java:182)
at org.eclipse.jdt.internal.core.util.HandleFactory.createOpenable(HandleFactory.java:109)
at org.eclipse.jdt.internal.core.search.matching.MatchLocator.locateMatches(MatchLocator.java:1177)
at org.eclipse.jdt.internal.core.search.JavaSearchParticipant.locateMatches(JavaSearchParticipant.java:94)
at org.eclipse.jdt.internal.core.search.BasicSearchEngine.findMatches(BasicSearchEngine.java:223)
at org.eclipse.jdt.internal.core.search.BasicSearchEngine.search(BasicSearchEngine.java:506)
at org.eclipse.jdt.core.search.SearchEngine.search(SearchEngine.java:551)
at org.eclipse.jdt.internal.corext.refactoring.RefactoringSearchEngine.internalSearch(RefactoringSearchEngine.java:142)
at org.eclipse.jdt.internal.corext.refactoring.RefactoringSearchEngine.search(RefactoringSearchEngine.java:129)
at org.eclipse.jdt.internal.corext.refactoring.rename.RenameTypeProcessor.initializeReferences(RenameTypeProcessor.java:594)
at org.eclipse.jdt.internal.corext.refactoring.rename.RenameTypeProcessor.doCheckFinalConditions(RenameTypeProcessor.java:522)
at org.eclipse.jdt.internal.corext.refactoring.rename.JavaRenameProcessor.checkFinalConditions(JavaRenameProcessor.java:45)
at org.eclipse.ltk.core.refactoring.participants.ProcessorBasedRefactoring.checkFinalConditions(ProcessorBasedRefactoring.java:225)
at org.eclipse.ltk.core.refactoring.Refactoring.checkAllConditions(Refactoring.java:160)
at org.eclipse.jdt.internal.ui.refactoring.RefactoringExecutionHelper$Operation.run(RefactoringExecutionHelper.java:77)
at org.eclipse.jdt.internal.core.BatchOperation.executeOperation(BatchOperation.java:39)
at org.eclipse.jdt.internal.core.JavaModelOperation.run(JavaModelOperation.java:709)
at org.eclipse.core.internal.resources.Workspace.run(Workspace.java:1800)
at org.eclipse.jdt.core.JavaCore.run(JavaCore.java:4650)
at org.eclipse.jdt.internal.ui.actions.WorkbenchRunnableAdapter.run(WorkbenchRunnableAdapter.java:92)
at org.eclipse.jface.operation.ModalContext$ModalContextThread.run(ModalContext.java:121)
Thanks McDowell, closing and opening the project seems to have fixed it (at least for now).
Comment #9 to bug 269820 explains how to delete the search index, which appears to be the solution to a corrupt index whose symptoms are the dreaded
An internal error occurred during: "Items filtering".
Class file name must end with .class
message box.
How to delete the search index:
Close Eclipse
Delete <workspace>/.metadata/.plugins/org.eclipse.jdt.core/*.index
Delete <workspace>/.metadata/.plugins/org.eclipse.jdt.core/savedIndexNames.txt
Start Eclipse again
Two more general-purpose mechanisms for fixing some of Eclipse's idiosyncrasies:
Close and open the project
Delete the project (but not from disk!) and reimport it as an existing project
Failing that, bugs.eclipse.org might provide the answer.
If the workspace is caching something broken, you may be able to delete it by poking around in workspace/.metadata/.plugins. Most of that stuff is fairly transient (though backup and watch for deleted preferences).
Got this error to the other day. Tried deleting the all .class-files and resources from my output folder manually. Didn't work. Restarted my computer (WinXP). Didn't work. Closed my project in Eclipse and opened it again. Worked!!! Hopes this solves someones problem out there. The search facilities and truly essential to Eclipse.
I also encountered this issue recently, the below scenario worked for me.
Close Eclipse
Delete <workspace>/.metadata/.plugins/org.eclipse.jdt.core/*.index
Delete <workspace>/.metadata/.plugins/org.eclipse.jdt.core/savedIndexNames.txt
Start Eclipse again
Closing the projects didn't do the trick for me. I started eclipse with the -clean flag and that worked for some reason.
Just
Close project
Clear manually output folder(s)
Open project
(Eclipse 3.5 SR2, Build id: 20100218-1602)

Categories

Resources