Solved

HTTP status error 404

Posted on 2003-11-24
13
340 Views
Last Modified: 2012-06-27
dear all below is a prog that tried to send an email using jsp

<%@ page import="java.sql.*, java.util.*, javax.mail.*, javax.mail.internet.*" errorPage="errorpsd.jsp, error.jsp, errornull.jsp, errorSameUsername.jsp" %>

<%
      String email = "danielchongboon@yahoo.com";
        String suggestion = "registration is successful";
        String topic = "Registraion is good";
        Properties props = new Properties();
       
        
         props.put("mail.smtp.host", "mail.server.com");
       Session s = Session.getInstance(props,null);

       MimeMessage message = new MimeMessage(s);

       InternetAddress from = new InternetAddress(email);//get address
       message.setFrom(from);
       InternetAddress to = new InternetAddress("danielchongboon@yahoo.com"); //to
       message.addRecipient(Message.RecipientType.TO, to);
       //InternetAddress cc = new InternetAddress("cc@towho.com");
       //message.addRecipient(Message.RecipientType.CC, cc);
 
       message.setSubject("Suggestion: " + topic);//get topic
       message.setText(suggestion);//message body

       Transport.send(message); //this is the problem
%>


but i got the following error...
description The requested resource (/errorpsd.jsp, error.jsp, errornull.jsp, errorSameUsername.jsp) is not available.

pls help
Thanks a million

0
Comment
Question by:ahnui79
13 Comments
 
LVL 14

Accepted Solution

by:
kennethxu earned 63 total points
Comment Utility
>> you said you have those page but you don't:
errorPage="errorpsd.jsp, error.jsp, errornull.jsp, errorSameUsername.jsp" %>
0
 
LVL 2

Assisted Solution

by:anthony_castillon
anthony_castillon earned 62 total points
Comment Utility
I think you can only have one error page.  When you set all those jsp's as the value of errorPage, it evaluated everything inside the quotation marks as one URL.
0
 
LVL 1

Expert Comment

by:cpuburst
Comment Utility
Whatever be the case, you are getting an error in your page in the send mail code.
When the jsp encounters an error then it tries to find if there is an error page specified for any errors.
But when it tried to find the files listed for error forwarding, it gave another 404 error.
So please check ur mail sending code. That is where the error is.

Just remove the errorPage attribute and run the page. You will get the stack trace of the error on the console.

regards
cpuburst
0
 
LVL 1

Expert Comment

by:cpuburst
Comment Utility

I should also be getting a share in the split.
regards
Cpuburst
0
 
LVL 35

Expert Comment

by:girionis
Comment Utility
I believe there's nothing wrong with the source code. To my understanding the error lies to including multiple error files at once.
0
Highfive + Dolby Voice = No More Audio Complaints!

Poor audio quality is one of the top reasons people don’t use video conferencing. Get the crispest, clearest audio powered by Dolby Voice in every meeting. Highfive and Dolby Voice deliver the best video conferencing and audio experience for every meeting and every room.

 
LVL 1

Expert Comment

by:cpuburst
Comment Utility
Hi,
You believe!!!,  but first you should verify ur knowledge of JSP, than guessing.

I have some sample code for you to test and understand.
As per your understanding, both the following code samples should fail. But actually only the second code alone fails.
Only when there is an error the page in the errorPage attribute is called. If that is not found, it results in page not found http 404 error.  So it turns out that my answer is the only completely correct answer. The error has to be in the code, than in the errorPage attribute declaration.  Now you decide what you should do with the points. Whether, I get the points or not is fine. But a wrong analysis shouldn't happen.

 
CODE Sample 1******************************************************************

<%@ page  errorPage="errorpsd.jsp, error.jsp, errornull.jsp, errorSameUsername.jsp" %>
<!doctype html public "-//w3c//dtd html 4.0 transitional//en">
<html>
<head>
<title> Test</title>
</head>
<body>
Hello buddy <br>
<%= Integer.parseInt("12")%>
</body>
</html>

CODE SAMPLE 2 ***************************************************************

<%@ page  errorPage="errorpsd.jsp, error.jsp, errornull.jsp, errorSameUsername.jsp" %>
<!doctype html public "-//w3c//dtd html 4.0 transitional//en">
<html>
<head>
<title> Test</title>
</head>
<body>
Hello buddy <br>
<%= Integer.parseInt("hello12")%>
</body>
</html>

**********************************************************************************
0
 
LVL 35

Expert Comment

by:girionis
Comment Utility
> As per your understanding, both the following code samples should fail.

Nope, only the second will fail since the JSP will never throw an error (and thus the error pages will never be called).

> Only when there is an error the page in the errorPage attribute is called.
>  If that is not found, it results in page not found http 404 error.

I never said otherwise.

Notice the question more carefully and see what the user asked (asterisks are mine):

>but i got the following error...
>description *****The requested resource (/errorpsd.jsp, error.jsp, errornull.jsp, errorSameUsername.jsp)*****
>is not available.

which means that it cannot find one of the error pages. I was probably wrong with my comment

>  including multiple error files at once.

and should have said it clearer:

> including multiple error files at once and one of them cannot be found.

So the only correct answer to the user's question is kennethxu's actually. If the user didn't have any error pages defined and was getting a different error message then your comment would have been correct but in this case it's not.

Or if you would like me to rephrase that. The user actually gets two (or more) error messages but the first one he needs to check on is whether the error page exists. After that he can check the rest of the error messages.
0
 
LVL 35

Expert Comment

by:girionis
Comment Utility
> Now you decide what you should do with the points

I do not decide who gets the points or not. I am just suggesting possible solutions.
0
 
LVL 35

Expert Comment

by:girionis
Comment Utility
> You believe!!!,

Yes I believe, I am not going to run every single example I see in order to be able to say what can possible be wrong or right.
0
 
LVL 1

Expert Comment

by:cpuburst
Comment Utility
>I believe there's nothing wrong with the source code. To my understanding the error lies to including multiple error files at once.
>I was probably wrong with my comment

Why don't you have a definite statement?.

I never said Kennethxu's answer is wrong. It is correct as far as errorpage attribute declaration is concerned.  
But I didn't want to give the author "ahnui79", an impression that it is only because of his errorPage declaration, his code failed. Actually the first error happened in his code, then only it came to errorpage attribute. Even though the first answer will solve the errorPage problem, again "ahnui79" will have another server error on his shoulders. So I feel an answer should be comprehensive and should deal with the root cause.

Girionis, you do what you feel is right. No more comments from my part on this.

Thanks and regards

Cheers
Cpuburst.
0
 
LVL 35

Expert Comment

by:girionis
Comment Utility
> Why don't you have a definite statement?.

It is easy to come to wrong conclusions if you only copy/paste half of my words.

> I never said Kennethxu's answer is wrong. It is correct as far as errorpage attribute declaration is concerned.  
> But I didn't want to give the author "ahnui79", an impression that it is only because of his errorPage declaration,

It is not only because of his errorPage declaration but *mainly* because of it. If the user *first* corrects the error page *then* he will get a different one.

I won't argue any more. I will let a moderator decide.
0

Featured Post

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

This article explains in simple steps how to renew expiring Exchange Server Internal Transport Certificate.
Learn to move / copy / export exchange contacts to iPhone without using any software. Also see the issues in configuration of exchange with iPhone to migrate contacts.
Illustrator's Shape Builder tool will let you combine shapes visually and interactively. This video shows the Mac version, but the tool works the same way in Windows. To follow along with this video, you can draw your own shapes or download the file…
This video shows how to remove a single email address from the Outlook 2010 Auto Suggestion memory. NOTE: For Outlook 2016 and 2013 perform the exact same steps. Open a new email: Click the New email button in Outlook. Start typing the address: …

743 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

14 Experts available now in Live!

Get 1:1 Help Now