|By Deepak Vohra, Ajay Vohra||
|August 8, 2005 12:00 PM EDT||
The JBoss open source application server is commonly used in the development phase of a J2EE project. In the production phase the commercial BEA WebLogic server is preferred because of its enhanced set of features. Without modifications, an application developed in JBoss does not deploy in WebLogic server.
The deployment descriptors for the WebLogic server are different from the JBoss deployment descriptors. An application may be migrated to WebLogic by converting the vendor-specific deployment descriptors to WebLogic. In this tutorial an EJB application developed in JBoss will be migrated to WebLogic with MySQL as the database.
Download and install the BEA WebLogic server (www.bea.com/framework.jsp?CNT=overview.htm &FP=/content/products/weblogic/server). Create a server domain. Download the MySQL JDBC driver JAR file (www.mysql.com/products/connector/j/) and the MySQL database server (www.mysql.com/products/mysql/). Develop a Java application or obtain an XSLT utility to transform the JBoss deployment descriptors to WebLogic deployment descriptors with an XSLT.
Without deployment descriptor conversions, an application developed for JBoss does not deploy in WebLogic. In this tutorial, we will migrate an example entity EJB application developed in JBoss to WebLogic by converting the JBoss deployment descriptors to WebLogic deployment descriptors.
The example application consists of a Catalog entity EJB. The EJB's bean class (CatalogBean.java) is shown in Listing 1. The remote interface (Catalog.java) and home interface (CatalogHome.java) are shown in Listing 2 and Listing 3. The entity EJB classes do not need to be modified for deploying a JBoss EJB application to WebLogic. Only the deployment descriptors for an EJB are required to be modified.
Configuring WebLogic JDBC
In this section a JDBC connection will be configured with the MySQL database from the WebLogic server. First a JDBC Connection Pool is configured and subsequently a JNDI data source to access the JDBC connection pool is configured. Add the MySQL database driver JAR file, mysql-connector-java-3.0.16-ga-bin.jar, to the CLASSPATH variable of the examples server. The CLASSPATH variable for the WebLogic server is set in the <BEA>\user_projects\domains\mydomain\startWebLogic script. Double-click on the startWebLogic script file to start the WebLogic examples server. The server gets started on port 7001. Login to the WebLogic Administration Console with the URL http://localhost:7001/console. The login page for the Administration Console gets displayed. In the login page specify user name and password and log in to the administration console.
In the administration console select the Services>JDBC node. To configure a JDBC connection pool, right-click on the Connection Pools node and select Configure a new JDBCConnectionPool. In the Choose database frame displayed select MySQL as the Database Type. Select MySQL's Driver (Type 4) as the Database Driver. Click on the Continue button. Specify the connection properties for the JDBC connection. In the Database Name field specify test, the example MySQL database. In the Host Name field specify localhost. In the Database User Name field specify root. A password is not required to login to MySQL database with the root username, but the WebLogic server requires a password to be specified. Specify the password for the user name. Click on the Continue button.
In the Test database connection frame, the MySQL driver com.mysql.jdbc.Driver is specified in the Driver Classname field. The MySQL driver is used to establish a connection with the MySQL database. In the URL field specify jdbc:mysql://localhost/test as the connection URL for the database. To test the JDBC connection to the database click on the Test Driver Configuration button. If a connection gets established with the database, a "connection successful" message gets displayed. In the Create and deploy frame, select the server on which the connection pool is to be deployed. Click on the Create and deploy button to deploy the JDBC connection pool on the server. The configured connection gets deployed on the examples server and a node for the connection pool gets added to the JDBC>Connection Pools node. To modify the configuration of the connection pool, select the connection pool node and modify the settings in the different tabs: General, Target and Deploy, Monitoring, Control, Testing, Connections.
Next, configure a data source in the WebLogic server. Right-click on the Services>JDBC node and select Configure a new JDBCTxDataSource. Specify a data source name. In the JNDI Name field specify a JNDI name for the data source - MySQLDS for example. Click on the Continue button. In the Connect to connection pool frame, select a connection pool from the list of connection pools. Select the connection pool that was configured in the previous section and click on the Continue button. In the Target the data source frame select a server as the target server for the data source. Click on the Create button. The configured data source gets deployed on the examples server and a node for the data source gets added to the Data Sources node. To modify the data source select the data source node and modify the settings in the different tabs: Configuration, Target, and Deploy. The data source is available with the JNDI name MySQLDS, which was specified in the data source configuration.
Converting the JBoss EJB Application
In the previous section the WebLogic server was configured with the MySQL database. In this section we'll convert the JBoss EJB application to a WebLogic EJB application, which involves converting the deployment descriptors. A JBoss entity EJB application consists of the EJB deployment descriptors (ejb-jar.xml, jboss.xml, and jbosscmp-jdbc.xml), the bean class (CatalogBean.java), the remote interface (Catalog.java), and the home interface (CatalogHome.java). To deploy the entity EJB in the JBoss server, an EJB JAR file is created; this EJB JAR file has the structure:
Jul. 7, 2015 02:00 AM EDT Reads: 1,301
Jul. 7, 2015 01:15 AM EDT Reads: 965
Jul. 6, 2015 11:00 PM EDT Reads: 1,946
Jul. 6, 2015 05:00 PM EDT Reads: 2,177
Jul. 6, 2015 05:00 PM EDT Reads: 2,019
Jul. 6, 2015 04:30 PM EDT Reads: 746
Jul. 6, 2015 02:45 PM EDT Reads: 1,182
Jul. 6, 2015 02:15 PM EDT Reads: 1,237
Jul. 6, 2015 02:15 PM EDT Reads: 1,913
Jul. 6, 2015 02:00 PM EDT Reads: 1,484
Jul. 6, 2015 01:45 PM EDT Reads: 2,176
Jul. 6, 2015 01:15 PM EDT Reads: 2,232
Jul. 6, 2015 01:15 PM EDT Reads: 1,864
Jul. 6, 2015 01:00 PM EDT Reads: 1,790
Jul. 6, 2015 12:15 PM EDT Reads: 2,138
Jul. 6, 2015 11:45 AM EDT Reads: 2,607
Jul. 6, 2015 11:30 AM EDT Reads: 1,813
Jul. 6, 2015 11:15 AM EDT Reads: 1,838
Jul. 6, 2015 11:00 AM EDT Reads: 2,572
Today air travel is a minefield of delays, hassles and customer disappointment. Airlines struggle to revitalize the experience. GE and M2Mi will demonstrate practical examples of how IoT solutions are helping airlines bring back personalization, reduce trip time and improve reliability. In their session at @ThingsExpo, Shyam Varan Nath, Principal Architect with GE, and Dr. Sarah Cooper, M2Mi’s VP Business Development and Engineering, will explore the IoT cloud-based platform technologies driving this change including privacy controls, data transparency and integration of real time context wi...
Jul. 6, 2015 09:45 AM EDT Reads: 1,829