I build a web project in Eclipse Kepler with Apache Tomcat 7.0.47.
While running on server, it causes java.lang.ClassNotFoundException: java.nio.file.Paths as below.
java.lang.NoClassDefFoundError: java/nio/file/Paths
at ...
Caused by: java.lang.ClassNotFoundException: java.nio.file.Paths
at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1702)
at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1547)
... 12 more
It worked well before I invite this new feature of Java 7. Could anyone give me some suggest to figure out what's going on here please?
Uninstalling older version is not required.
But it is obvious that your Tomcat 7.0 still uses the jdk 6. There are two paths system path and user path. Check both of them.
Related
I started a Maven project in Java 8 and wanted to migrate it to Java 9. At the same time I also went from Eclipse Neon EE to Eclipse Oxygen EE. (JFX SDK reinstalled).
While the Eclipse Workspace shows no errors; as soon as I try to compile and run the exact same program that used to run perfectly fine in Java 8, I get the following Exception:
{...}
Caused by: java.lang.ClassNotFoundException: com.sun.javafx.css.converters.PaintConverter
at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:582)
at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:185)
at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:496)
... 26 more
Exception running application application.Main
I have now rebuilt the project several times and cannot get it to work...
In Java 9, the previous internal class
com.sun.javafx.css.converters.PaintConverter
became public as
javafx.css.converter.PaintConverter in the module javafx.graphics.
See Javadoc - Class PaintConverter.
JFoenix supports Java 9 with a separate JAR.
I just download the spark on Mac, the version I download is the latest one
pre-built for Hadoop 2.6
When I try to install this, on the Terminal I type bin/pyspark
I got is the following exception
Exception in thread "main" java.lang.NoClassDefFoundError:
org/apache/spark/launcher/Main
Caused by: java.lang.ClassNotFoundException: org.apache.spark.launcher.Main
at java.net.URLClassLoader$1.run(URLClassLoader.java:202)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
at java.lang.ClassLoader.loadClass(ClassLoader.java:247)
I looked up on Google and some answer says I need to update my Java, I just downloaded latest Java version but still get the error message
Can anyone help me on this please. Please explain in detail as I'm new to Spark
I met the same problem when I was trying to install Spark 1.6.2 on Mac OS (10.11 El Captain).
After installing the latest Java JDK (Java SE Development Kit 8), I had no problem to run pyspark. You could download the latest JDK from Oracle's website.
Good luck!
BTW, I also installed the legacy Java 6 runtime for OS X 10.11 El Capitan provided by Apple because I encountered an error message To use the "java" command-line tool you need to install a JDK in the beginning of the installation process.
This question already has answers here:
Why am I getting a NoClassDefFoundError in Java?
(31 answers)
Closed last year.
I'm having an issue getting a servlet to connect to a MySQL database on Linux (Ubuntu) server running Tomcat 7.
I have the code running perfectly fine on the dev environment (Windows 7, Tomcat 7). I make the WAR file in Eclipse with mysql-connector-java-5.1.34-bin.jar in WEB-INT/lib directory then deploy on Tomcat / Linux environment.
The WAR file unpacks fine and the static content is served without issue to the browser but, when initiating a task to interact with the database, I get an error code 500 internal server error and the localhost.2015-03-24.log gives the following error:
java.lang.NoClassDefFoundError: javax/websocket/Endpoint
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClass(ClassLoader.java:800)
at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142)
at org.apache.catalina.loader.WebappClassLoader.findClassInternal(WebappClassLoader.java:2944)
at org.apache.catalina.loader.WebappClassLoader.findClass(WebappClassLoader.java:1208)
at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1688)
at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1569)
at websocket.drawboard.DrawboardContextListener.contextDestroyed(DrawboardContextListener.java:32)
at org.apache.catalina.core.StandardContext.listenerStop(StandardContext.java:5014)
at org.apache.catalina.core.StandardContext.stopInternal(StandardContext.java:5659)
at org.apache.catalina.util.LifecycleBase.stop(LifecycleBase.java:232)
at org.apache.catalina.core.ContainerBase$StopChild.call(ContainerBase.java:1575)
at org.apache.catalina.core.ContainerBase$StopChild.call(ContainerBase.java:1564)
at java.util.concurrent.FutureTask.run(FutureTask.java:262)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
at java.lang.Thread.run(Thread.java:744)
Caused by: java.lang.ClassNotFoundException: javax.websocket.Endpoint
at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1718)
at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1569)
... 17 more
I would also like to know how I can view the 17 other exceptions that are not being listed.
Make sure you set the WebSocketServlet dependency as provided.
<dependency>
<groupId>javax.websocket</groupId>
<artifactId>javax.websocket-api</artifactId>
<version>1.1</version>
<scope>provided</scope>
</dependency>
Thanks Arpit for your answer. However, adding the Maven dependenciy did not solve the problem. (On my Windows installation of Tomcat it worked all the time, on my Linux Tomcat not.)
As it turns out, the Debian (Ubuntu) version of Tomcat comes without the corresponding .jar (on Windows and normal Linux Tomcats it's included). Thus I tried adding the dependency with scope 'compile' to really add the .jar to my. war. No success either.
Finally the solution was to manually add the jars from the download of Tomcat from their website to Tomcat lib folder of the server.
For 3 days now, I have been trying to install glassfish 4.1 on eclipse Luna version 4.4.1. I first installed the plugin from eclipse marketplace then added it in my runtime using jdk 8. I also made jdk my default since eclipse default uses jre. I have to point out that I have been been using glassfish on netbeans and tomcat on eclipse but I decided to play around with glassfish on eclipse. Every information I got on the internet didn't fix my issue.
Below is the error I got in the console. Right now, this is driving me nuts so I have decided to come to you for direction.
Thanks
Launching GlassFish on Felix platform
ERROR: Unable to create cache directory: C:\Program Files\glassfish-4.1\glassfish\domains\domain1\osgi-cache\felix
ERROR: Error creating bundle cache. (java.lang.RuntimeException: Unable to create cache directory.)
java.lang.RuntimeException: Unable to create cache directory.
at org.apache.felix.framework.cache.BundleCache.<init>(BundleCache.java:131)
at org.apache.felix.framework.Felix.init(Felix.java:640)
at com.sun.enterprise.glassfish.bootstrap.osgi.OSGiFrameworkLauncher$1.run(OSGiFrameworkLauncher.java:88)
Exception in thread "Thread-1" java.lang.RuntimeException: org.osgi.framework.BundleException: Error creating bundle cache.
at com.sun.enterprise.glassfish.bootstrap.osgi.OSGiFrameworkLauncher$1.run(OSGiFrameworkLauncher.java:90)
Caused by: org.osgi.framework.BundleException: Error creating bundle cache.
at org.apache.felix.framework.Felix.init(Felix.java:645)
at com.sun.enterprise.glassfish.bootstrap.osgi.OSGiFrameworkLauncher$1.run(OSGiFrameworkLauncher.java:88)
Caused by: java.lang.RuntimeException: Unable to create cache directory.
at org.apache.felix.framework.cache.BundleCache.<init>(BundleCache.java:131)
at org.apache.felix.framework.Felix.init(Felix.java:640)
... 1 more
Exception in thread "main" java.lang.reflect.InvocationTargetException
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:483)
at com.sun.enterprise.glassfish.bootstrap.GlassFishMain.main(GlassFishMain.java:97)
at com.sun.enterprise.glassfish.bootstrap.ASMain.main(ASMain.java:54)
Caused by: org.glassfish.embeddable.GlassFishException: java.lang.NullPointerException
at com.sun.enterprise.glassfish.bootstrap.osgi.OSGiGlassFishRuntimeBuilder.build(OSGiGlassFishRuntimeBuilder.java:170)
at org.glassfish.embeddable.GlassFishRuntime._bootstrap(GlassFishRuntime.java:157)
at org.glassfish.embeddable.GlassFishRuntime.bootstrap(GlassFishRuntime.java:110)
at com.sun.enterprise.glassfish.bootstrap.GlassFishMain$Launcher.launch(GlassFishMain.java:112)
... 6 more
Caused by: java.lang.NullPointerException
at com.sun.enterprise.glassfish.bootstrap.osgi.OSGiGlassFishRuntimeBuilder.newFramework(OSGiGlassFishRuntimeBuilder.java:241)
at com.sun.enterprise.glassfish.bootstrap.osgi.OSGiGlassFishRuntimeBuilder.build(OSGiGlassFishRuntimeBuilder.java:135)
... 9 more
Error stopping framework: java.lang.NullPointerException
java.lang.NullPointerException
at com.sun.enterprise.glassfish.bootstrap.GlassFishMain$Launcher$1.run(GlassFishMain.java:203)
Java HotSpot(TM) Client VM warning: ignoring option MaxPermSize=192m; support was removed in 8.0
Run Eclipse or any other IDE you use in Administrator mode.
Works for me.
I think your comment deserves to be posted as the main answer but I have been trying to mark your comment as answer but I wash't able to. So I decided to post post your comment here and then back it up with my own experience.
Answer by unwichtich:
I guess this is a similar problem. The cause may be that you have installed Glassfish in c:\Program Files. You can try to move your Glassfish installation to a directory where your normal user account has full access rights but you then have to change the path to the Glassfish installation in Eclipse.
My own experience:
Turns out that all the problems I had with the glassfish server (including exit code 1 error) was because glassfish could not handle folder names with spaces in it. So I moved the glassfish-4.1 folder from C:\Program File\glassfish-4.1.. path to C:\ glassfish-4.1.. It wiped all my tears away. This is really important in eclipse and netbeans IDEs (if you are installing the netbeans that does not come with a glassfish bundled zip).
I had the same problem and fixed it by installing Glassfish under C:\ instead of C:\Program Files. Try that.
use JDk 7 instead of JDK 8 am also faced the same issue i just changed to jdk7 its working now.
I have a really strange problem. I can successfully start my Eclipse internal JBoss Server (7.0.2). I can access the website and everything is fine. But after restarting or shutting down and starting again I always receive the following error out of nowhere:
Exception in thread "main" java.lang.NoClassDefFoundError: /Users/path/Coding/JBoss
Caused by: java.lang.ClassNotFoundException: .Users.robin.Coding.JBoss
at java.net.URLClassLoader$1.run(URLClassLoader.java:202)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
at java.lang.ClassLoader.loadClass(ClassLoader.java:247)
I googled and looked in the JBoss forums. Some ppl had a problem with using the JRE Version instead of the JDK. I checked I am using the JDK 1.6..
Here some other informations:
Eclipse Indigo (3.7.1)
JBoss (jboss-as-web-7.0.2.Final) also tested with the newer version 7.1
JBoss Tools (3.3.x)
Java version "1.6.0_29"
Mac Os X 10.7.3 (Lion)
After deleting the internal Server in Eclipse and recreating I can again start it successfully the first time. The path to the external JBoss directory is correct.
Did anyone have the same problem or any idea what it could be?
Thanks for your help!
I found the solution. It's very strange but somehow after executing the Server a second time it's crashing because of the space in the path:
/Users/robin/Coding/JBoss Servers/..'
After removing the space I could also run the Server several times without crashing. Thanks to Perception, his comment was leading me to the solution.