|
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.
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.
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.
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.
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.
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.
Any Java program containing a valid main method can be run from inside Studio. To run any Java client:
If the Java Client looks up for a bean, then
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");The method suggested in point 3 can be used instead of point 2, though it is recommended that point 2 be used.
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.
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.
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 |
|