I am getting class not found(javax.media.jai.JAI) exception while running my code. I have downloaded(https://www.oracle.com/java/technologies/java-archive-downloads-java-client-downloads.html#jai-1_1_2_01-oth-JPR) the JAI jar and added in Project lib folder but not working getting same error again. where can I add this jar. Please advise.
Note : The is old servlet project structure there is no Maven features.
Error Log:
java.lang.ClassNotFoundException: javax.media.jai.JAI
at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1365)
at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1188)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:264)
enter image description here
You can go to build path and add ur external jars by downloading it online.
Related
I have project which I need to modify for a task and that runs a terminal with the help of a .jar file. I can run the very same Code on an IDE like Eclipse, but not VSC.
This is the error is get:
The jar files for this project are:
text-io-3.4.0.jar, slf4j-api-2.0.0-alpha5.jar and slf4j-nop-2.0.0-alpha5.jar
Exception in thread "main" java.lang.NoClassDefFoundError: jline/console/ConsoleReader
at org.beryx.textio.jline.JLineTextTerminalProvider.getTextTerminal(JLineTextTerminalProvider.java:28)
at org.beryx.textio.TextIoFactory$Holder.getDefaultTerminal(TextIoFactory.java:95)
at org.beryx.textio.TextIoFactory$Holder.<init>(TextIoFactory.java:65)
at org.beryx.textio.TextIoFactory$Holder.<clinit>(TextIoFactory.java:54)
at org.beryx.textio.TextIoFactory.getTextIO(TextIoFactory.java:111)
at ch.zhaw.catan.Catan.run(Catan.java:19)
at ch.zhaw.catan.Catan.main(Catan.java:50)
Caused by: java.lang.ClassNotFoundException: jline.console.ConsoleReader
at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:641)
at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:188)
at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:520)
... 7 more
I assume it's about configurations. The path to the library is set within the project. I don't see the error, my professor doesn't use VSC.
What can I do to fix this? Do I need to provide more data? I could upload the files if needed.
-edit
here's a link to the dummy.java and the jar files
https://github.com/dangdung87/test
as for the lines causing the error:
private void run() {
TextIO textIO = TextIoFactory.getTextIO();
TextTerminal<?> textTerminal = textIO.getTextTerminal();
It appears that the textio lib needs the jline library (https://mvnrepository.com/artifact/jline/jline/2.14.6).
Download the jar and add it to the dependencies of the project.
We had the same problem with the catan project ;)
I have built a very simple command line application using picocli and I would like to package it into an executable file. I first packaged it into a jar file using Maven package, and then used Launch4J as recommended by several users on SO to obtain an executable. However, it throws the NoClassDefFound error, when I run Application.exe in the command prompt.
> Exception in thread "main" java.lang.NoClassDefFoundError:
> picocli/CommandLine
> at mycli.HelloCli.main(HelloCli.java:48)
> Caused by: java.lang.ClassNotFoundException: picocli.CommandLine
> 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)
> ... 1 more
The application works perfectly well when executed in IntelliJ. I tried adding the custom jar file I created by looking at answers similar to these but it doesn't seem to help. I also tried changing the folder of execution but that doesn't solve the error either.
From several answers I searched across SO, I realized that the picocli jar needed to be on the class path. So I added the "Main class" as the one containing my main method, and specified the "Classpath" to the jar file created by building an artifact out of all the dependencies present, while configuring Launch4J.
For details on how to build an artifact jar out of a project's dependencies, visit this answer if you use Eclipse, or this answer if you use IntelliJ.)
This must seem like an idiotic question but I am new to Hadoop and was trying to run a simple example. However, I keep running into problems with JAR files and dont seem to have the correct imports. I am using cloudera CDH 4 and it has a hole lot of JAR files to choose from with several versions of each. Since I am just starting off am not being able to differentiate. Presently i am getting this exception :
Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/commons/configuration/Configuration
at org.apache.hadoop.metrics2.lib.DefaultMetricsSystem.<init>(DefaultMetricsSystem.java:38)
at org.apache.hadoop.metrics2.lib.DefaultMetricsSystem.<clinit>(DefaultMetricsSystem.java:36)
at org.apache.hadoop.security.UserGroupInformation$UgiMetrics.create(UserGroupInformation.java:120)
at org.apache.hadoop.security.UserGroupInformation.<clinit>(UserGroupInformation.java:236)
at org.apache.hadoop.mapreduce.task.JobContextImpl.<init>(JobContextImpl.java:72)
at org.apache.hadoop.mapreduce.Job.<init>(Job.java:144)
at org.apache.hadoop.mapreduce.Job.<init>(Job.java:131)
at org.apache.hadoop.mapreduce.Job.<init>(Job.java:139)
at com.ayon.hadoop.firstimpl.Driver1.main(Driver1.java:23)Caused by: java.lang.ClassNotFoundException: org.apache.commons.configuration.Configuration
at java.net.URLClassLoader$1.run(URLClassLoader.java:366)
at java.net.URLClassLoader$1.run(URLClassLoader.java:355)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:354)
at java.lang.ClassLoader.loadClass(ClassLoader.java:425)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308)
at java.lang.ClassLoader.loadClass(ClassLoader.java:358)
... 9 more
It is probably because of a wrong JAR file import. So my question is this:
Can anyone tell me what are the basic JAR files needed to start up a simple Hadoop job? Also any pointers to the above exception will be much appreciated.
To include all the necessary jar files, compile your code using the following command:
# javac -cp `$HADOOP_HOME\bin\hadoop classpath` YourClassFile.java
Please note the quotes
If you're using Eclipse, follow below steps to add JARs to your project
1.Right click on the project
2.Go to Properties
3.Click on "Java Build Path"
4.Libraries Tab
5.Add External JARs
6.Select the path "/usr/local/hadoop"
7.Select all "JAR files" & add all JARs
8.Again "Add EXternal JARs"
9.Go to path "/usr/local/hadoop/lib"
10.ADD all JARs in there
11.Click "Ok"
You're set. Hope this helps.. again it depends on the Eclipse version you're using.
My Java Swing application works fine when I run it from eclipse. But when I try to run it as a jar file, it fails to recognise my referenced libraries (bluecove-2.1.1-SNAPSHOT.jar) and gives me the following error:
Exception in thread "main" java.lang.NoClassDefFoundError: javax/bluetooth/UUID
Caused by: java.lang.ClassNotFoundException: javax.bluetooth.UUID
at java.net.URLClassLoader$1.run(URLClassLoader.java:366)
at java.net.URLClassLoader$1.run(URLClassLoader.java:355)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:354)
at java.lang.ClassLoader.loadClass(ClassLoader.java:425)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308)
at java.lang.ClassLoader.loadClass(ClassLoader.java:358)
Is there something wrong in the way I am creating the jar file or is there some issue with the bluecove jar itself?
this is simple
right click on project-->Build Path-->Configure build path-->Order and Export
and check wheather bluecove library is marked if not check mark
The problem was that I was trying to export it to a jar and then manually adding the main class in manifest.MD and the jars it was using. All I had to do was export it to an 'executable' jar and check the extract all jars option while exporting :)
I am trying to run Tomcat 6.0.18 from Netbeans 6.7 but getting the following output
on the server console.
java.lang.NoClassDefFoundError: org/apache/juli/logging/LogFactory
at org.apache.catalina.startup.Bootstrap.<clinit>(Bootstrap.java:54)
Caused by: java.lang.ClassNotFoundException: org.apache.juli.logging.LogFactory
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 sun.misc.Launcher$ExtClassLoader.findClass(Launcher.java:229)
at java.lang.ClassLoader.loadClass(ClassLoader.java:307)
at java.lang.ClassLoader.loadClass(ClassLoader.java:248)
I have tried reinstalling , tried different versions of tomcat viz. 6.0.24 , 7.0.16 , 5.5 etc , shifted from eclipse to netbeans to but don't why it is coming. In one of the replies for the same it was suggested to add $CATALINA_HOME\bin\tomcat-juli.jar to the launch configuraton in case of eclipse but in netbeans this library along with the others in lib folder have already been added. still the situation is same :(
try this , it has solved the problem
it seems that the META-INF/MANIFEST.MF file in the bootstrap.jar contains a no reference for
tomcat-juli.jar
just add/update this entry in META-INF/MANIFEST.MF file in the bootstrap.jar
Class-Path: commons-daemon.jar tomcat-juli.jar
and then try to run the tomcat sever
Hi,I have just begun to learn, also encountered the same problem, and finally I get through the following steps:
Tomcat v7.0 Apache Open,
Information Overview in General launch
Open configuration >Edit >Configuration, >Classpath, >Entries,
External TOMCAT_HOME/bin/tomcat-juli.jar
restart your lomboz
For more information,you can view this picture,hope this will fix your problems.
For some reason, the tomcat-juli.jar (or whichever JAR contains org.apache.juli.logging.LogFactory) isn't added to the classpath.
You don't say how you start tomcat (Eclipse Tomcat plugin, Web Tools, ANT script, ...) so it's hard to say why it's not there. If you can, add a breakpoint in URLClassLoader.java:202 and examine the result of calling getURLs() (see point #5 in 5 Tips for Debugging Java Code in Eclipse).
Bootstrap.jar is missing that is why this Exception is coming