Dear Nigel & subtenante,
I just called "java -jar myapp.jar", without giving the complete path to the
java interpreter binary file. After subtenantes posting I found out that
there is a java.exe located in c:\Windows\System32. This is different from
my JDK 1.5.0 and JRE 1.5.0. In eclipse there is only the JRE 1.5.0
installed.
So I tested PathTo\JRE1.5.0_07\bin\java and I was sure that it would work
now. But it did not! :-(
I also tested PathTo\JDK1.5.0_07\bin\java and
PathTo\JDK1.5.0_07\jre\bin\java (what's the difference?), but nothing
worked!
Within eclipse, the application works perfectly, i. e. it can send mail.
Here is the exception I receive when the application wants to send mail:
javax.mail.MessagingException: Could not connect to SMTP host:
post.mydomain.de, port: 25;
nested exception is:
java.net.SocketException: Software caused connection abort: connect
at
com.sun.mail.smtp.SMTPTransport.openServer(SMTPTransport.java:1282)
at
com.sun.mail.smtp.SMTPTransport.protocolConnect(SMTPTransport.java:370)
at javax.mail.Service.connect(Service.java:275)
at javax.mail.Service.connect(Service.java:156)
at javax.mail.Service.connect(Service.java:105)
at javax.mail.Transport.send0(Transport.java:168)
at javax.mail.Transport.send(Transport.java:98)
at utl.mail.Mailer.send(Mailer.java:66)
at utl.mail.Mailer.sendMail(Mailer.java:97)
at utl.mail.Mailer.sendMail(Mailer.java:116)
at pms.office.Monitor.report(Monitor.java:66)
at pms.office.Monitor.execute(Monitor.java:105)
at pms.Application.run_mon(Application.java:143)
at pms.Application.run(Application.java:155)
at pms.Application.main(Application.java:200)
Caused by: java.net.SocketException: Software caused connection abort:
connect
at java.net.PlainSocketImpl.socketConnect(Native Method)
at java.net.PlainSocketImpl.doConnect(PlainSocketImpl.java:333)
at
java.net.PlainSocketImpl.connectToAddress(PlainSocketImpl.java:195)
at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:182)
at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:366)
at java.net.Socket.connect(Socket.java:516)
at java.net.Socket.connect(Socket.java:466)
at
com.sun.mail.util.SocketFetcher.createSocket(SocketFetcher.java:232)
at com.sun.mail.util.SocketFetcher.getSocket(SocketFetcher.java:189)
at
com.sun.mail.smtp.SMTPTransport.openServer(SMTPTransport.java:1250)
... 14 more
I ist possible that JavaMail behaves differently within eclipse?
Are you absolutely sure that it is connecting to the host which you really
think it is?
Well, I used *one* host, which was hardcoded within the code, and the same
code works within eclipse and does not outside eclipse. My code
(utl.mail.Mailer.send) just calls JavaMail code. I cannot see what is
happening inside JavaMail. However, when I run the application (inside or
outside eclipse), is there a simple method to verify the network operations
that take place?
Thanks,
Magnus