centos

centos weblogic应用部署方法

小樊
39
2025-10-07 07:43:48
栏目: 智能运维

Prerequisites for WebLogic Application Deployment on CentOS
Before deploying applications to WebLogic on CentOS, complete the following setup:

Step 1: Install WebLogic Server

  1. Extract Installer: Switch to the weblogic user (su - weblogic) and extract the downloaded JAR file:
    mkdir -p /opt/weblogic && unzip fmw_14.1.1.0.0_wls_lite_generic.jar -d /opt/weblogic
    
  2. Create Response File: Define silent installation parameters in /opt/weblogic/wls.rsp:
    [ENGINE]
    Response File Version=1.0.0.0.0
    [GENERIC]
    ORACLE_HOME=/opt/weblogic/Oracle/Middleware
    INSTALL_TYPE=WebLogic Server
    DECLINE_SECURITY_UPDATES=true
    
  3. Run Silent Installation: Execute the installer with the response file:
    java -jar /opt/weblogic/fmw_14.1.1.0.0_wls_lite_generic.jar -silent -responseFile /opt/weblogic/wls.rsp -invPtrLoc /opt/weblogic/oraInst.loc
    
    (Create /opt/weblogic/oraInst.loc with inventory_loc=/opt/weblogic/oraInventory and inst_group=weblogic if not present.)

Step 2: Create a WebLogic Domain

  1. Run Domain Configuration Script: Navigate to the WebLogic configuration directory and start the wizard:
    cd /opt/weblogic/Oracle/Middleware/wlserver/common/bin && ./config.sh
    
  2. Follow Prompts:
    • Select “Create a new domain” and provide a name (e.g., base_domain).
    • Set the administrator username/password (e.g., weblogic/admin123).
    • Choose the domain location (default: /opt/weblogic/user_projects/domains/base_domain).
    • Select “Development Mode” for testing (switch to “Production Mode” for production).
  3. Complete Domain Creation: The script generates the domain structure. Start the domain with:
    cd /opt/weblogic/user_projects/domains/base_domain/bin && ./startWebLogic.sh
    
    Access the console at http://<server-ip>:7001/console (login with the admin credentials).

Step 3: Deploy Applications (3 Common Methods)

Method 1: Deploy via WebLogic Console (GUI)

  1. Login to Console: Open http://<server-ip>:7001/console in a browser and authenticate.
  2. Navigate to Deployments: Expand the “Deployments” section in the left-hand menu and click “Install”.
  3. Select Application File:
    • Choose “Upload your files” and browse to upload the WAR/EAR file (e.g., myapp.war).
    • Alternatively, select “Install Application Located on the Server” if the file is already on the server (e.g., in /opt/weblogic/deployments).
  4. Configure Deployment:
    • Enter a deployment name (e.g., MyApp).
    • Select the target server/cluster (e.g., AdminServer).
    • Choose “Install this deployment as an application”.
  5. Complete Deployment: Click “Finish” and verify the application status changes to “Active” in the Deployments list.

Method 2: Deploy via Auto-Deployment Directory

  1. Copy WAR File: Place the WAR file into the domain’s auto-deployment directory:
    cp myapp.war /opt/weblogic/user_projects/domains/base_domain/applications/
    
  2. Verify Deployment: WebLogic automatically detects and deploys the application. Check the console’s “Deployments” section—the application should appear with a status of “Prepared”. Start it manually if needed (select the app → “Control” → “Start”).

Method 3: Deploy via Command Line (weblogic.Deployer)

  1. Use weblogic.Deployer: This tool allows programmatic deployment. Run the following command to install a WAR file:
    java weblogic.Deployer -adminurl t3://localhost:7001 -username weblogic -password admin123 -install /opt/weblogic/deployments/myapp.war -targets AdminServer -name MyApp
    
    Replace localhost, weblogic, admin123, and paths with your environment details.
  2. Check Status: Use -list to verify the deployment:
    java weblogic.Deployer -adminurl t3://localhost:7001 -username weblogic -password admin123 -list
    
    The output should include MyApp with a status of “deployed”.

Step 4: Verify Application Access
After successful deployment, access the application using its context root:

Troubleshooting Tips

0
看了该问题的人还看了