Simple Hello World servlet giving error 404 in Eclipse Tomcat - java

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.

Related

Resource Not Found?

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?

OneLogin java-saml-tookit-jspsample crashes while parsing response

Has anyone tried using the OneLogin Java Toolkit JSP sample successfully?
I have downloaded and tried "java-saml-tookit-jspsample". I was able to follow the instructions and get it setup the Eclipse with JDK8. I was able to configure "onelogin.saml.properties" in the sample and the SAML Test Connector in my OneLogin Account.
When I run the application, I get the login link, and it is able to connect one Login and get back the Authentication response. I can also see the XML received when I debug, but the program crashes while processing the response.
It crashes at following source line in Util.java.
docfactory.setAttribute("http://java.sun.com/xml/jaxp/properties/schemaLanguage", XMLConstants.W3C_XML_SCHEMA_NS_URI);
With error
"java.lang.IllegalArgumentException:
http://java.sun.com/xml/jaxp/properties/schemaLanguage"
I tried adding a xercesImpl.jar and xml-apis.jar to see if its an XML parser issue, but it did not help either.
I'm the author of java-saml and I tested it with Oracle Java8 and had no issues.
This post suggest that the issue is related with how xerces.jar was installed.

OAuth Callback in the Glass Quick Starter Java App

Got my Glass last week. Working on running the Java version of the Quick Starter Glassware demo. I am having trouble with the OAuth callback. Do I need set this up myself? Or is there source included in the sample somewhere? Please help!
Clarification: I have set up my own project with the Java Quick Starter app's code, deployed it in EC2 and have set up the Client-ID and Client-secret in the Google APIs Console. I set the Redirect URI as http://<my server>/<my-app>/oauth2callback. When I visit the app in the browser, I get a 404 error that /oauth2callback is not found. I also tried setting the Redirect URI to just my app's root, i.e. http://<my server>/<my app>. Strangely, I still get the same error that /oauth2callback is not found.
Additional questions: Can you please clarify what the callback URL needs to be set to? Is the handler code already included in the quick-start-demo app or do I need to provide that code?
I think the problem is that you're not using a URL that actually maps to your server and servlet container. Try hitting the URLs directly from a browser and make sure they show up in your server and servlet container logs.
The callback url needs to be set to the oauth2callback servlet, relative to the path that leads to the server and servlet container. I don't know how you've set these up, so I can only guess, but it sounds like the <my app> portion isn't correct.
The handler code is included as part of the webapp. See the web.xml file to see the path mapping and the servlet object that it maps to. In this case, around line 53, oauth2callback is mapped to the com.google.glassware.AuthServlet class.
Update: See also the answer posted at Java Google glass starter project mapping in AWS EC2

AppEngine processing my POST requests as GET

I encountered a weird stuff and I've been struggling with it for a while now. Google AppEngine is processing my POST requests as GET. I've tried 3 different REST clients and they produced the same error (an html document that said GET is not available for the specified URL; but for God's sake I sent a POST!).
I'm using Java, and I've set the web.xml file correctly. Please note that this is not the first servlet in the project that responds to POST and others have worked properly. To complicate matters, this same servlet responds to POST normally when I run the app on my local development appengine server. I've cleaned and rebuilt the project several times and even changed the URL of the servlet but the problem still persists. Any help? Thanks.
The most common reason for this is that your POST is redirected for some reason, and redirects are always GET. What does the logging console say?
I was using the non secure url and it redirects POST to GET. Using https fixed this.

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