I'm working on some code. This code works in 2 environments but no in the third. This is the code:
in TagHandler.java InitialContext initial = new InitialContext(); System.out.println("in sendMail - looked up JavaMail session " + Attr.MAIL_SESSION_LOOKUP); Session session = (Session)initial.lookup(Attr.MAIL_SESSION_LOOKUP); System.out.println("in sendMail - creating email and sending it");
The code is getting to the first println but not the second. The MAIL_SESSION_LOOKUP is set to what it should be in the println and on the server, the Mail session name is correct - I checked that. I'm getting a ClassCastException.
The really funny thing is - I didn't change the code. I had to rebuild my computer in January and I have deployed the same code since then and that is when my troubles began. I'm running j2sdk 1.4.2_13 and I believe the code was developed in either j2sdk 1.4.2_04 or 1.4.2_06. I tried copying the mail.jar files off another computer where the code was created but this hasn't helped.
Originally posted by Dawn Thomas: This is the import I have:
I would guess you're having a class loader issue. This could probably be moved into the advanced forum - I can tell you how to fix it, but there are probably more elegant ways.. try this.
This is probably not perfect, I've never had to deal with a situation like this, but I'd probably start with something like this - maybe someone that has experience with it can come in and help.
Joined: Nov 05, 2007
Thanks for your help. It turns out that I have something configured wrong in my new IDE. I recently switched from Sun One to Rational Application Developer and there is some manual configuration I need to do that I was not aware of.