Examples
Sample applications demonstrating LangChain4j CDI with various Jakarta EE runtimes.
Examples
All examples demonstrate a car booking application with chat, fraud detection, and function calling.
Recommended: Quarkus
The fastest way to get started:
cd examples/quarkus-car-booking
mvn quarkus:dev
Startup time is around 10 seconds with live reload support.
Available Examples
| Example | Runtime | Extension Type |
|---|---|---|
quarkus-car-booking |
Quarkus | Build-compatible |
helidon-car-booking |
Helidon | Build-compatible |
helidon-car-booking-portable-ext |
Helidon | Portable |
wildfly-car-booking |
WildFly | Portable |
glassfish-car-booking |
GlassFish | Portable |
liberty-car-booking |
Open Liberty | Portable |
liberty-car-booking-mcp |
Open Liberty | Portable + MCP |
car-booking-mcp |
- | MCP server demo |
Running an Example
- Install all core modules first:
mvn clean install -DskipTests -pl '!examples/payara-car-booking'
- Navigate to the example directory and run:
cd examples/quarkus-car-booking
mvn quarkus:dev
-
Without an LLM provider (Ollama), endpoints return connection errors (expected behavior).
-
With Ollama, use the provided setup scripts in the examples directory.
MCP Server Example
The car-booking-mcp example demonstrates how to expose car booking operations as MCP tools:
cd examples/car-booking-mcp
mvn quarkus:dev
The MCP server is available at http://localhost:8080/mcp.
Liberty MCP Example
The liberty-car-booking-mcp example demonstrates MCP server integration with Open Liberty:
cd examples/liberty-car-booking-mcp
mvn liberty:dev