JBuilder 7.0 + WebLogic 7.0 Development EJB Project

zhaozj2021-02-16  73

WebLogic 7 configuration: 1. Install WebLogic7, here is selected as the following domain configuration method:

Domain configuration

2. Start the server. Open IE, type in the address bar: http: // localhost: 7001 / console 3. Enter the username and password 4. Select Services-> JDBC-> Connection Pools in the directory tree on the left, click Configure a New on the right JDBC Connection Pool. Enter the following information:

Configuration-> General page: Name = SQL Server Connection Pool URL = jdbc: weblogic: mssqlserver4: northwind @ localhost Driver classname = weblogic.jdbc.mssqlserver4.Driver Properties: user = sa Password = "" <- sa password

Click Create to establish a connection pool.

Targets-> Server Page:

Move your MyServer to the list of the right, but click Apply

5. Select Services-> JDBC-> Data Sources-> JDBC-> Data Source (or TXData Sources) in the directory tree on the left, click the Configure a New JDBC Connection Pool on the right. Enter the following information:

Configuration-> General Page: Name = SQLSERVER TX DATA SOURCE JNDI Name = SQLSERVER POOL Name = SQL Server Connection Pool

Select Emulate TWO-PHASE COMMIT for Non-Xa Driver and Row Prefetch Enabled

Click Create to establish a data source.

Targets-> Server Page:

Move myServer to the list of the right, but click Apply, the configuration is complete.

6. The above is to configure the SQL Server 2000 database. For the MySQL database, we need to first configure their drivers. The specific approach is:

1) First create a test database EJBSHOP and establish the following table:

Create Table Customers (ID VARCHAR (64), Name Varchar (64), Address Varchar (64), Password Varchar (64))

2) Copy mysql.jar to E: / bea / weblogic700 / server / lib.

3) Modify E: /bea/user_projects/mydomain/startexamplesserver.cmd

@Rem ClassPath To Be Picked Up by WebLogic Server.

Set classpath = E: /BEA/JDK131_02/lib/tools.jar;% Samples_Home% / Server / Eval / PointBase / lib / PBServer42 ECF172.jar;% Samples_Home% / Server / Eval / PointBase / lib / pbclient42ecf172.jar;% Client_c lasses%;% server_classes%

change into

@Rem ClassPath To Be Picked Up by WebLogic Server. Set ClassPath = E: /Bea/weblogic700/server/lib/mysql.jar; E: /BEA/JDK131_02/lib/tools.jar;% Samples_Home% / Server / Eval / PointBase / lib / pbserver42ecf172.jar;% Samples_Home% / Server /eVal/pointbase/lib/pbclient42ecf172.jar;%Client_classes%;%Server_Classes%4) Start the server, add a data connection pool, as shown below

Configuration-> General Page: Name = mysql connection pool 2 url = jdbc: mysql: //127.0.0.1: 3306 / EJBSHOP driver classname = org.gjt.mm.mysql.driver proties: user = root password = root

Connection pool settings

Click Create to establish a connection pool. Targets-> Server Page: Move MyServer to the list of the right, but click Apply. 5) Select SERVICES-> JDBC-> Data Sources-> JDBC-> Data Source, click on the directory tree on the left, click the Configure a new JDBC Connection Pool on the right. You enter the following information:

Configuration-> General Page: Name = mysql TX Data Source 2 JNDI Name = mysql2 pool name = mysql connection pool 2

Select Emulate TW-PHASE COMMIT for Non-Xa Driver and Row Prefetch Enabled.

Click Create to establish a data source.

Targets-> Server Page:

Move myServer to the list of the right, but click Apply, the configuration is complete.

Data source settings

JBUILDER7 configuration

1. After installing JBuilder, modify the environment variable Temp and TMP for directory without spaces, such as: E: / WinNT / TEMP. 2. Start JBuilder7, select: Tools-> Configure Servers 3. Select the WebLogic Application Server 6.x on the left, select the enable server 4. of the right side. / WebLogic700 / Server, normal, JBuilder7 will automatically add other items to you. 5. Set the Custom-> JDK Installation Directory to the JDK installation directory, such as: E: / bea / jdk131_02 6. Set the Custom-> Bea Home Directory to WebLogic7 Home Director, such as: E: / BEA 7. Custom -> Domain Directory is set to your domain directory, such as: E: / bea / user_projects / mydomain 8. After adding USER Name, after, Domain Name, Server Name, click OK to exit. The Configure Servers is set as shown below: General Settings

Custom setting

9. Select: Tools-> Enterprise Setup, click New on the CORBA page, follow the table to fill in the appropriate information:

Name for this configuration = WelLogic 7.0 Path for ORB Tools = E: / bea / weblogic700 / server Library for Projects = WebLogic 6.x Deploy IDL compiler command = idlj.exe Commnad option for output directory = E: / CORBAOutput (any directory, Don't have spaces)

Click OK to exit.

Enterprise Setup

10. Select Project-> Default Project Properties

WEBLOGIC 6.X Client and WebLogic 6.x deploy in the Required Libraries in the PATH page are not, please check if the above steps are correct.

11. Select Server page, click Single Services for All Service in Project

Select WebLogic Application Server 6.x in the drop-down list, but strike OK exit, configure it.

12. Remote deployment

This briefly introduces how to deploy applications on remote WebLogic Server. Even remote deployment, the application server is also required on this machine. If it is deployed on WebLogic Server 7.0, select Tools-> Enterprise Deployment in JBuilder, modify the host name and port number of the remote server in the pop-up window, and then set the correct username and password. As shown below:

Remote deployment settings

For specific items, remote deployment can also be performed by modifying the EJB component or WebApp's properties, as shown below:

Remote deployment of specific projects

13. Configure the database driver

First, add a database drive class, click Tools -> Configure Libraries, add the database driver (here as an example): Add a driver class

Then, click Tools -> Enterprise Setup, click Add on the Database DRIVERS page, click New in the pop-up dialog, and select the drive class just added in the pop-up dialog.

14. Add driver in Database Pilot

Tools-> Database Pilot-> View-> Options-> Drivers-> Add, enter org.gjt.mm.mysql.driver in the pop-up dialog box Enter mysql: // localhost: 3306 / EJBSHOP , Pay attention to no "JDBC:" before.

In File-> New pop-up New URL, select Driver for org.gjt.mm.mysql.driver just added, the URL is automatically displayed as JDBC: MySQL: // localhost: 3306 / EJBSHOP, OK, then point the toolbar The arrow (Apply) that is to the right. Double-click on the left, enter the username root and password root, but the test database link is passed, if you do not see the following steps, please check the above steps. If successful, as shown below:

connection succeeded

Establish a simple CMP Entity Bean

1. Turn off all works: file-> Close Projects

2. Select File-> New Project

3. Enter TEST in the Name column, enter the storage path (do not have spaces), other unchanged, click Finish.

4. Select File-> New-> Enterprise-> EJB 2.0 Bean Designer Click OK.

New EJB1

In the pop-up dialog box, enter EJBTEST3 in Name, as shown below:

New EJB2

5. Right-click on DataSources in the lower left corner of the screen, select Import Schema from Database, in the pop-up dialog box, select the database connection just added

Then fill in the username, password, and JNDI name:

Configuring data sources

Click OK, if you set it correctly, DataSource will appear under DataQL2 under DataSource.

Data source settings success

6. Click the plus number of DataSource on the Datasource named mysql2 to expand, you will see all the tables and views.

7. Right-click the Customers table, select Create CMP 2.0 Entity Bean to add an entity bean to the right design area.

Customers entity bean

8. Click Customers on the rectangular top of the Customers table, select Interfaces as Remote in the panel that pops up on the right, select File-> Save ALL to save all items.

Modified to Remote interface

For habits, we can click to change the name:

Change the class

9. After compiling this EJB component, after the compilation is successful, right-click EJBTEST3 to select Deploy Options for "EJBTEST3.jar" -> Deploy, will be released to WebLogic.

After the release is successful, you will see the following prompt:

Establish test client

1. Select File-> New-> Enterprise-> EJB Test Client Click OK. Establish a client as shown below

2. Write the main () code as follows:

3. Compile this class, then run:

Run the test client

The information column will display the results of the operations as follows:

- Initializing bean access - Succeeded initializing bean access - Execution time:.. 2364 ms - Calling findByPrimaryKey (00001) - Succeeded:. FindByPrimaryKey (00001) - Execution time: 260 ms - Return value from findByPrimaryKey (. 00001): firsttest.CustomersBean_b8ip57_EOImpl_WLStub@a4f30ea - Calling getId () - Succeeded:. getId () - Execution time: 30 ms - Return value from getId ():. 00001. - Calling getName () - Succeeded : GetName () - Execution Time: 40 ms. - Return Value from getName (): ed roman. - Calling getPassword () - succeeded: getpassword () - Execution Time: 20 ms. - Return Value from GetPassword (): Password. - Calling getaddress () - succeeded: getaddress () - Execution Time: 20 ms. - Return Value from getaddress (): 7117 Woodhollow Drive # 926, Austin TX 78731.

转载请注明原文地址:https://www.9cbs.com/read-15539.html

New Post(0)