Pramati Technologies

Running J2EE Clients

Overview

J2EE applications are built such that they are platform independent and once written, can be run across different types of J2EE-compliant servers. Pramati Studio allows applications to be test-run from inside Studio before deploying and running the application commercially. This chapter describes how to configure and then run applications from within Studio.

Compiling the Client

Before executing any client, it has to be compiled. Compiling the program lists out all the compilation errors in the build tab of the output panel and can be corrected before running the client. The Run tool available in Studio compiles the client, if not compiled already, and then runs it, by default. This feature can be removed, if desired.

Displaying Output Messages

The output of any application when it is run is displayed in the Run tab of the Output Panel in Studio. All output messages of running the application are displayed in the Output Panel. The maximum number of lines shown is 2000. If it exceeds 2000, the first 250 lines are deleted. The messages in the panel cannot be edited. To clear all the messages displayed in the Panel, right click anywhere in the Panel > Clear.

The output messages are stored in a log file, <program_name.log> under the Desk Root directory. Here <program_name.log> is the name of the application program. The Input Text Field appears in the lower half of the Run Tab in the Output Panel. This field is used to enter any inputs to be provided by the user. The text entered in this field is treated as the standard input required by the program.

Running HTML Client

To run a HTML client:

Running JSP Client

To run a JSP, compile it and Right Click on the JSP and select Run after deploying the JSP. To access any content, the URL is http://localhost:8181/web-module-name/file where 8181 is the default port name and the file is the file name of the file with the extension. The Web module name is the context root of the web application. For example, to execute gameofeight.jsp, which is packaged into jspDeskWeb.war, the URL entered in the browser should be: http://127.0.0.1:8181/jspDeskWeb/gameofeight.jsp where :8181 is the web Server's default port number and jspDeskWeb in the Web module.

Running Servlet Client

To run a servlet:

Running Java Client

Any Java program containing a valid main method can be run from inside Studio. To run any Java client:

  1. Compile the program, by right clicking on the file in the desk tree and select Compile.
  2. Right click on the Editor and click Run or right click on the corresponding file node in the explore panel and click Run. This deploys the application and runs the client in the Output Panel and adds the file to the Run Settings, automatically.
  3. To run the last executed file again, press Ctrl + Shift + F10.

If the Java Client looks up for a bean, then

    1. Use the following properties for creating the Initial context. These are the default properties provided in the built-in Test Server and should be changed by the user according to the application specifications.
props.put("java.naming.factory.initial", "com.pramati.naming.client.Pramati-
ClientContextFactory");  
props.put("java.naming.provider.url", "rmi://127.0.0.1:9191");  
props.put(Context.SECURITY_PRINCIPAL,"root");  
props.put(Context.SECURITY_CREDENTIALS,"pramati");  
props.put("com.pramati.naming.realm","system"); 
  1. Add the JAR containing the stub classes to the user classpath of the module (containing the Java client). This JAR is available in the following location <install_dir>/nodes/StandAlone/default/archives/Desk_DeskEJB.jar/classes/Desk_DeskEJBClient.jar where Desk represents the name of the desk, DeskEJB represents the name of the EJB module, and Desk_DeskEJBClient.jar the JAR containing the stub classes.
The method suggested in point 3 can be used instead of point 2, though it is recommended that point 2 be used.
  1. Enable server specific Security Manager on the System for dynamic downloading of stubs. In case of Pramati Server, this can be done by inserting the line System.setSecurityManager(new com.pramati.security.client.RMIClientSecurityManager()); and then adding pramati_security.jar located under <install_dir>/server/lib/pramati/ to the current Java Module's classpath.
Note: Refer the relevant server documentations for the location of the client JAR, in cases where other servers are used for development.
Running the current Java file open in the editor

Click on Build > Run File from the main menu or use the keyboard shortcut, Ctrl + Shift + F10 to run the current Java file open in the editor, if it contains a valid main method. The toolbar icon, may also be used for performing this operation.

If the file has only one corresponding desk node, then the file is run using the configuration of that desk node, else a list containing a list of modules pops up, and the user has to choose one to run the file.

Running Clients in Debug Mode

To debug a Java program having a main method:

    1. Right click in Editor and select Debug or right click on the corresponding file node in explore panel and select Debug. The file is automatically added to the Debug Settings after debugging.
  1. To debug the last debugged file again, press Ctrl + Shift + F9.

Pramati Technologies  © Copyright   TOCPREVNEXTINDEX