[Last Call] Learn about multicloud storage options and how to improve your company's cloud strategy. Register Now

x
?
Solved

HTTP status error 404

Posted on 2003-11-24
13
Medium Priority
?
348 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 252 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 248 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
Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

 
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

[Webinar] Lessons on Recovering from Petya

Skyport is working hard to help customers recover from recent attacks, like the Petya worm. This work has brought to light some important lessons. New malware attacks like this can take down your entire environment. Learn from others mistakes on how to prevent Petya like worms.

Question has a verified solution.

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

Geo-targeting is the practice of distributing content based on a person’s location, as best as you can determine it. Let’s look at some ways you could successfully use this tactic. The following tips and case studies could lead to meaningful results.
One of the most important things in an application is the query performance. This article intends to give you good tips to improve the performance of your queries.
This course is ideal for IT System Administrators working with VMware vSphere and its associated products in their company infrastructure. This course teaches you how to install and maintain this virtualization technology to store data, prevent vuln…
Please read the paragraph below before following the instructions in the video — there are important caveats in the paragraph that I did not mention in the video. If your PaperPort 12 or PaperPort 14 is failing to start, or crashing, or hanging, …

656 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