9 Replies Latest reply on Dec 18, 2007 1:23 AM by jaikiran

    org.jboss.resource.adapter.jdbc.WrappedCallableStatement

      I have done a lot of search and also have tried whatever I could fine but the issue could not be resoved. When I run the code I get the following error:

      Error in java.lang.ClassCastException: org.jboss.resource.adapter.jdbc.WrappedCallableStatement"

      Here is a part of the code:

      import oracle.jdbc.OracleCallableStatement;
      import oracle.jdbc.OracleTypes;
      import oracle.jdbc.pool.OracleDataSource;
      import java.lang.*;
      import java.util.*;
      import java.io.*;
      import java.sql.*;
      ............
      ........
      .....

      OracleCallableStatement cstmt = null;
      String[] orgNames = null;
      int maxTablLen = 250;
      int eleMaxLen = 100;

      try{
      ConnPool conObj = new ConnPool();
      con = conObj.getConnection();


      cstmt = (OracleCallableStatement) con.prepareCall(" begin"+
      "GETS_LMS_RECAP_DEFECTS_PKG.GETS_PL_SQL_TEST(?);"+
      " end;");

      cstmt.registerIndexTableOutParameter(1,maxTablLen,OracleTypes.VARCHAR,eleMaxLen);

      cstmt.execute();

      orgNames = (String [])cstmt.getObject(1);

      System.out.println("Number of rows= "+orgNames.length);
      for (int i=0; i<orgNames.length; i++){
      System.out.print(orgNames);
      System.out.println();
      }

      The exception is thrown prior to even executing "cstmt.execute();".
      Please advise how to fix this error?

        • 1. Re: org.jboss.resource.adapter.jdbc.WrappedCallableStatement
          jaikiran

          Try this

          import org.jboss.resource.adapter.jdbc.WrappedCallableStatement;
          import oracle.jdbc.OracleCallableStatement;
          import oracle.jdbc.OracleTypes;
          import oracle.jdbc.pool.OracleDataSource;
          import java.lang.*;
          import java.util.*;
          import java.io.*;
          import java.sql.*;
          ............
          ........
          .....
          
          OracleCallableStatement cstmt = null;
          WrappedCallableStatement wcs = null;
          String[] orgNames = null;
          int maxTablLen = 250;
          int eleMaxLen = 100;
          
          try{
           ConnPool conObj = new ConnPool();
           con = conObj.getConnection();
          
           
           wcs = (WrappedCallableStatement) con.prepareCall(" begin"+
           "GETS_LMS_RECAP_DEFECTS_PKG.GETS_PL_SQL_TEST(?);"+
           " end;");
           cstmt = (OracleCallableStatement) wcs.getUnderlyingStatement();
          cstmt.registerIndexTableOutParameter(1,maxTablLen,OracleTypes.VARCHAR,eleMaxLen);
          
          cstmt.execute();
          
          orgNames = (String [])cstmt.getObject(1);
          
          System.out.println("Number of rows= "+orgNames.length);
          for (int i=0; i<orgNames.length; i++){
           System.out.print(orgNames);
           System.out.println();
           }
          
          


          • 2. Re: org.jboss.resource.adapter.jdbc.WrappedCallableStatement

            Thank you Jaikiran for the your assistance. I am using Eclipse, I have added jboss-common-jdbc-wrapper.jar file which contains the org.jboss.resource.adapter.jdbc.WrappedCallableStatement;
            but when I try to import as follow:

            import org.jboss.resource.adapter.jdbc.WrappedCallableStatement;

            I get the following error:

            The import org.jboss.resource.adapter.jdbc.WrappedCallableStatement
            cannot be resolved.

            There are so many other classes in org.jboss.resource.adapter.jdbc and I have tried importing a few and they are imported successfully. I don't understand what's the problem with the one I need to import.

            If you (or any body) has any suggestion, please reply.

            • 3. Re: org.jboss.resource.adapter.jdbc.WrappedCallableStatement
              jaikiran

               

              "cybercollege" wrote:
              I am using Eclipse, I have added jboss-common-jdbc-wrapper.jar file which contains the org.jboss.resource.adapter.jdbc.WrappedCallableStatement;
              but when I try to import as follow:

              import org.jboss.resource.adapter.jdbc.WrappedCallableStatement;

              I get the following error:

              The import org.jboss.resource.adapter.jdbc.WrappedCallableStatement
              cannot be resolved.

              There are so many other classes in org.jboss.resource.adapter.jdbc and I have tried importing a few and they are imported successfully. I don't understand what's the problem with the one I need to import.



              Strange. This class is infact present in the jboss-common-jdbc-wrapper.jar. Which version of JBoss do you use? Does refreshing and rebuilding the project in Eclipse help?


              • 4. Re: org.jboss.resource.adapter.jdbc.WrappedCallableStatement

                I am using JBOSS version 4.0.3
                Refreshing/Redeploying does not help.

                Another point, WrappedPreparedStatement class does not contain "getUnderlyingStatement" method. There are othe java files that contain "getUnderlyingStatement" method. e.g. "WrappedPreparedStatement.java" or "WrappedStatement.java"

                Please comment.

                • 5. Re: org.jboss.resource.adapter.jdbc.WrappedCallableStatement

                  I am sorry, I meant "WrappedCallableStatement.class" file does not contain "getUnderlyingStatement" method.

                  • 6. Re: org.jboss.resource.adapter.jdbc.WrappedCallableStatement
                    jaikiran

                    The WrappedCallableStatement extends from WrappedStatement, which has the getUnderlyingStatement API. I am not sure what is causing this problem on your Eclipse setup. Can you post the exact code that you are using and also the error that you see. By the way, is there any other way, you can compile your classes, instead of using Eclipse IDE?


                    • 7. Re: org.jboss.resource.adapter.jdbc.WrappedCallableStatement

                      The code is same that I have posted earlier. I am trying to add what you have suggested. But I am unable to import

                      "import org.jboss.resource.adapter.jdbc.WrappedCallableStatement"

                      where as I am able to import for e.g.
                      "import org.jboss.resource.adapter.jdbc.WrappedStatement;"
                      AND
                      "import org.jboss.resource.adapter.jdbc.WrappedPreparedStatement;"

                      I can see that all these class files are present under "org.jboss.resource.adapter.jdbc" in Eclipse SDK package explorer.

                      It is so strange that eclipse displays "import org.jboss.resource.adapter.jdbc.WrappedCallableStatement cannot be resolved" whenever I try to import it.

                      • 8. Re: org.jboss.resource.adapter.jdbc.WrappedCallableStatement

                        Good news: I am able to import the "WrappedCallableStatement" file. The issue was due to the conflict between the same files at two different locations. Now I am having exception at the following line (Above code):

                        cstmt.registerIndexTableOutParameter(1,maxTablLen,OracleTypes.VARCHAR,eleMaxLen);

                        The exception is: "Unsupported feature".

                        Please comment.

                        • 9. Re: org.jboss.resource.adapter.jdbc.WrappedCallableStatement
                          jaikiran

                          As the message states, the feature is not supported by the Oracle driver you are using. You might have to lookup the driver documentation to see which version (if at all any) supports this.