HA Javamail not handling exceptions

C

christopher

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
 
C

christopher

On Jul 15, 9:13 am, (e-mail address removed) 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.
 
C

christopher

On Jul 15, 9:13 am, (e-mail address removed) 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
 
R

Roedy Green

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

christopher

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.

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
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,582
Members
45,057
Latest member
KetoBeezACVGummies

Latest Threads

Top