Re: JavaMail works inside Eclipse but not outside
Magnus Warker wrote:
Dear Nigel and Andrew,
thank you for giving me tips about that.
Well, my java application should monitor a server process and send mail as
soon as the server process does not work anymore.
I just recognized that the mail functionality works when running the program
inside eclipse and does not when run outside eclipse, on the same machine.
As I was told today, access to the mail server via SMTP:25 is denied for
such workstations as the one I tested my application. So this is the reason
why "telnet <mailserver> 25" does not result in a connection. (I just
tested it with this telnet command, just to test if access is possible from
my machine at all).
But what still works and always worked is running the same application on
the same machine inside eclipse. The only difference is that outside
eclipse there is a jar file for the application, several jar files for the
libraries, and a batch file that calls "java -jar myapp.jar". But outside
eclipse I get the error that the mail server is not reachable.
I did not find any proxy settings in my eclipse installation.
In fact, the application works inside eclipse and does not outside. But what
is the difference???
Thank you,
Magnus
Please tell us the exact exception which is thrown. Also, could you answer my
question as to what is the message transaction type. Since direct access to the
mail server port 25 is blocked it cannot be simple SMTP. Is is using the mail
submission port or some other mechanism.
Are you absolutely sure that it is connecting to the host which you really think
it is? You mentioned that the exception indicates the host is not reachable,
which doesn't make sense if it's the same host as is accessed when run within
Eclipse. Use a network capture/analysis tool (such as Wireshark) to be sure.
--
Nigel Wade, System Administrator, Space Plasma Physics Group,
University of Leicester, Leicester, LE1 7RH, UK
E-mail : nmw@ion.le.ac.uk
Phone : +44 (0)116 2523548, Fax : +44 (0)116 2523555