Uploaded image for project: 'MariaDB Connector/J'
  1. MariaDB Connector/J
  2. CONJ-425

java.lang.ClassCastException: [B cannot be cast to java.lang.String

Details

    • Bug
    • Status: Closed (View Workflow)
    • Major
    • Resolution: Fixed
    • 1.5.5, 1.5.7
    • 1.5.8
    • Other
    • None
    • JDK 1.8.0.25
      Windows Server 2012
      MariaDB 10.1.19
      JPA 2.1.0

    Description

      We have a stored procedure called by Java using JPA:
      StoredProcedureQuery storedProcedure = em.createStoredProcedureQuery(EXPORT_PROCEDURE_NAME);
      storedProcedure.registerStoredProcedureParameter(OUTPUT_ATTRIBUT_NAME, String.class, ParameterMode.OUT);
      storedProcedure.execute();
      String jsonResult = (String) storedProcedure.getOutputParameterValue(OUTPUT_ATTRIBUT_NAME);

      The last line raises an error:
      java.lang.ClassCastException: [B cannot be cast to java.lang.String.
      The output of our stored procedure is a string containing JSON formatted data looking like this: [

      {param1: info1, param2: info2}

      ]
      Here is the header of the "show create procedure" query:
      STRICT_TRANS_TABLES,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION | CREATE DEFINER=`xxxx`@`localhost` PROCEDURE `EXPORT_TRANSFER_ALL`(OUT json_result TEXT)

      This error seems similar is similar to the one reported here: https://mariadb.atlassian.net/browse/CONJ-28

      It seems that we're receiving a byte array instead of string though we're not using a secured connexion to the database.

      Attachments

        Activity

          Stegle Julien Stegle created issue -
          Stegle Julien Stegle made changes -
          Field Original Value New Value
          Description We have a stored procedure called by Java using JPA:
          StoredProcedureQuery storedProcedure = em.createStoredProcedureQuery(EXPORT_PROCEDURE_NAME);
          storedProcedure.registerStoredProcedureParameter(OUTPUT_ATTRIBUT_NAME, String.class, ParameterMode.OUT);
          storedProcedure.execute();
          String jsonResult = (String) storedProcedure.getOutputParameterValue(OUTPUT_ATTRIBUT_NAME);

          The last line raises an error:
          java.lang.ClassCastException: [B cannot be cast to java.lang.String.
          The output of our stored procedure is a string containing JSON formatted data looking like this: [{param1: info1, param2: info2}]

          This error seems similar is similar to the one reported here: https://mariadb.atlassian.net/browse/CONJ-28

          It seems that we're receiving a byte array instead of string though we're not using a secured connexion to the database.

          We have a stored procedure called by Java using JPA:
          {{StoredProcedureQuery storedProcedure = em.createStoredProcedureQuery(EXPORT_PROCEDURE_NAME);
          storedProcedure.registerStoredProcedureParameter(OUTPUT_ATTRIBUT_NAME, String.class, ParameterMode.OUT);
          storedProcedure.execute();
          String jsonResult = (String) storedProcedure.getOutputParameterValue(OUTPUT_ATTRIBUT_NAME);}}

          The last line raises an error:
          {{java.lang.ClassCastException: [B cannot be cast to java.lang.String.}}
          The output of our stored procedure is a string containing JSON formatted data looking like this: [{param1: info1, param2: info2}]

          This error seems similar is similar to the one reported here: https://mariadb.atlassian.net/browse/CONJ-28

          It seems that we're receiving a byte array instead of string though we're not using a secured connexion to the database.

          Stegle Julien Stegle made changes -
          Description We have a stored procedure called by Java using JPA:
          {{StoredProcedureQuery storedProcedure = em.createStoredProcedureQuery(EXPORT_PROCEDURE_NAME);
          storedProcedure.registerStoredProcedureParameter(OUTPUT_ATTRIBUT_NAME, String.class, ParameterMode.OUT);
          storedProcedure.execute();
          String jsonResult = (String) storedProcedure.getOutputParameterValue(OUTPUT_ATTRIBUT_NAME);}}

          The last line raises an error:
          {{java.lang.ClassCastException: [B cannot be cast to java.lang.String.}}
          The output of our stored procedure is a string containing JSON formatted data looking like this: [{param1: info1, param2: info2}]

          This error seems similar is similar to the one reported here: https://mariadb.atlassian.net/browse/CONJ-28

          It seems that we're receiving a byte array instead of string though we're not using a secured connexion to the database.

          We have a stored procedure called by Java using JPA:
          {{StoredProcedureQuery storedProcedure = em.createStoredProcedureQuery(EXPORT_PROCEDURE_NAME);}}
          {{storedProcedure.registerStoredProcedureParameter(OUTPUT_ATTRIBUT_NAME, String.class, ParameterMode.OUT);}}
          {{storedProcedure.execute();}}
          {{String jsonResult = (String) storedProcedure.getOutputParameterValue(OUTPUT_ATTRIBUT_NAME);}}

          The last line raises an error:
          {{java.lang.ClassCastException: [B cannot be cast to java.lang.String.}}
          The output of our stored procedure is a string containing JSON formatted data looking like this: [{param1: info1, param2: info2}]

          This error seems similar is similar to the one reported here: https://mariadb.atlassian.net/browse/CONJ-28

          It seems that we're receiving a byte array instead of string though we're not using a secured connexion to the database.

          Stegle Julien Stegle made changes -
          Description We have a stored procedure called by Java using JPA:
          {{StoredProcedureQuery storedProcedure = em.createStoredProcedureQuery(EXPORT_PROCEDURE_NAME);}}
          {{storedProcedure.registerStoredProcedureParameter(OUTPUT_ATTRIBUT_NAME, String.class, ParameterMode.OUT);}}
          {{storedProcedure.execute();}}
          {{String jsonResult = (String) storedProcedure.getOutputParameterValue(OUTPUT_ATTRIBUT_NAME);}}

          The last line raises an error:
          {{java.lang.ClassCastException: [B cannot be cast to java.lang.String.}}
          The output of our stored procedure is a string containing JSON formatted data looking like this: [{param1: info1, param2: info2}]

          This error seems similar is similar to the one reported here: https://mariadb.atlassian.net/browse/CONJ-28

          It seems that we're receiving a byte array instead of string though we're not using a secured connexion to the database.

          We have a stored procedure called by Java using JPA:
          {{StoredProcedureQuery storedProcedure = em.createStoredProcedureQuery(EXPORT_PROCEDURE_NAME);}}
          {{storedProcedure.registerStoredProcedureParameter(OUTPUT_ATTRIBUT_NAME, String.class, ParameterMode.OUT);}}
          {{storedProcedure.execute();}}
          {{String jsonResult = (String) storedProcedure.getOutputParameterValue(OUTPUT_ATTRIBUT_NAME);}}

          The last line raises an error:
          {{java.lang.ClassCastException: [B cannot be cast to java.lang.String.}}
          The output of our stored procedure is a string containing JSON formatted data looking like this: [{param1: info1, param2: info2}]
          Here is the header of the "show create procedure" query:
          {{STRICT_TRANS_TABLES,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION | CREATE DEFINER=`xxxx`@`localhost` PROCEDURE `EXPORT_TRANSFER_ALL`(OUT json_result TEXT)}}

          This error seems similar is similar to the one reported here: https://mariadb.atlassian.net/browse/CONJ-28

          It seems that we're receiving a byte array instead of string though we're not using a secured connexion to the database.

          Stegle Julien Stegle made changes -
          Affects Version/s 1.5.7 [ 22500 ]
          Priority Major [ 3 ] Critical [ 2 ]
          Stegle Julien Stegle made changes -
          Attachment classcast_java_exception.txt [ 43311 ]
          Attachment classcast_procedure.txt [ 43312 ]
          diego dupin Diego Dupin made changes -
          Fix Version/s 1.5.8 [ 22509 ]
          diego dupin Diego Dupin made changes -
          Status Open [ 1 ] In Progress [ 3 ]
          diego dupin Diego Dupin made changes -
          Status In Progress [ 3 ] Stalled [ 10000 ]
          diego dupin Diego Dupin made changes -
          Priority Critical [ 2 ] Major [ 3 ]
          diego dupin Diego Dupin made changes -
          Component/s Other [ 12201 ]
          Resolution Fixed [ 1 ]
          Status Stalled [ 10000 ] Closed [ 6 ]
          serg Sergei Golubchik made changes -
          Workflow MariaDB v3 [ 79525 ] MariaDB v4 [ 134951 ]

          People

            diego dupin Diego Dupin
            Stegle Julien Stegle
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Git Integration

                Error rendering 'com.xiplink.jira.git.jira_git_plugin:git-issue-webpanel'. Please contact your Jira administrators.