Error: java.lang.ClassNotFoundException: javax.activation.DataSource
See original GitHub issueHello, thanks for the tool!
Environment
- Operating System: Linux Mint 19.1 64 bits
- MsgViewer version: 1.6
- Java version:
$ java --version
java 11.0.2 2019-01-15 LTS
Java(TM) SE Runtime Environment 18.9 (build 11.0.2+9-LTS)
Java HotSpot(TM) 64-Bit Server VM 18.9 (build 11.0.2+9-LTS, mixed mode)
also tested with
$java --version
openjdk 11.0.2 2019-01-15
OpenJDK Runtime Environment (build 11.0.2+9-Ubuntu-3ubuntu118.04.3)
OpenJDK 64-Bit Server VM (build 11.0.2+9-Ubuntu-3ubuntu118.04.3, mixed mode, sharing)
Bug Description:
While reading this file (20190502_094613_1556783173.7038.msg.zip - zipped due to github format restrictions) I get the following error message:
Exception in thread "pool-1-thread-1" java.lang.NoClassDefFoundError: javax/activation/DataSource
at net.sourceforge.MSGViewer.factory.MessageParserFactory.saveMBoxFile(MessageParserFactory.java:107)
at net.sourceforge.MSGViewer.factory.MessageParserFactory.saveMessage(MessageParserFactory.java:90)
at net.sourceforge.MSGViewer.ViewerPanel$10$1.do_stuff(ViewerPanel.java:799)
at at.redeye.FrameWork.base.AutoMBox.invoke(AutoMBox.java:64)
at at.redeye.FrameWork.base.AutoMBox.<init>(AutoMBox.java:50)
at net.sourceforge.MSGViewer.ViewerPanel$10$1.<init>(ViewerPanel.java:793)
at net.sourceforge.MSGViewer.ViewerPanel$10.run(ViewerPanel.java:793)
at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
at java.base/java.lang.Thread.run(Thread.java:834)
Caused by: java.lang.ClassNotFoundException: javax.activation.DataSource
at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:583)
at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:178)
at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:521)
... 10 more
Exception in thread "pool-1-thread-2" java.lang.NoClassDefFoundError: javax/activation/DataSource
at net.sourceforge.MSGViewer.factory.MessageParserFactory.saveMBoxFile(MessageParserFactory.java:107)
at net.sourceforge.MSGViewer.factory.MessageParserFactory.saveMessage(MessageParserFactory.java:90)
at net.sourceforge.MSGViewer.ViewerPanel$10$1.do_stuff(ViewerPanel.java:799)
at at.redeye.FrameWork.base.AutoMBox.invoke(AutoMBox.java:64)
at at.redeye.FrameWork.base.AutoMBox.<init>(AutoMBox.java:50)
at net.sourceforge.MSGViewer.ViewerPanel$10$1.<init>(ViewerPanel.java:793)
at net.sourceforge.MSGViewer.ViewerPanel$10.run(ViewerPanel.java:793)
at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
at java.base/java.lang.Thread.run(Thread.java:834)
Caused by: java.lang.ClassNotFoundException: javax.activation.DataSource
at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:583)
at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:178)
at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:521)
... 10 more
The main window will open normally, but if I try to open one of the mail attachments (which are actually other attached messages), I get this error dialog:
Analysis
I did some research on the error message, and found it to be connected to a missing java module (java.xml.bind), which was deprecated on Java 9 and excluded from Java 11, as described here. Since the library cannot be found, the files for the attachments are never saved in the temp folder, resulting in the error message above. Since the link also suggests a possible fix, I downloaded MsgViewer source code and changed the pom.xml file to include the suggested dependencies, recompiled the package and tested again. This fixed the error about the library, but introduced another one, while parsing the msg file:
java.lang.IndexOutOfBoundsException: Index 0 out of bounds for length 0
at java.base/jdk.internal.util.Preconditions.outOfBounds(Preconditions.java:64)
at java.base/jdk.internal.util.Preconditions.outOfBoundsCheckIndex(Preconditions.java:70)
at java.base/jdk.internal.util.Preconditions.checkIndex(Preconditions.java:248)
at java.base/java.util.Objects.checkIndex(Objects.java:372)
at java.base/java.util.ArrayList.get(ArrayList.java:458)
at net.sourceforge.MSGViewer.factory.msg.MsgWriter.write(MsgWriter.java:80)
at net.sourceforge.MSGViewer.factory.MessageParserFactory.saveMsgFile(MessageParserFactory.java:72)
at net.sourceforge.MSGViewer.factory.MessageParserFactory.saveMessage(MessageParserFactory.java:61)
at net.sourceforge.MSGViewer.ViewerPanel$9$1.do_stuff(ViewerPanel.java:611)
at at.redeye.FrameWork.base.AutoMBox.invoke(AutoMBox.java:64)
at at.redeye.FrameWork.base.AutoMBox.<init>(AutoMBox.java:50)
at net.sourceforge.MSGViewer.ViewerPanel$9$1.<init>(ViewerPanel.java:605)
at net.sourceforge.MSGViewer.ViewerPanel$9.run(ViewerPanel.java:605)
at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
at java.base/java.lang.Thread.run(Thread.java:834)
(this error appears twice, since there are two attachments failing). This time, the tmp files were created, but as empty files.
I cannot continue from this poins - I’m not a Java developer, and couldn’t figure out where this error came from, sorry…
Workaround
MsgViewer works just fine on java 8. I was lucky enough that I still had my old Java 8 library, so I’m calling the jar directly using the old java executable, and then it can open the attached files flawlessly. This said, there is a message on the console that caught my attention, just when it started reading the file:
2019-05-02 11:43:13,318 INFO (Message.java:197): Could not decompress RTF data java.lang.IllegalArgumentException: compressed-RTF data size mismatch
Could this be related to the error in java 11?
Hope it helps! 😃
Issue Analytics
- State:
- Created 4 years ago
- Comments:6 (4 by maintainers)
Top GitHub Comments
Hi @lolo101, I finally had the chance to test it! Works pretty fine, I’ve just upgraded to your latest 1.11 version! Thanks for the very nice work! 😃
Hello @thomasphansen Please give a try to v1.7.0 😉