If I understand correctly, you are saying that the USB 3.0 port works correctly, the DCC-EX controller (built with the Elegoo Mega) works properly, and JMRI works properly, BUT NOT when you use that specific combination of items.
?
That's certainly strange.? Maybe a conflict between JMRI (or the Java you are using), and the underlying hardware / drivers used for the USB 3.0 port and the Atmega16u2 used on the Elegoo Mega?
?
Cheers,
Trevor