The origin server did not find a current representation for the target resource or is not ... error when running jsp page - eclipse

I am trying to run this code in my Eclipse JSP dynamic web page. But on running it in the Tomcat Server Version 9.0, I am getting an error 404 message. Error Message-The origin server did not find a current representation for the target resource or is not willing to disclose that one exists. I was trying to include a header page in my other jsp page in this code.
So far I have tried switching the location of the server via server properties. I have also checked the Use Tomcat installation checkbox in Server Locations. Still, I am getting this error.
<!DOCTYPE html>
<html>
<head>
<title>Insert title here</title>
</head>
<body>
<jsp:forward page="http://localhost:8080/HelloJSP/HeaderPage.jsp" />
</body>
</html>

If the page is under WEB-INF folder, an 404 error message might appear. I had the similar problem.
I put the pages under the WebContent folder instead. In Eclipse, the location of files may look confusing. Sometimes right click the file and look at their properties for paths. Just like below :
As you can see, even though pages look like they are under WEB-INF, they are under WebContent. Then, you won't see 404. And you can put the url to see your page in your browser.
If this doesn't help, then check your Web Project Settings.
Right-click your project, go to Properties, and find Web Project Settings.
Can you see my Context root "/" ? If I want to run my jquery.html page, I just type
localhost:8080/jquery.html
If you change your context root to "test", then you type :
localhost:8080/test/jquery.html
Don't forget to clean your Tomcat after changing your context root. Otherwise, it won't apply changes.

Thank You for your help :)
Actually, this problem was solved once I removed all the server from eclipse and switched it off. Then I readded the sever once again and it started working. Still not able to find the reason this error was caused but it was fixed by using the above method.

Related

Server returns 404 on assets for PWA with vue

I run NPM build on the PWA boilerplate I am using.
Folder structure on server is as follows:
my-project ->
static,
index.html,
service-worker
I have then hosted on server and the Manifest and assets are returning a 404.
The project is currently here.
https://evilernie44.github.io/my-project/
Any help is much appreciated.
Changing routes on the manifest and two different servers
I want to get a boiler-plate hosted as a starting point for my PWA
Your script tags point to the wrong path.
Take this tag for example:
<script type=text/javascript src=/static/js/app.98f21a65b373eaa50022.js></script>
The browser resolves it to https://evilernie44.github.io/static/js/app.98f21a65b373eaa50022.js, which does not exist.
The correct path should be ./static/js/app.98f21a65b373eaa50022.js. The extra dot instructs the browser to build the full url relative to the current path.
Alternatively, you can specify an absolute path, such as /my-project/static/js/app.98f21a65b373eaa50022.js which points to the correct location.
In conclusion, any of the following 2 script tags would work:
<script type=text/javascript src=./static/js/app.98f21a65b373eaa50022.js></script>
<script type=text/javascript src=/my-project/static/js/app.98f21a65b373eaa50022.js></script>
By default Vue CLI assumes you are running the application as root, so it will try to load the files from '/'.
When deploying to production, or in a subfolder, you need to set the publicPath in vue.config.js
https://cli.vuejs.org/config/#publicpath

jenkins html reports link : can't index the index.html file automatically

This is the URL without index.html at the end( it doesn't work)
And this is the one I manually add index.html to the end(it works)
ps:Ubuntu Server 14.04.2/Jenkins 1.641
I've got the same bugs.
Update your Jenkins and the Html Report Plugin. This will solve your problem

Create and publish a static web project in Eclipse

when I tried to create and publish a static web project in eclipse I got: "Error copying file index.html: No such file or directory"
My environment: SuSE 12.2, Eclipse Indigo Release 2, Apache2 2.2.22,
This is what I did to create the project:
1) Create new Server
Basic, HTTP Server
Publishing Directory: /srv/www/htdocs
Enable publishing to this server: true
2) Create Project
New -> Static Web Project
Project Name: Simplepage
Target Runtime: HTTP Server (from 1)
Default Configuration
Content root: Simplepage
Web content folder name: WebContent
3) Create very simple page
Create new HTML file
Parent folder: Simplepage/WebContent
Name: index.html
Content:<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=${encoding}">
<title>Insert title here</title>
</head>
<body>
Test
</body>
</html>
4) Start Project
Right Click on Project Name -> Run as -> Run on Server
Here I got the error message mentioned above.
At this point there is a new folder /srv/www/htdocs/Simplepage created but has no content.
Later I made a test with the following configuration:
Change publishing directory to: "/srv/www/htdocs/XY"
Start Project gives error: "Access forbidden! You don't have permission to access the requested directory..."
At this time there is a new directory created: /srv/www/htdocs/XY/Simplepage containing the file index.html.
The window in eclipse is showing the path http://localhost/Simplepage/. When I change this manually to http://localhost/XY/Simplepage/ the newly created page is shown.
I don't understand this behaviour. Can someone explain this?
You have installed Apache2 server on your home computer, with the publishing directory /srv/www
Note that Apache2 runs on its own user (on my Ubuntu it is www-data). Apache's publishing directory /srv/www is normally owned by Apache's user.
You have also directed HTTP Server of Eclipse to the same directory. Note that this server is different from Apache; it is run by Eclipse inside its belly, and usually on different ports from Apache, to avoid port conflict. I think this server is run on the same user Eclipse runs, i.e., your regular user on your home comp.
I think that the error messages you get, are permission mismatch: Eclipse cannot publish in directories owned by Apache's user.
The solution is not to try to use Apache's directories but rather the default directories of Eclipse.
I have explained this in more detail here: Eclipse Web (http) servers: Debugging and publishing http files in Eclipse.
I do use both Eclipse' HTTP Preview server and Apache2:
Eclipse' HTTP Preview server for files I work on in Eclipse, and
Apache2 to run a localhost copy of my Wordpress site.
When files I work on in Eclipse, are mature, I transfer them manually to Wordpress as posts or pages.

Deactivate/change default favicon in iPlanet 6.0

While there are many questions here about a favicon not showing, I have one that is showing out of nowhere...
If I type in my browser http://localhost, I see the root of the web directory and no favicon.ico is there. Yet an icon shows up on the browser tab. If I type http://localhost/favicon.ico, the browser does show me the icon!
How can http://localhost/favicon.ico return something that does not exist?
I am using an iPlanet server linked to weblogic app container.
I searched for a favicon.ico in my entire web directory and weblogic domain, didn't find any (or rather: some others lying around but not the one I see).
I even searched for the string 'favicon.ico' in domain, web directory and iPlanet directory, in case it is in some configuration file, didn't find anything.
Any hint?
Edit: As pointed out by Sacha below, this is a default icon of the server. I would like to know where in the config it is located, and how to deactivate it. I found how to do that in documentation of iPlanet 7.0, but I am using iPlanet 6.0 and I can't find anything in the doc.
If there is no favicon.ico server displays a default one.It might be a xampp or wamp logo.If you want to customize put yours in your project root directory. Eg:- If your project name is saas put it in saas folder.
If going to localhost/favicon.ico shows you the icon, then it is there. I am not sure why it is not in the directory.
I was also facing the same problem in jBoss server of my jsp project in which the browser was showing by default server icon and there was no favicon.ico in my whole project directory
then i searched for the favicon on the server and it was there so i have remove that file from the server to remove any default favicon from my project.

HTTP Status 404 description The requested resource () is not available. Apache Tomcat/7.0.27 [duplicate]

This question already has answers here:
JSP in /WEB-INF returns "HTTP Status 404 The requested resource is not available"
(3 answers)
Closed 6 years ago.
when i try to access my project home at http://localhost:7080/first/ or http://localhost:7080/first/start-page.html i get this message:
HTTP Status 404 - type Status report message description The requested resource () is not available. Apache Tomcat/7.0.27
but if i ask for localhost:7080/ the home page of tomcat is correctly found.
can someone help me?
why i can't get my start-page.html from eclipes?
but when i run from C:\Users\Mohsen\workspace.metadata.plugins\org.eclipse.wst.server.core\tmp0\wtpwebapps\first\WEB-INF\start-page.html, it runs correctly.
<?xml version="1.0" encoding="ISO-8859-1" ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:h="http://java.sun.com/jsf/html">
<h:head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" />
<title>first page</title>
</h:head>
<h:body>
<fieldset>
<legend>Random Results Page</legend>
<h:form>
Press button to get one of three possible results pages.
<br/>
<h:commandButton value="Go to Random Page"
/>
</h:form>
</fieldset>
…
</h:body></html>
Please look on tab "Servers" like on image:
If you don't see your project in server you need "publish" you project before.
// right click on server -> "Add and Remove" -> add your project from "Available" into "Configured" -> click "finish"
I hope this must help.
I don't think if you right click on server and select "Publish" will publish your project straight away. I think you need to add the project to the server first (I could be wrong).
Usually the easiest way to run the project on the server is to right click on the project, select "Run As" and select "Run on Server".
That will give you the option to select the server you want to use (or create a new one if you haven't created one then).
Try this move your start-page.html to your local host.
in my case i try this code
sudo mv start-page.html /etc/tomcat7/Catalina/localhost
Then check your localhost if the start-page.html are there.
Then you see the 4 .xml like docs.xml, the examples.xml, the manager.xml, etc. and you must see the start-page.html then try restart again your tomcat7.
Because the 404 error means cannot fine the location of your start-page.html
I think you created "xhtml file", creating a "file" and changing the file extension. This is wrong. You should create a html file and configure again extension. Then click the next button. After that, you should choose "New Facelet Template". Then finish.