Resource Not Found? - java

There's this dynamic web project (java) that I'm working on, which requires me to access the web-page it'll redirect me to. So usually when i start the server and run it from chrome, i go to the desired page. But since a couple of days, my project is misbehaving. The same URL which it earlier used to run properly, now shows
Not Found : HTTP Error 404. The requested resource is not found"
After starting the tomcat server many times, on one run it randomly connects to the URL.
Does anyone know why this happens? And without any fix how am i able to reconnect to the URL again? And if you know, how to fix this issue?

Related

Tomcat 9 Application causing 502 error after logging in

I manage a few Tomcat 9 applications that are run on a remote server that also use IIS 8.5. Each site has three environments (DEV, TEST, and PROD). All of the environments are the same but on different servers. Their databases (Oracle DB) are also on separate remote servers. I do not use any other third party frameworks for the sites (such as Maven or Gradle).
One of my applications had an issue where an attacker could access the web.xml through a Multiple Directory Traversal Vulnerability. Some brief information can be found here: https://www.securityfocus.com/bid/63052/exploit
However, I discovered on the DEV and TEST (I thought PROD as well) that the filter we put in place was actually causing the site to not work correctly. You'd put in your user and password and click login and nothing would happen. I seemed to have fixed it on the DEV and TEST environment by fixing the regular expression that my code was testing the URI against. Code:
final String REGEX_INCLUDED = ".*\\/WEB-INF\\/web.xml.jsf.*";
...
if (Pattern.matches(REGEX_INCLUDED, URI)) {
log.debug("SecurityFilter redirect");
resp.sendRedirect("/errors/403.html"); // /login.jsf OR /index.html
} else
chain.doFilter(request, response);
I deployed the new war onto PROD, entered my user and password and it would load. The site redirects to the homepage after login, BUT it doesn't actually load if that makes sense. The response is a generic 502 error (shown below) but the URL does, in fact, say /home.jsp where it should respond with the homepage.
502 Error
I've checked the catalina log and I've not found a stack trace or any sign of an error being output. No other logs are useful either in showing what the issue is. I've tried just clearing my cache and retrying, using a different browser, restarting the tomcat service, restarting the site in IIS and nothing.
If there is something I'm missing that you wish to see let me know. BTW, I've tried removing the filter that blocks access to the web.xml just to make sure it wasn't the issue and both with and without the filter, it results in the 502 error.
Thanks in advance for any help.
Answering my own question: I had looked around everywhere and only after posting I found a related post:
502 proxy error on deployment
Their answer helped. The difference between my PROD environment and my DEV/TEST environments is that PROD is on a Proxy. I went to IIS on the server and found the server farm that the site used. I then clicked on the Proxy option and changed my timeout from 30 seconds to 60 seconds. Looks like my proxy was timing out. Hope this helps someone in the future.

Simple Hello World servlet giving error 404 in Eclipse Tomcat

I am trying to follow a very simple Hello World servlet tutorial from this link. I have followed all steps as written, but when I run it on the tomcat7 server (downloaded from within eclipse), it gives me an HTTP error 404, saying that the requested source is not available.
Note that my server is working fine on
localhost:8080
. But the servlet -
localhost:8080/HelloWorldServlet/HelloWorld
is giving me this error.
It means Tomcat cannot map your url to existing servlet method. Are you sure, you covered all steps correctly? Hard to say with no details included.
You are probably missing the application name after the url, if you upload it to gitHub maybe I can provide more info.

How to switch with another application when redeploying a WAR?

Sorry if this question was asked before, if it was, I didn't find it.
I'm using GlassFish 4.
When I need to redeploy an application (for fixing a bug for exemple), its URL will return temporarily a 404 NOT FOUND error until the application is fully redeployed.
My question is: do you know a way to redirect the URL to another application or a web page ("Application not available for the moment...") during the time the URL is inaccessible?
I heard of load balancer but it's between 2 servers (which I don't have).
Thank you.
You can use rolling updates to update an application without any downtime, by using the :version suffix. For full information on how to do it, see the blog post at http://blog.payara.fish/payara-server-rolling-upgrades.

Beginner-jJava- Amazon Elastic Beanstalk- Unable to correctly specify health check url-also,what is base url

I have created a sample web application in Java. It has no errors, and I was able to create a WAR archive successfully. I also tested this successfully in local Tomcat 7 server.
Now, this sample web app has 2 servlets- "home" and "runsinglecrawljob". The name of the war archive is "sparkcrawler0.12.war".
So, in local Tomcat, I access the web app at
http://localhost:8080/SparkCrawler0.12/runsinglecrawljob
And the other servlet is
http://localhost:8080/SparkCrawler0.12/home
Now, when I created an Elastic Beanstalk environment, I specified health check url="/home"
But I am getting error that health check url is not responsive, and because of this the application is not running in Elastic Beanstalk- it is showing a 503 error- as per Google Chrome this is the exact message --
"HTTP Error 503 (Service Unavailable): The server is currently unable to handle the request. This code indicates this is a temporary condition, and the server will be up again after a delay."
Now, what is the correct value of health check URL?
Also, if my URL is
http://spark.elasticbeanstalk.com
as defined in Elastic Beanstalk, then do I access the web app at
http://spark.elasticbeanstalk.com/SparkCrawler0.12/runsinglecrawljob
Or do I access the web app at
http://spark.elasticbeanstalk.com/runsinglecrawljob ?
I don't know if this is related or not, but I have a very similar issue but with a PHP codeigniter application.
I uploaded the application, and 'index.php' is the normal starting point of the application.
I also have a simple "phpinfo.php" that sits parallel to the index.php.
So, the URL is myApp.elasticbeanstalk.com which hits index.php and it is fine.
However, for my health check, I set it to /phpinfo.php because I want myApp.elasticbeanstalk.com/phpinfo.php to be used as the health check.
If I do this, the health check always fails, and so my application does not run and I see the glaring red box of doom.
This has been driving me crazy.
(Why do I want to do this? -- it's because I wanted to add an .htaccess file to the application root that requires a password for everything except the phpinfo.php file, and I tested this locally and it works. I did not add the .htaccess file yet -- I just wanted to see if I could point the health check to something besides "/" and have it work.
UPDATE --
I sorted out my issue. It turns out that when I launch one of these elastic beanstalk environments, I have to set up the healthcheck url right then and there to be /phpinfo.php and then upload my application. When I was fussing with this earlier, I would try to edit the configuration later to change the health check url and that never worked and the instance would never come alive again.

HTTP 500 internal error in jdeveloper

I'm working on an assignment. An online order system using EJB 3.0. im using jDeveloper 10 and oracle 10g for the database. i have coded around 20%, now i need to check the system that i have developed so far. so when i run the web client it does not show me any error and it runs successfully. but when the browser tries to open the page it says. HTTP 500 internal error on the browser. My jsp page is under web directory anyway. output pic is attached.
how could solve this issue?
Are there any log files on your web server ?
Put in your code some statement to log to file what is doing.
Use a browser with developer support, like Firefox with Firebug, and watch the HTTP transactions.
Which other conditions change between web client and browser mode ?
how could solve this issue?
Look at the log files in your EJB server. There will probably be an entry or entries corresponding to your browser's attempting to fetch the page that resulted in the 500 error. They should give some information about what is happening, and may even give you a stack trace. Also check the SEVERE / ERROR / WARNING entries prior to the event.
If that doesn't give you an answer, you need to investigate what is different about the requests when they come from your web client versus from your browser. If your EJB implementation has a way to capture the incoming request headers, use that. Otherwise, you could use wireshark or tcpdump to capture them.
Thanks for your contributions.
I guess it was something wrong with my jdeveloper 10. i installed the jdeveloper 11 n i started running on it. the project started to run successfully.

Categories

Resources