DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT <http://nagoya.apache.org/bugzilla/show_bug.cgi?id=20073>. ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND INSERTED IN THE BUG DATABASE.
http://nagoya.apache.org/bugzilla/show_bug.cgi?id=20073 no object DCH for MIME type text/plain ------- Additional Comments From [EMAIL PROTECTED] 2003-11-22 21:05 ------- Hi again, I was somewhat confused in my previous message. The definition of mime-type and DCH should be: META-INF/mailcap in "mail.jar", not META-INF/mailcap.default in "activation.jar". And the required entity in "catalina.policy" will look like this: grant codeBase "file:${catalina.home}/shared/lib/activation.jar" { permission java.io.FilePermission "/usr/local/jakarta-tomcat-4.1.12-LE-jdk14/shared/lib/mail.jar","read"; }; Anyway, I re-wrote my message... ------------------------------------------------- As you did, our client got the exception like this: javax.mail.SendFailedException: Sending failed; nested exception is: javax.mail.MessagingException: IOException while sending message; nested exception is: javax.activation.UnsupportedDataTypeException: no object DCH for MIME type text/plain at javax.mail.Transport.send0(Transport.java:219) To re-produce it on our development machine, I tried several configurations. And only when I start Tomcat with ScurityManager, I got the same one. "DCH" is short hand of DataContentHandler, and it is responsible for creating the binary stream that will be sent to the SMTP server. Because there are many kinds of mail body, the several implementations are included in "mail.jar". For example, "mail.jar" shipped with the DataContentHandler for "text/plain" and "image/jpeg". When "javax.mail.Transport" tries to send the e-mail, it creates the DataContentHandler implementation appropriate for the mime-type of the out-going e-mail. The mapping between the mime-map and the class name of DataContentHandler is defined by: META-INF/mailcap in "mail.jar", and this "mailcap" is read by CommandMap object. For example, to create DataContentHandler implementation for "text/plain", your code will look like this: CommandMap cmap=CommandMap.getDefaultCommandMap(); DataContentHandler dch=cmap.createDataContentHandler("text/plain"); Then, CommandMap object reads: META-INF/mailcap from "mail.jar", and creates the DataContentHandler object for "text/plain". This is what is done by "javax.mail.Transport" to send the e-mails. By the way, where CommandMap comes from? Its fully qualified class name is: javax.activation.CommandMap Yes, this class is included in "activation.jar". According to Servlet Spec, the classes marked as "Java Extension" should be searched by the parent class-loader at first, rather than by the class-loader for each web application. So, when we place "activation.jar" into: ${catalina.home}/shared/lib all the classes in Java Activation Framework will be loaded from this JAR file, even if we place it also in: (docBase)/WEB-INF/lib To read: META-INF/mailcap from: ${catalina.home}/shared/lib/mail.jar CommandMap object from: ${catalina.home}/shared/lib/activation.jar needs the "read" permission to: ${catalina.home}/shared/lib/mail.jar To make it possible, "catalina.policy" should include the entity like: grant codeBase "file:${catalina.home}/shared/lib/activation.jar" { permission java.io.FilePermission "/usr/local/jakarta-tomcat-4.1.12-LE-jdk14/shared/lib/mail.jar","read"; }; In addition, "mail.jar" in: ${catalina.home}/shared/lib needs the Socket permission to access the SMTP server. So, "catalina.policy" also need the entities like: grant codeBase "file:${catalina.home}/shared/lib/mail.jar" { permission java.net.SocketPermission "localhost", "connect,resolve"; }; I'm not sure about the details of your environment, but if you run your Tomcat with SecurityManager, the my solution may help you too. Any questions are welcome to me. Best regards, ---------------------- Happy Java programming! Jun Inamori OOP-Reserch Corporation E-mail: [EMAIL PROTECTED] URL: http://www.oop-reserch.com/ --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]