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

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?

Related

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.

Configuring Tomcat 8.5. in Eclipse for running Rest API

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.

JavaEE Servlet won't hot deploying

I started working with javaEE and currently doing some basic servlet stuff. So I'm using Eclipse neon and GlassFish server. Created a dynamic web project and everything works fine.
The problem are servlet file changes. If there is a change in the java file nothing happens - no hot deploying/ republish. I have to complete remove the application from server and re add it to see the changes.
Changing .html files works (doesn't effect servlets changes)
Rebuild does nothing
Server "clean" does nothing
Server restart does nothing
"Automatically publish when resources change" is of course on, hence the html changes
The problem might be, that it does not observe the correct files for triggering the redeployment.
I haven't tried it for GlassFish, but could see the same behavior for WildFly as you described with the default server settings.
Try to add \.class$ to section Application Reload Behavior in server settings. (This will be the case for exploded deployment.)
Credits to varantes answer in this question

.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.

Adding server-specific options to an Eclipse-managed Tomcat instance (in server.xml)

How can I make sure that the server.xml which Eclipse produces for every separate project that relies on Tomcat, will always contain a specific option, which I added manually?
I'd like to add a bunch of <Context> mappings to the server.xml file. I tried doing that in the server.xml in the main tomcat dir - didn't work.
Then I saw that Eclipse builds a temporary folder for every project that uses Tomcat. This folder also containes this server.xml file. I edited it, and voila, it worked. However, soon after that the same file got updated by Eclipse, with the original data that it contained.
It is not very efficient to manually copy and paste the code every time before I run/restart tomcat. I hope there is a more permanent way.
Let's assume you have configured tomcat 5.5
If you have configured your tomcat server in eclipse using all default options, you want to edit the server.xml located at WORKSPACE_LOC\Servers\Tomcat v5.5 Server at localhost-config\server.xml