error in running a web application on tomcat server - eclipse

I am currently converting my Java project written under Eclipse to a web application and trying to run on tomcat server. I have converted the project into a maven module, changed its project facets and other requirements to make it a web app. I have put my project.cfg.xml file under WEB-INF and included deployment to web.xml file. When i run my browser and point to "http://localhost:8080/manager/html", i am able to see my deployed war file. But it says running = false and when i click on my project, it shows me
HTTP Status 404 - /myproject/
type Status report
message /myproject/
description The requested resource is not available.
Apache Tomcat/7.0.32
I faced the same problem in running sample programs from "quickstart" also.

You should read $TOMCAT_HOME/logs/catalina.out This log records the lifecycle of web applications. You should be able to find the part where it attempts to start your web application and it is most likely throwing some errors at that location.

Observe the tomcat console . Surely, there are some errors being thrown at the application start-up, due to which it's not starting.

Related

404 JSP file not found Dynamic Web Module imported project

I imported a project from sample codes from a book https://github.com/pauldeck/springmvc-2ed/tree/master/chapter-02/eclipse/appdesign1 into Eclipse.
I convert the project to Dynamic Web Module by right click project>properties>project facets>convert to facets form. However, when I run as run on server on Tomcat 8.5, I got HTTP Status 404 – Not Found.
enter image description here
Why my controller is already working but I cannot find the resource jsp in my webapp?
As the Tomcat server returns message JSP is not found, the url is successfully dispatched by the controller. Have you checked if your jsp files are deployed when run on server?
enter image description here
make sure you have included all your resources under deployment assembly configuration.

Deployment descriptor in web.xml file is failing to load

I have a web-application that I'm developing using JSP. I'm running the application on Tomcat Server (version 8). In the project explorer view of Eclipse IDE, I'm getting an error saying that the source code could (a JSP file) not be run on server.
I have written my web.xml from scratch. It includes some server options or parameters which are defined by certain xml tags (display names). These display names were missing so I had to modify the web-app tag so that these tags are available. So far so good. The application is fine, but I get a pop-up message from the IDE giving a null pointer exception. I found that it is related to the Project View of Eclipse IDE, and when I switched to package explorer the error is gone but this time when I pick a server page to run on server (the server is running fine) i get another error which says the selection (the jsp file) could not be run on server. I believe this is still a dev environment problem. How can I fix it?

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.

Hawtio simple plugin example - tab is not visible

I am trying to develop a custom hawtio plugin. I have custom WAR deployed in Tomcat based on hawtio-default 1.4.37. It works correctly
I built simple-plugin.war following https://github.com/hawtio/hawtio/tree/master/hawtio-plugin-examples/simple-plugin instruction (no changes are done) and deployed it in the same Tomcat.
There are no errors, all logs are clean, I can see simple-plugin as plugin of hawtio in JMX bean, however no new tab is visible (although as I guess from .js code "Simple" tab should appear)
Any idea? Is it something to do with perspectives?
Edit:
Just checked the browser console and seen 404 error
GET http://localhost:8080/myhawtio/plugin/ 404 (Not Found)
It seems that my custom WAR is not correctly reconfigured
Edit 2:
Downloaded and deployed clean hawtio-default-1.4.37.war - simple-plugin works, "Simple" tab is visible
Downloaded and deployed clean sample-1.4.37.war - simple-plugin does not work, tab is not visible and get 404 error
GET http://localhost:8080/sample-1.4.37/plugin 404 (Not Found)
You must make sure to install the simple plugin using the same name as its configured in the web.xml file.
In the web.xml the context path gets set when you build the example from:
https://github.com/hawtio/hawtio/blob/master/hawtio-plugin-examples/simple-plugin/src/main/resources/WEB-INF/web.xml#L14
By default that is generated as
<context-param>
<description>Plugin's path on the server</description>
<param-name>plugin-context</param-name>
<param-value>/simple-plugin</param-value>
</context-param>
So that means you should install the war as simple-plugin in Apache Tomcat, eg rename the .war file to simple-plugin.war
If you're getting a 404 for /hawtio/plugin then you're missing the PluginServlet from your war, or at least it isn't running -> https://github.com/hawtio/hawtio/blob/master/hawtio-system/src/main/java/io/hawt/web/PluginServlet.java
This servlet is how the frontend discovers any additional plugins to load. I'd suggest comparing your web.xml with the one from hawtio-web and make sure this class is getting loaded.

Part of the Web application doesn't run on Tomcat where as runs as planned on Eclipse Indigo

A Web application running fantastic (as expected/planned) on Eclipse (Indigo); but a particular functionality1 fails while deployed on Tomcat 6.0.
I had changed the environment settings of Tomcat as on Eclipse, but unfortunately it's still not working.
And the strange thing is that; while running in Eclipse the temp directory for Java is TEMP folder2 of the User; where as while running on Tomcat the temp folder becomes WINDOWS\TEMP and that why new file couldn't be found and hence exception FileNotFound is getting fired. Why does this happen?
[1]: It's calling a non-Java application to convert files that are being uploaded to server.
[2]: Used for the aforesaid non-Java application for the file conversion.
Tomcat, when installed as a Windows service, is running under a different user account and thus uses different paths. Especially when running as system service there is no user directory. If you have a controlled environment you should set fixed paths, e.g. per environment variables or properties files, that both applications can share.