Hi all,

I've tracked down a solution but I'm not sure I fully understand what was 
happening...basically the problem was that the httpRequest.getServerPort() 
method was returning port 0.
This meant that my URL referenced attachment was not being found on the 
server and javamail was throwing errors!

I fixed this by using a VirtualHost in my httpd.conf file with an explicit 
:80 port specified in the VirtualHost directive. getServerPort() now 
returns '80' correctly in the app.
Prior to using VirtualHosts I was using the following mounts to pass 
control from Apache to Tomcat :
JkMount /myApp/*.jsp ajp13
JkMount /myApp/* ajp13

For some reason these do not pass on the default port 80...does anyone know why 
as the equivalent mount in mod_jServ did!

Joe


______________________________ Reply Separator _________________________________
Subject: java.net.BindException in JavaMail with mod_jk.dll 
Author:  <[EMAIL PROTECTED]> at STSINT
Date:    06/08/01 09:50


     Hi,
     
     I've recently switched from using mod_jserv.dll to mod_jk.dll, 
     primarily to improve the SSL support in my Apache / Tomcat setup. 
     Unfortunately, the section of my web app that uses JavaMail is now 
     failing when I try to send an attachment, (located in the Tomcat web 
     app root), with the mail. It's ok with a straight-forward mail.
     
     I guess it's something to do with Tomcat accessing the document to 
     attach it to the mail, but it works fine when I switch back to 
     mod_jserv and I'm not sure how this would even be involved in an 
     operation that's being done in tomcats JVM...
     
     Cheers in advance,
     Joe Berry
     
     
     p.s. I'm using Apache 1.3.14 on Windows NT (yes, I know...), with 
     Tomcat 3.2.1, although the same thing happens on 3.2.3.
     
     
     
     It's failing with this message : 
     DEBUG SMTP RCVD: 354 Start mail input; end with <CRLF>.<CRLF>
     
     java.net.BindException: Cannot assign requested address: no further 
     information
             at java.net.PlainSocketImpl.socketConnect(Native Method) 
             at 
     java.net.PlainSocketImpl.doConnect(PlainSocketImpl.java:312)
             at 
     java.net.PlainSocketImpl.connectToAddress(PlainSocketImpl.java:125)
             at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:112) 
             at java.net.Socket.<init>(Socket.java:273)
             at java.net.Socket.<init>(Socket.java:100)
             at sun.net.NetworkClient.doConnect(NetworkClient.java:50)
             at sun.net.www.http.HttpClient.openServer(HttpClient.java:331) 
             at sun.net.www.http.HttpClient.openServer(HttpClient.java:517) 
             at sun.net.www.http.HttpClient.<init>(HttpClient.java:267)
             at sun.net.www.http.HttpClient.<init>(HttpClient.java:277) 
             at sun.net.www.http.HttpClient.New(HttpClient.java:289)
             at 
     sun.net.www.protocol.http.HttpURLConnection.connect(HttpURLConnection. 
     java:379)
             at 
     sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConn 
     ection.java:472)
             at java.net.URL.openStream(URL.java:798) 
             at 
     javax.activation.URLDataSource.getInputStream(URLDataSource.java:100)
             at javax.activation.DataHandler.writeTo(DataHandler.java:297) 
             at 
     javax.mail.internet.MimeBodyPart.writeTo(MimeBodyPart.java:1089)
             at 
     javax.mail.internet.MimeBodyPart.writeTo(MimeBodyPart.java:635)
             at 
     javax.mail.internet.MimeMultipart.writeTo(MimeMultipart.java:233)
             at 
     com.sun.mail.handlers.multipart_mixed.writeTo(multipart_mixed.java:68)
             at 
     javax.activation.ObjectDataContentHandler.writeTo(DataHandler.java:849 
     )
             at javax.activation.DataHandler.writeTo(DataHandler.java:305) 
             at 
     javax.mail.internet.MimeBodyPart.writeTo(MimeBodyPart.java:1089)
             at 
     javax.mail.internet.MimeMessage.writeTo(MimeMessage.java:1527)
             at 
     com.sun.mail.smtp.SMTPTransport.sendMessage(SMTPTransport.java:321)
             at javax.mail.Transport.send0(Transport.java:164) 
             at javax.mail.Transport.send(Transport.java:81)
             at com.stsjava.ws.util.SendEmail.send(SendEmail.java:285) 
             at com.stsjava.ws.util.SendEmail.send(SendEmail.java:202) 
             at 
     com.stsjava.storms.ca.webhelpers.mail.MailAttachmentHelper.sendMessage 
     WithAttachment(Mail
     AttachmentHelper.java:139)
             at 
     com.stsjava.storms.ca.webhelpers.mail.MailAttachmentHelper.perform(Mai 
     lAttachmentHelper.j
     ava:85)
             at 
     com.stsjava.storms.ca.actions.mail.MailJobDetailsAction.perform(MailJo 
     bDetailsAction.java
     :63)
             at 
     com.stsjava.storms.ca.control.Controller.performAction(Controller.java 
     :219)
             at 
     com.stsjava.storms.ca.control.Controller.handleRequest(Controller.java 
     :166)
             at 
     com.stsjava.storms.ca.web.EmailServlet.handleRequest(EmailServlet.java 
     :64)
             at 
     com.stsjava.storms.ca.control.Controller.doPost(Controller.java:116)
             at 
     javax.servlet.http.HttpServlet.service(HttpServlet.java:760)
             at 
     javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
             at 
     org.apache.tomcat.core.ServletWrapper.doService(ServletWrapper.java:40 
     4)
             at org.apache.tomcat.core.Handler.service(Handler.java:286) 
             at 
     org.apache.tomcat.core.ServletWrapper.service(ServletWrapper.java:372)
             at 
     org.apache.tomcat.core.ContextManager.internalService(ContextManager.j 
     ava:797)
             at 
     org.apache.tomcat.core.ContextManager.service(ContextManager.java:743)
             at 
     org.apache.tomcat.service.connector.Ajp13ConnectionHandler.processConn 
     ection(Ajp13Connect
     ionHandler.java:160)
             at 
     org.apache.tomcat.service.TcpWorkerThread.runIt(PoolTcpEndpoint.java:4 
     16)
             at 
     org.apache.tomcat.util.ThreadPool$ControlRunnable.run(ThreadPool.java: 
     498)
             at java.lang.Thread.run(Thread.java:484)
     javax.mail.SendFailedException: Sending failed;
       nested exception is:
             javax.mail.MessagingException: IOException while sending 
     message;
       nested exception is:
             java.net.BindException: Cannot assign requested address: no 
     further information
             at javax.mail.Transport.send0(Transport.java:219) 
             at javax.mail.Transport.send(Transport.java:81)
             at com.stsjava.ws.util.SendEmail.send(SendEmail.java:285) 
             at com.stsjava.ws.util.SendEmail.send(SendEmail.java:202) 
             at 
     com.stsjava.storms.ca.webhelpers.mail.MailAttachmentHelper.sendMessage 
     WithAttachment(Mail
     AttachmentHelper.java:139)
             at 
     com.stsjava.storms.ca.webhelpers.mail.MailAttachmentHelper.perform(Mai 
     lAttachmentHelper.j
     ava:85)
             at 
     com.stsjava.storms.ca.actions.mail.MailJobDetailsAction.perform(MailJo 
     bDetailsAction.java
     :63)
             at 
     com.stsjava.storms.ca.control.Controller.performAction(Controller.java 
     :219)
             at 
     com.stsjava.storms.ca.control.Controller.handleRequest(Controller.java 
     :166)
             at 
     com.stsjava.storms.ca.web.EmailServlet.handleRequest(EmailServlet.java 
     :64)
             at 
     com.stsjava.storms.ca.control.Controller.doPost(Controller.java:116)
             at 
     javax.servlet.http.HttpServlet.service(HttpServlet.java:760)
             at 
     javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
             at 
     org.apache.tomcat.core.ServletWrapper.doService(ServletWrapper.java:40 
     4)
             at org.apache.tomcat.core.Handler.service(Handler.java:286) 
             at 
     org.apache.tomcat.core.ServletWrapper.service(ServletWrapper.java:372)
             at 
     org.apache.tomcat.core.ContextManager.internalService(ContextManager.j 
     ava:797)
             at 
     org.apache.tomcat.core.ContextManager.service(ContextManager.java:743)
             at 
     org.apache.tomcat.service.connector.Ajp13ConnectionHandler.processConn 
     ection(Ajp13Connect
     ionHandler.java:160)
             at 
     org.apache.tomcat.service.TcpWorkerThread.runIt(PoolTcpEndpoint.java:4 
     16)
             at 
     org.apache.tomcat.util.ThreadPool$ControlRunnable.run(ThreadPool.java: 
     498)
             at java.lang.Thread.run(Thread.java:484)
     2001-08-06 09:20:03 - Messaging Exception: Sending failed;
       nested exception is:
             javax.mail.MessagingException: IOException while sending 
     message;
       nested exception is:
             java.net.BindException: Cannot assign requested address: no 
     further information
     2001-08-06 09:20:03 -  SendFailedException occurred in SendEmail 
     Sending failed;
       nested exception is:
             javax.mail.MessagingException: IOException while sending 
     message;
       nested exception is:
             java.net.BindException: Cannot assign requested address: no 
     further information
     2001-08-06 09:20:03 - SendEmailException caught in MailAction Unable 
     to send email. An error occured
      whilst attempting to send mail.
     
     
     
*********************************************************************** 
This message has been sent via the Internet. Internet communications 
are not secure against interception or modification. Severn Trent 
Systems therefore can not guarantee that this message has not been 
modified in transit, and this message should not be viewed as 
contractually binding.
     
This message and any files transmitted with it are confidential and 
intended solely for the use of the addressee. If you have received 
this message in error please notify the sender and destroy your 
copies of the message and any attached files. 
*********************************************************************** 
Severn Trent Systems Ltd : a part of Severn Trent plc. 
Registered in England and Wales Registration No. 2394552
     

Reply via email to