0

I have a Spring Boot application and I am loading a file from Google Cloud Storage, however this error is being thrown:

java.lang.ClassCastException: class com.jws1g18.myphrplus.EncFile cannot be cast to class com.jws1g18.myphrplus.EncFile 
(com.jws1g18.myphrplus.EncFile is in unnamed module of loader 'app'; com.jws1g18.myphrplus.EncFile is in unnamed module of loader org.springframework.boot.devtools.restart.classloader.RestartClassLoader @18e513bc)

However I am struggling to work out why it is being thrown, as they are the same class. It is being thrown by this code:

private static EncFile readEncFile(InputStream iStream) {
        try {
            return (EncFile) SerializationUtils.deserialize(iStream.readAllBytes());
        } catch (IOException e) {
            return null;
        }
    }

Let me know if you need any more info. Any help would be appreciated

Jamie
  • 23
  • 10
  • 1
    Can you have a look here? https://stackoverflow.com/questions/57750294/class-loader-error-unnamed-module-of-loader-org-springframework-boot-devtools – comdotlinux Mar 17 '21 at 22:10
  • This worked thanks, tried to find an SO post on it but guess I was searching for the wrong keywords. – Jamie Mar 17 '21 at 22:24

0 Answers0