Solved

HTTP status error 404

Posted on 2003-11-24
13
341 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
ID: 9813517
>> 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
ID: 9814281
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
ID: 9950624
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
ID: 10857914

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

Expert Comment

by:girionis
ID: 10858022
I believe there's nothing wrong with the source code. To my understanding the error lies to including multiple error files at once.
0
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 
LVL 1

Expert Comment

by:cpuburst
ID: 10858313
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
ID: 10858779
> 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
ID: 10858863
> 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
ID: 10858874
> 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
ID: 10858922
>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
ID: 10859157
> 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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

We need a new way to communicate time sensitive or critical info.   The best part of my role at xMatters is visiting our clients all over the world to learn about how they operate their businesses, share insights that xMatters has gleaned across…
Note: This is the third blog post in a series on email clearinghouses (https://www.xmatters.com/alert-management/blog-email-has-failed-us?utm_campaign=70138000000ydLoAAI&utm_source=exex&utm_medium=article&utm_content=blog-post).   We’ve been talki…
Video by: Mark
This lesson goes over how to construct ordered and unordered lists and how to create hyperlinks.
Learn how to create flexible layouts using relative units in CSS.  New relative units added in CSS3 include vw(viewports width), vh(viewports height), vmin(minimum of viewports height and width), and vmax (maximum of viewports height and width).

867 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

16 Experts available now in Live!

Get 1:1 Help Now