You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@geronimo.apache.org by Geist Alexander <al...@gmx.com> on 2007/01/01 14:21:52 UTC

Re: Bug in geronimo-javamail_1.4_mail-1.0.jar?

Done.
https://issues.apache.org/jira/browse/GERONIMO-2679

I cant find the source for the mail implementation. Maybe i can fix this 
problem und build geronimo-javamail.jar to replace the buggy version.
Sorry, but im a nub in geronimo and its implementation.

A. Geist

>
> On Dec 29, 2006, at 9:05 PM, Geist Alexander wrote:
>
>> I am using the latest Geronimo release  2.0-M1. This release includes 
>> the geronimo-javamail_1.4_mail-1.0.jar.
>> .\geronimo-tomcat6-jee5-2.0-M1\repository\org\apache\geronimo\javamail\geronimo-javamail_1.4_mail\1.0\geronimo-javamail_1.4_mail-1.0.jar 
>>
>>
>> I was testing the sample code in my web-app and a standalone 
>> client-application. The result was the same Exception in both apps. I 
>> think there is a bug in the implementation. The vector has 2 items, 
>> the index to get the second item must be "1" not "2".
>>
>> The same sample code works with suns mail.jar, but i was not able to 
>> use this jar in my geronimo web application.*
>> *
>
> Geist,
> Apologies. I forgot how the javamail implementation was separated
>> from our specification.
>
> There's clearly a bug in the javamail implementation. Could you create 
> a jira?
>
> --kevan
>
>


Re: Bug in geronimo-javamail_1.4_mail-1.0.jar?

Posted by David Jencks <da...@yahoo.com>.
On Jan 1, 2007, at 9:33 AM, Rick McGuire wrote:

> Geist Alexander wrote:
>> Done.
>> https://issues.apache.org/jira/browse/GERONIMO-2679
>>
>> I cant find the source for the mail implementation. Maybe i can  
>> fix this problem und build geronimo-javamail.jar to replace the  
>> buggy version.
>> Sorry, but im a nub in geronimo and its implementation.
> I've fixed this in the latest trunk javamail code, located here:
>
> https://svn.apache.org/repos/asf/geronimo/javamail/trunk
>
> If you could build this and verify this actually fixes your  
> problem, that would be great.  Note that this codes builds the jars  
> using the 1.1-SNAPSHOT version ID, so you'll need to rename these  
> if you're dropping them into an Geronimo assembly as replacements.

Actually IMO if you have to change the version on the jar to use it  
that's another bug.  I thought we were NOT including versions in the  
geronimo dependencies so you could upgrade jars without rebuilding  
everything or lying about jar names.

thanks
david jencks

>
> Rick
>
>
>>
>> A. Geist
>>
>>>
>>> On Dec 29, 2006, at 9:05 PM, Geist Alexander wrote:
>>>
>>>> I am using the latest Geronimo release  2.0-M1. This release  
>>>> includes the geronimo-javamail_1.4_mail-1.0.jar.
>>>> .\geronimo-tomcat6-jee5-2.0-M1\repository\org\apache\geronimo 
>>>> \javamail\geronimo-javamail_1.4_mail\1.0\geronimo- 
>>>> javamail_1.4_mail-1.0.jar
>>>>
>>>> I was testing the sample code in my web-app and a standalone  
>>>> client-application. The result was the same Exception in both  
>>>> apps. I think there is a bug in the implementation. The vector  
>>>> has 2 items, the index to get the second item must be "1" not "2".
>>>>
>>>> The same sample code works with suns mail.jar, but i was not  
>>>> able to use this jar in my geronimo web application.*
>>>> *
>>>
>>> Geist,
>>> Apologies. I forgot how the javamail implementation was separated
>>>> from our specification.
>>>
>>> There's clearly a bug in the javamail implementation. Could you  
>>> create a jira?
>>>
>>> --kevan
>>>
>>>
>>
>>
>


Re: Bug in geronimo-javamail_1.4_mail-1.0.jar?

Posted by Rick McGuire <ri...@gmail.com>.
Geist Alexander wrote:
> Sending a message doesnt work too.
>
>        // Get system properties
>        Properties props = System.getProperties();
>
>        // Setup mail server
>        props.put("mail.smtp.host", Settings.smtpServer);
>        props.put("mail.imap.partialfetch", "false");
>        props.put("mail.smtp.auth", "true");
>
>        Authenticator auth = new Authenticator()
>        {
>            protected PasswordAuthentication getPasswordAuthentication()
>            {
>                return new PasswordAuthentication(Settings.user, 
> Settings.key);
>            }
>        };
>              return Session.getDefaultInstance(props, auth);
>
> The method was used to get the session. It works.
> Next step is to build and to send the message.
>
>        // Define message
>        MimeMessage message = new MimeMessage(mailParam.getSession());
>
>        // Set the from address
>        message.setFrom(new InternetAddress(Settings.from));
>
>        // Empfänger
>        message.addRecipient(Message.RecipientType.TO, new 
> InternetAddress(mailParam.getMailAddress()));
>
>        // Set the subject
>        message.setSubject("XMG Keys");
>
>        BodyPart messageBodyPart = new MimeBodyPart();
>              String text = 
> getEmailText(mailParam.getXmgKey(),mailParam.getXlgKey(), 
> mailParam.getDate());
>              messageBodyPart.setContent(text, "text/html");
>              Multipart multipart = new MimeMultipart();
>        multipart.addBodyPart(messageBodyPart);
>
>        // Put parts in message
>        message.setContent(multipart);
>
>        // Send message
>        Transport.send(message);
>
> Transport.send(message) is throwing this Exception
>
> javax.mail.SendFailedException: Send failure 
> (javax.mail.MessagingException: Connection error 
> (java.net.ConnectException: Connection refused: connect))
>    at javax.mail.Transport.send(Transport.java:163)
>    at javax.mail.Transport.send(Transport.java:48)
>    at keygen.main.MailSender.sendMail(MailSender.java:44)
>    at keygen.main.MailSender.main(MailSender.java:112)
> Caused by: javax.mail.MessagingException: Connection error 
> (java.net.ConnectException: Connection refused: connect)
>    at 
> org.apache.geronimo.javamail.transport.smtp.SMTPTransport.protocolConnect(SMTPTransport.java:403) 
>
>    at javax.mail.Service.connect(Service.java:254)
>    at javax.mail.Service.connect(Service.java:85)
>    at javax.mail.Service.connect(Service.java:70)
>    at javax.mail.Transport.send(Transport.java:94)
>    ... 3 more
> Caused by: java.net.ConnectException: Connection refused: 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:519)
>    at java.net.Socket.connect(Socket.java:469)
>    at java.net.Socket.<init>(Socket.java:366)
>    at java.net.Socket.<init>(Socket.java:239)
>    at 
> org.apache.geronimo.javamail.transport.smtp.SMTPTransport.getConnectedSocket(SMTPTransport.java:1091) 
>
>    at 
> org.apache.geronimo.javamail.transport.smtp.SMTPTransport.getConnection(SMTPTransport.java:851) 
>
>    at 
> org.apache.geronimo.javamail.transport.smtp.SMTPTransport.protocolConnect(SMTPTransport.java:380) 
>
>    ... 7 more
>
> There is also a problem in the connect(String server, String user, 
> String pass) - method of the class javax.mail.Store. Calling it, the 
> default-port -1 will be used.
Please open Jira issues for each of the problems you find.  This allows 
us to keep track of what needs to be fixed and also allows others to see 
the problems and potentially contribute fixes.

Rick

>
>
>
> Rick McGuire schrieb:
>> Geist Alexander wrote:
>>> Done.
>>> https://issues.apache.org/jira/browse/GERONIMO-2679
>>>
>>> I cant find the source for the mail implementation. Maybe i can fix 
>>> this problem und build geronimo-javamail.jar to replace the buggy 
>>> version.
>>> Sorry, but im a nub in geronimo and its implementation.
>> I've fixed this in the latest trunk javamail code, located here:
>>
>> https://svn.apache.org/repos/asf/geronimo/javamail/trunk
>>
>> If you could build this and verify this actually fixes your problem, 
>> that would be great.  Note that this codes builds the jars using the 
>> 1.1-SNAPSHOT version ID, so you'll need to rename these if you're 
>> dropping them into an Geronimo assembly as replacements.
>>
>> Rick
>>
>>
>>>
>>> A. Geist
>>>
>>>>
>>>> On Dec 29, 2006, at 9:05 PM, Geist Alexander wrote:
>>>>
>>>>> I am using the latest Geronimo release  2.0-M1. This release 
>>>>> includes the geronimo-javamail_1.4_mail-1.0.jar.
>>>>> .\geronimo-tomcat6-jee5-2.0-M1\repository\org\apache\geronimo\javamail\geronimo-javamail_1.4_mail\1.0\geronimo-javamail_1.4_mail-1.0.jar 
>>>>>
>>>>>
>>>>> I was testing the sample code in my web-app and a standalone 
>>>>> client-application. The result was the same Exception in both 
>>>>> apps. I think there is a bug in the implementation. The vector has 
>>>>> 2 items, the index to get the second item must be "1" not "2".
>>>>>
>>>>> The same sample code works with suns mail.jar, but i was not able 
>>>>> to use this jar in my geronimo web application.*
>>>>> *
>>>>
>>>> Geist,
>>>> Apologies. I forgot how the javamail implementation was separated
>>>>> from our specification.
>>>>
>>>> There's clearly a bug in the javamail implementation. Could you 
>>>> create a jira?
>>>>
>>>> --kevan
>>>>
>>>>
>>>
>>>
>>
>
>


Re: Bug in geronimo-javamail_1.4_mail-1.0.jar?

Posted by Geist Alexander <al...@gmx.com>.
Sending a message doesnt work too.

        // Get system properties
        Properties props = System.getProperties();

        // Setup mail server
        props.put("mail.smtp.host", Settings.smtpServer);
        props.put("mail.imap.partialfetch", "false");
        props.put("mail.smtp.auth", "true");

        Authenticator auth = new Authenticator()
        {
            protected PasswordAuthentication getPasswordAuthentication()
            {
                return new PasswordAuthentication(Settings.user, 
Settings.key);
            }
        };
       
        return Session.getDefaultInstance(props, auth);

The method was used to get the session. It works.
Next step is to build and to send the message.

        // Define message
        MimeMessage message = new MimeMessage(mailParam.getSession());

        // Set the from address
        message.setFrom(new InternetAddress(Settings.from));

        // Empfänger
        message.addRecipient(Message.RecipientType.TO, new 
InternetAddress(mailParam.getMailAddress()));

        // Set the subject
        message.setSubject("XMG Keys");

        BodyPart messageBodyPart = new MimeBodyPart();
       
        String text = 
getEmailText(mailParam.getXmgKey(),mailParam.getXlgKey(), 
mailParam.getDate());
       
        messageBodyPart.setContent(text, "text/html");
       
        Multipart multipart = new MimeMultipart();
        multipart.addBodyPart(messageBodyPart);

        // Put parts in message
        message.setContent(multipart);

        // Send message
        Transport.send(message);

Transport.send(message) is throwing this Exception

javax.mail.SendFailedException: Send failure 
(javax.mail.MessagingException: Connection error 
(java.net.ConnectException: Connection refused: connect))
    at javax.mail.Transport.send(Transport.java:163)
    at javax.mail.Transport.send(Transport.java:48)
    at keygen.main.MailSender.sendMail(MailSender.java:44)
    at keygen.main.MailSender.main(MailSender.java:112)
Caused by: javax.mail.MessagingException: Connection error 
(java.net.ConnectException: Connection refused: connect)
    at 
org.apache.geronimo.javamail.transport.smtp.SMTPTransport.protocolConnect(SMTPTransport.java:403)
    at javax.mail.Service.connect(Service.java:254)
    at javax.mail.Service.connect(Service.java:85)
    at javax.mail.Service.connect(Service.java:70)
    at javax.mail.Transport.send(Transport.java:94)
    ... 3 more
Caused by: java.net.ConnectException: Connection refused: 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:519)
    at java.net.Socket.connect(Socket.java:469)
    at java.net.Socket.<init>(Socket.java:366)
    at java.net.Socket.<init>(Socket.java:239)
    at 
org.apache.geronimo.javamail.transport.smtp.SMTPTransport.getConnectedSocket(SMTPTransport.java:1091)
    at 
org.apache.geronimo.javamail.transport.smtp.SMTPTransport.getConnection(SMTPTransport.java:851)
    at 
org.apache.geronimo.javamail.transport.smtp.SMTPTransport.protocolConnect(SMTPTransport.java:380)
    ... 7 more

There is also a problem in the connect(String server, String user, 
String pass) - method of the class javax.mail.Store. Calling it, the 
default-port -1 will be used.



Rick McGuire schrieb:
> Geist Alexander wrote:
>> Done.
>> https://issues.apache.org/jira/browse/GERONIMO-2679
>>
>> I cant find the source for the mail implementation. Maybe i can fix 
>> this problem und build geronimo-javamail.jar to replace the buggy 
>> version.
>> Sorry, but im a nub in geronimo and its implementation.
> I've fixed this in the latest trunk javamail code, located here:
>
> https://svn.apache.org/repos/asf/geronimo/javamail/trunk
>
> If you could build this and verify this actually fixes your problem, 
> that would be great.  Note that this codes builds the jars using the 
> 1.1-SNAPSHOT version ID, so you'll need to rename these if you're 
> dropping them into an Geronimo assembly as replacements.
>
> Rick
>
>
>>
>> A. Geist
>>
>>>
>>> On Dec 29, 2006, at 9:05 PM, Geist Alexander wrote:
>>>
>>>> I am using the latest Geronimo release  2.0-M1. This release 
>>>> includes the geronimo-javamail_1.4_mail-1.0.jar.
>>>> .\geronimo-tomcat6-jee5-2.0-M1\repository\org\apache\geronimo\javamail\geronimo-javamail_1.4_mail\1.0\geronimo-javamail_1.4_mail-1.0.jar 
>>>>
>>>>
>>>> I was testing the sample code in my web-app and a standalone 
>>>> client-application. The result was the same Exception in both apps. 
>>>> I think there is a bug in the implementation. The vector has 2 
>>>> items, the index to get the second item must be "1" not "2".
>>>>
>>>> The same sample code works with suns mail.jar, but i was not able 
>>>> to use this jar in my geronimo web application.*
>>>> *
>>>
>>> Geist,
>>> Apologies. I forgot how the javamail implementation was separated
>>>> from our specification.
>>>
>>> There's clearly a bug in the javamail implementation. Could you 
>>> create a jira?
>>>
>>> --kevan
>>>
>>>
>>
>>
>


Re: Bug in geronimo-javamail_1.4_mail-1.0.jar?

Posted by Jason Warner <ja...@gmail.com>.
I've started to take a look at this issue but I am having trouble
reproducing the problem. I ran the code you placed in there with
modifications to only pull a couple of messages from my gmail account. It
didn't have any problems pulling them off there and then displaying them.
Have you verified that the messages were succesfully received before
attempting to read them?

On 1/1/07, Geist Alexander <al...@gmx.com> wrote:
>
> With your fix i was able to read the Messages in the Message[] Array.
> Unfortunately i found a next bug(?). This exception returns, when i am
> reading the content of a message.
>
> java.io.IOException: Underlying input stream returned zero bytes
>     at sun.nio.cs.StreamDecoder.readBytes(StreamDecoder.java:268)
>     at sun.nio.cs.StreamDecoder.implRead(StreamDecoder.java:306)
>     at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:158)
>     at sun.nio.cs.StreamDecoder.read0(StreamDecoder.java:107)
>     at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:93)
>     at java.io.InputStreamReader.read(InputStreamReader.java:151)
>     at
> org.apache.geronimo.mail.handlers.TextHandler.getContent(TextHandler.java
> :107)
>     at
> javax.activation.DataSourceDataContentHandler.getContent(DataHandler.java
> :774)
>     at javax.activation.DataHandler.getContent(DataHandler.java:521)
>     at javax.mail.internet.MimeMessage.getContent(MimeMessage.java:923)
>     at keygen.main.MailReceiver.receive(MailReceiver.java:49)
>     at keygen.main.MailReceiver.main(MailReceiver.java:173)
>
> Same code works with Suns mail.jar
>
> Alex
>
>
> Rick McGuire schrieb:
> > Geist Alexander wrote:
> >> Done.
> >> https://issues.apache.org/jira/browse/GERONIMO-2679
> >>
> >> I cant find the source for the mail implementation. Maybe i can fix
> >> this problem und build geronimo-javamail.jar to replace the buggy
> >> version.
> >> Sorry, but im a nub in geronimo and its implementation.
> > I've fixed this in the latest trunk javamail code, located here:
> >
> > https://svn.apache.org/repos/asf/geronimo/javamail/trunk
> >
> > If you could build this and verify this actually fixes your problem,
> > that would be great.  Note that this codes builds the jars using the
> > 1.1-SNAPSHOT version ID, so you'll need to rename these if you're
> > dropping them into an Geronimo assembly as replacements.
> >
> > Rick
> >
> >
> >>
> >> A. Geist
> >>
> >>>
> >>> On Dec 29, 2006, at 9:05 PM, Geist Alexander wrote:
> >>>
> >>>> I am using the latest Geronimo release  2.0-M1. This release
> >>>> includes the geronimo-javamail_1.4_mail-1.0.jar.
> >>>> .\geronimo-
> tomcat6-jee5-2.0-M1\repository\org\apache\geronimo\javamail\geronimo-javamail_1.4_mail\1.0\geronimo-javamail_1.4_mail-1.0.jar
> >>>>
> >>>>
> >>>> I was testing the sample code in my web-app and a standalone
> >>>> client-application. The result was the same Exception in both apps.
> >>>> I think there is a bug in the implementation. The vector has 2
> >>>> items, the index to get the second item must be "1" not "2".
> >>>>
> >>>> The same sample code works with suns mail.jar, but i was not able
> >>>> to use this jar in my geronimo web application.*
> >>>> *
> >>>
> >>> Geist,
> >>> Apologies. I forgot how the javamail implementation was separated
> >>>> from our specification.
> >>>
> >>> There's clearly a bug in the javamail implementation. Could you
> >>> create a jira?
> >>>
> >>> --kevan
> >>>
> >>>
> >>
> >>
> >
>
>

Re: Bug in geronimo-javamail_1.4_mail-1.0.jar?

Posted by Geist Alexander <al...@gmx.com>.
With your fix i was able to read the Messages in the Message[] Array.
Unfortunately i found a next bug(?). This exception returns, when i am 
reading the content of a message.

java.io.IOException: Underlying input stream returned zero bytes
    at sun.nio.cs.StreamDecoder.readBytes(StreamDecoder.java:268)
    at sun.nio.cs.StreamDecoder.implRead(StreamDecoder.java:306)
    at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:158)
    at sun.nio.cs.StreamDecoder.read0(StreamDecoder.java:107)
    at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:93)
    at java.io.InputStreamReader.read(InputStreamReader.java:151)
    at 
org.apache.geronimo.mail.handlers.TextHandler.getContent(TextHandler.java:107)
    at 
javax.activation.DataSourceDataContentHandler.getContent(DataHandler.java:774)
    at javax.activation.DataHandler.getContent(DataHandler.java:521)
    at javax.mail.internet.MimeMessage.getContent(MimeMessage.java:923)
    at keygen.main.MailReceiver.receive(MailReceiver.java:49)
    at keygen.main.MailReceiver.main(MailReceiver.java:173)

Same code works with Suns mail.jar

Alex


Rick McGuire schrieb:
> Geist Alexander wrote:
>> Done.
>> https://issues.apache.org/jira/browse/GERONIMO-2679
>>
>> I cant find the source for the mail implementation. Maybe i can fix 
>> this problem und build geronimo-javamail.jar to replace the buggy 
>> version.
>> Sorry, but im a nub in geronimo and its implementation.
> I've fixed this in the latest trunk javamail code, located here:
>
> https://svn.apache.org/repos/asf/geronimo/javamail/trunk
>
> If you could build this and verify this actually fixes your problem, 
> that would be great.  Note that this codes builds the jars using the 
> 1.1-SNAPSHOT version ID, so you'll need to rename these if you're 
> dropping them into an Geronimo assembly as replacements.
>
> Rick
>
>
>>
>> A. Geist
>>
>>>
>>> On Dec 29, 2006, at 9:05 PM, Geist Alexander wrote:
>>>
>>>> I am using the latest Geronimo release  2.0-M1. This release 
>>>> includes the geronimo-javamail_1.4_mail-1.0.jar.
>>>> .\geronimo-tomcat6-jee5-2.0-M1\repository\org\apache\geronimo\javamail\geronimo-javamail_1.4_mail\1.0\geronimo-javamail_1.4_mail-1.0.jar 
>>>>
>>>>
>>>> I was testing the sample code in my web-app and a standalone 
>>>> client-application. The result was the same Exception in both apps. 
>>>> I think there is a bug in the implementation. The vector has 2 
>>>> items, the index to get the second item must be "1" not "2".
>>>>
>>>> The same sample code works with suns mail.jar, but i was not able 
>>>> to use this jar in my geronimo web application.*
>>>> *
>>>
>>> Geist,
>>> Apologies. I forgot how the javamail implementation was separated
>>>> from our specification.
>>>
>>> There's clearly a bug in the javamail implementation. Could you 
>>> create a jira?
>>>
>>> --kevan
>>>
>>>
>>
>>
>


Re: Bug in geronimo-javamail_1.4_mail-1.0.jar?

Posted by Rick McGuire <ri...@gmail.com>.
Geist Alexander wrote:
> Done.
> https://issues.apache.org/jira/browse/GERONIMO-2679
>
> I cant find the source for the mail implementation. Maybe i can fix 
> this problem und build geronimo-javamail.jar to replace the buggy 
> version.
> Sorry, but im a nub in geronimo and its implementation.
I've fixed this in the latest trunk javamail code, located here:

https://svn.apache.org/repos/asf/geronimo/javamail/trunk

If you could build this and verify this actually fixes your problem, 
that would be great.  Note that this codes builds the jars using the 
1.1-SNAPSHOT version ID, so you'll need to rename these if you're 
dropping them into an Geronimo assembly as replacements.

Rick


>
> A. Geist
>
>>
>> On Dec 29, 2006, at 9:05 PM, Geist Alexander wrote:
>>
>>> I am using the latest Geronimo release  2.0-M1. This release 
>>> includes the geronimo-javamail_1.4_mail-1.0.jar.
>>> .\geronimo-tomcat6-jee5-2.0-M1\repository\org\apache\geronimo\javamail\geronimo-javamail_1.4_mail\1.0\geronimo-javamail_1.4_mail-1.0.jar 
>>>
>>>
>>> I was testing the sample code in my web-app and a standalone 
>>> client-application. The result was the same Exception in both apps. 
>>> I think there is a bug in the implementation. The vector has 2 
>>> items, the index to get the second item must be "1" not "2".
>>>
>>> The same sample code works with suns mail.jar, but i was not able to 
>>> use this jar in my geronimo web application.*
>>> *
>>
>> Geist,
>> Apologies. I forgot how the javamail implementation was separated
>>> from our specification.
>>
>> There's clearly a bug in the javamail implementation. Could you 
>> create a jira?
>>
>> --kevan
>>
>>
>
>