Unable to start tomcat server in netbeans and eclipse - java

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

Related

Where can I add javax.media.jai Jar package in Java?

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.

Why is my IDE looking in the wrong dependency folder for a needed class?

I'm trying to run a script that was working fine until I changed the home folder.
Once I changed the home folder I ran into a few issues but I was able to resolve them. The only thing I have not been able to resolve is the following error.
Exception in thread "main" java.lang.NoClassDefFoundError: org/openqa/selenium/remote/internal/JsonToWebElementConverter
at BrowserStackAndroid.main(BrowserStackAndroid.java:43)
Caused by: java.lang.ClassNotFoundException: org.openqa.selenium.remote.internal.JsonToWebElementConverter
at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:583)
at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:178)
at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:521)
... 1 more
This is an interesting error that, after some research, I have not been able to wrap my head around.
The class that it is searching for is in the org.selenium.remote dependency. Except that it's not in the internal folder but the remote folder.
So the class that it is searching for is JsonToWebElementConverter.
This class is located in the following path
org/openqa/selenium/remote/JsonToWebElementConverter
The folder that the IDE (or Maven?) is looking into is
org/openqa/selenium/remote/internal
Which only has the class WebElementToJsonConverter
I've tried reinstalling the library via maven in several different ways, using different dependencies, etc but haven't been able to fix this issue.
I've never come across an issue like this before so I'm really excited to see what the solution is going to be.
Notes:
The error is being thrown because of the following line of code
AndroidDriver<AndroidElement> driver = new AndroidDriver<AndroidElement>(new URL("https://" + userName + ":" + accessKey + "#hub-cloud.browserstack.com/wd/hub"), caps);
This project worked perfectly fine before but as soon I changed the directory of the project stopped working.
This is happening as you have same class or library with in 2 dependencies. Simply removing selenium based dependencies will resolve the issue as all selenium dependencies already comes with Appium java client. For classpath you can check at java docs
So the way to set class path via cmd (Navigate to project root folder)
set CLASSPATH= target/org/openqa/selenium/remote/internal/JsonToWebElementConverter
Note: for maven project all compiled java files should be in target folder. If you are facing same issue you can add missing class inclasspath destination should be target folder as explained in java docs

java.lang.NoSuchMethodError: org.jboss.logging.Logger.getMessageLogger in Tomcat(Ubuntu 16.04)

I 'm getting this exception when I am trying to deploy the .war file in Tomcat
java.lang.NoSuchMethodError: org.jboss.logging.Logger.getMessageLogger(Ljava/lang/Class;Ljava/lang/String;)Ljava/lang/Object;
at org.hibernate.ejb.Ejb3Configuration.<clinit>(Ejb3Configuration.java:142)
at org.hibernate.ejb.HibernatePersistence.createEntityManagerFactory(HibernatePersistence.java:55)
at javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:63)
at javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:47)
Please be aware that:
-The same .war file is already working on a different Server(Linux OpenSuse)
-I copied the Tomcat folder(all the server's) from the old server(OpenSuse) to the new server(Ubuntu 16.04). This way the files are the same.
-The JVM is the same in both of the servers.
-The exception does not happen during Development time(in Eclipse).
My questions are:
-Some people have suggested me to change my maven pom files. Does it make sense? Because as I said the .war is already working on the OpenSuse server.
-Should I be able to deploy the same.war without any change. Shouldn't I?
There is at-least one of the libraries missing in the server you are getting the error.
Check all libraries in the $PATH variables you are using in the server its working.
Hope this Helps!
Regards,
Eby

What are the JARs required for Hadoop project at startup?

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.

Getting a weird ClassNotDefFoundException on runtime with GWT

I am deploying a web application based on GWT. When I compile, I don't get any errors, but in runtime, I get this one (not complete stack trace):
java.lang.NoClassDefFoundError: org/xmlpull/v1/XmlPullParserException
at org.gvsig.remoteClient.sos.SOSClient.<init>(SOSClient.java:47)
at com.uji.project.server.ConnectServiceImpl.makeConnection(ConnectServiceImpl.java:18)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
Caused by:
Caused by: java.lang.ClassNotFoundException: org.xmlpull.v1.XmlPullParserException
at java.net.URLClassLoader$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
I have read on this website that that is probably caused if one or more classes are not available on running time but, as seen, the error is caused by some problem with the XML parser, but I have the XML parser included in my lib folder. In detail, in the project's lib folder, it is possible to find 3 JAR files: gwt-maps.jar, gwt-servlet.jar, and kxml2.jar*.
If I open "kxml2.jar" file I can see folder org that within has xmlpull folder, that within has v1 folder and finally XmlPullParserException.class.
So...why on runtime do I not have this class available if it is included on the lib folder?
In appengine classes can only access to the classesof the JRE which are in this whitelist. If this jar is using another class of the JRE it won't be included in runtime.
Here you can read that "XML processing APIs including DOM, SAX, and XSLT" are compatible with appengine. Maybe xmlpullparser is not compatible, but I'm not sure.
Finally a colleague told me the solution to this runtime error! :D
When a GWT application is deployed, many files are copied under a small file structure (pending from ) that contains all classes, libraries and other files that are needed on runtime.
For some reason, if you don't tell on purpose Eclipse to copy (on compile/deploy time) a specific library into that PATH, the application will not find on runtime that library and will raise an error.
Solution (for me) was as simple as copying by hand that library into that folder: In my case was copying "kxml2.jar" under "C:\gwt-2.1.0\SOSProject\war\WEB-INF\lib". I restarted the application and just worked. :D
I hope this patch/solution will help others to solve this annoying problem under GWT!
Try this
Window->Preferences->Java Build Path->Add Jars
Navigate to your project/lib, select kxml2.jar Hit OK.
In the end, what I did was to start again from the beginning: In the same workspace I had different projects and maybe there were, let's say, interferences between them.
So, I unzipped again the GWT SDK, start a new project, copied the original source code on the new project, deployed it and on runtime, now I am not getting that weird ClassNotDefFound error. Now I am getting another one, but that is another issue! Thanks to all.

Categories