404 JSP file not found Dynamic Web Module imported project - eclipse

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.

Related

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?

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.

error in running a web application on tomcat server

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.

Hello World Struts 2 Eclipse project 404 error

I've created a struts2 project with eclipse, when executing it shows the message error:
HTTP Status 404 - /StrutsHelloWorld/Login.jsp
type Status report
message /StrutsHelloWorld/Login.jsp
description The requested resource (/StrutsHelloWorld/Login.jsp) is not available.
Apache Tomcat/7.0.26
I've followed step by step guide http://viralpatel.net/blogs/tutorial-create-struts-2-application-eclipse-example/
and i got that message error.
Please anybody help me!
This is the directory structure. URL: localhost:8080/StrutsHelloWorld/Login.jsp
try to add the following jars into aweb-inf/lib folder and BuildPath
commons-fileupload-x.y.z.jar
commons-io-x.y.z.jar
commons-lang-x.y.jar
commons-logging-x.y.z.jar
commons-logging-api-x.y.jar
freemarker-x.y.z.jar
javassist-.xy.z.GA
ognl-x.y.z.jar
struts2-core-x.y.z.jar
xwork-core.x.y.z.jar
From the given url, there is full project available for download. And never forget to include struts2 libraries in WEB-INF/lib. It works for me.
I also followed the tutorial, what was missing (for me) is that I have to add the struts libraries to the deployment assembly (project->properties->'Deployment Assembly')
I have configured a user library as Struts2 that contains all struts2 jars, I have included this entry to be deployed to web-inf/lib. Take a look to the console error.

Configuration about eclipse + Tomcat

I wrote a little helloworld jsp file to test it. But it failed. I can't figure it out.Any one help me ?
I got these error info:
HTTP ERROR 404
Problem accessing /myjsp/WEB-INF/myjsptest.jsp. Reason:
NOT_FOUND
HTTP error 404 means that the requested resource was not found by the server.
The problem doesn't seem to be related to Tomcat or Eclipse but rather to your web application. I think the reason is that you are trying to access a JSP file in WEB-INF folder. You shouldn't do that because WEB-INF folder is not accessible directly from a web browser. Your JSP files should be outside of it.
WEB-INF folder is used to store configuration files (e.g. web.xml) and Java classes (e.g. servlets). JSP files and all static content should be placed outside of it.
You may find more information about JSP technology e.g. in this tutorial or this tutorial (in Chapter 12).