1 Reply Latest reply on Dec 15, 2011 11:41 AM by r.reimann

    IBM DB2 driver module requires access to package sun.io

    r.reimann Newbie

      Hi,

       

      while trying to define and use a DB2 driver module in AS 7.1.0.Beta1 i got strange exceptions from within the driver while traversing a ResultSet:

      com.ibm.db2.jcc.a.SqlException: [jcc][t4][10199][10462][4.0.100] Required character converter is not available. ERRORCODE=-4220, SQLSTATE=null
                at com.ibm.db2.jcc.a.yc.a(yc.java:55)
                at com.ibm.db2.jcc.a.yc.a(yc.java:119)
                at com.ibm.db2.jcc.a.dc.a(dc.java:1788)
                at com.ibm.db2.jcc.a.dc.n(dc.java:496)
                at com.ibm.db2.jcc.a.dc.F(dc.java:1262)
                at com.ibm.db2.jcc.a.mk.d(mk.java:938)
                at com.ibm.db2.jcc.a.mk.getString(mk.java:916)
                at com.ibm.db2.jcc.a.mk.getString(mk.java:1368)
                at org.jboss.jca.adapters.jdbc.WrappedResultSet.getString(WrappedResultSet.java:1359)
      

       

      A search in the IBM developerWorks forums (http://www.ibm.com/developerworks/forums/message.jspa?messageID=14230275) revealed that the driver tries to access the character converters inside the sun.io package. The only way i found to workaround the problem was to add the path sun/io to the dependencies within the module.xml of sun.jdk. With the module descriptors below the exception vanished.

       

      module.xml of my driver com.ibm.db2:

      <module xmlns="urn:jboss:module:1.1" name="com.ibm.db2">
        <resources>
          <resource-root path="db2jcc4.jar"/>
          <resource-root path="db2jcc_license_cu.jar"/>
        </resources>
        <dependencies>
          <module name="javax.api"/>
          <module name="javax.transaction.api"/>
          <module name="sun.jdk"/>
        </dependencies>
      </module>
      

       

      patched module.xml of the existing sun.jdk module:

      <module xmlns="urn:jboss:module:1.1" name="sun.jdk">
          <resources>
              <!-- currently jboss modules has not way of importing services from
              classes.jar so we duplicate them here -->
              <resource-root path="service-loader-resources"/>
          </resources>
          <dependencies>
              <system export="true">
                  <paths>
                      <path name="com/sun/script/javascript"/>
                      <path name="com/sun/jndi/dns"/>
                      <path name="com/sun/jndi/ldap"/>
                      <path name="com/sun/security/auth"/>
                      <path name="com/sun/security/auth/login"/>
                      <path name="com/sun/security/auth/module"/>
                      <path name="sun/io"/> <!-- manually added to provide character converter access for db2 driver -->
                      <path name="sun/misc"/>
                      <path name="sun/nio"/>
                      <path name="sun/nio/ch"/>
                      <path name="sun/util"/>
                      <path name="sun/util/calendar"/>
                      <path name="sun/security/provider"/>
                      <path name="META-INF/services"/>
                  </paths>
                  <exports>
                      <include-set>
                          <path name="META-INF/services"/>
                      </include-set>
                  </exports>
              </system>
          </dependencies>
      </module>
      

       

      Since i don't like the idea of patching the sun.jdk module descriptor i would like to ask if it is possible to apply this change for the next release of AS7 (7.1.0.CR1).

       

      Regards

      Robert