james-server-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Idea Harness (JIRA)" <server-...@james.apache.org>
Subject [jira] [Commented] (JAMES-1431) Geronimo JavaMail implementation throws exception when opening content of an image attachment
Date Tue, 14 Aug 2012 15:38:38 GMT

    [ https://issues.apache.org/jira/browse/JAMES-1431?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13434200#comment-13434200
] 

Idea Harness commented on JAMES-1431:
-------------------------------------

Eric,

I initially grabbed geronimo-javamail_1.4_mail-1.8.1.jar from http://www.jarvana.com/jarvana/archive-details/org/apache/geronimo/javamail/geronimo-javamail_1.4_mail/1.8.1/geronimo-javamail_1.4_mail-1.8.1.jar.
However, it was
released ((ie. Jun 11, 2010) before the fix was made to https://issues.apache.org/jira/browse/GERONIMO-5415
(ie. June 30, 2010). Hence, instead I grabbed the most recent release, which is geronimo-javamail_1.4_mail-1.8.3.jar
(released on Jul 21, 2011).

I tested with geronimo-javamail_1.4_mail-1.8.3.jar (added it to JAMES/conf/wrapper.conf and
JAMES/lib) and without Oracle's mail-1.4.4.jar (in JAMES/conf/wrapper.conf and deleted it
from JAMES/lib) and my test works 
without the exception. Pertinent sections of my JAMES/conf/wrapper.conf look like this :

...
#original
#       wrapper.java.classpath.10=%REPO_DIR%/mail-1.4.4.jar
#but I want to check with geronimo-javamail_1.4_mail-1.8.3.jar and without mail-1.4.4.jar
wrapper.java.classpath.10=%REPO_DIR%/geronimo-javamail_1.4_mail-1.8.3.jar
...
#original
#       wrapper.java.classpath.88=%REPO_DIR%/geronimo-javamail_1.4_mail-1.6.jar
#Should really remove this line (and decrement all classpath arg counts after this line) but
rather than doing this just use geronimo-javamail_1.4_mail-1.8.3.jar again which was
#already used as argument 10 earlier in this file
wrapper.java.classpath.88=%REPO_DIR%/geronimo-javamail_1.4_mail-1.8.3.jar
...

in general these are the steps to use geronimo JavaMail implementation instead of the Oracle
JavaMail implementation (if you really think that this what should be done):

1. add geronimo-javamail_1.4_mail-1.8.3.jar (attached; you can grab it from another Maven
repo, etc.) to JAMES/lib and add line 
   wrapper.java.classpath.10=%REPO_DIR%/geronimo-javamail_1.4_mail-1.8.3.jar 
in JAMES/conf/wrapper.conf
2. delete line wrapper.java.classpath.88 within JAMES/conf/wrapper.conf 
   wrapper.java.classpath.88=%REPO_DIR%/geronimo-javamail_1.4_mail-1.6.jar
and decrement all classpath arg counts after this line within JAMES/conf/wrapper.conf.
3. delete mail-1.4.4.jar from JAMES/lib
4. delete geronimo-javamail_1.4_mail-1.6.jar from JAMES/lib

Before completely switching from Oracle JavaMail to geronimo JavaMail, though, I'd advice
running Apache James's full unit / regression tests to confirm that there are no dependencies
on Oracle JavaMail and that everything still works correctly. Also, if this is the route to
go, then developers need to be aware of this so that they look up geronimo JavaMail API javadocs
(which by the way suck -- it appears that only geronimo JavaMail 1.4 Mail 1.6 release Java
Docs are available (http://geronimo.apache.org/maven/specs/geronimo-javamail_1.4_spec/1.6/apidocs/javax/mail/internet/MimeMessage.html)
and it is very SLOW to load and no Java Docs are available for geronimo JavaMail 1.4 Mail
1.8 release), etc. rather than Oracle JavaMail's.
                
> Geronimo JavaMail implementation throws exception when opening content of an image attachment
> ---------------------------------------------------------------------------------------------
>
>                 Key: JAMES-1431
>                 URL: https://issues.apache.org/jira/browse/JAMES-1431
>             Project: JAMES Server
>          Issue Type: Bug
>          Components: Deployment Modules, James Core
>    Affects Versions: 3.0-beta4
>         Environment: Linux Fedora 14
>            Reporter: Idea Harness
>         Attachments: arrow_down_8x8.png, BodyPartExtractingMailet.java, btnbg_over.jpg,
up_15x15.gif
>
>
> When image files (Content-Type: image/gif, image/jpeg, image/jpg) are attached to emails
and 
> Apache James 3.0 Beta4 serves as an MTA I am getting these exceptions on MimeBodyPart.getContent()
calls below (while processing the mail within the attached 
> test.mailet.BodyPartExtractingMailet mailet). This is due to the fact that as of Apache
James Beta4
> it ships with Geronimo JavaMail implementation (geronimo-javamail_1.4_mail-1.6.jar) that
is the cause
> of this exception (with Apache James Beta3 Oracle JavaMail implementation (mail-1.4.4.jar)
handled
> this correctly without exceptions).
> Precise steps to reproduce :
> 1. Deploy the attached test.mailet.BodyPartExtractingMailet to run within Apache James
Beta4
>    a. package it as a jar and put it under JAMES/lib
>    b. add <mailet match="All" class="test.mailet.BodyPartExtractingMailet"/> to

>    JAMES/conf/mailetcontainer.conf
>    c. add log4j.logger.test.mailet.BodyPartExtractingMailet=DEBUG, CONS, FILE to
>    JAMES/conf/log4j.properties
>    d. (re-) start James, tailing -f either JAMES/log/mailetcontainer.log or JAMES/bin/wrapper.log
> 2. Using your favorite email client send an email to yourself (with Apache James processing

> your email) containing attachments with MimeTypes image/jpeg, image/jpg and image/gif

> (surprisingly enough image/png is handled without an exception). You can use attached
> btnbg_over.jpg and up_15x15.gif.
> 3. Observe these exceptions in the log file 
> spooler-1 | INFO  | 11:51:14,807 08/13/2012 | mailetcontext | service() start
> spooler-1 | INFO  | 11:51:14,866 08/13/2012 | mailetcontext | BodyPart with an image
MimeType [image/gif;
>  name="up_15x15.gif"] found, BEFORE calling getContent() on it.
> spooler-1 | INFO  | 11:51:14,940 08/13/2012 | mailetcontext | Exception is thrown during
MimeBodyPart.getContent() call
> javax.activation.UnsupportedDataTypeException: Unknown image type image/gif;
>  name="up_15x15.gif"
> 	at org.apache.geronimo.javamail.handlers.AbstractImageHandler.getContent(AbstractImageHandler.java:57)
> 	at javax.activation.DataSourceDataContentHandler.getContent(DataHandler.java:790)
> 	at javax.activation.DataHandler.getContent(DataHandler.java:537)
> 	at javax.mail.internet.MimeBodyPart.getContent(MimeBodyPart.java:637)
> 	at test.mailet.BodyPartExtractingMailet.service(BodyPartExtractingMailet.java:51)
> 	at org.apache.james.mailetcontainer.impl.camel.CamelProcessor.process(CamelProcessor.java:65)
>   ...
> spooler-1 | INFO  | 11:51:14,945 08/13/2012 | mailetcontext | BodyPart with an image
MimeType [image/png;
>  name="arrow_down_8x8.png"] found, BEFORE calling getContent() on it.
> spooler-1 | INFO  | 11:51:14,961 08/13/2012 | mailetcontext | BodyPart with an image
MimeType found, AFTER calling getContent() on it.
> spooler-1 | INFO  | 11:51:14,961 08/13/2012 | mailetcontext | BodyPart with an image
MimeType [image/jpeg;
>  name="btnbg_over.jpg"] found, BEFORE calling getContent() on it.
> spooler-1 | INFO  | 11:51:14,962 08/13/2012 | mailetcontext | Exception is thrown during
MimeBodyPart.getContent() call
> javax.activation.UnsupportedDataTypeException: Unknown image type image/jpeg;
>  name="btnbg_over.jpg"
> 	at org.apache.geronimo.javamail.handlers.AbstractImageHandler.getContent(AbstractImageHandler.java:57)
> 	at javax.activation.DataSourceDataContentHandler.getContent(DataHandler.java:790)
> 	at javax.activation.DataHandler.getContent(DataHandler.java:537)
> 	at javax.mail.internet.MimeBodyPart.getContent(MimeBodyPart.java:637)
> 	at test.mailet.BodyPartExtractingMailet.service(BodyPartExtractingMailet.java:51)
> 	at org.apache.james.mailetcontainer.impl.camel.CamelProcessor.process(CamelProcessor.java:65)
>   ...
> spooler-1 | INFO  | 11:51:14,968 08/13/2012 | mailetcontext | service() end
> Note #1: removing geronimo-javamail_1.4_mail-1.6.jar from the classpath fixes the problem
(ie, no
> exceptions are thrown). However, you can't just comment the line out 
>         wrapper.java.classpath.88=%REPO_DIR%/geronimo-javamail_1.4_mail-1.6.jar
> in JAMES/conf/wrapper.conf as all jars after this line will be lost (as they are expected
to be in order); hence just set the JavaMail (mail-1.4.4.jar) which was already set up earlier
(as Classpath argument 10) ... as also jar argument 88 
>         wrapper.java.classpath.88=%REPO_DIR%/mail-1.4.4.jar
> ). 
> Note #2: This issue might be documented in https://issues.apache.org/jira/browse/GERONIMO-5415
> and was supposedly fixed in geronimo-javamail_1.4_mail-1.8.1.jar (however Apache James
Beta4 is using an older geronimo-javamail_1.4_mail-1.6.jar). I don't know whether Apache James
really needs
> geronimo-javamail implementation as Oracle's JavaMail (ie. mail-1.4.4.jar) seems to handle
this 
> correctly.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

---------------------------------------------------------------------
To unsubscribe, e-mail: server-dev-unsubscribe@james.apache.org
For additional commands, e-mail: server-dev-help@james.apache.org


Mime
View raw message