WebSphere Application Server & Liberty

 View Only
  • 1.  Resource Reference Not found

    Posted Mon September 18, 2023 12:27 PM

    Hi All,

    I have recently deployed an Application from Traditional WebSphere to Liberty. I was able to bring up the page but could not login duw to below message. When i checked Traditional Resource references section, i see we have resource reference mapped to it. How can i do that simialarly in Webspshere liberty server.xml. Tried below but it's not working. Can you suggest the correct syntax. Appreciate your help.

    <application-bnd>
            <resource-ref id="webapp" jndiName="ldap/ad_resource" binding-name="ldap/ad_resource" />
    </application-bnd>

    ERROR com.webapp.login.ws.LoginWebService - Could not login due to 500com.frameworks.login.dao.exception.ResourceNotFoundException: Unable to create ldap template due to: CWNEN1001E: The object referenced by the java:comp/env/ldap/ad_resource JNDI name 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



    ------------------------------
    Nagarjuna Reddy Arakala
    ------------------------------


  • 2.  RE: Resource Reference Not found

    Posted Tue September 19, 2023 06:05 AM

    Hi, You should set it in the enterprise application definition.  The moduleName must match.

    <enterpriseApplication id="myApp" location="myApp.ear" name="myApp">

    <web-bnd moduleName="My Module Name">

    <resource-ref id="ref1" name="ldap/refName" binding-name="ldap/realName"/>

    </web-bnd>

    </enterpriseApplication>

    Brian



    ------------------------------
    Brian S Paskin
    Sr. Technology Engineer
    IBM Cloud Engineering
    ------------------------------



  • 3.  RE: Resource Reference Not found

    Posted Tue September 19, 2023 08:21 AM

    Hi Brian, Thank you for checking on my post.

    I will configure this in enterprise application definition. When i checked further in WAS9 we have resource environment entries setup which is being looked up by module resource mapping. How can we configure below in Liberty. 

    WAS9 config: 

    <resources.env:ResourceEnvironmentProvider xmi:id="ResourceEnvironmentProvider_1545853691379" name="NYMP_ADResourceEnvironmentProvider" description="This is the resource provider for the AD principal that will authenticate business users of NY Manual Payments app.">

    <factories xmi:type="resources.env:ResourceEnvEntry" xmi:id="ResourceEnvEntry_1545853811120" name="NYMP_AD" jndiName="ldap/ad_resource" referenceable="Referenceable_1545853742095">

    <propertySet xmi:id="J2EEResourcePropertySet_1545853864615">

    <resourceProperties xmi:id="J2EEResourceProperty_1545853864615" name="ldapUrl" type="java.lang.String" value="ldap://LDAPGC.smbcgroup.com:3268" required="false"/>

    <resourceProperties xmi:id="J2EEResourceProperty_1545853897621" name="userDn" type="java.lang.String" value="CN=svt,OU=Services,DC=smbcgroup,DC=com" required="false"/>

    <resourceProperties xmi:id="J2EEResourceProperty_1545853939477" name="userPassword" type="java.lang.String" value="{xor}" required="false"/>

    </propertySet>

    </factories>

    <referenceables xmi:id="Referenceable_1545853742095" factoryClassname="com.smbcgroup.frameworks.login.dao.jndi.ADContextBeanFactory" classname="com.smbcgroup.frameworks.login.dao.entity.ADContextBean"/>

    </resources.env:ResourceEnvironmentProvider>



    ------------------------------
    Nagarjuna Reddy Arakala
    ------------------------------



  • 4.  RE: Resource Reference Not found

    Posted Tue September 19, 2023 10:54 AM

    Something like this.  The library of where the class is located will need to be specified.

        <jndiReferenceEntry id="My_AD" jndiName="ldap/ad_resource">
            <factory objectClassName="com.xxx.xxx.xxx.ADContextBean" className="com.xxx.xxxx.xxx.ADContextBeanFactory">
              <library filesetRef="${server.config.dir}/lib"/>
            </factory>
            <properties ldapUrl="ldap://LDAPGC.xxx.xxx:3268" userDn="CN=xxx,OU=xxxx,DC=xxx,DC=com" userPassword="yourPassword"/>
        </jndiReferenceEntry>

    You should use the Transformation Advisor to help you migrate the applications.

    Brian



    ------------------------------
    Brian S Paskin
    Sr. Technology Engineer
    IBM Cloud Engineering
    ------------------------------



  • 5.  RE: Resource Reference Not found

    Posted Tue September 19, 2023 10:02 PM

    Thank you Brian for your suggestion. I have tried the syntax mentioned below, but somehow getting the error upon login.

    Error:

    09-19-2023 21:53:52.726 INFO  com.xxxx.xxxx.CoreLoginServiceImpl - Login request for user:John
    09-19-2023 21:53:52.728 ERROR com.xxxxxx.yyyyyy.webapp.login.ws.LoginWebService - Could not login due to 500com.xxxxx.xxxxxxx.login.dao.exception.ResourceNotFoundException: Unable to create ldap template due to: CWNEN1001E: The object referenced by the java:comp/env/ldap/ad_resource JNDI name 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.

    server.xml

     <applicationManager autoExpand="true"/>
      <application location="/opt/WebSphere/Liberty/wlp/usr/servers/NY-xxxxxxx/apps/xxxxxxx_APP.ear" name="xxxxxxxx_APP" type="ear" context-root="xxxxx-webapp" autoStart="true">
              <web-bnd moduleName="xxxxx-webapp">
    <resource-ref id="N_AD" name="ldap/ad_resource" binding-name="ldap/ad_resource"/>
    </web-bnd>
    <application-bnd>
    <jndiReferenceEntry id="N_AD" jndiName="ldap/ad_resource"> <factory objectClassName="com.xxxx.xxxxx.login.dao.entity.ADContextBean" className="com.xxxx.xxxxx.login.dao.jndi.ADContextBeanFactory"> <library filesetRef="/opt/WebSphere/Liberty/wlp/usr/servers/NY-xxxxxx/apps/expanded/NY_xxxxxxx.ear/xxxxxx-webapp-0.0.1-SNAPSHOT.war/WEB-INF/lib"/> </factory> <properties ldapUrl="ldap://LDAPGC.xxxxx.com:3268" userDn="CN=svt,OU=Services,DC=xxxxxxx,DC=com" required="false" userPassword="{xor}"/> </jndiReferenceEntry>
      </application>



    ------------------------------
    Nagarjuna Reddy Arakala
    ------------------------------



  • 6.  RE: Resource Reference Not found

    Posted Wed September 20, 2023 05:36 AM

    I am not sure if the issue is the class is not found, as you should specify the jar where the classes live, or the lookup is failing.  Normally I would ask for logs and a trace, but this is not a support channel but questions channel.  Can you give me a snippet of the web.xml for the reference, and if you are using the web-bnd.xml(xmi) file, the corresponding entry?  Also, are there any errors in the log before this error?

    Brian



    ------------------------------
    Brian S Paskin
    Sr. Technology Engineer
    IBM Cloud Engineering
    ------------------------------