Pramati Technologies

Running J2EE Clients

The J2EE specification specifies that all J2EE products must support the Run As capability that allows the Application Component Provider and the Deployer to specify an identity under which enterprise beans or Web components run. 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. This tab comprises of the Output Panel itself and the Input Text Field. All output messages of running the application are displayed in the Output Panel. If the number of lines in the message 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:

Example

To execute index.html, which can be packaged, the URL entered in the browser should be: http://127.0.0.1:8181/games/index.html where :8181 is the web Server's default port number and games the Web Module.

Running JSP Client

To run a JSP, compile it and Right Click on the JSP and select Run. 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.

Example

To execute gameofeight.jsp, which is packaged into games.war, the URL entered in the browser should be: http://127.0.0.1:8181/games/gameofeight.jsp where :8181 is the web Server's default port number and games the Web Module.

Running Servlet Client

To run a servlet:

Example

http://localhost:8181/sample/package1/package2/Test .

In the above example, sample is the context root and package1.package2.Test is the fully qualified path for the servlet class file, Test- (package1/package2/Test.class) in the file system and sample is the Web Module or Java Module where the Servlet is stored.

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. Once the application is compiled, Right Click on it and select Run. This deploys the application and runs the client in the Output Panel of Studio.

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.PramatiClientContextFactory");
    • 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");
  2. 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.

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

Run clients in the debug mode by pressing Ctrl + Alt + D. Running a program in the debug mode is running the program with the following VM options.

-Djava.compiler=NONE -Xdebug -Xnoagent

-Xrunjdwp:transport=dt_socket,server=y,suspend=n, address=1234


Pramati Technologies  © Copyright   TOCPREVNEXTINDEX