Ich habe folgendes:DataSource und ByteArrayDataSource nicht kompatibel?
InputStream imageStream = classLoader.getResourceAsStream("email/logo.png");
DataSource fds = new ByteArrayDataSource(IOUtils.toByteArray(imageStream), "image/png");
Welche mir ein Fehler von Würfen:
Error:(65, 30) java: incompatible types: javax.mail.util.ByteArrayDataSource cannot be converted to org.apache.poi.poifs.nio.DataSource
Error:(66, 44) java: no suitable constructor found for DataHandler(org.apache.poi.poifs.nio.DataSource) constructor javax.activation.DataHandler.DataHandler(javax.activation.DataSource) is not applicable (argument mismatch; org.apache.poi.poifs.nio.DataSource cannot be converted to javax.activation.DataSource) constructor javax.activation.DataHandler.DataHandler(java.net.URL) is not applicable (argument mismatch; org.apache.poi.poifs.nio.DataSource cannot be converted to java.net.URL)
Was ich hier falsch mache?
Wir wissen nicht, was Sie erreichen wollen, was es sehr schwer macht, Ihnen zu helfen. Möchten Sie wirklich 'org.apache.poi.poifs.nio.DataSource' verwenden? Vielleicht möchten Sie stattdessen 'javax.activation.DataSource'? –
@JonSkeet, das wars! – uksz