question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Error: java.lang.ClassNotFoundException: javax.activation.DataSource

See original GitHub issue

Hello, 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:

Screenshot from 2019-05-02 10-53-35

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:closed
  • Created 4 years ago
  • Comments:6 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
thomasphansencommented, Sep 15, 2020

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! 😃

0reactions
lolo101commented, Jun 17, 2019

Hello @thomasphansen Please give a try to v1.7.0 😉

Read more comments on GitHub >

github_iconTop Results From Across the Web

NoClassDefFoundError: javax/activation/DataSource
I solved a similar NoClassDefFoundError: javax/activation/DataSource problem in a mixed Java/Scala project by switching to Java 8 (it was ...
Read more >
javax/activation/DataSource NoClassDefFoundError error
Hi, I'm trying to use Jakarta mail to connect to Gmail and retrive email but getting the following exception. Exception in thread "main"...
Read more >
Exception in thread "main" java.lang.NoClassDefFoundError ...
I get the following error: Exception in thread "main" java.lang.NoClassDefFoundError: javax/activation/DataSource. when attempting to run:.
Read more >
jakarta.activation.DataSource was not found - Mkyong.com
DataSource ` warning by including the `jakarta.activation-api`. ... java.lang.NoClassDefFoundError: jakarta/servlet/ServletInputStream ...
Read more >
Cause of java.lang.NoClassDefFoundError: javax/activation ...
Hi, looks more like a classpath issue. the calling class may reside at the higher classloader hierachy than where the activation.jar reside, ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found