7 Replies Latest reply on May 24, 2004 12:12 PM by Kabir Khan

    bounce ClassCastException

    mike andrews Newbie

      found a ClassCastException in JMSMailListener.prepareBounceMessageForMail(), and am not sure how to proceed. may be a minor architectural issue needing original architect's advice :-)

      issue is in logic looking at whether recipient is local or not, whether or not to add message to a failed list. logic assumes EnvelopedAddress, when in fact its a MailAddress, and MailAddress doesn't have a getLocal() method --- which is the architectural issue. i committed a small comment there to cvs.

      i tried removing the code 'boolean local = ...' etc, leaving just the 'failed.add(..)', and successfully got a bounce message when sending to a non-existent yahoo account (or maybe yahoo didn't like 'mail from:<mikea@localhost>'), but don't think this is the right solution since i basically removed the logic there which should be doing something useful.

      mike

        • 1. Re: bounce ClassCastException
          Steve Lewis Expert

          What happens when you do a

          rcpts.getClass().getName()?

          This should tell you what class is actually it's expecting. You may already know this sort of thing, not trying to be insulting.

          • 2. Re: bounce ClassCastException + NUKES FORUM BUGS
            mike andrews Newbie

            no problem steve, i positively appreciate any time someone can spend to help me understand this or any other issue! thanks.

            i did a "logger.info(rcpts.getClass())", which showed a "MailAddress", and not an "EnvelopedAddress". that also explains the ClassCastException.

            ---------------------

            btw --- this new jboss forum website design has a nasty side-effect: if you resize the browser window in IE while composing, you risk completely losing your post when page is re-layed-out (happened to me once on this message already). not sure which html or javascript is responsible for that.

            p.s., trying to resize browser window after *previwing* one's post results in IE error message 'can't refresh without re-sending information'. so i think the reason is maybe due to some errant javascript, resizing browser window translates into a 'refresh' instead --- there's tons of javascript in these web pages.

            p.p.s: another weird new forum 'feature' is this automatic italicization you probably see in this post. have no idea how that happens either, and i never usually speak in italics!

            • 3. Re: bounce ClassCastException
              Andrew Oliver Master

              This is kabir's code. I think the logic only takes place if say the server doesn't exist. Yahoo would generate the bounce message if it was justa non-existent account. Whats weird is it seems like the bounce code is working...

              • 4. Re: bounce ClassCastException
                mike andrews Newbie

                right --- don't know why, but may be because the ClassCastException is being caught somewhere else... i apologize for not completely tracing it through yet. will check into it. mike

                • 5. Re: bounce ClassCastException
                  Kabir Khan Master

                  I'll take a look a bit later today. Mike, do you have a use case that will cause this to happen?

                  • 6. Re: bounce ClassCastException
                    mike andrews Newbie

                    thanks kab --- i was logged in as mikea@localhost, user mikea, password in jboss-service.xml, on my own local machine's jboss server. i sent an email to test@yahoo.com. from jbmail logs, looks like yahoo didn't like 'mikea@localhost' and rejected that. a few seconds later, got a classcastexception in jbmail logs. this was all in latest HEAD code. mike

                    • 7. Re: bounce ClassCastException
                      Kabir Khan Master

                      Fixed, the errors happening within SMTPSender are different when the server can't be reached, and when an account on a server is invalid. The invalid account exception (SendFailedException) returns a InternetAddress[]. Previously I created MailAddress from the failed ones, now I am creating EnvelopedAddress w/local=false.