EGL Development User Group

EGL Development User Group

EGL Development User Group

The EGL Development User Group is dedicated to sharing news, knowledge, and insights regarding the EGL language and Business Developer product. Consisting of IBMers, HCL, and users, this community collaborates to advance the EGL ecosystem.

 View Only
Expand all | Collapse all

Beginning EGL Project Development - Tomcat 8

  • 1.  Beginning EGL Project Development - Tomcat 8

    Posted Wed February 22, 2023 09:31 AM

    Okay, this is my last question for the night.  It's late.  :)  I couldn't seem to get Liberty up and running so I dropped back to my old faithful Tomcat.  RBD allowed me to configure a runtime environment for Tomcat 8 with EGL Debugging, so I went for that.  That created a Tomcat instance and then, with a little sleuthing, I was able to get the standard Tomcat management applications working, so I know that Tomcat is deployed correctly.  However, as soon as I add my simple EGL web service project to Tomcat, I get a severe error and it won't start:

    SEVERE: A child container failed during start
    (...)
    Caused by: java.lang.NoClassDefFoundError: org.apache.commons.logging.Log

    I've tried putting the logging jar in every folder I could find, and just couldn't get it to work.  I'm calling it an evening, but if someone has successfully deployed an EGL web service to a local Tomcat 8 instance, I'd love to hear how you did it.  Thank you!



    ------------------------------
    Joe Pluta
    ------------------------------



  • 2.  RE: Beginning EGL Project Development - Tomcat 8

    Posted Fri February 24, 2023 02:34 AM

    Hello Joe,

    Welcome back!

    When using Tomcat in RBD the first thing is to Install a clean Tomcat 8 of 9 server (seperate from RBD). 
    My tomcat 8 for example is located in:
    C:\tomcats\8.0.53
    In C:\tomcats\8.0.53\lib are also the extra libraries my standalone Tomcat uses.
    here are the log4j* .jar files, the mail.jar the commons* .jar
    When it's possible to start it and see the example page, it's time to connect it in RBD. 
    So i start RBD en goto preferences and choose : Server -  Runtime Environments.

    Then i add the server...


    I configure the server.xml, context.xml web.xml and the tomcat-users.xml
    And i start the server.  At that point i don't get any errors.



    ------------------------------
    Jeroen Dielemans
    DMG
    Waalwijk
    ------------------------------



  • 3.  RE: Beginning EGL Project Development - Tomcat 8

    Posted Fri February 24, 2023 02:59 PM

    Thanks, Jeroen, I appreciate the feedback.   I'll start with a clean Tomcat installation.  In fact, I think I'll start with a fresh workspace and see where I get.



    ------------------------------
    Joe Pluta
    ------------------------------



  • 4.  RE: Beginning EGL Project Development - Tomcat 8

    Posted Sun February 26, 2023 11:10 PM

    Hello again, Jeroen!  Here's where I am right now.

    1. I installed a clean Tomcat 8.5.86, it runs fine when I start/stop it from the base folder (C:\Apache\apache-tomcat-8.5.86 on my machine).  I had to change the JAVA_HOME in my catalina.properties, and then add a manager role to tomcat-users.xml, and everything is running fine.  I can start at //127.0.0.1:8080 and get to all the standard Tomcat-supplied applications.

    2. I then created a server in my RBD workspace.  It started, but the home page didn't come up.  So I copied my webapps folder from the Tomcat installation to my workspace, in .metadata (down in org.eclipse.wst.server.core).  Now I see the home page and can get to manager app so everything seems to be working.

    3. I created a simple service using the tutorial from here: https://www.ibm.com/docs/en/rbd/9.7?topic=learn-create-hello-world-service-egl.  When I generate it, RBD tries to deploy but I get the error "java.lang.NoClassDefFoundError: org.apache.commons.logging.Log" and the application won't deploy.

    So, I'm not sure what I did wrong, but it looks like I'm missing some sort of configuration.  You said "I configure the server.xml, context.xml web.xml and the tomcat-users.xml".  I haven't changed server.xml or context.xml, so maybe that's something I'm missing.  But I just can't figure out why it can't find the Log class.



    ------------------------------
    Joe Pluta
    ------------------------------



  • 5.  RE: Beginning EGL Project Development - Tomcat 8

    Posted Mon February 27, 2023 02:40 AM

    Hello Joe,
    Okay, thanks for your detailed explanation. 
    Now i understand that the deploy you are talking about isn't the one to the tomcat server but much earlier.
    It's the moment that the service is deployed (and the wsdl is generated if it is a soap service).
    I 'm curious which Java settings you have in Preferences - Compiler.

    and JDK



    Maybe also some settings are needed for Tomcat later on, but for now we have to be sure that there are no errors anymore in EGL Deployment results



    ------------------------------
    Jeroen Dielemans
    DMG
    Waalwijk
    ------------------------------



  • 6.  RE: Beginning EGL Project Development - Tomcat 8

    Posted Mon February 27, 2023 04:38 PM

    Hi Jeroen!  I think I may have misled you.  The project is generating successfully, just not deploying to Tomcat.  I get errors in Tomcat startup.  Let me illustrate:

    My configuration:

    This matches yours, I think.  Then I create the simple HelloService project:

    As you can see, the project looks complete, and the WEB-INF/lib folder contains all of my JAR files.  When I generate, the generation is successful, as are the initial deployment functions:

    Then RBD attempts to automatically deploy the project to my Tomcat server and start it, and that's where I get the error:

    And that seems to be coming from the Tomcat startup.  Here is the beginning and end of the error dump:

    So I think I'm doing the basic configuration and setup correctly.  I think I'm writing the code correctly and I think the generation is successful.  I think the application is being deployed to the server completely.  I even went and looked in wtpwebapps folder in .metadata for my EGLService project and saw that the WEB-INF/lib folder is correct:

    So everything looks good, but Tomcat won't start.  It seems to be trying to verify the EGLService application and getting a ClassNotFoundException.  And I only assume it's the EGLService application because if I remove the application, Tomcat starts fine.

    A final piece to this is that when I tried to manually deploy this application to my base Tomcat installation (by copying the EGLService folder from wtpwebapps to my Tomcat installation folder), Tomcat startup got the same error, although it wasn't fatal and Tomcat started, but EGLService was not running.

    org.apache.catalina.LifecycleException: Failed to start component [StandardEngine[Catalina].StandardHost[localhost].StandardContext[/EGLService]]

    I'm stumped, Jeroen.  Thanks for taking the time to comment as I fight through this!

     



    ------------------------------
    Joe Pluta
    ------------------------------



  • 7.  RE: Beginning EGL Project Development - Tomcat 8

    Posted Tue February 28, 2023 03:56 AM

    Hello Joe,

    Okay your lib folder is very empty, and is see the old JaxRPC protocol (i expected the JAXWS or the JAX WS CXF libraries).

    Now my steps:
    1. Create new EGL project . Type web project. Next.
    2. I select the tomcat as target runtime and choose: show advanced settings. Next,  Next,  Next.
    3. I select: Generate web.xml deployment descriptor (needed for Tomcat!)
    4. i create packages for interfaces and services
    5. i create the interface.
    6. i choose the package and select: New service.


    7. i select the interface, and select: Create as web (SOAP) service
    8. Now i check if the wsdl is already there and it is, and i see that a lot of libraries are added.


    8. i add the project via add/remove  and start the server
    9. i test it via: http://localhost:8080/EGLService/services/HelloService?wsdl



    ------------------------------
    Jeroen Dielemans
    DMG
    Waalwijk
    ------------------------------



  • 8.  RE: Beginning EGL Project Development - Tomcat 8

    Posted Tue February 28, 2023 04:36 PM

    Hi Jeroen!  I have no idea what to do next.  There must be some configuration setting that I am missing, but I don't know where it could be.  I'm trying to create a trial application to get a purchase approved and I can't get past this.



    ------------------------------
    Joe Pluta
    ------------------------------



  • 9.  RE: Beginning EGL Project Development - Tomcat 8

    Posted Thu March 02, 2023 03:43 AM

    Hello Joe,

    We are using EGL (with Rich UI) for about 15 years now. So it must be something small which is not working.
    If you follow the steps i described at what point you see a difference? 



    ------------------------------
    Jeroen Dielemans
    DMG
    Waalwijk
    ------------------------------



  • 10.  RE: Beginning EGL Project Development - Tomcat 8

    Posted Thu March 02, 2023 10:01 AM

    Thanks for your time with this, Jeroen.  As soon as I have a free hour, I'm going to start over with a clean workspace.  I'll follow your steps as closely as I can.  But the biggest obvious difference is that I don't get all the libraries in the WEB-INF/lib folder of my EGLService project, and I don't know why that would be.



    ------------------------------
    Joe Pluta
    ------------------------------



  • 11.  RE: Beginning EGL Project Development - Tomcat 8

    Posted Mon February 27, 2023 02:45 AM
    Edited by Jeroen Dielemans Mon February 27, 2023 02:46 AM

    one thing i forgot: also important: which type of EGL project did you choose? Web project is needed!



    ------------------------------
    Jeroen Dielemans
    DMG
    Waalwijk
    ------------------------------



  • 12.  RE: Beginning EGL Project Development - Tomcat 8

    Posted Fri March 03, 2023 10:11 AM

    Hi Joe,

    Where did you put your apache-commons jarfile?

    Put it in your server's lib-folder and restart to see if that helps.

    Best regards,

    Bernd

    ASIST.



    ------------------------------
    Bernd van Oostrum
    Leuven
    32478808505
    ------------------------------



  • 13.  RE: Beginning EGL Project Development - Tomcat 8

    Posted Wed March 08, 2023 09:29 PM

    Hi Bernd!  Thanks for your input.  It's been a really difficult week so I haven't gotten much done.  But let me see if I have some basic assumptions correct.  First, I assume that the base folder for the Tomcat test server under RBD is down in my workspace.  Specifically, it's in the .metadata/.plugins/org.eclipse.wst.server.core folder, in a subfolder named tmp0 (or tmp1, or tmp2, etc.).  There is one tmpN folder for each server.  Under my tmp0 folder, I have conf and logs just like I would expect in any normal Tomcat configuration.  Interestingly, there is no lib folder at that level.  Then, where I would expect to see a webapps folder with a folder for my MyService application, I instead see an empty webapps folder and a folder named wtpwebapps, which contains the MyService folder.  I assume that wtpwebapps is just some sort of naming convention that IBM uses for the deployed applications.

    Given those assumptions, that tells me I should find my libs under MyService/WEB-INF/lib, and I do.  However, when RBD starts Tomcat, I get the noClassDefFound error.  I did try copying lib from WEB-INF to the tmp0 folder, but that didn't work either.  I even tried copying the apache logging jar to my base Tomcat installation's lib folder, but that didn't help.

    So the question is, given my very simple workspace and project setup, how do I configure the MyService project to find its own jar files?  It doesn't seem to want to load them from its WEB-INF/lib folder.  I assume that some files under tmp0 tell my RBD Tomcat server how to load its applications, but I am out of ideas.



    ------------------------------
    Joe Pluta
    ------------------------------



  • 14.  RE: Beginning EGL Project Development - Tomcat 8

    Posted Fri March 31, 2023 07:40 AM

    Hi Joe,

    May I request you to raise a support ticket and send us their workspace directory and Tomcat directory for further investigation.

    Thanks,
    Kushagra Goyal
    Development Manager, RBD



    ------------------------------
    Kushagra Goyal
    ------------------------------



  • 15.  RE: Beginning EGL Project Development - Tomcat 8

    Posted Mon April 03, 2023 06:25 PM

    Thank you, Kushagra!  And thank you for all the help this morning.  I wanted to post here the same thing I sent to you as an email, that after putting the correct JAR files into my Tomcat environment that everything is now working right up until I try to use the service.  The RUI handler works correctly, but the call to the EGL service fails with a Java connection error.  This may be a firewall issue, but I don't know how to check.  Perhaps someone on the thread can help.  I will reach out to my operations team as well; our laptop firewalls are under corporate administration.

    Apr 3, 2023, 5:23:18 PM.1  EGL1621E:EGL1621E An error occurred while trying to invoke function:sayHello on WebService:http://localhost:9080/EGLServer/services/HelloService.
    EGL0001I The error occurred in EGL Rich UI Proxy.
        detail1:500
        detail2:FAILED
        detail3:java.net.ConnectException: Connection refused: connect



    ------------------------------
    Joe Pluta
    ------------------------------



  • 16.  RE: Beginning EGL Project Development - Tomcat 8

    Posted Mon April 03, 2023 06:49 PM

    Hi Joe,
    Glad to read you made some progress.
    I guess that the service is not deployed correctly. Can you start a browser and open http://localhost:9080/EGLServer/services/HelloService

    You should see "hello I'm a service".
    I don't think this is a firewall-issue.

    Best regards,
    Bernd
    ASIST



    ------------------------------
    Bernd van Oostrum
    Leuven
    32478808505
    ------------------------------



  • 17.  RE: Beginning EGL Project Development - Tomcat 8

    Posted Tue April 04, 2023 04:27 PM

    Hi Bernd!  As it turns out, the default port for Tomcat is 8080, and once I configured that it worked properly.  I also worked with several folks from HCL who walked me through the problem with my JAR files (it turns out that RBD expects a specific version of the logging JAR file and I just had to add that to my Tomcat installation).  So right now I'm happily creating RUI handlers that talk to a service.  The next step will be to get that service to call a program on the IBM i.



    ------------------------------
    Joe Pluta
    ------------------------------



  • 18.  RE: Beginning EGL Project Development - Tomcat 8

    Posted Tue April 04, 2023 06:49 PM

    Hi Joe,

    I guess you want to call CICS-modules?
    You'll need to dive into CICS Transaction Gateway (configure TCPIP on iSeries + install and configure the product on windows), and use linkage options in the builddescripter.
    First steps will be hard but once it is done it works great.

    Regards,
    Bernd
    ASIST



    ------------------------------
    Bernd van Oostrum
    Leuven
    32478808505
    ------------------------------



  • 19.  RE: Beginning EGL Project Development - Tomcat 8

    Posted Wed April 05, 2023 01:54 PM

    Hi Bernd!  Actually, back when I did this 10 years ago the iSeries linkage part allowed direct calls to ILE programs, and hopefully it works the same way for the IBM i.  If so, it uses the JT400 JAR and it's very good about passing Record parts directly as data structures.



    ------------------------------
    Joe Pluta
    ------------------------------



  • 20.  RE: Beginning EGL Project Development - Tomcat 8

    Posted Thu April 06, 2023 11:55 AM

    You're right Joe. 
    JAVA400 in the linkage options is perfect to call programs on iSeries, no need to dive into CTG :)

    Regards,
    Bernd.



    ------------------------------
    Bernd van Oostrum
    Leuven
    32478808505
    ------------------------------



  • 21.  RE: Beginning EGL Project Development - Tomcat 8

    Posted Fri April 07, 2023 07:20 PM

    Hi Joe,
    jt400.jar still works, and we can still pass EGL records (as well as arrays, strings, and other datatypes) as parameters to the remote EGL called  program using the catcher mechanism. Let us know if you run into any issues there.



    ------------------------------
    Dev Banerjee
    RBD Development
    ------------------------------



  • 22.  RE: Beginning EGL Project Development - Tomcat 8

    Posted Sun April 09, 2023 01:26 AM

    Okay, Dev, I give up for now.  I've tried everything to get a call to ILE to work, but I have not been unsuccessful.  Every time my service attempts to call the ILE program (TEST1), I get this error:

    Apr 9, 2023, 12:18:15 AM.0  EGL1621E:EGL1621E An error occurred while trying to invoke function:sayHello on WebService:http://localhost:8080/EGLServer/services/HelloService.
    EGL0001I The error occurred in EGL Rich UI Proxy.
        detail1:500
        detail2:FAILED
        detail3:java.rmi.RemoteException: EGL0150E An error occurred calling the TEST1 program. Error: EGL0006E An error occurred while creating an object of the services.TEST1 type. The following error occurred: java.lang.ClassNotFoundException: services.TEST1.
    EGL0001I The error occurred in HelloService_Impl.

    I use this call:

    Call "TEST1"(Test1Parm) {isExternal = yes, linkageKey = TEST1};

    I have tried many times with different call syntax, including no options at all.  My LinkagePart looks good:


    As far as I can guess, the error is from this generated code:

            // Call "TEST1"(Test1Parm) {isExternal = yes, linkageKey = TEST1};
            ezeProgram._runUnit().getCallers().localCall( "TEST1",
                new com.ibm.javart.JavartSerializable[] {
                    Test1Parm
                },
                null, "services", ezeProgram );

    No matter what I do, the service generates a call to localCall, which I believe is what is causing the error, but that's just a wild guess on my part.  Any help at this point would be appreciated.



    ------------------------------
    Joe Pluta
    ------------------------------



  • 23.  RE: Beginning EGL Project Development - Tomcat 8

    Posted Sun April 09, 2023 09:42 PM

    Hi Joe,
    I am assuming you are calling a service that is deployed on Tomcat, from a RUI client, and that service calls an ILE program using jt400.
    If so, can first call the ILE program directly from RUI, to make sure there is no configuration issue on the iSeries. 
    What kind of ILE program are you calling? Something generated from EGL or a natively written program?
    Thanks



    ------------------------------
    Dev Banerjee
    RBD Development
    ------------------------------



  • 24.  RE: Beginning EGL Project Development - Tomcat 8

    Posted Sun April 09, 2023 10:36 PM

    Hi Dev!  It's been a long time since I did this, and when I was writing EGL code my RUI project was always separate from the web project that called the ILE code on the IBM i.  And that's how the RUI tutorial I have works.  It calls a service like this:

        helloService HelloService {@bindService};
        call helloservice.SayHello(Fnamesr, Lnamesr, citysr)
             returning to Service_output
             onException servicelib.serviceExceptionHandler;

    This works today.  What fails is when in my EGL web service, I add code to try to call the ILE program like this:

            SysLib.setRemoteUser("MYUSER", "MYPWD");
            call "TEST1" (Test1Parm) { LinkageKey = "TEST1", IsExternal = YES };

    It's seems to me that you're saying that I can call the ILE program (this is a native RPG program) directly from my RUI application.  How would I do that?  Do I set up a linkage part in the RUI and execute the call instruction?  Because I don't see how the RUI application can directly invoke the ILE program, since it's just running Javascript in the browser.  It has to go to the application on the web server, which in turns invokes the JT400 routines.



    ------------------------------
    Joe Pluta
    ------------------------------



  • 25.  RE: Beginning EGL Project Development - Tomcat 8

    Posted Mon April 10, 2023 11:46 AM

    Hi Joe,
    Can you export your projects to a zip file and attach here. The scenario seems simple enough so that we could try to recreate ourselves.
    Thanks



    ------------------------------
    Dev Banerjee
    RBD Development
    ------------------------------



  • 26.  RE: Beginning EGL Project Development - Tomcat 8

    Posted Mon April 10, 2023 05:07 PM

    I'll try to do that tonight, Dev.  I will make a really simple workspace with only a web project.  In that project, I'll create a service, and that service will call attempt to call an RPG program using the standard EGL "call" syntax.  I'll add the LinkagePart and the Native Binding and see if either of those work.  I'll then send you the workspace.



    ------------------------------
    Joe Pluta
    ------------------------------



  • 27.  RE: Beginning EGL Project Development - Tomcat 8

    Posted Mon April 10, 2023 08:20 PM
      |   view attached

    OK, I built a very simple workspace.  It has a single web project, which in turn has a single interface and service.  The service accepts a parameter and either attempts to call an RPG program or it just returns a hardcoded value.  This is actually the model I use for all of my business logic, so that I can test without the IBM i.  The point here is that I can test the project without any RUI code whatsoever, which is another architectural goal.  I use Web Services Explorer to test the service, and it works fine as long as I don't try to call the RPG program.  I tried adding a Linkage Part and also a Native Service Binding, and neither seems to work.  No matter what I try, the generated Java code for the service still has this:

         // Call "TEST1"(TEST1Parm);
         ezeProgram._runUnit().getCallers().localCall( "TEST1",

    I would expect to see something about java400 that would look like more like this:

         ezeProgram._runUnit().getCallers().java400( ezeProgram ).call( "TEST1",

    So clearly I haven't properly set up my configuration.  I'm attaching an export file for the project.  It's not much!  




    ------------------------------
    Joe Pluta
    ------------------------------

    Attachment(s)

    zip
    SimpleWeb.zip   17.71 MB 1 version


  • 28.  RE: Beginning EGL Project Development - Tomcat 8

    Posted Mon April 10, 2023 11:15 AM

    Hi Joe,
    Did you set the linkage part as part of the builddescripter you're generating with?

    Dev's suggestion is to use an ExternalType of type HostProgram to call an iSeries-program. See Accessing IBM i programs as web services: overview - IBM Documentation

    Regards,
    Bernd.



    ------------------------------
    Bernd van Oostrum
    Leuven
    32478808505
    ------------------------------



  • 29.  RE: Beginning EGL Project Development - Tomcat 8

    Posted Tue April 11, 2023 09:19 AM

    Hi Joe,
    Thanks for attaching the project. 
    While I have not yet set up the configuration to run it, I noticed that in your build descriptor the linkage part IBMi is not  used. 
    I was getting the call to generate as localcall, but when I changed the linkage option in the build descriptor to point to IBMi, it picked up
    the linkage. 
    old:             // Call "TEST1"(TEST1Parm);
                ezeProgram._runUnit().getCallers().localCall( "TEST1",
                    new com.ibm.javart.JavartSerializable[] {
                        TEST1Parm
                    },
    now:
                // Call "TEST1"(TEST1Parm);
                ezeProgram._runUnit().getCallers().java400( ezeProgram ).call( "TEST1",
                    new com.ibm.javart.JavartSerializable[] {
                        TEST1Parm
                    },
                    new com.ibm.javart.calls.CallOptions( null,
                        com.ibm.javart.calls.CallOptions.LINKTYPE_DYNAMIC,
                       ....



    ------------------------------
    Dev Banerjee
    RBD Development
    ------------------------------



  • 30.  RE: Beginning EGL Project Development - Tomcat 8

    Posted Tue April 11, 2023 10:07 AM

    Yep, that was the missing piece, Dev!  Mahesh Eruvuri over at HCL identified the same issue.  I knew it was a setting somewhere.  Everything is working now!



    ------------------------------
    Joe Pluta
    ------------------------------



  • 31.  RE: Beginning EGL Project Development - Tomcat 8

    Posted Tue April 04, 2023 04:02 AM

    Hi Joe

    Tomcat's default port is 8080. However, RBD uses a default port of 9080 for WSDL generation - this is controlled in the EGL Service preferences.

    Try changing the port to 8080 in your client project's deployment descriptor binding tab, or in the client project's WSDL file (under "<wsdlsoap:address location = ")



    ------------------------------
    Tom Baranski
    Senior Developer
    Rational Business Developer
    ------------------------------



  • 32.  RE: Beginning EGL Project Development - Tomcat 8

    Posted Tue April 04, 2023 03:12 PM

    Thanks, Tom!  That worked perfectly.  I am now on to stage 2: building a prototype UI.  Finally, I'll need to call programs on the IBM i.  One step at a time!



    ------------------------------
    Joe Pluta
    ------------------------------