wallabri Posted November 16, 2007 Posted November 16, 2007 Hi, I installed ScriptMaster (after seeing ref to it on talk) and see huge potential for it. I am trying to use on FM9A with Java 1.6.0 and most of the functions work but anything to do with email give me the error: "No object DCH for MIME type text/plain ..." Any ideas on what the problem is, I have filled in valid info for SMTP & other settings and definately have an active internet connection. Thanks for any help.
JamesBand Posted November 16, 2007 Posted November 16, 2007 You might post the code your using... remove the sensitive bits, of course.
wallabri Posted November 16, 2007 Author Posted November 16, 2007 I am using the examples that come with the ScriptMaster download (downloaded yesterday), any of the email examples all give me the same error.
JamesBand Posted November 16, 2007 Posted November 16, 2007 (edited) I tried the samples and the only one I had a problem with was the 'Javamail' example. The other examlpes work fine for me. I am using Java 1.4.2 for XP. I am not sure why the 'Javamail' example isn't working... I spent about 20 mins on it and got nowhere. Maybe someone with a little more java experience can help out. ;) Edited November 16, 2007 by Guest
JamesBand Posted November 16, 2007 Posted November 16, 2007 import javax.mail.*; import javax.mail.internet.*; import java.util.Properties; // monkey with the settings below // smtpHost = "replace.with.smtp.server.address"; body = "replace with message"; subject = "replace with subject"; from = "[email protected]"; to = "[email protected]"; htmlBody = "This is an HTML Message"; textBody = "This is a Text Message."; // monkey with the settings above // MimeMultipart content = new MimeMultipart("alternative"); MimeBodyPart text = new MimeBodyPart(); MimeBodyPart html = new MimeBodyPart(); text.setText( textBody ); html.setContent(htmlBody, "text/html"); content.addBodyPart(text); content.addBodyPart(html); System.setProperty("mail.smtp.host", smtpHost); MimeMessage msg = new MimeMessage(Session.getDefaultInstance(System.getProperties())); msg.setContent( content, "alternative" ); msg.setSubject(subject); msg.setFrom(new InternetAddress(from)); msg.setRecipient(Message.RecipientType.TO, new InternetAddress(to)); Transport.send(msg); return true; In the Examples file, goto the "Javamail Email" example and replace the code with the code above... and let me know if it works. -- Don't forget to set the variables to suit your circumstances. --
wallabri Posted November 16, 2007 Author Posted November 16, 2007 I can tell you that I tried on my Mac (iBook G4) and the mail examples work without a problem. Will try your sample code on my PC when I get a chance.
JamesBand Posted November 16, 2007 Posted November 16, 2007 My situation is the opposite... It works on my PCs and I have yet to try it on my MAC.
shmert Posted November 17, 2007 Posted November 17, 2007 Hi, this is a problem with javamail on the windows side that I'm looking into. This affects our email plugin as well. It has something to do with not being able to read some mail config file on your system. I'll post here when I figure it out! -Sam Barnum 360Works
JamesBand Posted November 17, 2007 Posted November 17, 2007 The code above does work on the PC. It creates a Multipart Alternative email with both Text and HTML Bodies.
Jesse Barnum Posted November 18, 2007 Posted November 18, 2007 I tried this and got the same error. I'm running Java 1.6 on Windows, I think that configuration is causing the problem. I'll see if I can figure out what's causing this.
JamesBand Posted November 19, 2007 Posted November 19, 2007 (edited) Found this: UnsupportedDataTypeException javax.activation.UnsupportedDataTypeException: no object DCH for MIME type text/plain. You have an obsolete JavaMail or Java Activation Framework jar. Could this mean that there are updated jars, that work with Java 1.6? Edited November 19, 2007 by Guest
JamesBand Posted November 19, 2007 Posted November 19, 2007 Ok... I installed Java SE 6... and I get the same error. However, when I uninstall SE 6, it works again. This seems to be way out of my area of expertise. That being said, Groovy utilizes the Java Vitrual Machine that is installed. On my PCs, when 1.4.2 is installed javamail works. When SE 6 is installed javamail fails. Looking at the problem from this point of view, it seems that for Groovy (or a groovy based plugin) to operate with SE 6, it may have to be recompiled for use with SE 6 or using SE 6 libraries or something along these lines. Then again I could be way off. (And wouldn't be surprised if I am.)
Jesse Barnum Posted November 19, 2007 Posted November 19, 2007 I have Java 6 installed, and it works for me when I run a test using regular compiled Java with the activation.jar and mail.jar as part of the startup classpath. However, it fails with the script master plugin. This is making me think that either 1) it's a groovy thing, or 2) it's a class loader issue (since we load the classes at runtime from the jar instead of from the startup classpath). My guess is #2 - I'm writing a test case to see if I can reproduce the problem outside of Groovy.
JamesBand Posted November 19, 2007 Posted November 19, 2007 According to the javamail page: Note: Unless you're using Java SE 6, you will also need the JavaBeans Activation Framework (JAF) extension that provides the javax.activation package. We suggest you use version 1.1.1 of JAF, the latest release. JAF is included with Java SE 6. Noticed this earlier today.
Jesse Barnum Posted November 20, 2007 Posted November 20, 2007 Just released a 1.55 update to ScriptMaster which fixes this problem. It did turn out to be a class loader issue: Looking at the source code for the Java Activation framework, I found this line at MailcapCommandMap:149: loadAllResources( dbv, "META-INF/mailcap" ); This then uses a class loader to try to find this file. It first checks the Thread's context class loader, and then uses the class loader that loaded activation.jar. The problem is that we were not setting a context class loader for the thread, and since Java Activation Framework is now part of the JDK in Java 6, it is loaded in a separate class loader than mail.jar, so it never finds the META-INF/mailcap file (which is in mail.jar). I fixed it by setting the Thread's context class loader when you call SMLoadJar.
JamesBand Posted November 21, 2007 Posted November 21, 2007 err... well... I thought it would be spectacular... I finally got a change this AM to try it... I downloaded the new plugin and reintalled jre-6u3-windows-i586-p... Then I tried the javamail... I get an error: no object DCH for MIME type text/plain; charset=us-ascii I rebooted and still got the error. I installed jre-6u10-ea-windows-i586-p-iftw and still got the error. I have tried it with and without the activation.jar (even though it should not be necessary... it wasn't going to get any worse.) I am getting the same results in my test DB and the Examples DB. Am I missing something? I don't have the JDK loaded, just the JRE. Could that be it?
JamesBand Posted November 21, 2007 Posted November 21, 2007 To add to the info, my MSOffice stuff with the ScriptOM and Jacob JARs are unaffected by the upgrade of the JRE.
Jesse Barnum Posted November 27, 2007 Posted November 27, 2007 Can you check your lib/ext folder to see if you have mail.jar or activation.jar there? If so, try removing them to see if that helps.
Recommended Posts
This topic is 6216 days old. Please don't post here. Open a new topic instead.
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now