Re: [Ikvm-developers] IKVM 0.36 and javamail
Brought to you by:
jfrijters
|
From: Jeroen F. <je...@su...> - 2008-01-24 15:08:32
|
Hi, It's a system class loader issue. When running under ASP.NET there is no us= eful system class loader. Setting the thread context class loader works around the problem: java.lang.Thread.currentThread().setContextClassLoader(((java.lang.Class)Ge= tType()).getClassLoader()); Regards, Jeroen > -----Original Message----- > From: Valdemar Mejstad [mailto:Val...@la...] > Sent: Thursday, January 24, 2008 14:17 > To: Jeroen Frijters; ikv...@li... > Subject: RE: IKVM 0.36 and javamail > > Hi again, > > Sorry about the lack of specific details. I've done some more research > and it seems I'm having problems when using javamail from an ASP.NET > application. > > When I try to do message.getContent() as in the previous example it > returns a javax.mail.util.SharedByteArrayInputStream object instead of > a Multipart object. From that I figured that javamail wasn't able to > read the mailcap-file properly. I've attached the example mail I try to > parse (message.eml). > > Doing message.getContent() properly returned a Multipart object using > IKVM 0.34. Any ideas? What's the difference between running a console > app and an ASP.NET website in IIS? > > Cheers, > Valdemar > > -----Original Message----- > From: Jeroen Frijters [mailto:je...@su...] > Sent: den 23 januari 2008 14:11 > To: Valdemar Mejstad; ikv...@li... > Subject: RE: IKVM 0.36 and javamail > > Hi Valdemar, > > I just tried it and it seemed to work. Do you have some more info (e.g. > the full exception message and stack trace) or a repro scenario? > > Regards, > Jeroen > > > -----Original Message----- > > From: ikv...@li... [mailto:ikvm- > > dev...@li...] On Behalf Of Valdemar > Mejstad > > Sent: Wednesday, January 23, 2008 13:55 > > To: ikv...@li... > > Subject: [Ikvm-developers] IKVM 0.36 and javamail > > > > Hi, > > > > I'm having trouble using javamail with IKVM in 0.36. I've used ikvmc > to > > create a dll from the javamail jar and reference it in a C# .NET > > project. > > > > I execute the following: > > > > // read multipart email message from file FileInputStream in =3D new > > FileInputSTream("message.eml"); MimeMessage message =3D new > > MimeMessage(Session.getInstance(new > > Properties()), in); > > > > // parse content into a multipart object MultiPart multiPart =3D > > (MultiPart) message.getContent(); > > > > > > The last line throws an UnsupportedEncodingException. This seems to > be > > because the ikvmc:ed javamail does not find/read the mailcap-file > when > > running in .NET. The mailcap-file normally resides in the META-INF > > directory in the javamail jar file. > > > > This seemed to work using IKVM 0.34. > > > > Is there a way to make javamail find and read the mailcap-file when > > running in .NET? > > > > Regards, > > Valdemar > > > > > ----------------------------------------------------------------------- > > -- > > This SF.net email is sponsored by: Microsoft Defy all challenges. > > Microsoft(R) Visual Studio 2008. > > http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/ > > _______________________________________________ > > Ikvm-developers mailing list > > Ikv...@li... > > https://lists.sourceforge.net/lists/listinfo/ikvm-developers |