NeTBeans Web Application Project gives a error message HTTP Status 404 - netbeans

When I run the project directly right clicking the project name I get a error "HTTP status 404" but when i individually run a file (eg. home.html) it runs.The project is a servlet project, where my home.html is connected to a servlet file.There are no errors for sure. What's the real issue?

404 errors are generated by the web container when a resource is not found. Clearly there must be an issue with your paths or something, but based on the limited information you provide it is hard to spot the mistake...

Related

getting error message "Failed to load resource: the server responded with a status of 404 (Not Found)"

I have a simple MVC web application, which was running locally without problems 3 weeks ago.
When I now open the application in Netbeans and run it, everything seems to work fine as well. However, when I go to the browser (in my case google chrome) to look at the app's frontend (at http://localhost:8080/optimizer), I get the following error message:
HTTP Status 404 - Not Found
In Chrome's javascript console the following error message is given:
optimizer:1 Failed to load resource: the server responded with a status of 404 (Not Found)
"optimizer" is the name of the app. (What's the point of the "1" in "optimizer:1"? ... I don't get this either.)
The server (payara) is running:
I can also reach the server's admin page:
However, somehow the server cannot seem to find the application, although 3 weeks ago everything worked fine ... I just don't get it.
What's wrong? How can I fix this?
UPDATE:
Clicking on "List Deployed Applications" in Payara's Admin Console reveals that my app is not(!) deployed.
I tried to deploy it by clicking on "Deploy an Application" -> "Choose file".
I selected the jar-file "optimizer-1.0-SNAPSHOT.jar", selected Type "EJB Jar", then clicked on OK.
I got this error message:
Archive type of /private/var/folders/hh/hgq7wrjn5d51gy2tkbxkkbwh0000gn/T/optimizer-15075570634779987058.0-SNAPSHOT.jar was not recognized
How can I deploy my app? And why did it work automatically before and now it doesn't work any more?
UPDATE 2:
A difference I realise compared to before (3 weeks ago) is that the browser doesn't open automatically any more when I run the app.
Furthermore, Google Chrome used to be the IDE'S default browser ... now there is just a grey globe and I can no longer choose Chrome as my browser:
UPDATE 3:
I just noticed there is an error message that appears when the server is started (it's in the middle of hundred of rows of log output so I didn't notice it at first):
UPDATE 4:
-> NetBeans IDE 11.2
-> Payara Server 5.193
Error clearly shows, server is not able to recognize archive type of jar,
Archive type of
/private/var/folders/hh/hgq7wrjn5d51gy2tkbxkkbwh0000gn/T/optimizer-15075570634779987058.0-SNAPSHOT.jar
was not recognized
From payara blog,
If you set “Location” by “Packaged File to Be Uploaded to the Server”,
the suitable type would be selected.
So, the suitable type would be selected automatically.
Also, optimizer-15075570634779987058.0-SNAPSHOT.jar is not an original jar optimizer-1.0-SNAPSHOT.jar
It seems that issue is with the path of an archive, from thread
Code in uploadFrame.jsf:
<sun:form id="form">
I probe to change it to:
<sun:form id="form" enctype="multipart/form-data">
in uploadFrame.jsf into console-common.jar file. And it works.
You can try with changing uploadFrame.jsf into console-common.jar file.
(Not sure if chrome takes care of this, as it was working for you with chrome).
You may also want to try manual deployment,
install-directory/bin/asadmin deploy PATH_TO_ARCHIEVE/optimizer-1.0-SNAPSHOT.jar
Ok, I now found out how to run the app locally without problems: by creating a .war file instead of a .jar file - now I can run the app again without problems.

Customization YCommerceWebService - Webroot "/rest" not working anymore

I created a YcommerceWebServices with "ant extgen", added it in localextension file, I added the oAuth2 authentification extension.
When I was doing request from postam like :
https://localhost:9002/rest/v2/{baseSiteID}/users/{userID}/...
It was working, I was receiving all the information. Since I started to customize I get all the time HTTP Error 302 Moved temporarily .
Even when I am on the hac and I click on my customExtension in the column web on "/rest" I get a 404 (before it was working too)
I tried to "Ant clean all" and update from Hac, no result.
The problem came from the fact, that during my customization by modifying the file /web/webroot/WEB-INF/config/v2/dto-level-mappings-v2-spring.xml
I had made an error on the declaration of a bean.
Indeed looking carefully at the compilation and launch of the server (ant clean all - ./hybrisserver.sh). I saw that there was an error. the launcher was launched but my webservice was not active.

starting tomcat manually via startup.bat doesn't seem to work

I have a jsp web-project which i wrote in eclipse. I can run it within eclipse, no problems there.
Now i have the final war-file and can access it via firefox (localhost:8080/program) WHEN the tomcat server is still up within eclipse.
The thing is, i want the program for other people to test it, but without having them to start tomcat via eclipse.
So i tried to start tomcat manually via bin/startup.bat - no success.
I tried changing the port number within the server.xml and excluded the localhost from proxy in the firefox settings. Still no success.
What did i miss? Can you please help me, give me some clue?
I'd highly appreciate!
Greetings from Germany
---edit(03-17-2016)---
Some more information:
I tried to access (i started the server via eclipse beforehand) the default examples ROOT/index.jsp + manager/index.jsp and got the following exception:
HTTP Status 404 - /manager/index.jsp
type Status report message
/manager/index.jsp description
The requested resource is not
available. Apache Tomcat/7.0.67
On my program i only get
address unkown
Firefox can not connect to the server at localhost:8080
Website might be temporary out of order
Consider enabling Proxy
P.S.: I translated the last exception myself so it's not the real exception

How do I make Liferay 6.1.0 always redirect to a 404 page when a resource isn't found?

I have created a simple hook for a Liferay site I have. It contains a 404.jsp that overrides the default Liferay 404. It works fine if I type in a specific page. For example:
Going to http://localhost:8080/jooky.jsp throws
SEVERE: PWC6117: File "C%3A%5Cbundles%5Cliferay-portal-6.1.0-ce-ga1%5Cglassfish-3.1.1%5Cdomains%5Cdomain1%5Capplications%5Cliferay-portal%5Cjooky.jsp" not found
in my Glassfish server log and redirects me to my custom /errors/404.jsp without a problem.
However, going to http://localhost:8080/jooky throws a different error
INFO: 14:07:41,790 INFO [PortalImpl:4873] Current URL /jooky generates exception: null
and redirects to a page within the portal that looks like this:
Can anyone help me redirect these non-file type URL's to my 404 page as well?
Thanks.
I was still struggling to figure out how to do this until I read the section in the Liferay Developer's Guide about "Overriding a JSP".
That told me exactly what I needed to know. Where the 404.jsp file should be stored in my hook, why there was a .portal.jsp file appearing in my liferay installation, etc.
One other critical thing that was not mentioned was the addition required to the portal-ext.properties file.
I had to add the following:
# 404 page
layout.show.http.status=true
layout.friendly.url.page.not.found=/errors/404.jsp
After a server restart, the 404 page started displaying for all incorrect pages.

tomcat6 application deployment error

I am new to tomcat and servlets and am trying to deploy my first web application in tomcat and the index.jsp page is showing up blank.
It works fine in eclipse. I have the web.xml for the application setup to have the index.jsp as the default page. I am able to run the application and debug it in eclipse but when I export it as a WAR file and deploy it in tomcat and try to access it through a regular browser I get a blank page.
What am I missing here? Any help is greatly appreciated.
Thanks,
- Vas
If you ever get a blank page, the most important information you (and we) need are:
The request URL.
The already sent data -if any- (webbrowser > View Source).
The response headers (Firebug? Webdeveloper Toolbar?).
The server logs (stdout, stderr, webapp).
This usually indicate a wrong URL (to be proven by 1), or an exception halfway a JSP page (to be proven by 2 and 4), or an internal server error without an error page (to be proven by 3 and 4).
You need to configure your server.xml file and declare a context for your web application. You can find the documentation here: http://tomcat.apache.org/tomcat-6.0-doc/config/context.html
But a blank page is kind of weird, because I think if your web application wasn't deploy correctly, you will get a Http 404 error.