Uploaded image for project: 'OpenEJB'
  1. OpenEJB
  2. OPENEJB-2110

ClassCastException in JNDIContext.lookup() (line 465)

    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: Critical
    • Resolution: Fixed
    • Affects Version/s: 4.7.1
    • Fix Version/s: None
    • Component/s: tomee
    • Labels:
    • Environment:
      TomEE+ 1.7.1, JDBC, JNDI. I don't think OS matters in this case, nor would the fact that we're using DB2

      Description

      A bit esoteric, but I defined a datasource in TomEE (using tomee.xml) and deployed my app along with the datasource. I then wrote a quick throwaway app (as a test to prove out an issue I was troubleshooting) that grabbed an org.apache.openejb.client.RemoteInitialContextFactory and attempted to look the datasource up. When I ran this, I get the following:

      Exception in thread "main" java.lang.ClassCastException: org.apache.openejb.client.ThrowableArtifact cannot be cast to java.lang.Error
      at org.apache.openejb.client.JNDIContext.lookup(JNDIContext.java:465)
      at javax.naming.InitialContext.lookup(InitialContext.java:411)

      A bit of debugging through the source showed that the original error generated was this:

      JNDI_ERROR:java.lang.NoSuchMethodException: org.apache.openejb.resource.jdbc.managed.local.ManagedDataSource.getDriverClass().

      Of course, the NoSuchMethodException implements Throwable, which is implemented by Error. Perhaps casting the return of getResult() to Throwable might be a better approach?

      I can try to take a look at this if you want...just let me know.

        Attachments

          Activity

            People

            • Assignee:
              romain.manni-bucau Romain Manni-Bucau
              Reporter:
              ckujawa Chris Kujawa
            • Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: