Solved

HTTP status error 404

Posted on 2003-11-24
13
346 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
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
 
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

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

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

Article by: Justin
In light of the WannaCry ransomware attack that affected millions of Windows machines, you might wonder if your Mac needs protecting. Yes, it does and here is how to do it.
Let’s face it: one of the reasons your organization chose a SaaS solution (whether Microsoft Dynamics 365, Netsuite or SAP) is that it is subscription-based. The upkeep is done. Or so you think.
Michael from AdRem Software outlines event notifications and Automatic Corrective Actions in network monitoring. Automatic Corrective Actions are scripts, which can automatically run upon discovery of a certain undesirable condition in your network.…
Add bar graphs to Access queries using Unicode block characters. Graphs appear on every record in the color you want. Give life to numbers. Hopes this gives you ideas on visualizing your data in new ways ~ Create a calculated field in a query: …

705 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