Error running Tomcat 7.0.34: Can't find catalina.jar - java

I have a Java web application that I have been working on 6 months ago and when I last worked on it, it would run perfectly. When I ran it again 6 months later I got this error "Can't find catalina.jar". I'm using IntelliJ 13.0 and tomcat 7.0.34.
Can anybody help me with this problem?

I had the same problem and solved it like this:
The method is to chose right Tomcat Home and Tomcat base directory in the wizard Run/Debug Configuration -> Server -> Configure...

Catalina.jar should already be present in tomcat/lib directory.
Is your tomcat home set up correctly, and is the jar there.

Also ensure that the user trying to access the lib directory and Catalina.jar etc.. has access to do so (Unix).

This problem may have occurred because Tomcat was loaded into the Program Files directory. Intellij IDEA cannot read files from Tomcat/lib inside program files. It can be decide: to run the IDEA with administrator rights or download Tomcat to another directory.

I have already fixed this problem,you need to correct the Tomcat Home's path.
My problem is that I renamed the file of apache-tomcat-8.5.9 to Tomcat,then the Idea could not distinguish the version.

Related

Not able to install Glasfish on mac. it says the specified directory is not a valid GlassFish installation

I tried creating a directory everywhere even in root folders. I also created a folder called Glasfish to save the server but still did not work.
Just select the glassfish folder inside your glassfish folder :)
See this answer for some more details.

Running a duplicate Java Project on Tomcat 7

I'm working on Java project for a portal. I checked out a sample portal from an svn, and pasted a renamed copy of it in the eclipse package explorer.
When I tried to run this new project on a Tomcat 7 server, I got the error message:
Could not publish server configuration for Tomcat v7.0 Server at localhost.
Multiple Contexts have a path of "/SamplePortal".
What do I need to do to get this new project to run?
All the suggestions in this thread are valid. If you extract the war file into a folder inside of Tomcat's webapps folder, it should work.
If you are trying to do it from Eclipse, make sure the file server.xml is not corrupted, or that Eclipse is not misreading it. Restart Eclipse if that is the case.
You need to change the name of your project directory or .war file so it doesn't conflict with the existing SamplePortal project.

Unknown version of Tomcat was specified in Eclipse

I want to add latest tomcat-7.0.42 in my eclipse. Probably eclipse tomcat server adapter 7 only supports tomcat version upto 7.0.12 ..
So please help me how can I configure my eclipse with tomcat-7.0.42
You are specifying tomcat source directory.
You need to specify tomcat binary installation root directory, also known as CATALINA_HOME.
Usually, this is where you untar apache-tomcat-7.0.42.tar.gz file.
This happened to me because Tomcat was still in the process of downloading (Download and Install). The message disappeared after a few minutes.
The eclipse window should really have some type of progress indicator showing download status.
To recognise your Tomcat installation folder, Eclipse is scanning for the following files:
conf/catalina.policy
conf/server.xml
conf/web.xml
conf/context.xml
conf/tomcat-users.xml
conf/catalina.policy
conf/catalina.properties
lib/catalina.jar
so make sure you're pointing to the right place and have the right read permissions.
E.g.
OS X (if installed via brew), it's: /usr/local/opt/tomcat/libexec
Linux/Ubuntu: see: Tomcat and Eclipse Integration Error
For LINUX the installation directory for Tomcat 7 is:
/usr/share/tomcat7
Please use this configuration.
More here:
http://gridlab.dimes.unical.it/lackovic/eclipse-tomcat-ubuntu-jersey/
I got the same error and resolved it by giving enough permissions to the folder. I gave full permissions by (you can try limited permissions which is enough for eclipse to run tomcat)
sudo chmod -R 777 apache-tomcat-8.5.33/
FYI, I encountered this error on my mac, but I think it should be same for ubuntu system too.
I know this is and oldie but i had this issue recently with the latest versions of Tomcat and Eclipse on Windows 10.
It was a permissions issue. All i had to do was navigate to the Tomcat install directory and open the folder. I was prompted to access the folder as an Administrator.
After this the versions were recognised by Eclipse and I could add the new runtime.
I am on MacOS and installed tomcat using homebrew, Following path fixed my problem
/usr/local/Cellar/tomcat/9.0.14/libexec
Probably, you are trying to point the tomcat directory having the source folder. Please download the tomcat binary version from here .For Linux environments, there you can find .zip and .tar.gz files under core section. Please download and extract them. after that, if you point this extracted directory, eclipse will be able to identify the tomcat version. Eclipse was not able to find the version of tomcat, since the directory you pointed out didn't contain the conf folder. Hope this helps!
As soon as you provide the directory where Tomcat needs to be installed and click ok you can notice download and installation starts in the progress tab of Eclipse.
Let the process complete.The error will automatically disappear.
Note: It is not mandatory to name your folder CATALINA_HOME. I have tested this with windows. Cannot assert the same for Linux but IMO same rule should apply.
Just in case...
Apache Tomcat 8.5.X is not compatible with Apache Tomcat 8.0 server selection in eclipse. And it gives this error.
Go to "Window -> preferences -> Server -> Runtime Environments"
Remove the existing servers they might not have downloaded completely.
Add new Server
For Windows Users,
Use the Tomcat Service Installer from the Apache tomcat downloads page. You will get a .exe file. which Installs the service for windows. It will usually install Apache tomcat at "C:\Program Files\Apache Software Foundation\Tomcat 8.0" and its easily recognized in eclipse.
Having installed tomcat with brew the solution for me was:
sudo chmod -R 777 /usr/local/Cellar/tomcat/<your_version>
In my case I used wrong directory, the right one is lib exec and my path:
/usr/local/Cellar/tomcat#7/7.0.96/libexec
You are pointing to the source directory. You can run a build by running ant from that same directory, then add '\output\build' to the end of the installation directory path.
It may be due to the access of the tomcat installation path(C:\Program Files\Apache Software Foundation\Tomcat 9.0) wasn't available with the current user.
Since this is evidently happening on Linux, this would be because your dev user might not have read access to Tomcat's installation directory. That's because Tomcat's installation directory (let's say it is pointed to by CATALINA_HOME) is owned by tomcat:tomcat while your dev user is something that's neither tomcat nor one that belongs to the tomcat group. Therefore Eclipse fails to read ${CATALINA_HOME}/conf/catalina.policy.
The following should fix the permission issue:
sudo find ${CATALINA_HOME} -type d -exec chmod o+rx {} \;
Why do we need the execute bits? Because to traverse a directory and reach its descendants, you need execute permissions. In your case, if CATALINA_HOME isn't yet set, replace the actual installation directory (/opt/tomcat/apache-tomcat-<version> maybe?) in the above.
For Windows
Just open the (tomcat xx.x) folder once and check if you can see all other root folders while selecting folder.
Sometimes windows wont give access to this folder

Configure Servlet, JSP with Tomcat 7

I am beginner in Java EE and when I install Tomcat 7, its works fine, I can access http://localhost:8080.
Now I understood that servlet and jsp jars files come under tomcat 7 and no need to download from oracle site.
So my question is when I compile my first servlet, it's say import javax.servlet.*; and import javax.servlet.http.*; not found.
How can I solved this?
Also one more thing In that servlet, I am also looking for visited user ip address. So I can know the location of that user.
I am using window platform and I configured JDK properly and its work fine.
hmmm, this is common question for beginner in Java EE, even I was too. Don't worry, here I am explaining you - How to solve this problem?. Here I am assume that you know How to install and configure tomcat 7, if not, visit http://www.coreservlets.com/Apache-Tomcat-Tutorial/
Basically tomcat 7 (even old one) come with servlets and jsp jars, you can find those jar in tomcat's lib folder
Tomcat 7.0\lib
servlet-api.jar
jsp-api.jar
Now you need to place these files in classpath (let me know if you don't know How to set files in classpath) By default tomcat not setting classpath for servlets.
After that if you compile your java file, it should works. let me know if you face any problem or difficulties.
if you want user location, you need to use request.getRemoteAddr() and it will give you the ip address, regarding location name (city, state, country and even more information), please visit http://www.maxmind.com/ services.
Here is the some links
http://www.maxmind.com/app/geolitecity
Example - http://geoip.cvs.sourceforge.net/viewvc/geoip/java/CityLookupTestV6.java?view=markup
If you are compiling using command line window, you have to specify class path for the servlet-api.jar in the lib directory of the tomcat installation directory or servlet-api.jar should be added to the windows class path. For using in command line,
javac -classpath <tomcat-installation-directory>/lib/servlet-api.jar myapp.java
If you are using IDE, need to add the server to the IDE and/or set the runtime environment to Tomcat.

Setting build path in eclipse java

I have searched stackoverflow before posting this question.
In eclipse i am running a tomcat server. I deleted the .class files from the work folder of the tomcat server. From then on I am facing the issue saying the class couldnot be found.
I re-built the project. Didnt help
Can you please suggest how to fix this issue.
You should NOT run Tomcat as a normal program inside Eclipse. You should use the EE version of Eclipse, and then add Tomcat in the server view. This will allow you to deploy Dynamic Web Projects directly to Tomcat or any other supported server.
delete the server from eclipse server view and create it again.

Categories