Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

HA Javamail not handling exceptions

1 view
Skip to first unread message

chris...@dailycrossword.com

unread,
Jul 15, 2007, 12:13:07 PM7/15/07
to
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

chris...@dailycrossword.com

unread,
Jul 15, 2007, 1:25:50 PM7/15/07
to
On Jul 15, 9:13 am, christop...@dailycrossword.com 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.

chris...@dailycrossword.com

unread,
Jul 15, 2007, 1:54:44 PM7/15/07
to
On Jul 15, 10:25 am, christop...@dailycrossword.com wrote:
> On Jul 15, 9:13 am, christop...@dailycrossword.com 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

Roedy Green

unread,
Jul 15, 2007, 2:30:15 PM7/15/07
to
On Sun, 15 Jul 2007 09:13:07 -0700, chris...@dailycrossword.com
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

chris...@dailycrossword.com

unread,
Jul 15, 2007, 3:04:31 PM7/15/07
to
On Jul 15, 11:30 am, Roedy Green <see_webs...@mindprod.com.invalid>
wrote:
> On Sun, 15 Jul 2007 09:13:07 -0700, christop...@dailycrossword.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

0 new messages