Hi !

I am developing with Java 11 (OpenJDK) and have the following runtime problem 
when calling DBUtils.md5Hex()
Exception in thread "Thread-0" java.lang.NoClassDefFoundError: 
org/apache/commons/codec/digest/DigestUtils

The purpose of my code is very classical: a history-aware save function, which 
only overwrites a file when the content to save differs from the content in the 
existing file (see below).

Surprisingly, compilation works fine.

Does apache commons codec support Java 11 ?
Am I doing something wrong ?
Might this be due to a missing dependency ?


Best regards,

François Vandewalle


    public boolean save(String target_file_name){
        try {
            // Check whether the file changed by comparing MD5 hashes
            String md5_existing_file = "";
            try (InputStream in = new FileInputStream(target_file_name)) {
                md5_existing_file = DigestUtils.md5Hex(in);
            }
            String md5_new_content;
            md5_new_content = DigestUtils.md5Hex(file_content);

            if (!md5_new_content.equals(md5_existing_file)){
                try (BufferedWriter out = new BufferedWriter(new 
FileWriter(target_file_name, false))) {
                    try {
                        out.write(file_content);
                    }
                    catch (IOException ioEx) {
                    }
                }
            }
        }
        catch (IOException ioEx){

        }

        return true;
    }

François Vandewalle
Systems Engineer / Development & Automation
GE Power
Power Conversion
T +49 30 7622 3818
F +49 30 7622 3737
francois.vandewa...@ge.com<mailto:francois.vandewa...@ge.com>
www.gepowerconversion.com<http://www.gepowerconversion.com/>

Culemeyerstraße 1 | 12277 Berlin, Germany

GE Energy Power Conversion GmbH
Geschäftsführung: Jörg Nuttelmann, Martin Fleischer; Aufsichtsratsvorsitz: 
Wolfgang Dierker
Registergericht: Berlin-Charlottenburg; HRB 121288; USt-IdNr.: DE 269448104

Diese E-Mail und alle Daten, die darin übertragen werden, sind vertraulich und 
allein für den Adressaten
bestimmt. Falls Sie diese E-Mail irrtümlich erhalten, bitten wir um Mitteilung 
und darum, sie vollständig
von Ihrem Computer zu löschen.

This e-mail and any files transmitted with it are confidential and solely for 
the use of the individual or
entity to whom they are intended. If you have received this e-mail in error 
please notify the sender either
by telephone or by e-mail and delete the material from any computer.


Reply via email to