HA Javamail not handling exceptions

Discussion in 'Java' started by christopher@dailycrossword.com, Jul 15, 2007.

  1. Guest

    I am using HA Javamail (http://ha-javamail.sourceforge.net/
    changes.html), which looks to be a little long in the tooth. It does
    perform extremely well for 95% of what I want, but once it is
    installed there is no option to not use it. Essentially, after
    installing the jar in tomcat's HA Javamail simply works -- something
    about the javax.mail.Transport interface makes it integrate
    automatically.

    My issue is HA Javamail does not seem to be throwing all the
    exceptions thrown by the current JavaMail package. Consequently (If I
    am saying this right), even if I catch Throwable when I invoke
    Transport.sendMessage() I still get an exception in the logs:
    com.sun.mail.smtp.SMTPSendFailedException
    and my operation appears to have succeeded.

    As I see it my options are a) rollback JavaMail to an earlier version
    that doesn't throw things that HAJavamail doesn't catch, or b) hack
    into HAJavamail and try and throw the exceptions so I can catch them
    in my routine. I guess rebuilding someone else's package is a skill I
    should have, but I am anticipating all manner of issues, considering
    the age of the software.

    suggestions?
    -- clh
     
    , Jul 15, 2007
    #1
    1. Advertising

  2. Guest

    On Jul 15, 9:13 am, wrote:
    (snip)
    >
    > suggestions?
    > -- clh

    The jar for JavaMail 1.3 was included in the source download for HA
    JavaMail. I did try to roll back the jar for JavaMail to 1.3. What I
    got was the class def for the SMTP exception could not be found, which
    doesn't make sense, because it doesn't exist in JavaMail 1.3 OR HA
    Javamail. I recompiled my class (after rolling back the jar) and it
    compiles ok (without using -extdirs) and when I run it I get no class
    deff for the regular MessagagingException (not the SMTP version that
    doesn't exist).

    I hate this crap. I spend more than 50% of my time not coding because
    of this kind of frustration. Is it a classpath issue now? my class
    can compile but not run because I missed a dot?

    Sigh.
     
    , Jul 15, 2007
    #2
    1. Advertising

  3. Guest

    On Jul 15, 10:25 am, wrote:
    > On Jul 15, 9:13 am, wrote:
    > (snip)

    I lied -- I did use -extdirs to compile and it *was* a classpath error
    of sorts (the last error, not the original). Turns out the old 1.3
    mail jars supplies by HA mail and freshly downloaded from sun are not
    readable by the current jar executable (1.5). I extracted all the
    classes and re-jarred them and now I get a brand spanking new error:

    Exception in thread "main" java.lang.ClassFormatError: Unknown
    constant tag 0 in class file javax/mail/internet/InternetAddress
    at java.lang.ClassLoader.defineClass1(Native Method)
    at java.lang.ClassLoader.defineClass(ClassLoader.java:620)
    at
    java.security.SecureClassLoader.defineClass(SecureClassLoader.java:
    124)
    at java.net.URLClassLoader.defineClass(URLClassLoader.java:
    260)
    at java.net.URLClassLoader.access$100(URLClassLoader.java:56)
    at java.net.URLClassLoader$1.run(URLClassLoader.java:195)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.net.URLClassLoader.findClass(URLClassLoader.java:188)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:299)
    at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:
    268)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:251)
    at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:
    319)
    at spgame.MailCron.<init>(MailCron.java:81)
    at spgame.MailCron.main(MailCron.java:99)

    So, this looks like an incompatibility between versions to me --
    between the JavaMail and activation.jar versions, or JavaMail 1.3 and
    the JVM 1.5 classloader, or who knows?

    Did I mention I hate this crap?

    -- clh
     
    , Jul 15, 2007
    #3
  4. Roedy Green Guest

    On Sun, 15 Jul 2007 09:13:07 -0700,
    wrote, quoted or indirectly quoted someone who said :

    >As I see it my options are a) rollback JavaMail to an earlier version
    >that doesn't throw things that HAJavamail doesn't catch, or b) hack
    >into HAJavamail and try and throw the exceptions so I can catch them
    >in my routine. I guess rebuilding someone else's package is a skill I
    >should have, but I am anticipating all manner of issues, considering
    >the age of the software.
    >
    >suggestions?


    First try an email to the authors. IT might prod them to take an
    interest in improving the product. Personally, I put any sort of bug
    at the top of the TODO queue.
    --
    Roedy Green Canadian Mind Products
    The Java Glossary
    http://mindprod.com
     
    Roedy Green, Jul 15, 2007
    #4
  5. Guest

    On Jul 15, 11:30 am, Roedy Green <>
    wrote:
    > On Sun, 15 Jul 2007 09:13:07 -0700,
    > wrote, quoted or indirectly quoted someone who said :
    >
    > >As I see it my options are a) rollback JavaMail to an earlier version
    > >that doesn't throw things that HAJavamail doesn't catch, or b) hack
    > >into HAJavamail and try and throw the exceptions so I can catch them
    > >in my routine. I guess rebuilding someone else's package is a skill I
    > >should have, but I am anticipating all manner of issues, considering
    > >the age of the software.

    >
    > >suggestions?

    >
    > First try an email to the authors. IT might prod them to take an
    > interest in improving the product. Personally, I put any sort of bug
    > at the top of the TODO queue.
    > --
    > Roedy Green Canadian Mind Products
    > The Java Glossaryhttp://mindprod.com


    Thanx roedy -- good to see you're still around!
    The last development activity was several years ago, and the project
    was left in Beta.

    Hey -- I hammered out all the BS issues and managed to rebuild their
    package without using ant (package was too old!). I put in a couple
    System.out()'s and can see the basic flow.

    The ultimate issue is they are catching the exceptions in various
    threads and explicitly dumping them to System.out(). hehe that's
    exactly what I do with Beta code! I have read several articles about
    throwing exceptions from threads, so it looks like I will have to
    massage their code. Doesn't look too tough, just not how I wanted to
    spend my day.

    Otherwise this package rocks.

    Cheers! (and thanks for listening to me vent!)

    -- clh
     
    , Jul 15, 2007
    #5
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. moo moo
    Replies:
    3
    Views:
    1,081
    John C. Bollinger
    Oct 22, 2003
  2. Ahmed Moustafa
    Replies:
    5
    Views:
    30,076
    Chris Smith
    Jul 14, 2004
  3. Paul Miller
    Replies:
    3
    Views:
    1,033
    Alex Martelli
    Nov 12, 2003
  4. Replies:
    3
    Views:
    621
    Sherm Pendley
    Apr 16, 2007
  5. Lie
    Replies:
    3
    Views:
    649
Loading...

Share This Page