L.5 JavaBeans resource sample program
Following directory stores the sample program that uses JavaBeans resource.
Cosminexus-installation-directory\CC\examples\javabeans
Following is the overview and the execution procedure of the sample:
- Organization of this subsection
(1) Overview of JavaBeans resource sample program
The following figure shows the configuration of JavaBeans resource sample program:
This sample program displays the value on the browser on the basis of the information of each setting specified in the properly of the JavaBeans resource property file.
Following figure shows the execution example of the sample program:
(2) Execution procedure of JavaBeans resource sample program
Following procedure describes the method of executing the sample program:
(a) Compiling sample programs
Compile sample programs by using the batch file (compile.bat) provided in the sample. This batch file creates JavaBeans resource (MyJavaBean.jar) and EAR file (LookupBean.ear).
(b) Setting the J2EE server
(c) Customizing the J2EE server
(d) Starting the J2EE server
(e) Importing and starting JavaBeans resource
Use the batch file (deployJb.bat) provided in the sample to deploy JavaBeans resource. This batch file imports and starts JavaBeans resource.
Following is the process executed by this batch file:
-
The cjimportjb command is executed and JavaBeans resource is imported to the J2EE server. The used JavaBeans resource property file is "jb_resource.xml".
-
The cjstartjb command is executed and JavaBeans resource is started. The used JavaBeans resource display name is "JavaBean_resource".
-
The cjlistjb command is executed and the status of JavaBeans resources on the J2EE server is displayed in a list. The operation status of JavaBeans (operating) can be confirmed from this list.
(f) Deploying the application
See Appendix L.1(5) Importing, setting and starting the application
(g) Executing the application
Start the browser and specify the following string in the URL:
http://Machine-name: Port-number/ContextRoot/servlet/LookupBeanServlet
When accessing the NIO HTTP server of the J2EE server directly, specify the URL as follows if using the default port:
http://localhost:8008/web_jb/servlet/LookupBeanServlet
(h) Undeploying the application
(i) Stopping JavaBeans resource
Stop the JavaBeans resource with the cjstopjb command.
C:\>cd Program Files\Hitachi\Cosminexus\CC\admin\bin C:\Program Files\Hitachi\Cosminexus\CC\admin\bin>cjstopjb MyServer -resname JavaBean_resource
(j) Restarting the J2EE server
Stop the J2EE server with the cjstopsv command and start with the cjstartsv command. For the method of stopping the J2EE server, see Appendix L.1(7) Stopping the J2EE server. For the method of starting the J2EE server, see Appendix L.1(3) Starting the J2EE server.
(k) Deleting JavaBeans resource
Delete JavaBeans resource with the cjdeletejb command.
C:\>cd Program Files\Hitachi\Cosminexus\CC\admin\bin C:\Program Files\Hitachi\Cosminexus\CC\admin\bin>cjdeletejb MyServer -resname JavaBean_resource