Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8218540

class [B cannot be cast to class [C ([B and [C are in module java.base of loader

    Details

    • Subcomponent:
    • CPU:
      x86_64
    • OS:
      linux

      Description

      ADDITIONAL SYSTEM INFORMATION :
      RHEL 7 64bit
      java version "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)


      A DESCRIPTION OF THE PROBLEM :
      Caused by: java.lang.RuntimeException: Unable to initialize AuthorizeService, class [B cannot be cast to class [C ([B and [C are in module java.base of loader 'bootstrap')
              at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
              at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
              at java.base/jdk.internal.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
              at java.base/java.lang.reflect.Constructor.newInstance(Constructor.java:490)
              at deployment.application.war//org.codehaus.groovy.reflection.CachedConstructor.invoke(CachedConstructor.java:77)
              at deployment.application.war//org.codehaus.groovy.runtime.callsite.ConstructorSite$ConstructorSiteNoUnwrapNoCoerce.callConstructor(ConstructorSite.java:102)
              at deployment.application.war//org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCallConstructor(CallSiteArray.java:57)
              at deployment.application.war//org.codehaus.groovy.runtime.callsite.AbstractCallSite.callConstructor(AbstractCallSite.java:182)
              at deployment.application.war//org.codehaus.groovy.runtime.callsite.AbstractCallSite.callConstructor(AbstractCallSite.java:194)
              at deployment.application.war//com.company.agent.commons.services.AuthorizeService.initBean(AuthorizeService.groovy:54)
              at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
              at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
             at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
              at java.base/java.lang.reflect.Method.invoke(Method.java:566)
              at deployment.application.war//org.springframework.beans.factory.annotation.InitDestroyAnnotationBeanPostProcessor$LifecycleElement.invoke(InitDestroyAnnotati
      onBeanPostProcessor.java:349)
              at deployment.application.war//org.springframework.beans.factory.annotation.InitDestroyAnnotationBeanPostProcessor$LifecycleMetadata.invokeInitMethods(InitDes
      troyAnnotationBeanPostProcessor.java:300)
              at deployment.application.war//org.springframework.beans.factory.annotation.InitDestroyAnnotationBeanPostProcessor.postProcessBeforeInitialization(InitDestroy
      AnnotationBeanPostProcessor.java:133)
              ... 35 more
      Caused by: java.lang.ClassCastException: class [B cannot be cast to class [C ([B and [C are in module java.base of loader 'bootstrap')
              at deployment.application.war//groovy.json.internal.FastStringUtils$StringImplementation$1.toCharArray(FastStringUtils.java:88)
              at deployment.application.war//groovy.json.internal.FastStringUtils.toCharArray(FastStringUtils.java:175)
              at deployment.application.war//groovy.json.internal.BaseJsonParser.parse(BaseJsonParser.java:103)
              at deployment.application.war//groovy.json.JsonSlurper.parseText(JsonSlurper.java:208)
              at groovy.json.JsonSlurper$parseText.call(Unknown Source)
              at deployment.application.war//org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:45)
              at deployment.application.war//org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:108)
              at deployment.application.war//org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:116)
              at deployment.application.war//com.company.agent.commons.services.AuthorizeService.requestToken(AuthrizeService.groovy:76)
              at deployment.application.war//com.company.agent.commons.services.AuthorizeService.initBean(AuthrizeService.groovy:52)
              ... 42 more


      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      create a java program that convert String to Object
      "class B cast to class C”, that the method try to cast a byte[] array to a char[] array.

      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -
      Caused by: java.lang.RuntimeException: Unable to initialize AuthorizeService, class [B cannot be cast to class [C ([B and [C are in module java.base of loader 'bootstrap')
      Caused by: java.lang.ClassCastException: class [B cannot be cast to class [C ([B and [C are in module java.base of loader 'bootstrap')
              at deployment.application.war//groovy.json.internal.FastStringUtils$StringImplementation$1.toCharArray(FastStringUtils.java:88)
              at deployment.application.war//groovy.json.internal.FastStringUtils.toCharArray(FastStringUtils.java:175)
              at deployment.application.war//groovy.json.internal.BaseJsonParser.parse(BaseJsonParser.java:103)
              at deployment.application.war//groovy.json.JsonSlurper.parseText(JsonSlurper.java:208)
              at groovy.json.JsonSlurper$parseText.call(Unknown Source)
              at deployment.application.war//org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:45)
              at deployment.application.war//org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:108)
              at deployment.application.war//org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:116)
              at deployment.application.war//com.company.agent.commons.services.AuthorizeService.requestToken(AuthrizeService.groovy:76)
              at deployment.application.war//com.company.agent.commons.services.AuthorizeService.initBean(AuthrizeService.groovy:52)
              ... 42 more
      ACTUAL -
      should convert String to Object

      FREQUENCY : always


        Attachments

          Activity

            People

            • Assignee:
              smarks Stuart Marks
              Reporter:
              webbuggrp Webbug Group
            • Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: