Start the server
The Chat Server API can be started using the Gradle wrapper or by running the compiled JAR directly.Using Gradle (recommended for development)
- Compile the application if needed
- Start the Spring Boot application
- Enable hot reload with DevTools
- Display startup logs in the console
Using the JAR file (recommended for production)
After building the project, run the compiled JAR:With custom environment variables
Verify the server is running
Check the startup logs
When the server starts successfully, you should see output similar to:The application name is defined in
application.properties:1 as “server”.Check the default port
By default, Spring Boot applications run on port
8080. Look for this line in the logs:Test the health endpoint
The server includes Spring Boot Actuator (Expected response:
build.gradle.kts:35). Test the health endpoint:Access Swagger UI
The server includes SpringDoc OpenAPI documentation (build.gradle.kts:53-54) with an interactive Swagger UI.
The API documentation is configured in
APIServerApplication.java:22-27 with the title “Chat Server API” and version from Configuration.SERVER_VERSION.Open Swagger UI
Navigate to the following URL in your web browser:Features available in Swagger UI
- Interactive API documentation: View all available endpoints
- Request/response schemas: See data models and validation rules
- Try it out: Execute API requests directly from the browser
- Authentication: Test endpoints with JWT tokens
View OpenAPI specification
Access the raw OpenAPI JSON specification:Stopping the server
Troubleshooting
Port already in use
If you see an error like:-
Change the port: Create
application.propertiesoverride or use command line: -
Kill the existing process:
Database locked error
If you see:- Check for multiple server instances: Ensure only one server process is accessing the database
- Remove lock files: Delete
main.db-shmandmain.db-walfiles (only when server is stopped) - Verify WAL mode: The server configures WAL mode automatically via
connection-init-sqlinapplication.properties:8-12
JWT authentication errors
If authentication fails with token errors:-
Verify JWT_SECRET: Ensure the environment variable is set correctly and is Base64-encoded
-
Check token expiration: Tokens expire after 30 days (
Configuration.java:15). Generate a new token by logging in again. -
Use the default secret: For development only, the server falls back to a default secret if
JWT_SECRETis not set
Out of memory errors
If the server crashes with:-
Increase heap size:
-
Adjust SQLite cache: Reduce the cache size in
application.propertiesfrom-10000to-5000(5MB)
Connection refused errors
If external clients can’t connect:-
Bind to all interfaces: Add to
application.properties: - Check firewall settings: Ensure port 8080 is allowed through your firewall
-
Verify server is running: Check the process is active:
Schema validation errors
If you see Hibernate validation errors:-
Delete the database: Remove
main.dband restart (development only) -
Change DDL mode: In
application.properties, temporarily usecreateinstead ofupdate: