Configuration about eclipse + Tomcat - eclipse

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

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.

Where do I place my templates for Blog-related mail notifications in Liferay 7.0?

The documentation states that I can configure the liferay server to use my own templates for the email messages. Specifically, if I add these properties to a portal-ext-env.properties in $CATALINA_BASE/conf/liferay:
blogs.email.entry.added.enabled=true
blogs.email.entry.added.subject=${resource:com/liferay/portlet/blogs/dependencies/email_entry_added_subject.tmpl}
blogs.email.entry.added.body=${resource:com/liferay/portlet/blogs/dependencies/email_entry_added_body.tmpl}
Liferay will supposedly use the templates in the specified paths (com/liferay/portlet/blogs/dependencies/email_entry_added_subject.tmpl and com/liferay/portlet/blogs/dependencies/email_entry_added_body.tmpl). The thing is, it's not very clear what these paths are relative to. Are these files relative to $CATALINA_BASE? For example, would the above configuration result in Liferay looking up $CATALINA_BASE/com/liferay/portlet/blogs/dependencies/email_entry_added_body.tmpl for creating the body of an email message? If this is not the case, where does Liferay lookup templates for Blog-related email messages?
After some digging, I've found that you place the templates in the $CATALINA_BASE/webapps/ROOT/WEB-INF/classes folder. Paths that you reference in the properties (e.g. blogs.email.entry.added.body=${resource:com/liferay/portlet/blogs/dependencies/email_entry_added_body.tmpl}) are relative to the aforementioned classes folder.
So, if I wanted Liferay to use a template file in the ff. relative path: org/foo/my_email_entry_added_body.tmpl, I would do two things:
Place the file in $CATALINA_BASE/webapps/ROOT/WEB-INF/classes/org/foo/my_email_entry_added_body.tmpl.
Add the following line to $CATALINA_BASE/portal-ext-env.properties: blogs.email.entry.added.body=${resource:org/foo/my_email_entry_added_body.tmpl}.
I consulted my co-worker and got a better understanding of why this is. The architecture of a Liferay application is such that it comes bundled with a Tomcat server. According to the documentation, WEB-INF/classes is a directory that a web app deployed to a Tomcat server looks up for classes and resources:
A class loader is created for each web application that is deployed in a single Tomcat instance. All unpacked classes and resources in the /WEB-INF/classes directory of your web application, plus classes and resources in JAR files under the /WEB-INF/lib directory of your web application, are made visible to this web application, but not to other ones.
Specifically, this folder is high in priorty in the web app's classpath.
When you see Liferay code similar to ${resource:path/to/foo}, it's looking up resources in its classpath. One of the paths in that classpath is WEB-INF/classes. Hence, if path/to/foo is placed in WEB-INF/classes, Liferay will find path/to/foo there.

Missing files in axis2 download

Does anyone know anything about this?
Every simple SOAP web server tutorial I have found uses Axis2 from:
https://axis.apache.org/axis2/java/core/download.html
But I keep getting a 500 error that says files are missing.
I am missing the "include" folder with the jsp files in it. This folder is supposed to be located under Web Content > axis2-web
Here's a screenshot of one tutorial that actually shows what I seem to be missing from the apache download. By the way, I am downloading the binary zip and using Tomcat and Eclipse.
click here to see the files that are missing

How to deploy gwt static pages in jboss

I have some static files ( html, javascript, css - compiled gwt client code). I need to deploy that files in jboss.
That is I need to access like http://localhost:8080/Client/homepage.html .
Where do I need to put the files in jboss.
I tried putting it in
D:\Program Files\jboss-4.2.3.GA\server\default\deploy\Client\homepage.html
restarted the server and tried to access
http://localhost:8080/Client/homepage.html.
But it shows 404 error.
How should I fix this?
If you rename Client folder to Client.war, the example will work.
You don´t need to do anything special to deploy static files, just place them in a valid war and that´s it. By valid war I mean having a WEB-INF folder with your web descriptor inside (web.xml), lib and classes folder, etc..
It is shown here:
http://docs.oracle.com/javaee/5/tutorial/doc/bnadx.html

404 -resource under sub-directory not found in eclipse

I am able to access a resource(say test.html) only when it is directly under WebContent in eclipse.If i place it in WEB-INF or WEB-INF/jsp the IDE shows error 404-requested resource is not available.
http://localhost:8080/MyApp/test.html (This works when test.html is under WebContent and not any of it's subdirectory)
When it is in WebContent/WEB-INF
Right click-run takes to the below URL which shows 404-resource not available
http://localhost:8080/MyApp/WEB-INF/test.html
How do i access it by placing "test.html" in WEB-INF or WEB-INF/jsp?
All configurations are default with no restrictions specified in web.xml and using Tomcat 7 as the web server
To prevent access to specific files. You cannot access /WEB-INF/ directory from outside the server itself. If you want to create subdirectory create them under
WebApp/
-index.jsp
-YourSubdirectory/
--test.jsp
test.jsp can be accessed via localhost:8080/MyApp/YourSubdirectory/test.jsp
Files at WEB-INF directory cannot be accessed directly from browser. This is the basic restriction.
However content of this directory could be accessed at application level. Web container provides such opportunity.
For example, if you using SpringMVC, you can map some URL to the file at WIB-INF directory and it will work correctly.