Now, the next step is to configure your application domain to run your MVC application. You need to configure the connection pool in your domain and then deploy the EAR file. Configuring the Connection PoolThrough the administration console, create a new connection pool called mvc_app_conn_pool. For this connection pool, specify the URL as jdbc:pointbase:mvcapp and the Driver Classname as com.pointbase.jdbc.jdbcUniversalDriver. Specify the user name of the Pointbase database in the properties as user=mvcapp. Specify the password of the database in the Properties attribute. Now, click the Testing tab, and enter the test table name Test. Select Test Reserved Connections and Test Released Connections. Select the server name in the Targets tab. Your MVC application is a transactional one. Hence, you need to configure Tx Data Sources and not plain Data Sources. The Tx Data Sources link is under the Data Sources link. Create the Tx Data Source with the name mvcapp_tx_data_source and JNDI name mvc_app_tx_ds. Specify mvc_app_conn_pool as the connection pool name. Select Emulate Two-Phase Commit for non-XA driver. Also select Row Prefetch Enabled. Select the server name in the Targets tab. You have now deployed your Tx Data Sources, which are used in the MVC application. Deploying Your EAR FileThere are four methods of deploying your MVC application. You will do it each way. The first method is the hot deployment technique. The second method is the production deployment technique, also called two-stage deployment. The third method is to deploy your application using WebLogic Builder. Finally, the fourth method is to deploy your application via the command prompt using the weblogic.Deployer tool. Hot DeploymentThe hot deployment technique is the simplest and the fastest. It is meant for development purposes and is not recommended for production purposes. To employ this technique, put the EAR file into the applications directory of your mvc_app_domain. The server then automatically deploys your application. The server has to be running in development mode in order to perform a hot deployment. Two-Stage DeploymentWhen an application was deployed in the WebLogic Server before the 7.0 release, the deployment sent a copy of the application to all the servers targeted by the deployment of this application. These would then deploy the application. If for some reason, such as a configuration pool not existing on one of these servers, the deployment of the application on one of these servers failed, the deployment state across all these servers would be inconsistent. Now, with the two-stage deployment, the deployment first prepares all the targeted servers. This is called the preparation phase. The next phase, called the activation phase, activates the application across all these servers. Most errors in deployment are indicated in the preparation phase itself, and deployment of the application on the targeted servers does not proceed to the activation phase. If any error occurs in either of the phases, the deployment across the whole cluster fails. You can set the order of the applications' activation at startup. You can carry out two-stage deployment in several ways. You'll first see how it can be done through the Administration Console. Note It is a good practice to test-deploy your Web components and EJB components separately. In this way, you can test whether your applications work properly. You can then deploy your whole EAR file, or you can deploy your application components separately. If you deploy your application components separately, they are considered to be separate applications. The base application class loader loads the EJB component, whereas a child class loader is created to load the Web component. You will need to include the EJB remote and home interfaces within the Web component. The WebLogic Server uses stub and skeleton calls for calling the EJB classes. If you load your application as an EAR file, however, it is considered to be a single application, and a single class loader is used. In this case, you don't need to add the remote and home interfaces of the EJB component into the Web component. Also, the performance greatly improves when you deploy your application as a whole, rather than as components, because the WebLogic Server makes a direct Java method call by using call by reference to interact between the components. However, when your components are deployed as separate applications in order to avoid class loader conflicts, the WebLogic Server uses call by value and uses the RMI's subsystem to marshall and unmarshall facilities, even if the applications are within the same JVM. If you use EJB 2.0 local interfaces, you must deploy your application as an ear file. Deploying Through the Administration ConsoleTo deploy through the Administration Console, follow these steps:
Deploying Through the WebLogic BuilderYou can start your WebLogic Builder either through the Start Menu or through a command prompt. The link in the Start Menu calls the same command, which you will execute through the command prompt. The command file to start the WebLogic Builder resides in the C:\bea\weblogic700\server\bin directory under the name startWLBuilder.cmd or startWLBuilder.sh file. To start this, open a DOS prompt, navigate to the directory containing the startWLBuilder file, and execute the command startWLBuilder. When the builder starts up, select the AirlineApp.ear file through the File link in the toolbar. You will see a screen like the one in Figure 16.7. Figure 16.7. Selecting the application file in the WebLogic Builder.After selecting the file and deploying it through the WebLogic Builder, you will see a screen like the one shown in Figure 16.8. Figure 16.8. Deployed application on WebLogic Builder.Deploying Through the Command Prompt Using weblogic.DeployerOpen a DOS prompt and set the environment using the setEnv file in your domain directory. Deploy your application using the following command: java weblogic.Deployer activate nostage source C:\MVC_Application\ deployable_components\AirlinesApp.ear user mvcappserver password mvcappserver |