Payara: When deployed an application containing Dozer, the java.lang.ClassCastException was thrown. /FISH-743

Created on 15 Oct 2020  路  4Comments  路  Source: payara/Payara

# Description #

When deployed an application containing Dozer, the following Exception was thrown.

  Exception while visiting com/github/dozermapper/core/util/MappingOptions.class of size 764
java.lang.ClassCastException: org.glassfish.hk2.classmodel.reflect.impl.InterfaceModelImpl cannot be cast to org.glassfish.hk2.classmodel.reflect.impl.AnnotationTypeImpl
        at org.glassfish.hk2.classmodel.reflect.impl.ModelClassVisitor$ModelDefaultAnnotationVisitor.visit(ModelClassVisitor.java:420)
        at org.objectweb.asm.ClassReader.readElementValue(ClassReader.java:3045)
        at org.objectweb.asm.ClassReader.readMethod(ClassReader.java:1375)
        at org.objectweb.asm.ClassReader.accept(ClassReader.java:717)
        at org.objectweb.asm.ClassReader.accept(ClassReader.java:401)
        at org.glassfish.hk2.classmodel.reflect.Parser$5.on(Parser.java:336)
        at com.sun.enterprise.v3.server.ReadableArchiveScannerAdapter.handleEntry(ReadableArchiveScannerAdapter.java:165)
        at com.sun.enterprise.v3.server.ReadableArchiveScannerAdapter.onSelectedEntries(ReadableArchiveScannerAdapter.java:127)
        at org.glassfish.hk2.classmodel.reflect.Parser.doJob(Parser.java:321)
        at org.glassfish.hk2.classmodel.reflect.Parser.access$300(Parser.java:44)
        at org.glassfish.hk2.classmodel.reflect.Parser$3.call(Parser.java:280)
        at org.glassfish.hk2.classmodel.reflect.Parser$3.call(Parser.java:269)
        at java.util.concurrent.FutureTask.run(FutureTask.java:266)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
        at java.lang.Thread.run(Thread.java:748)

Expected Outcome

No exceptions will be thrown.

Current Outcome

An exception was thrown.

Steps to reproduce (Only for bug reports)

  1. Build the following Appilication. mvn clean package
  2. bin/asadmin start-domain
  3. bin/asadmin deploy --contextroot=payara-dozer --name=payara-dozer --virtualservers=server payara-dozer.war
  4. View the server.log.

Environment

  • Payara Version: 5.2020.5
  • Edition: Full
  • JDK Version: 8
  • Operating System: Windows
  • Database: None
Accepted Bug

All 4 comments

I am seeing the same issue without dozer with the Payara full version. It does not appear on 5 2020.4. Could be related to https://github.com/payara/Payara/pull/4865 when H2K types are being discarded?

Hi @otukatigayim I was able to reproduce this easily, I have raised an internal issue FISH-743.

I also have tons of
java.lang.ClassCastException: class org.glassfish.hk2.classmodel.reflect.impl.InterfaceModelImpl cannot be cast to class org.glassfish.hk2.classmodel.reflect.impl.AnnotationTypeImpl
when deploying my application using docker image payara/server-full:5.2020.5-jdk11.

Can I safely ignore these exceptions or should I better go back to payara/server-full:5.2020.4-jdk11 and hope/wait for a fix in payara/server-full:5.2020.6-jdk11 ?

Same exceptions for me in Payara Micro 5.2020.5, where the deployed project uses Hibernate and MariaDB.

Was this page helpful?
0 / 5 - 0 ratings