EGL Development User Group

Expand all | Collapse all

Migrating EGL App to WebSphere Liberty using jt400

  • 1.  Migrating EGL App to WebSphere Liberty using jt400

    Posted Fri December 06, 2019 06:40 AM

    We have a number of legacy EGL apps running on RBD 9.5/9.5 and Websphere Traditional v8.5.5. Using the Websphere Configuration Migration tool, I was able to generate the following Liberty server.xml that mirrors how we are making an iSeries database connection today:

    <server>    <featureManager>        <feature>jsp-2.3</feature>        <feature>localConnector-1.0</feature>        <feature>servlet-4.0</feature>        <feature>jdbc-4.2</feature>    </featureManager>    <authData id="RDATA" password="somePassword" user="RDATA"/>    <jdbcDriver id="DB2_UDB_for_iSeries_(Toolbox)" javax.sql.DataSource="com.ibm.as400.access.AS400JDBCConnectionPoolDataSource">        <library>            <file name="${OS400_TOOLBOX_JDBC_DRIVER_PATH}/jt400.jar"/>        </library>    </jdbcDriver>    <dataSource containerAuthDataRef="RDATA" id="RDATA" jdbcDriverRef="DB2_UDB_for_iSeries_(Toolbox)" jndiName="RDATA">        <connectionManager agedTimeout="0" connectionTimeout="180" maxIdleTime="1800" maxPoolSize="10" minPoolSize="0" reapTime="180"/>    </dataSource>    <variable name="OS400_TOOLBOX_JDBC_DRIVER_PATH" value="C:\\jars"/>    <applicationMonitor updateTrigger="mbean"/>    <enterpriseApplication id="APPEAR" location="APPEAR.ear" name="APPEAR"/></server>

    I'm successfully able to add the APPEAR project to Liberty in my RBD environment. However, when I go to make my connection to the iSeries using EGL's native SQLLib.connect() function, I get the following error:

    EGL0507E An error occurred while loading the JDBC drivers.  Error: java.lang.ClassNotFoundException: org.apache.derby.jdbc.EmbeddedDriverEGL0002I The error occurred in connectionHelper processing the getConnection function.

    It seems there is some setting within RBD that wants to use a Derby connection to run on Liberty. How can I make RBD understand that it should be getting it's connection via the jt400.jar instead of the Derby instance it's trying to load?

    nmccrack


  • 2.  Re: Migrating EGL App to WebSphere Liberty using jt400

    Posted Fri December 06, 2019 11:42 AM

    Hi Nick,

    There are a number of places the datasource can be being picked up within the workspace which can conflict with your WAS Liberty entry.
    1. Check first in Preferences->EGL->SQL Database connections and if you haven't added your DB2 connection here you will see Derby selected as the default.
    You can add yours via the New Connection wizard and once done make sure to highlight it and click the apply button before closing the SQL Database connections dialog so that its definitely picked up.
    2. Check your build descriptor, eglbld file and make sure the correct datasource is defined in "Load DB options using Connection" dropdown as that will populate the respective BD options for you.
    3. There is also an option for web projects to bind your datasource ie Right click->EGL Runtime Data Source->Load values from data tools connections where you can either add the new details or, if its already defined in SQL Database connections, just select in the dropdown. This will also add the datasource reference to the web.xml file.

    Try these options first and if you still have troubles feel free to record a support case and I will be happy to arrange a remote session to walkthrough the configuration with you next week.

    Thanks and Regards

    Mark

     

    Mark Hall

     

    HCL Technologies

    RBD L2 Support

    Mark Hall


  • 3.  Re: Migrating EGL App to WebSphere Liberty using jt400

    Posted Mon December 09, 2019 06:24 AM

    Hi Mark,


    Thanks for getting back to me - I tried the suggestions above. I defined a new SQL Database Connection using the AS/400 Toolbox for Java Default, and applied it as the default. I also set that connection in both the EGL Build Descriptor and the EGL Runtime Data Source on my Web Project. When I attempt to run now, I'm seeing the following:

    EGL0506E Cannot connect to RDATA, the database URL may be wrong: No suitable driver found for RDATA

    If it's easier to discuss through a remote session I'm happy to do that - how do I go about opening a support case?

    Thanks,

    Nick

     

    nmccrack


  • 4.  Re: Migrating EGL App to WebSphere Liberty using jt400

    Posted Tue December 10, 2019 07:39 AM

    Hi Nick,

    Thanks for the reply, do you have the jt400.jar added to your Java build path?
    I need to see exactly what you are doing to figure out the problem so the following link describes the new support case creation site which includes some training videos concerning ticket creation: http://ibm.biz/Zsupport
    In  a nutshell you just need to go to https://www.ibm.com/mysupport/s/ -> Support Cases -> Open a case and fill out the form with your companies customer, ICN number.

    Once you've created the ticket if you mail me the ticket number directly at hallm@hcl.com I will pick it up and we can arrange a session for a suitable morning for you as I am EMEA based.

     

    Thanks and Regards
    Mark

    Mark Hall

    HCL Technologies
    RBD L2 Support

    Mark Hall


  • 5.  Re: Migrating EGL App to WebSphere Liberty using jt400

    Posted Mon December 16, 2019 09:06 AM

    Hi All,

    Just in case anybody else sees this issue or similar in future Nick kindly raised a support ticket for his outstanding "No suitable driver found for RDATA" error message which turned out to be a bit of a red herring as Nick then found the root cause of the error himself ie.
    Turns out I just need to define the following in my server.xml:
    <feature>jndi-1.0</feature>
    This allowed the jndi reference to the datasource to connect to my system, and everything seems to be working correctly now!

    I forgot that the omission of features in the server.xml has been a common source of WAS Liberty issues for cases I received in the past, my bad, but thanks to Nick for sharing his solution!

     

    Thanks and Regards
    Mark

    Mark Hall

    HCL Technologies
    RBD L2 Support

    Mark Hall