IBM Support

PI74321: After upgrade to 16.0.0.4. NamingException and ClassCastException occur on JNDI lookup on IBM i

Fixes are available

17.0.0.1: WebSphere Application Server Liberty 17.0.0.1
17.0.0.2: WebSphere Application Server Liberty 17.0.0.2
17.0.0.3: WebSphere Application Server Liberty 17.0.0.3
17.0.0.4: WebSphere Application Server Liberty 17.0.0.4
18.0.0.1: WebSphere Application Server Liberty 18.0.0.1
18.0.0.2: WebSphere Application Server Liberty 18.0.0.2
18.0.0.3: WebSphere Application Server Liberty 18.0.0.3
18.0.0.4: WebSphere Application Server Liberty 18.0.0.4
19.0.0.1: WebSphere Application Server Liberty 19.0.0.1
19.0.0.2: WebSphere Application Server Liberty 19.0.0.2
19.0.0.3: WebSphere Application Server Liberty 19.0.0.3
19.0.0.4: WebSphere Application Server Liberty 19.0.0.4
19.0.0.5: WebSphere Application Server Liberty 19.0.0.5
19.0.0.6: WebSphere Application Server Liberty 19.0.0.6
19.0.0.7: WebSphere Application Server Liberty 19.0.0.7
19.0.0.8: WebSphere Application Server Liberty 19.0.0.8
19.0.0.9: WebSphere Application Server Liberty 19.0.0.9
19.0.0.10: WebSphere Application Server Liberty 19.0.0.10
19.0.0.11: WebSphere Application Server Liberty 19.0.0.11
19.0.0.12: WebSphere Application Server Liberty 19.0.0.12
20.0.0.1: WebSphere Application Server Liberty 20.0.0.1
20.0.0.2: WebSphere Application Server Liberty 20.0.0.2
20.0.0.3: WebSphere Application Server Liberty 20.0.0.3
20.0.0.4: WebSphere Application Server Liberty 20.0.0.4
20.0.0.5: WebSphere Application Server Liberty 20.0.0.5
20.0.0.6: WebSphere Application Server Liberty 20.0.0.6
20.0.0.7: WebSphere Application Server Liberty 20.0.0.7
20.0.0.8: WebSphere Application Server Liberty 20.0.0.8
20.0.0.9: WebSphere Application Server Liberty 20.0.0.9
20.0.0.10: WebSphere Application Server Liberty 20.0.0.10
20.0.0.11: WebSphere Application Server Liberty 20.0.0.11
20.0.0.12: WebSphere Application Server Liberty 20.0.0.12
21.0.0.3: WebSphere Application Server Liberty 21.0.0.3
21.0.0.4: WebSphere Application Server Liberty 21.0.0.4
21.0.0.5: WebSphere Application Server Liberty 21.0.0.5
21.0.0.6: WebSphere Application Server Liberty 21.0.0.6
21.0.0.7: WebSphere Application Server Liberty 21.0.0.7
21.0.0.8: WebSphere Application Server Liberty 21.0.0.8
21.0.0.9: WebSphere Application Server Liberty 21.0.0.9
21.0.0.1: WebSphere Application Server Liberty 21.0.0.1
21.0.0.2: WebSphere Application Server Liberty 21.0.0.2
21.0.0.10: WebSphere Application Server Liberty 21.0.0.10
21.0.0.11: WebSphere Application Server Liberty 21.0.0.11
21.0.0.12: WebSphere Application Server Liberty 21.0.0.12
22.0.0.1: WebSphere Application Server Liberty 22.0.0.1
22.0.0.2: WebSphere Application Server Liberty 22.0.0.2
22.0.0.3: WebSphere Application Server Liberty 22.0.0.3
22.0.0.4: WebSphere Application Server Liberty 22.0.0.4

Subscribe

You can track all active APARs for this component.

 

APAR status

  • Closed as program error.

Error description

  • After upgrade to WebSphere Liberty latest 16.0.0.4. from
    16.0.0.2/16.0.0.3,  encountered javax.naming.NamingException
    and
    and java.lang.ClassCastException when web application tried
    JNDI
    lookup for DB2 IBM i (aka iSeries, AS/400) Toolbox for Java
    JDBC Driver
    datasource. Those exceptions appears message.log etc. This
    issue is not
    recreated on 16.0.0.2 and 16.0.0.3 so it looks like that
    this
    issue
    occurs latest 16.0.0.4 only.
    
    .
    We are able to recreate this issue in following.
    
    .
    1. Create liberty profile simple server configuration.
    server create <servername>
    
    .
    2. Modify server.xml for using Toolbox for Java JDBC data
    source.
    - Add JDBC data source definition
    <dataSource id="DefaultDataSource"
    jndiName="jdbc/db2iToolbox">
    <jdbcDriver libraryRef="DB2iToolboxLib"/>
    <properties.db2.i.toolbox password="password"
    user="username"
    serverName="hostname" databaseName="databasename"/>
    </dataSource>
    <library id="DB2iToolboxLib">
    <fileset dir="/home/user/jt400/lib"
    includes="jt400.jar"/>
    </library>
    
    .
    3. Put sample application contents to <servername>/dropins
    
    .
    4. Start liberty profile server.
    server start <servername>
    
    .
    5. When web client access to sample application, then you
    can
    receive
    Error404 and java.lang.ClassCastException etc. And you can
    see
    following output in message.log etc.
    
    .
    <<< Pickup from message.log file >>>
    
    javax.naming.NamingException: CWNEN1001E: The object
    referenced
    by the
    java:comp/env/jdbc/db2_1 JNDI could not be instantiated. If
    the
    reference name maps to a JNDI name in the deployment
    descriptor
    bindings for the application performing the JNDI lookup,
    make
    sure
    that the JNDI name mapping in the deployment descriptor
    binding
    is
    correct. If the JNDI name mapping is correct, make sure the
    target
    resource can be resolved with the specified name relative to
    the
    default initial context. [Root exception is
    com.ibm.wsspi.injectionengi
    ne.InjectionException: CWNEN0030E: The
    java:comp/env/jdbc/db2_1
    factory encountered a problem getting the object instance
    CWNEN1006E:
    The server was unable to obtain an object for the jdbc/db2_1
    binding
    with the javax.sql.DataSource type. The exception message
    was:
    java.lang.ClassCastException: java.lang.Boolean incompatible
    with java.lang.String binding object. The exception message
    was: {2}
    at
    com.ibm.ws.injectionengine.osgi.internal.naming.InjectionJav
    aCol
    onHelper
    .newCannotInstantiateObjectException(InjectionJavaColonHelpe
    r.ja
    va:183)
    at
    com.ibm.ws.injectionengine.osgi.internal.naming.InjectionJav
    aCol
    onHelper
    .getObjectInstance(InjectionJavaColonHelper.java:118)
    at
    com.ibm.ws.jndi.url.contexts.javacolon.internal.JavaURLConte
    xt.l
    ookup(Ja
    vaURLContext.java:333)
    at
    com.ibm.ws.jndi.url.contexts.javacolon.internal.JavaURLConte
    xt.l
    ookup(Ja
    vaURLContext.java:371)
    at
    org.apache.aries.jndi.DelegateContext.lookup(DelegateContext
    .jav
    a:161)
    at
    javax.naming.InitialContext.lookup(InitialContext.java:428)
    at
    jp.co.his.af.AFAbstractBaseAction.execute(AFAbstractBaseActi
    on.j
    ava:228)
    at
    org.apache.struts.chain.commands.servlet.ExecuteAction.execu
    te(E
    xecuteAc
    tion.java:58)
    :
    at
    org.apache.struts.action.ActionServlet.doGet(ActionServlet.j
    ava:
    449)
    at
    javax.servlet.http.HttpServlet.service(HttpServlet.java:687)
    at
    javax.servlet.http.HttpServlet.service(HttpServlet.java:790)
    at
    com.ibm.ws.webcontainer.servlet.ServletWrapper.service(Servl
    etWr
    apper.ja
    va:1290)
    :
    

Local fix

  • The basic problem, is that when using
    <properties.db2.i.toolbox> in the
    datasource config definition, the lookup of a specific property
    is
    returning a boolean value but casting to a string. A recent
    change in
    16.0.0.4 has exposed this problem. As a potential workaround,
    the custom
    should be able to use the generic <properties> entry instead of
    
    <properties.db2.i.toolbox>. This should get the customer past
    this
    issue.
    

Problem summary

  • ****************************************************************
    * USERS AFFECTED:  All users of IBM WebSphere Application      *
    *                  Server Liberty                              *
    ****************************************************************
    * PROBLEM DESCRIPTION: java.lang.ClassCastException when using *
    *                      properties.db2.i.toolbox configuration  *
    *                      element.                                *
    ****************************************************************
    * RECOMMENDATION:                                              *
    ****************************************************************
    A ClassCastException is seen when configuring a dataSource
    element that uses a properties.db2.i.toolbox element. For
    example:
    
    <dataSource ...>
        <properties.db2.i.toolbox ... />
    </dataSource>
    
    The exception shows the following:
    
    java.lang.ClassCastException: java.lang.Boolean incompatible
    with java.lang.String
    		 at
    com.ibm.ws.rsadapter.spi.DB2iToolboxHelper.<init>(DB2iToolboxHel
    per.java:69)
    		 at
    com.ibm.ws.rsadapter.spi.WSManagedConnectionFactoryImpl.createDa
    tabaseHelper(WSManagedConnectionFactoryImpl.java:397)
    		 at
    com.ibm.ws.rsadapter.spi.WSManagedConnectionFactoryImpl.<init>(W
    SManagedConnectionFactoryImpl.java:322)
    		 at
    com.ibm.ws.jdbc.DataSourceService.init(DataSourceService.java:49
    4)
    		 at
    com.ibm.ws.jca.cm.AbstractConnectionFactoryService$2.run(Abstrac
    tConnectionFactoryService.java:412)
    		 at
    com.ibm.ws.jca.cm.AbstractConnectionFactoryService$2.run(Abstrac
    tConnectionFactoryService.java:409)
    		 at
    java.security.AccessController.doPrivileged(AccessController.jav
    a:650)
    		 at
    com.ibm.ws.jca.cm.AbstractConnectionFactoryService.initPrivilege
    d(AbstractConnectionFactoryService.java:409)
    		 at
    com.ibm.ws.jca.cm.AbstractConnectionFactoryService.createResourc
    e(AbstractConnectionFactoryService.java:137)
    		 at
    com.ibm.ws.injectionengine.osgi.internal.IndirectJndiLookupObjec
    tFactory.createResourceWithFilterPrivileged(IndirectJndiLookupOb
    jectFactory.java:384)
    		 at
    com.ibm.ws.injectionengine.osgi.internal.IndirectJndiLookupObjec
    tFactory.access$100(IndirectJndiLookupObjectFactory.java:58)
    		 at
    com.ibm.ws.injectionengine.osgi.internal.IndirectJndiLookupObjec
    tFactory$3.run(IndirectJndiLookupObjectFactory.java:366)
    		 at
    java.security.AccessController.doPrivileged(AccessController.jav
    a:650)
    		 at
    com.ibm.ws.injectionengine.osgi.internal.IndirectJndiLookupObjec
    tFactory.createResourceWithFilter(IndirectJndiLookupObjectFactor
    y.java:363)
    		 at
    com.ibm.ws.injectionengine.osgi.internal.IndirectJndiLookupObjec
    tFactory.createResource(IndirectJndiLookupObjectFactory.java:339
    )
    		 at
    com.ibm.ws.injectionengine.osgi.internal.IndirectJndiLookupObjec
    tFactory.getObjectInstance(IndirectJndiLookupObjectFactory.java:
    135)
    		 at
    com.ibm.ws.injectionengine.osgi.internal.IndirectJndiLookupObjec
    tFactory.getObjectInstance(IndirectJndiLookupObjectFactory.java:
    101)
    		 at
    com.ibm.wsspi.injectionengine.InjectionBinding.getInjectionObjec
    tInstance(InjectionBinding.java:1556)
    		 at
    com.ibm.wsspi.injectionengine.InjectionBinding.getInjectionObjec
    t(InjectionBinding.java:1433)
    		 at
    com.ibm.wsspi.injectionengine.InjectionBinding.getInjectableObje
    ct(InjectionBinding.java:1373)
    		 at
    com.ibm.wsspi.injectionengine.InjectionTarget.inject(InjectionTa
    rget.java:108)
    		 at
    com.ibm.ws.webcontainer.osgi.webapp.WebApp.injectTargets(WebApp.
    java:1350)
    		 at
    com.ibm.ws.webcontainer.osgi.webapp.WebApp.inject(WebApp.java:12
    76)
    		 at
    com.ibm.ws.webcontainer.osgi.webapp.WebApp.injectAndPostConstruc
    t(WebApp.java:1423)
    		 at
    com.ibm.ws.webcontainer.osgi.webapp.WebApp.injectAndPostConstruc
    t(WebApp.java:1411)
    		 at
    com.ibm.ws.webcontainer.osgi.servlet.ServletWrapper.createTarget
    (ServletWrapper.java:64)
    		 at
    com.ibm.ws.webcontainer.servlet.ServletWrapper$1.run(ServletWrap
    per.java:1570)
    		 at
    java.security.AccessController.doPrivileged(AccessController.jav
    a:650)
    		 at
    com.ibm.ws.webcontainer.servlet.ServletWrapper.loadServlet(Servl
    etWrapper.java:1538)
    		 at
    com.ibm.ws.webcontainer.servlet.ServletWrapper.handleRequest(Ser
    vletWrapper.java:622)
    		 at
    com.ibm.ws.webcontainer.servlet.ServletWrapper.handleRequest(Ser
    vletWrapper.java:475)
    		 at
    com.ibm.ws.webcontainer.filter.WebAppFilterManager.invokeFilters
    (WebAppFilterManager.java:1157)
    		 at
    com.ibm.ws.webcontainer.webapp.WebApp.handleRequest(WebApp.java:
    4956)
    		 at
    com.ibm.ws.webcontainer31.osgi.webapp.WebApp31.handleRequest(Web
    App31.java:525)
    		 at
    com.ibm.ws.webcontainer.osgi.DynamicVirtualHost$2.handleRequest(
    DynamicVirtualHost.java:315)
    		 at
    com.ibm.ws.webcontainer.WebContainer.handleRequest(WebContainer.
    java:1014)
    		 at
    com.ibm.ws.webcontainer.osgi.DynamicVirtualHost$2.run(DynamicVir
    tualHost.java:280)
    		 at
    com.ibm.ws.http.dispatcher.internal.channel.HttpDispatcherLink$T
    askWrapper.run(HttpDispatcherLink.java:967)
    ...
    

Problem conclusion

Temporary fix

  • Use the generic <properties .../> configuration element instead
    of the specialized <properties.db2.i.toolbox ... />
    configuration element.
    

Comments

APAR Information

  • APAR number

    PI74321

  • Reported component name

    LIBERTY PROFILE

  • Reported component ID

    5724J0814

  • Reported release

    CD0

  • Status

    CLOSED PER

  • PE

    NoPE

  • HIPER

    NoHIPER

  • Special Attention

    NoSpecatt / Xsystem

  • Submitted date

    2017-01-03

  • Closed date

    2017-01-31

  • Last modified date

    2017-01-31

  • APAR is sysrouted FROM one or more of the following:

    SE66441

  • APAR is sysrouted TO one or more of the following:

Fix information

  • Fixed component name

    LIBERTY PROFILE

  • Fixed component ID

    5724J0814

Applicable component levels

  • RCD0 PSY

       UP

[{"Business Unit":{"code":"BU059","label":"IBM Software w\/o TPS"},"Product":{"code":"SSEQTP","label":"WebSphere Application Server"},"Platform":[{"code":"PF025","label":"Platform Independent"}],"Version":"CD0","Line of Business":{"code":"LOB45","label":"Automation"}}]

Document Information

Modified date:
04 May 2022