Skip to content

Commit 9d02164

Browse files
committed
Revert "chore(notes): remove outdated WebSphere and Eclipse documentation"
This reverts commit 3879c45.
1 parent 4ceb62b commit 9d02164

21 files changed

+2718
-0
lines changed

notes/2025-02-24-websphere-app-en.md

+133
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,133 @@
1+
---
2+
audio: false
3+
generated: true
4+
lang: en
5+
layout: post
6+
title: WebSphere Liberty - Hello World Application
7+
translated: false
8+
---
9+
10+
Here’s a simple example to run a "Hello World" application on your WebSphere Liberty server, assuming you’ve already set it up with the `javaee-8.0` feature enabled as per previous instructions. This example uses a basic JSP (JavaServer Pages) file and deploys it using the `dropins` directory for simplicity.
11+
12+
### Step-by-Step Guide
13+
14+
#### 1. Create the Application Directory and File
15+
You’ll create a small web application by placing a JSP file in the `dropins` directory of your Liberty server. The `dropins` directory allows Liberty to automatically detect and deploy applications.
16+
17+
- **Locate the `dropins` directory**:
18+
Navigate to the `dropins` directory within your server’s folder. If your Liberty installation is located at `/opt/ibm/wlp` and your server is named `myServer`, the path is:
19+
```
20+
/opt/ibm/wlp/usr/servers/myServer/dropins
21+
```
22+
Replace `/opt/ibm/wlp` with your actual Liberty installation directory and `myServer` with your server’s name.
23+
24+
- **Create an exploded WAR directory**:
25+
Inside the `dropins` directory, create a directory named `myApp.war`. The `.war` extension tells Liberty to treat this as a web application. Use this command:
26+
```bash
27+
mkdir -p /opt/ibm/wlp/usr/servers/myServer/dropins/myApp.war
28+
```
29+
30+
- **Create the `index.jsp` file**:
31+
Inside `myApp.war`, create a file named `index.jsp` with the following content to display "Hello World!":
32+
```jsp
33+
<html>
34+
<body>
35+
<h2>Hello World!</h2>
36+
</body>
37+
</html>
38+
```
39+
You can create it directly with a command like:
40+
```bash
41+
echo '<html><body><h2>Hello World!</h2></body></html>' > /opt/ibm/wlp/usr/servers/myServer/dropins/myApp.war/index.jsp
42+
```
43+
Alternatively, use a text editor to create `index.jsp` and save it in that location.
44+
45+
#### 2. Start the Server (if Not Already Running)
46+
If your server isn’t running, you need to start it so it can deploy and serve the application.
47+
48+
- **Navigate to the `bin` directory**:
49+
Go to the `bin` directory in your Liberty installation:
50+
```bash
51+
cd /opt/ibm/wlp/bin
52+
```
53+
54+
- **Start the server**:
55+
Run the server in foreground mode to see the output directly:
56+
```bash
57+
./server run myServer
58+
```
59+
Alternatively, start it in the background:
60+
```bash
61+
./server start myServer
62+
```
63+
If the server is already running, skip this step—Liberty will detect the new application automatically.
64+
65+
#### 3. Verify Application Deployment
66+
Liberty will deploy the `myApp.war` application automatically when it detects it in the `dropins` directory.
67+
68+
- **Check the console output**:
69+
If you started the server in foreground mode, watch for a message like:
70+
```
71+
[AUDIT ] CWWKT0016I: Web application available (default_host): http://localhost:9080/myApp/
72+
```
73+
This confirms the application is deployed and available.
74+
75+
- **Check logs (if running in background)**:
76+
If the server is running in the background, look in the log file at:
77+
```
78+
/opt/ibm/wlp/usr/servers/myServer/logs/console.log
79+
```
80+
for the same deployment message.
81+
82+
#### 4. Access the Application
83+
Now that the application is deployed, you can view it in a web browser.
84+
85+
- **Open your browser**:
86+
Navigate to:
87+
```
88+
http://localhost:9080/myApp/
89+
```
90+
The context root `/myApp` comes from the `myApp.war` directory name, and `index.jsp` is served by default as a welcome file.
91+
92+
- **Expected result**:
93+
You should see a page displaying:
94+
```
95+
Hello World!
96+
```
97+
in large text.
98+
99+
### Notes
100+
- **Port number**: This example uses port `9080`, the default HTTP port for Liberty. If you’ve configured a different port, adjust the URL accordingly (e.g., `http://localhost:YOUR_PORT/myApp/`).
101+
- **Permissions**: Ensure you have write permissions to the `dropins` directory.
102+
- **JSP support**: The `javaee-8.0` feature includes JSP support, so no additional configuration is needed.
103+
- **Troubleshooting**: If the page doesn’t load, check the server logs at `/opt/ibm/wlp/usr/servers/myServer/logs/messages.log` for errors, or ensure the server is running and the files are in the correct location.
104+
105+
This simple example demonstrates how to deploy and run a "Hello World" application on your WebSphere Liberty server using the `dropins` directory for automatic deployment. Enjoy your first Liberty application!
106+
107+
---
108+
109+
Here’s an explanation of how a "Hello World" application works when deployed on WebSphere Liberty:
110+
111+
### 1. **The Dropins Directory**
112+
WebSphere Liberty provides a convenient feature for deploying applications through its `dropins` directory. This is a special folder where you can simply place your application—either as a WAR (Web Application Archive) file or an exploded WAR directory—and Liberty will automatically detect and deploy it. Unlike traditional deployment methods, you don’t need to manually configure the application in the `server.xml` file. When Liberty starts or notices a change in the `dropins` folder (like adding a new application), it kicks off the deployment process automatically.
113+
114+
### 2. **Using an Exploded WAR Directory**
115+
In this example, the application is deployed as an exploded WAR directory named `myApp.war` instead of a single packaged WAR file. An exploded WAR is just a folder containing all the contents of a web application (like HTML, JSP files, and other resources) in an unzipped form. Liberty treats this directory exactly like it would a WAR file, deploying it as a fully functional web application. This method is especially useful during development because you can edit the files directly (e.g., tweak the HTML or JSP) without needing to repackage everything into a WAR file.
116+
117+
### 3. **The JSP File**
118+
The heart of this "Hello World" application is a file called `index.jsp`, a JavaServer Page (JSP). This file contains basic HTML to display "Hello World!" on the screen and could include Java code if needed (though in this case, it’s kept simple). When you access the application, Liberty dynamically compiles the JSP into a servlet—a small Java program that generates the webpage—and serves it to your browser.
119+
120+
### 4. **Enabling Java EE Features**
121+
To make all this work, Liberty relies on specific features being enabled in its configuration file, `server.xml`. Here, the `javaee-8.0` feature is activated, which provides support for technologies like JSPs, servlets, and other components of the Java Enterprise Edition (EE) 8 platform. This feature ensures Liberty has the necessary libraries and settings loaded to run the application smoothly.
122+
123+
### 5. **Automatic Deployment Process**
124+
Once you place the `myApp.war` directory into the `dropins` folder and start Liberty (or if it’s already running), the server automatically detects and deploys the application. You’ll see log messages in Liberty’s output indicating that the application has started and is available at a specific URL. This hands-off deployment process makes it quick and easy to get an application up and running.
125+
126+
### 6. **Accessing the Application: Context Root**
127+
The URL where you can access the application is determined by its **context root**, which is simply the name of the WAR file or directory. In this case, since the directory is named `myApp.war`, the context root becomes `/myApp`. By default, Liberty runs on port `9080`, so the full URL to access the application is `http://localhost:9080/myApp/`.
128+
129+
### 7. **Serving the Welcome File**
130+
When you visit `http://localhost:9080/myApp/` in your browser, Liberty needs to figure out what to display. It looks for a **welcome file**—a default page to serve when no specific file is requested. In this case, `index.jsp` is located in the root of the `myApp.war` directory and is recognized as a welcome file by default. Liberty compiles and serves `index.jsp`, which then displays "Hello World!" on your screen.
131+
132+
### Summary
133+
This "Hello World" application showcases how WebSphere Liberty simplifies web application deployment. By leveraging the `dropins` directory for automatic deployment, supporting exploded WARs for easy editing, and using the `javaee-8.0` feature for Java EE compatibility, Liberty lets you quickly deploy and test a simple web app without complex setup. The result is a lightweight, developer-friendly way to see "Hello World!" at `http://localhost:9080/myApp/`, perfect for learning or prototyping.
+148
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,148 @@
1+
---
2+
audio: false
3+
generated: true
4+
lang: en
5+
layout: post
6+
title: Using WebSphere Liberty with Eclipse
7+
translated: false
8+
---
9+
10+
To use the WebSphere plugin tools in Eclipse and integrate them for working with WebSphere Liberty, you can choose between two main options: **IBM Liberty Developer Tools** and **Liberty Tools**. Both are available through the Eclipse Marketplace and provide features to build, deploy, and manage applications on WebSphere Liberty, a lightweight, production-ready server for Java EE and cloud-native applications. Below is a detailed guide on how to use and integrate these tools.
11+
12+
---
13+
14+
### **Overview of the Tools**
15+
- **IBM Liberty Developer Tools**: A traditional plugin provided by IBM for managing Liberty servers within Eclipse. It allows you to create and manage Liberty servers, deploy applications, and debug directly from the IDE. This tool is ideal for a server-centric workflow or for projects that aren't using Maven or Gradle.
16+
- **Liberty Tools**: A next-generation, open-source alternative focused on Maven and Gradle projects. It offers a more integrated experience with build tools, automatic detection of Liberty projects, and support for Liberty's development mode (dev mode). This tool is better suited for modern, build-tool-centric workflows.
17+
18+
Both tools streamline development for WebSphere Liberty, but they differ in their approach. Choose the one that best fits your project type and development preferences.
19+
20+
---
21+
22+
### **Installation**
23+
1. **Install Eclipse**:
24+
- Use a compatible version, such as **Eclipse for Enterprise Java and Web Developers**.
25+
- Ensure your Eclipse version supports the plugin you choose (check compatibility in the marketplace listing).
26+
27+
2. **Install the Plugin**:
28+
- Open Eclipse and go to **Help > Eclipse Marketplace**.
29+
- Search for:
30+
- "IBM Liberty Developer Tools" for the traditional IBM toolset, or
31+
- "Liberty Tools" for the open-source alternative.
32+
- Install the desired plugin by following the prompts.
33+
34+
---
35+
36+
### **Setting Up the Liberty Runtime**
37+
- **Download Liberty**:
38+
- If you haven't already, download the WebSphere Liberty runtime from the [official IBM website](https://www.ibm.com/docs/en/was-liberty).
39+
- Ensure the Liberty version is compatible with the plugin you installed.
40+
41+
- **Configure the Runtime in Eclipse**:
42+
- For **IBM Liberty Developer Tools**:
43+
- Go to **Window > Preferences > Server > Runtime Environments**.
44+
- Click "Add," select "Liberty Server," and specify the path to your Liberty installation directory.
45+
- For **Liberty Tools**:
46+
- No explicit runtime configuration is needed. Liberty Tools detect Liberty projects via Maven or Gradle configurations, so ensure your project is properly set up (see below).
47+
48+
---
49+
50+
### **Integrating with Your Project**
51+
The integration process differs slightly between the two tools. Follow the steps below based on the tool you installed.
52+
53+
#### **For IBM Liberty Developer Tools**
54+
1. **Create a Liberty Server**:
55+
- Open the **Servers** view (**Window > Show View > Servers**).
56+
- Right-click in the Servers view and select **New > Server**.
57+
- Choose "Liberty Server" from the list and follow the wizard to configure the server, including specifying the path to your Liberty installation.
58+
59+
2. **Add Your Project**:
60+
- Right-click the server in the Servers view and select **Add and Remove...**.
61+
- Select your project and move it to the "Configured" side.
62+
63+
3. **Start the Server**:
64+
- Right-click the server and choose **Start** or **Debug** to run your application.
65+
- Access your application at the specified URL (default: `http://localhost:9080/<context-root>`).
66+
67+
#### **For Liberty Tools (Maven/Gradle Projects)**
68+
1. **Ensure Project Configuration**:
69+
- Your project must include the necessary Liberty plugin:
70+
- For Maven: Add the `liberty-maven-plugin` to your `pom.xml`.
71+
- For Gradle: Add the `liberty-gradle-plugin` to your `build.gradle`.
72+
- The `server.xml` configuration file should be in the standard location:
73+
- For Maven: `src/main/liberty/config`.
74+
- For Gradle: Adjust based on your project structure.
75+
76+
2. **Use the Liberty Dashboard**:
77+
- Click the Liberty icon in the Eclipse toolbar to open the **Liberty Dashboard**.
78+
- Liberty Tools automatically detect and list your Liberty projects in the dashboard.
79+
- Right-click on your project in the dashboard to access commands such as:
80+
- "Start in dev mode" (automatically redeploys changes without restarting the server).
81+
- "Run tests."
82+
- "View test reports."
83+
84+
3. **Access Your Application**:
85+
- Once the server is running, access your application at the specified URL (default: `http://localhost:9080/<context-root>`).
86+
- In dev mode, make changes to your code, and Liberty will automatically redeploy them.
87+
88+
---
89+
90+
### **Key Features**
91+
Both tools offer powerful features to enhance productivity:
92+
93+
- **Server Management**:
94+
- Start, stop, and debug Liberty servers directly from Eclipse.
95+
- **Application Deployment**:
96+
- Easily deploy and redeploy applications.
97+
- **Configuration Assistance**:
98+
- Both tools provide code completion, validation, and hover descriptions for Liberty configuration files (e.g., `server.xml`).
99+
- **Development Mode**:
100+
- Automatically detect and redeploy code changes without restarting the server (especially with Liberty Tools in dev mode).
101+
- **Debugging**:
102+
- Attach the Eclipse debugger to the Liberty server for troubleshooting.
103+
104+
---
105+
106+
### **Considerations and Potential Issues**
107+
- **Version Compatibility**:
108+
- Ensure that your versions of Eclipse, the plugin, and the Liberty runtime are compatible. Check the documentation for specific requirements.
109+
- **Project Configuration**:
110+
- For Liberty Tools, your project must be a properly configured Maven or Gradle project with the Liberty plugin included.
111+
- Ensure `server.xml` is in the expected location for the tools to recognize your project.
112+
- **Network Settings**:
113+
- Ensure that the default Liberty ports (e.g., 9080 for HTTP, 9443 for HTTPS) are open and not blocked by firewalls.
114+
- **Java Compatibility**:
115+
- Liberty is a Java-based server, so ensure you have a compatible Java version installed for your Liberty runtime.
116+
117+
---
118+
119+
### **Quick Start with Liberty Tools (Maven/Gradle)**
120+
If you're using Maven or Gradle, Liberty Tools offer a streamlined experience. Here's a step-by-step guide:
121+
122+
1. Install **Eclipse for Enterprise Java and Web Developers**.
123+
2. Go to **Help > Eclipse Marketplace**, search for "Liberty Tools," and install the plugin.
124+
3. Create or import a Maven/Gradle project configured for Liberty:
125+
- You can use the [Open Liberty Starter](https://openliberty.io/start/) to generate a sample project.
126+
4. Ensure your project has the `liberty-maven-plugin` (for Maven) or `liberty-gradle-plugin` (for Gradle) configured.
127+
5. Open the **Liberty Dashboard** by clicking the Liberty icon in the toolbar.
128+
6. Your project should appear in the dashboard. Right-click on it and select "Start in dev mode."
129+
7. Access your application at the specified URL (default: `http://localhost:9080/<context-root>`).
130+
8. Make changes to your code; Liberty dev mode will automatically redeploy them.
131+
9. Use the dashboard to run tests or view test reports as needed.
132+
133+
---
134+
135+
### **Choosing Between the Tools**
136+
- **IBM Liberty Developer Tools**:
137+
- Ideal for a traditional server management approach or for projects that aren't using Maven or Gradle.
138+
- Offers a Servers view for managing Liberty servers explicitly.
139+
- **Liberty Tools**:
140+
- Better suited for Maven or Gradle projects, with tighter integration with these build systems.
141+
- Provides a Liberty Dashboard for project-centric management and dev mode support.
142+
- Open-source, allowing community contributions and updates.
143+
144+
Both tools are available from the Eclipse Marketplace, so you can try both and choose the one that best fits your workflow.
145+
146+
---
147+
148+
In summary, using the WebSphere plugin tools in Eclipse involves installing the appropriate plugin, setting up the Liberty runtime, and configuring your project to work with Liberty. Whether you choose IBM Liberty Developer Tools or Liberty Tools, both provide robust features to streamline development for WebSphere Liberty within the Eclipse IDE.

notes/2025-02-24-websphere-en.md

+33
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
---
2+
audio: false
3+
generated: true
4+
lang: en
5+
layout: post
6+
title: WebSphere Liberty Server Commands
7+
translated: false
8+
---
9+
10+
When managing a WebSphere Liberty server, several commands are frequently used to perform essential tasks such as creating, starting, stopping, and monitoring the server. Below is a list of the most commonly used commands, along with a brief description of each:
11+
12+
- **`./server create <server_name>`**
13+
Creates a new server instance with the specified name. This command sets up the necessary directory structure and default configuration files (e.g., `server.xml`) for the server.
14+
15+
- **`./server start <server_name>`**
16+
Starts the server in the background. The server runs as a background process, and logs are written to the server's log files.
17+
18+
- **`./server stop <server_name>`**
19+
Stops a running server instance. This command gracefully shuts down the server.
20+
21+
- **`./server status <server_name>`**
22+
Checks whether the specified server is running. It returns the current status (e.g., started or stopped).
23+
24+
- **`./server run <server_name>`**
25+
Starts the server in the foreground. This is useful for debugging or monitoring, as server output is displayed directly in the console.
26+
27+
- **`./server package <server_name>`**
28+
Packages the server, including its configuration and applications, into a zip file. This is helpful for deploying the server to another environment or for backup purposes.
29+
30+
- **`./server debug <server_name>`**
31+
Starts the server in debug mode, allowing you to attach a debugger to the server process for troubleshooting.
32+
33+
These commands cover the basic operations needed to manage a WebSphere Liberty server effectively. For more advanced tasks, such as installing features or managing security, additional utilities like `featureUtility` or `securityUtility` are available but are less frequently used in day-to-day operations.

0 commit comments

Comments
 (0)