Hi Jean-Baptiste, Maybe in some cases this is working. For me it didn't. (I tried to install "activation" feature. I think this is what you are suggesting). I was able to fix my issue only using the servicemix activation-api-1.2.1. This is because the MailcapCommandMap doesn't seem to load all the specified mailcaps because of some OSGI class loading issue.
All the best, Andrei Mura On Thu, Feb 10, 2022 at 4:02 PM Jean-Baptiste Onofré <[email protected]> wrote: > No, I really mean Karaf specs features: > > > https://github.com/apache/karaf/blob/main/assemblies/features/specs/src/main/feature/feature.xml#L42 > > We can update the runtime by avoiding the import from the JRE, and > instead use an activation feature. > > Regards > JB > > On Thu, Feb 10, 2022 at 2:49 PM Andrei Petru Mura <[email protected]> > wrote: > > > > Hi Jean-Baptiste, > > > > Hmmm... I don't see to mention this before in this thread... You mean > servicemix-spec? > > I'm not sure what you mean by "karaf-spec feature". > > Sorry, but I'm not very familiar with some details of Karaf. > > > > Andrei M. > > > > On Thu, Feb 10, 2022 at 3:45 PM Jean-Baptiste Onofré <[email protected]> > wrote: > >> > >> Hi Andrei, > >> > >> Thanks for the update. And it's what we talked about in a previous > email. > >> > >> What do you think about removing activation from jre.properties and > >> adding activation spec from karaf-spec feature ? (it's what I proposed > >> previously). > >> It should work in almost all cases. > >> > >> Regards > >> JB > >> > >> On Thu, Feb 10, 2022 at 2:35 PM Andrei Petru Mura <[email protected]> > wrote: > >> > > >> > After some investigation, I managed to make this work. I'll mentioned > below a few points which I had to perform. > >> > First of all, I switched to Karaf 4.3.6. But If you have to stick > with Karaf 4.3.3, you have only to skip John Taylor's comment bellow. > >> > In a different thread, entitled "reading mail attachments", John > Taylor wrote: > >> > > >> > With either 4.3.5 or 4.3.6 I believe javax.activation was included > in the jre-9 export in jre.properties > >> > That pulls in the com.sun.activation/jakarta.activation bundle I > believe and that doesn't seem to work with the camel attachments processing. > >> > > >> > What I did to resolve it is comment that out in jre.properties and > pull in the servicemix activation package. > >> > > >> > jre.properties > >> > jre-9= \ > >> > ${jre-base}, \ > >> > javax.accessibility, \ > >> > javax.activity, \ > >> > javax.annotation;version="1.3", \ > >> > javax.annotation.processing;version="1.0", \ > >> > #javax.activation;version="1.2.1", \ > >> > javax.crypto, \ > >> > . . . > >> > > >> > install -s > mvn:org.apache.servicemix.specs/org.apache.servicemix.specs.activation-api-1.2.1/1.2.1_3 > >> > > >> > More than this, I would add that I installed the servicemix > activation bundle to start with level 10, and before all other > installations. I observed that the installation order has an impact on this > too. > >> > Afterwards, everything seems to work fine. > >> > > >> > All the best, > >> > Andrei Mura > >> > > >> > On Thu, Feb 3, 2022 at 4:29 PM Andrei Petru Mura <[email protected]> > wrote: > >> >> > >> >> Ok. I installed the one provided by eu.agno3.jcifs, but didn't fix > the issue. > >> >> > >> >> Andrei Mura > >> >> > >> >> On Thu, Feb 3, 2022 at 4:26 PM Andrei Petru Mura < > [email protected]> wrote: > >> >>> > >> >>> Hmmm... Can you give me the group ID too please? Thanks > >> >>> > >> >>> Andrei > >> >>> > >> >>> On Thu, Feb 3, 2022 at 4:12 PM Jean-Baptiste Onofré < > [email protected]> wrote: > >> >>>> > >> >>>> Hi > >> >>>> > >> >>>> I know that, depending of the use, bouncycastle 1.69 needs > >> >>>> jcifs-ng/2.1.7 (as it introduced a breaking change). > >> >>>> > >> >>>> But probably not related to your issue (the update), but possible > it's > >> >>>> the same issue (due to bc breaking change). > >> >>>> > >> >>>> Regards > >> >>>> JB > >> >>>> > >> >>>> On 03/02/2022 14:30, Andrei Petru Mura wrote: > >> >>>> > Hmm... Which ones? I upgraded many others... Including java > mail. I use > >> >>>> > jakarta.mail 1.6.7 now. > >> >>>> > > >> >>>> > Andrei M. > >> >>>> > > >> >>>> > On Thu, Feb 3, 2022 at 3:25 PM Jean-Baptiste Onofré < > [email protected] > >> >>>> > <mailto:[email protected]>> wrote: > >> >>>> > > >> >>>> > Hi Andrei, > >> >>>> > > >> >>>> > Did you upgrade only bouncycastle 1.69 or other dependency ? > >> >>>> > > >> >>>> > I remember another deps should be updated. > >> >>>> > > >> >>>> > Regards > >> >>>> > JB > >> >>>> > > >> >>>> > On 03/02/2022 14:09, Andrei Petru Mura wrote: > >> >>>> > > Hi all, > >> >>>> > > > >> >>>> > > I upgraded bouncycastle to 1.69 in karaf. When trying to > run this > >> >>>> > code: > >> >>>> > > > >> >>>> > > MimeBodyPart textPart = new MimeBodyPart(); > >> >>>> > > textPart.setContent(new String(body), "text/plain"); > >> >>>> > > textPart.setHeader("Content-Type", messageContentType); > >> >>>> > > textPart.setHeader("Content-Transfer-Encoding", "binary"); > >> >>>> > > textPart.setHeader("Content-Disposition", "attachment; > filename=" + > >> >>>> > > fileName); > >> >>>> > > > >> >>>> > > SMIMESignedGenerator gen = new SMIMESignedGenerator(); > >> >>>> > > gen.setContentTransferEncoding("base64"); > >> >>>> > > JcaSimpleSignerInfoGeneratorBuilder signerInfoGenerator = > new > >> >>>> > > JcaSimpleSignerInfoGeneratorBuilder(); > >> >>>> > > signerInfoGenerator = > signerInfoGenerator.setProvider("BC"); > >> >>>> > > SignerInfoGenerator signerGenerator = > >> >>>> > > signerInfoGenerator.build(alg.algorithmWithRSA(), > privateKey, > >> >>>> > certificate); > >> >>>> > > gen.addSignerInfoGenerator(signerGenerator); > >> >>>> > > > >> >>>> > > List<X509Certificate> certList = new > ArrayList<X509Certificate>(); > >> >>>> > > certList.add(certificate); > >> >>>> > > @SuppressWarnings("rawtypes") > >> >>>> > > Store certs = new JcaCertStore(certList); > >> >>>> > > > >> >>>> > > gen.addCertificates(certs); > >> >>>> > > > >> >>>> > > MimeMultipart signedReport = gen.generate(replyBody); > >> >>>> > > ByteArrayOutputStream out = new ByteArrayOutputStream(); > >> >>>> > > mimeMsg.writeTo(out); //the line which gives problems > >> >>>> > > out.close(); > >> >>>> > > > >> >>>> > > I get this: > >> >>>> > > > >> >>>> > > javax.activation.UnsupportedDataTypeException: text/plain > >> >>>> > > at > javax.activation.DataHandler.writeTo(DataHandler.java:75) > >> >>>> > ~[!/:2.9.0] > >> >>>> > > at > javax.mail.internet.MimeBodyPart.writeTo(MimeBodyPart.java:1670) > >> >>>> > > ~[!/:1.6.7] > >> >>>> > > at > javax.mail.internet.MimeBodyPart.writeTo(MimeBodyPart.java:972) > >> >>>> > > ~[!/:1.6.7] > >> >>>> > > at > javax.mail.internet.MimeMultipart.writeTo(MimeMultipart.java:537) > >> >>>> > > ~[!/:1.6.7] > >> >>>> > > > >> >>>> > > Trying to make the long story short, after investigation, > I find > >> >>>> > that BC > >> >>>> > > includes a file at META-INF/mailcap > >> >>>> > > This shouldn't be a problem, but it seems to me that this > is a > >> >>>> > problem. > >> >>>> > > > >> >>>> > > If I try to add the mailcap manually before the above code > >> >>>> > snippet, like > >> >>>> > > this: > >> >>>> > > > >> >>>> > > MailcapCommandMap mc = (MailcapCommandMap) > >> >>>> > > CommandMap.getDefaultCommandMap(); > >> >>>> > > mc.addMailcap("text/html;; > >> >>>> > > x-java-content-handler=com.sun.mail.handlers.text_html"); > >> >>>> > > mc.addMailcap("text/xml;; > >> >>>> > > x-java-content-handler=com.sun.mail.handlers.text_xml"); > >> >>>> > > mc.addMailcap("text/plain;; > >> >>>> > > x-java-content-handler=com.sun.mail.handlers.text_plain"); > >> >>>> > > mc.addMailcap("multipart/*;; > >> >>>> > > > x-java-content-handler=com.sun.mail.handlers.multipart_mixed"); > >> >>>> > > mc.addMailcap("message/rfc822;; > >> >>>> > > > x-java-content-handler=com.sun.mail.handlers.message_rfc822"); > >> >>>> > > > >> >>>> > > it has no effect, although I can see that the command > handler is > >> >>>> > set there. > >> >>>> > > > >> >>>> > > After all this investigation, I conclude that this is > related to > >> >>>> > OSGI > >> >>>> > > class loader. Any idea how to fix this or any hints? > >> >>>> > > > >> >>>> > > Thanks, > >> >>>> > > Andrei Mura > >> >>>> > >
