Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium


JSP -> JavaBean -> PCML -> RPG

Posted on 2003-03-27
Medium Priority
Last Modified: 2012-08-13
Based on the title of the question i think you guys also agree that I have no ideas where should i post this question in. :-)

Anyway, since this JSP sites which I think the respond time is tremendous, and also it's involve more on JSP tech, so i prefer post it here. Hope you guys would dissapointed me.

Before we start, have a look on this pdf files.

This pdf files is the base file that I refering. The main purpose for me to do this is to call my RPG program using JavaBean and JSP technology.

This is the few steps that I have done successfully.

1. Create a PCML (Program Call Markup Language)

<pcml version="1.0">
<program name="JFOONG" path="/QSYS.LIB/LMLIB/LIB/JFOONG.PGM">
<data name="name" type="char" usage="input" />
<data name="division" type="char" usage="input" />

2. Create a RPG program (This one you must trust me that it's running fine.  because i have tested it in the AS400 command line.)

3. Code my JavaBean and compiled it. And I got zero error or exception.

* Testing Java call RPG program.
* Creation date: (11/13/2001 11:35:27 AM)
* @author: James Zhang

import com.ibm.as400.data.*;
import com.ibm.as400.access.*;
import java.lang.*;
import java.io.*;
import java.util.*;

public class testjava {

* TestCallRpg constructor.

public testjava() { }

* This program is written as an application
* to easily demonstrate calling an RPG program
* and run the program from your development environment.
public void header() {

/* Create a connection the iSeries where the program you wish to call
resides */
      AS400 sys = new AS400("AS400_name","username","password");
      if(sys == null){
            System.out.println("Connection failed");
      } else {
            System.out.println("Manage to connect to AS400");
      ProgramCallDocument pcml;
            pcml = new ProgramCallDocument(sys, "Test"); // open the PCML File
            // set all the input parameters for program alias DateCalc
            pcml.setValue("JFOONG.name", "FOONG");
            pcml.setValue("JFOONG.division", "FP");
            // call the program
            boolean rc = pcml.callProgram("JFOONG");
            if(rc == false){
                  System.out.println("Program failed");
                  System.out.println("Program OK");
      }catch(PcmlException pe){
            System.out.println(" Caught Exception ");



4. Code my JSP page to call this JavaBean.

<%@ page language="java" import="java.sql.*, java.io.*, java.util.*, com.wrox.cars.* "
<jsp:useBean id="person" class="com.wrox.cars.testjava" />

5. Make sure that my IBM WebSphere Application class path will include in my com.ibm.as400 JAR file.

* Done!!

6. Open a browser and call the page, error come out.
Root Error-1:
     java/lang/Throwable.<init>()V+4 (Throwable.java:82)
     java/lang/LinkageError.<init>()V+1 (LinkageError.java:33)
     java/lang/NoClassDefFoundError.<init>()V+1 (NoClassDefFoundError.java:37)
java/lang/ClassLoader.defineClass(Ljava/lang/String;[BII)Ljava/lang/Class;+1 (ClassLoader.java:424)

Wrapped Error-2:
     java/lang/Throwable.<init>(Ljava/lang/String;)V+4 (Throwable.java:94)
     java/lang/Exception.<init>(Ljava/lang/String;)V+1 (Exception.java:42)
     javax/servlet/ServletException.<init>(Ljava/lang/Throwable;)V+5 (ServletException.java:161)

Wrapped Error-3: Server caught unhandled exception from servlet [jsp10]: null
com.ibm.servlet.engine.webapp.UncaughtServletException: Server caught unhandled exception from servlet [jsp10]: null
     java/lang/Throwable.(Ljava/lang/String;)V+4 (Throwable.java:94)
     java/lang/Exception.(Ljava/lang/String;)V+1 (Exception.java:42)
javax/servlet/ServletException.(Ljava/lang/String;Ljava/lang/Throwable;)V+1 (ServletException


Friends, this is all what I hope you can help. ANy comments, any brainstorming is appreciated.

And let me share my experience in troubleshooting this. At first, i thougt it maybe because some of the java library i didn't add it. So i have tried to add in all the possible library in. Second, I have remark off all the important code in my javaBean (suspected is in JavaBean).  Yet, this error code still in.


Thank you for reading it.......

Question by:xman19

Author Comment

ID: 8217338
Guys, my apology.

I know the errors... after I tested one by one.

The Java Bean, forget this,

packages com.wrox.cars.


But I am having another problem....

//This is the error log from AS400 File system
Manage to connect to AS400                                                                                                
[03.03.27 12:38:32:028 GMT+00:00] 9e93f864 SecurityManag A SECJ0021I: Illegal System exit() : java.lang.SecurityException
      java/lang/Throwable.<init>()V+4 (Throwable.java:82)                                                                

And ths is the problem  that caused by the browser..

Root Error-1:
     java/lang/Throwable.<init>()V+4 (Throwable.java:82)
     java/lang/Exception.<init>()V+1 (Exception.java:33)

So, I am looking into it. Maybe youcan conrtibute some brain Storming....
LVL 14

Accepted Solution

kennethxu earned 1860 total points
ID: 8218863
do you have some code that when error occur you calls System.exit() ? the application server will not allow your application to do this, because this will bring the entire application server down. So the application throw you SecurityExcetion when it sees System.exit() in your web applicaiton code.

please also post full stacktrace of the error you get, it helps us to determine the problem.

Author Comment

ID: 8221922
ken, since I am rushing to make this program done, thus I have temporary rem off the System.exit() statement.

But I am facing another problem. It's complainting couldn't find the PCML files that I coded....


And I have no experience in this PCML and where should it stored.

Any ideas?? I put it in the CLASSPATH of my App Server's classpath.
Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

LVL 14

Expert Comment

ID: 8222008
not sure what is PCML. can you post the full stacktrace of the exception?

Author Comment

ID: 8223941
ken this is the stackTrace,

 java.util.MissingResourceException: PCML document source 'JFOONG' cannot be found.      
       java/lang/Throwable.<init>(Ljava/lang/String;)V+4 (Throwable.java:94)              
       java/lang/Exception.<init>(Ljava/lang/String;)V+1 (Exception.java:42)              
       java/lang/RuntimeException.<init>(Ljava/lang/String;)V+1 (RuntimeException.java:47)
       com/wrox/cars/testjava.call()V+0 (testjava.java:44)                                

 java.util.MissingResourceException: PCML document source 'JFOONG' cannot be found.
       java/lang/Throwable.<init>(Ljava/lang/String;)V+4 (Throwable.java:94)      
       java/lang/Exception.<init>(Ljava/lang/String;)V+1 (Exception.java:42)    

Can not find the PCML files right?
LVL 19

Expert Comment

ID: 8225401
seems that way.. do you have the path right.  Can you output where it is looking for the files?

LVL 14

Expert Comment

ID: 8225822
can you post the line testjava.java:44
it says JFOONG is not found, where did you put this file? it should be named as JFOONG.pcml, and the directory should be in classpath.
LVL 14

Expert Comment

ID: 8225901

Author Comment

ID: 8250786
kennethxu, still couldn't locate my PCML files.
LVL 14

Expert Comment

ID: 8256222
can you show me the testjava.java?
you should create JFOONG.pcml file and place in under a dir which is in classpath.
LVL 19

Expert Comment

ID: 8612967
this this is quite a old post, I am not sure if you already finished with it or not.
You should be putting your PCML file at the same location where your bean resides. i.e. if you have jared your bean than your PCML file should also be avialble in the jar file and that too with the same directory structure as your bean package name.


Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Choosing the right mix of apps is very much necessary for CPAs for making the most of the latest technology through which they can boost their growth.
If you need to complete a Physical to Virtual (P2V), Virtual to Virtual (V2V) conversion to a VMware product (VMware Workstation, Player or VMware vSphere (ESXi) ) for FREE, then there is some good news...
This Micro Tutorial will teach you how to add a cinematic look to any film or video out there. There are very few simple steps that you will follow to do so. This will be demonstrated using Adobe Premiere Pro CS6.
In a question here at Experts Exchange (https://www.experts-exchange.com/questions/29062564/Adobe-acrobat-reader-DC.html), a member asked how to create a signature in Adobe Acrobat Reader DC (the free Reader product, not the paid, full Acrobat produ…
Suggested Courses

571 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question