Configuring Tomcat 8.5. in Eclipse for running Rest API - eclipse

I am getting error while starting apache Tomcat 8.5.8 as a server in Eclipse. It was showing error that installed Tomcat version is 8.5.8 but it is expecting 8.0, below is error:
error while configuring Apache tomcat
After looking in to other threads I came to know about solution for changing the server file at path catalina.jar\org\apache\catalina\util\Serverinfo.properties
Till here I done the change but while saving and came out of RAR file it shows error Error while saving the changes in serverinfo.properties file
I have tried after stoping the tomcat but still it not allow me to save the changes in server file. Please advice.

The error you're getting saving the file is because Tomcat is still running, and it has the jar file open. Windows will not allow you to save changes to a file while some other process has the file open.
First, stop Tomcat, then make your changes to the file and save the jar, and then restart Tomcat.
If it matters, I ran into the same problem with Eclipse incorrectly determining the version of Tomcat. The solution was to change that "server.info" property in the given file. For instance, if the Tomcat version you have is 8.5.8, you have to change the version to 8.0.5.8.

Related

Tomcat 404 error after swapped META-INF/context.xml file

I have Tomcat 8 installed on CentOS 7 x64
I had it set up correctly so I could go to Tomcat's manager app. I then swapped /META-INF/context.xml to a different context.xml file. After changing the context.xml file I got a "404".
The problem is that after changing the context.xml back to the original shape I am still getting the "404" (even though the only thing that had changed was the context.xml file and this file was now back in the original state).
I have tried restart tomcat, reboot server,...
The logs aren't showing any errors and catalina.out is showing that the manager app is being deployed when tomcat is starting.
My question is this, what part of tomcat is storing this broken state? I would have thought that going back to the original, working context.xml would make my tomcat work again, so what could that file have changed about tomcat that is being persisted even after restarting tomcat?

Having Trouble Configuring Tomcat 9 with Eclipse Photon

So I installed Apache Tomcat 9 on my computer, and am having trouble configuring and running it on Eclipse Photon. When I start the server through the Monitor Tomcat application, I can open it up to see the appropriate Apache Tomcat Page, however when I try to run it through eclipse, I get an Error 404, as shown on this image:
I tried changing the server location from "use workspace metadata" to "use tomcat installation", as I saw on several websites and videos to correct the exact issue I'm having ("The origin server did not find a current representation for the target resource or is not willing to disclose that one exists."), but when I run the file after saving that configuration, I get the error as shown in this image:
I am not attaching an application to it just yet, I wanted to ensure that the server was running, and I could see the appropriate Apache Tomcat splash page when I try to access localhost:8080, but that isn't happening.
The Monitor Tomcat application deploys a root application to handle '/'. When Eclipse launches Tomcat for you, it does not deploy anything you do not explicitly tell it to, so nothing's there for '/'.
https://wiki.eclipse.org/WTP_Tomcat_FAQ#If_I_start_my_Tomcat_server_and_try_to_display_Tomcat.27s_default_page.2C_why_do_I_see_a_directory_listing_or_404_error_page.3F
After doing some digging, I discovered that the reason I was receiving those errors was because the entire Tomcat 9.0 file had restricted access, only administrator-level accounts could modify those files. I was able to resolve the issue by going into the file path, right-clicking on the "Tomcat 9.0" folder --> Properties --> Security --> Edit --> Users --> Full Control.

How can I tell tomcat (within eclipse) to make the log file a rolling log file?

There was a great question/answer on setting up tomcat (within eclipse) to write log files to disk (see answer by #codesta):
Where can I view Tomcat log files in Eclipse?
Through the Edit Launch Configuration Properties wizard in eclipse I can specify which file to write my logs to. However, since it is a single file, it gets overwritten every time the server restarts. I already have access to the current log through the console in eclipse, but is there a way to make this a rolling file so that I can have history?
I have played around with only specifying a directory in the file path, but then no logs are written out.
Follow the instructions to use log4j for Tomcat's internal logging:
http://tomcat.apache.org/tomcat-6.0-doc/logging.html#Using_Log4j
The tomcat-juli jars that you need can be found here:
http://apache.osuosl.org/tomcat/tomcat-6/v6.0.35/bin/extras/
Substitute whatever version of Tomcat you're using. Your CATALINA_HOME for the purpose of libraries will be wherever you have Tomcat installed, but the CATALINA_HOME for your configuration files will likely be:
workspace.metadata.plugins\org.eclipse.wst.server.core\tmp0

Eclipse Helios Deployment Issue

I am using Helios Version of Eclipse. I am having an issue using that. I have created a Dynamic Web project there. I have some .jar files under WebRoot/WEB-INF/lib folder. With all other .jar files I have a .jar file called iText-2.1.5.jar. I am using GlassFish server as a Application Server. Now issue is, when I am trying to add this project to the server only previously mentioned .jar file adding seperately into the server . When I am trying to publish any change into the server it is showing an error message like 'Publish failed using Ant publisher Could not delete [.JAR] file....' . To avoid this problem everytime I have to stop the server and manually delete the .jar file from the specific location and then restart the server. This is very time consuming process. Can you guys please solve this problem?
Thanks is advance.
Somnath Guha

.war file not getting deployed on tomcat server 7.0

I have two queries which I am detailing below:
I installed tomcat 7.0 on my ubuntu machine 11.04.
1. .war file not deployed
When I start tomcat through terminal it works fine and I am able to see the tomcat webpage at http://localhost::8080/. After that I try to deploy a war file ps.war which I copy into the webapps folder inside the tomcat installation directory. And then I restart the server but get the same 404 error even when the .war has been extracted to a ps folder by tomcat.
2. Not running through eclipse
when I open it through eclipse then it shows in eclipse console that the server is started and synchronized but does not run any service and give HTTP 404 eroor. Also in this case, When I open a browser window then I get same 404 error at http://localhost::8080//
Please help me put as I am quite stuck at this moment and not able to run the web services any further. Thanks in advance.
#ezile i can understand for the first query that .war file was faulty thats why you were unable to get it through the browser..
but for second query solution how can i accept that making a correct .war file made http://localhost:8080 running in eclipse...
I am asking this question as i am having the same (first and second) difficulty !!
Did you mean to have two colons in your URL before the port number? It's supposed to just be one. http://localhost:8080
Next, in your tomcat installation directory there is a directory called logs which contains a few log files which will provide more information than just the 404 message you see in your browser.
One other thing to check which we've ran into before is case. I have seen a problem with WebContent\WEB-INF being the wrong case (i.e. lower case) and Tomcat not wanting to pick up the war artifacts.
Thanks all for your responses. I solved the problem. For first part there was some problems with my .war file and thats why it was not getting deployed.
For second, after I corrected my war, it automatically started working for eclipse too.
In my case it was because the WAR required a full path.
I had specified localhost:8080/WarFileName
Which didn't work. It was only when I specified
localhost:8080/WarFileName/src/homepage
Which was how the packages were created in the war file, that it worked.