ClassNotFoundException when running newest version of stanford-postagger 3.6.0 - stanford-nlp

I found the Stanford pos tagger and would like to use it in a project I am working on.
Unfortunately, I get the following error when I try to run it:
Exception in thread "Thread-0" java.lang.NoClassDefFoundError:
org/slf4j/LoggerFactory
at edu.stanford.nlp.io.IOUtils.(IOUtils.java:41)
at edu.stanford.nlp.tagger.maxent.MaxentTagger.readModelAndInit(MaxentTagger.java:765)
at edu.stanford.nlp.tagger.maxent.MaxentTagger.(MaxentTagger.java:298)
at edu.stanford.nlp.tagger.maxent.MaxentTagger.(MaxentTagger.java:263)
at edu.stanford.nlp.tagger.maxent.MaxentTaggerGUI$1.run(MaxentTaggerGUI.java:89)
Caused by: java.lang.ClassNotFoundException: org.slf4j.LoggerFactory
at java.net.URLClassLoader.findClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
... 5 more
The same error occurred whether running within eclipse, command line, or gui.
I discovered after searching for a solution and trying many that didn't help, that the previous version 3.5.2 runs just fine with no errors so I will revert to the previous version for now.
Is it possible there is a problem with the new version?

We've added slf4j logging to our releases. In 3.6.0 there is a folder called lib which needs to be added to the CLASSPATH.

Related

spring starter rest class not found hibernateexception

I downloaded the latest released Spring Toolkit - 3.8.1 Release.
I installed the starter "Import Spring Getting Started Content" -> "Accessing Data Rest"
I then tried to run "Complete" in a tomcat server and separately as a java application. In both cases it crashed. Most of the stack trace is omitted below:
Caused by: java.lang.ClassNotFoundException: org.hibernate.HibernateException
at java.net.URLClassLoader.findClass(Unknown Source) ~[na:1.8.0_73]
at java.lang.ClassLoader.loadClass(Unknown Source) ~[na:1.8.0_73]
at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source) ~[na:1.8.0_73]
at java.lang.ClassLoader.loadClass(Unknown Source) ~[na:1.8.0_73]
... 65 common frames omitted
Is there any fix?
Also, there is no Hello controller and the web site (https://spring.io/guides/gs/accessing-data-rest/) does not refer to creating such a thing.
Is it just completely broken?
I haven't discovered the ultimate cause, but I have solved the problem.
The computer where this wasn't working had had older versions of eclipse installed in the past, e.g. gallileo. The .eclipse directory dated from April 2013.
Completely removing the .eclipse and reinstalling STS caused STS to work fine. It is also important to install eclipse/STS outside of Windows protected directories like "Program Files" since we don't want to run eclipse as an administrator and Eclipse likes to write files in its installation directory.

Maven javafx with java 8

After fixing some problems with maven I am having some with my standalone app, all my other libraries seem to load properly.
I am getting this error
Exception in thread "main" java.lang.NoClassDefFoundError: javafx/embed/swt/FXCanvas
at mapper.osm.main.Main.createContents(Main.java:280)
at mapper.osm.main.Main.open(Main.java:182)
at mapper.osm.main.Main.main(Main.java:117)
Caused by: java.lang.ClassNotFoundException: javafx.embed.swt.FXCanvas
at java.net.URLClassLoader.findClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
... 3 more
jdc#hal-win MINGW64 ~/git/mapper-osm/mapper.osm/target (master)
$ java -version
java version "1.8.0_71"
Java(TM) SE Runtime Environment (build 1.8.0_71-b15)
Java HotSpot(TM) 64-Bit Server VM (build 25.71-b15, mixed mode)
I added this plugin to my pom.xml, but I still get the same problem https://github.com/javafx-maven-plugin/javafx-maven-plugin.
Isnt java 8 supposed to run with javafx natively?
If you are using tycho then this should solve your issue http://tomsondev.bestsolution.at/2014/05/15/maven-tycho-0-20-0-and-java8-source-code/
As the exception says, it cannot find a class, named FXCanvas under javafx/embed/swt. You need to add jfxswt.jar to your class path. There are two links, which may help you solve your issue. link 1 link2
I hope this helps.

Error creating .war file

I am testing Tomcat7 showing data from the example table "malaga_plagues". I have done changes but, when I try test it again, I obtain the following error creating .war file.
[root#host-192-168-192-78 AMS_Widhoc]# ../../../apache-maven-3.3.3/bin/mvn package
Exception in thread "main" java.lang.UnsupportedClassVersionError: org/apache/maven/cli/MavenCli : Unsupported major.minor version 51.0
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClass(ClassLoader.java:643)
at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142)
at java.net.URLClassLoader.defineClass(URLClassLoader.java:277)
at java.net.URLClassLoader.access$000(URLClassLoader.java:73)
at java.net.URLClassLoader$1.run(URLClassLoader.java:212)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:205)
at org.codehaus.plexus.classworlds.realm.ClassRealm.loadClassFromSelf(ClassRealm.java:401)
at org.codehaus.plexus.classworlds.strategy.SelfFirstStrategy.loadClass(SelfFirstStrategy.java:42)
at org.codehaus.plexus.classworlds.realm.ClassRealm.unsynchronizedLoadClass(ClassRealm.java:271)
at org.codehaus.plexus.classworlds.realm.ClassRealm.loadClass(ClassRealm.java:254)
at org.codehaus.plexus.classworlds.realm.ClassRealm.loadClass(ClassRealm.java:239)
at org.codehaus.plexus.classworlds.launcher.Launcher.getMainClass(Launcher.java:144)
at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:266)
at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:229)
at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:415)
at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:356)
[root#host-192-168-192-78 AMS_Widhoc]#
One month ago this was working fine, but now I have resumed the example and it does not work. I reinstalled Orion CB in mi VM but I didn't change anything in Tomcat.
Could you help me? Thank you.
Maven 3.3.3 is only compatible with Java 7+, and it seems that you are trying to run it with Java 6. Please check your JAVA_HOME environment variable, it should point to a Java 7 JDK.

CORBA/Webstart application doesn't work with Java7u55 anymore

My CORBA/Webstart application using an alternative ORB implementation (OpenORB) doesn't work with Java7u55 anymore.
The following exception occurs:
Error org.omg.CORBA.INITIALIZE: can't instantiate default ORB implementation org.openorb.CORBA.ORBSingleton vmcid: 0x0 minor code: 0 completed: No
org.omg.CORBA.INITIALIZE: can't instantiate default ORB implementation org.openorb.CORBA.ORBSingleton vmcid: 0x0 minor code: 0 completed: No
at org.omg.CORBA.ORB.create_impl_with_systemclassloader(Unknown Source)
at org.omg.CORBA.ORB.init(Unknown Source)
at org.openorb.CORBA.kernel.OpenORBLoader.init(Unknown Source)
at org.openorb.CORBA.ORB.set_parameters(Unknown Source)
at org.omg.CORBA.ORB.init(Unknown Source)
...
Caused by: java.lang.ClassNotFoundException: org.openorb.CORBA.ORBSingleton
at java.net.URLClassLoader$1.run(Unknown Source)
at java.net.URLClassLoader$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Unknown Source)
... 17 more
I think a a change in orb.omg.CORBA.ORB.init() is the reason the class for the ORB implementation wasn't found anymore as SystemClassLoader is used here now to create the ORB instance instead of current Thread's ContextClassLoader as before.
As a workaround I've copied the Jar containing org.omg.CORBA API of the ORB implementation I'm using to <jre-home>/lib/endorsed/ expecting that it will be used instead but still the implementation in rt.jar is used.
Any ideas how to work around this problem?
Finally I found a workaround which doesn't work for the currently used OpenORB but for JacORB (3.4).
Oracle obviously updated the release notes suggesting to configure only the org.omg.CORBA.ORBClass property but to ommit org.omg.CORBA.ORBSingletonClass which means the default singleton implementation shipped with Java will be used which is visible for the SystemClassLoader.
This may not work with all ORBs and in fact it doesn't work with OpenORB as it checks org.omg.CORBA.ORBSingletonClass but my application works without problems with the mentioned version of JacORB now.
there should be several workarounds:
specify the following VM args when launching your app: -Djava.endorsed.dirs=/path/to/your/corba_library_jars_folder
specify the following VM args when launching your app:
-Xbootclasspath/p:/path/to/your/corba_lib.jar:/path/to/your/corba_lib2.jar:...
copy your jars into $JAVA_HOME/jre/lib/endorsed directory (create it if it doesn't exist)

Why is WEKA not running from the command line?

I apologize, this seems like it is really simple but I can't seem to get it.
I've downloaded the Windows version of WEKA and installed it, but I can't seem to call it from the command line.
I've added a WEKAHOME environment variable, pointing to the directory containing weka.jar, and added that to my path with /weka.jar appended to it..
I am trying this command: java weka.classifiers.j48.J48 -t %WEKAHOME%/data/iris.arff
I then get the following error output.
Exception in thread "main" java.lang.NoClassDefFoundError:
weka/classifiers/j48/ J48 Caused by: java.lang.ClassNotFoundException:
weka.classifiers.j48.J48
at java.net.URLClassLoader$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source) Could not find the main class: weka.classifiers.j48.J48. Program will exit.
What can I do to fix this?
It's because of this weka.classifiers.j48.J48, that is an error in the Weka documentation, it should be: weka.classifiers.trees.J48
(Note: the comments below are no longer relevant. The answer here works, and remember to set the classpath as Thomas Jungblut says below.)

Resources