{"id":133760,"date":"2025-06-04T10:28:00","date_gmt":"2025-06-04T07:28:00","guid":{"rendered":"https:\/\/www.javacodegeeks.com\/?p=133760"},"modified":"2025-06-03T20:58:44","modified_gmt":"2025-06-03T17:58:44","slug":"java-langchain-mongodb-example","status":"publish","type":"post","link":"https:\/\/www.javacodegeeks.com\/java-langchain-mongodb-example.html","title":{"rendered":"Java Langchain MongoDB Example"},"content":{"rendered":"<p>This article explores how to build an AI-powered chatbot using Langchain4j, MongoDB Atlas, and Ollama running locally. This solution leverages the Retrieval-Augmented Generation (RAG) pattern to fetch relevant information from your data and use it to generate accurate and contextual responses.<\/p>\n<p>This guide walks through the setup, from data ingestion to chat response generation, while integrating embeddings, vector search, and a local language model.<\/p>\n<h2 class=\"wp-block-heading\">1. What is RAG?<\/h2>\n<p><strong>Retrieval-Augmented Generation (RAG)<\/strong> is an AI architecture that enhances the output of large language models (LLMs) by combining them with an external knowledge retrieval component. It is a hybrid approach in natural language processing (NLP) that combines two powerful technologies: <strong>retrieval-based methods<\/strong> and <strong>generative language models<\/strong>. It aims to improve the factual accuracy, relevance, and contextual richness of responses produced by large language models (LLMs).<\/p>\n<p><strong>Traditional LLM Limitations<\/strong><\/p>\n<p>While LLMs like GPT, LLaMA, or Mistral are trained on massive corpora and can generate fluent responses, they come with key limitations:<\/p>\n<ul class=\"wp-block-list\">\n<li><strong>Static Knowledge<\/strong>: LLMs cannot learn or access data after training unless fine-tuned or retrained.<\/li>\n<li><strong>Context Limitations<\/strong>: They operate solely on the input prompt and their internal weights.<\/li>\n<li><strong>Hallucinations<\/strong>: They may generate plausible-sounding but incorrect or fabricated information.<\/li>\n<\/ul>\n<h3 class=\"wp-block-heading\">1.1 Benefits of RAG<\/h3>\n<p>RAG brings together the best of two worlds: the reasoning and language capabilities of LLMs with the factual grounding of a live knowledge base. Key advantages include:<\/p>\n<ul class=\"wp-block-list\">\n<li><strong>Accuracy &amp; Reliability<\/strong>: Retrieved documents provide grounded context, reducing hallucinations.<\/li>\n<li><strong>Overcomes LLM limitations<\/strong>: Helps models respond accurately even if the training data is outdated or lacks specific context.<\/li>\n<li><strong>Cost Efficiency<\/strong>: No need to retrain or fine-tune models every time the data changes. Update the database instead.<\/li>\n<li><strong>Explainability<\/strong>: Responses can be traced back to specific documents, aiding transparency and trust.<\/li>\n<li><strong>Domain-specific support<\/strong>: Easily integrates your own knowledge base (support docs, policies, product manuals).<\/li>\n<li><strong>Reduced hallucinations<\/strong>: Limits the risk of fabricated answers by grounding responses in real documents.<\/li>\n<\/ul>\n<h2 class=\"wp-block-heading\">2. MongoDB for RAG<\/h2>\n<p>MongoDB is a document-based NoSQL database that offers a flexible and scalable foundation for building RAG applications. Its native JSON-like document structure and advanced features such as full-text search, Atlas Vector Search, and seamless integration with cloud services make it particularly well-suited for handling unstructured or semi-structured knowledge sources needed in RAG systems.<\/p>\n<h3 class=\"wp-block-heading\">2.1 Why Use MongoDB in a RAG Architecture?<\/h3>\n<ul class=\"wp-block-list\">\n<li><strong>Document-Oriented Storage<\/strong>: MongoDB stores data as BSON documents, allowing rich text, metadata, and structured fields to coexist. This structure aligns perfectly with the &#8220;chunks&#8221; of information retrieved in RAG pipelines.<\/li>\n<li><strong>Full-Text and Vector Search<\/strong>: MongoDB Atlas supports <strong>full-text search<\/strong> via built-in Lucene integration, and more importantly for RAG, <strong>Vector Search<\/strong> for retrieving similar documents based on embeddings. This is essential for semantic search in retrieval pipelines.<\/li>\n<li><strong>Flexible Schema<\/strong>: RAG systems often evolve and require flexibility in the way documents are structured. MongoDB\u2019s schema-less design enables you to update or extend documents without painful migrations.<\/li>\n<li><strong>Horizontal Scalability<\/strong>: As documents grows, whether it&#8217;s product manuals, legal documents, or research articles, MongoDB scales effortlessly through sharding and distributed clusters.<\/li>\n<\/ul>\n<h3 class=\"wp-block-heading\">2.2 Example Use in RAG<\/h3>\n<ul class=\"wp-block-list\">\n<li><strong>Storage<\/strong>: Store each paragraph, answer, or snippet as a MongoDB document with metadata and embedding vectors.<\/li>\n<li><strong>Retrieval<\/strong>: Use Atlas Vector Search to find top-k relevant documents based on semantic similarity to a user query.<\/li>\n<li><strong>Augmentation<\/strong>: Feed retrieved documents to the LLM to ground the response in real data.<\/li>\n<\/ul>\n<h2 class=\"wp-block-heading\">3. Prerequisites<\/h2>\n<p>For this article, you will need:<\/p>\n<ul class=\"wp-block-list\">\n<li>Java 21 or higher.<\/li>\n<li>Maven for dependency management.<\/li>\n<li>A MongoDB Atlas account with a live cluster.<\/li>\n<li>Ollama installed locally with a <code>LLaMA3<\/code> or <code>orca-mini<\/code> model.<\/li>\n<\/ul>\n<p><strong>Set Up Ollama Locally<\/strong><\/p>\n<p>To get started with Ollama, install it by following the <a href=\"https:\/\/ollama.com\/\" target=\"_blank\" rel=\"noreferrer noopener\">official instructions<\/a> for your operating system. Once installed, use the command line to pull and run a model, such as downloading and launching the LLaMA3 model.<\/p>\n<pre class=\"brush:bash\">\nollama pull orca-mini\nollama run orca-mini\n<\/pre>\n<p><strong>Set Up MongoDB Atlas<\/strong><\/p>\n<p>Sign in to <a href=\"https:\/\/www.javacodegeeks.com\/getting-started-with-mongodb-atlas.html\" target=\"_blank\" rel=\"noreferrer noopener\">MongoDB Atlas<\/a>, create a free cluster, then set up a database named <code>rag_app<\/code> with a collection called <code>documents<\/code>.<\/p>\n<h2 class=\"wp-block-heading\">4. Project Setup<\/h2>\n<p>Create a new Maven project and add the following dependencies to your <code>pom.xml<\/code>:<\/p>\n<pre class=\"brush:xml\">\n        &lt;dependency&gt;\n            &lt;groupId&gt;dev.langchain4j&lt;\/groupId&gt;\n            &lt;artifactId&gt;langchain4j&lt;\/artifactId&gt;\n            &lt;version&gt;1.0.0-alpha1&lt;\/version&gt;\n            &lt;scope&gt;test&lt;\/scope&gt;\n        &lt;\/dependency&gt;\n\n        &lt;dependency&gt;\n            &lt;groupId&gt;dev.langchain4j&lt;\/groupId&gt;\n            &lt;artifactId&gt;langchain4j-ollama&lt;\/artifactId&gt;\n            &lt;version&gt;1.0.0-alpha1&lt;\/version&gt;\n        &lt;\/dependency&gt;\n        \n        &lt;dependency&gt;  \n            &lt;groupId&gt;dev.langchain4j&lt;\/groupId&gt;  \n            &lt;artifactId&gt;langchain4j-mongodb-atlas&lt;\/artifactId&gt;  \n            &lt;version&gt;1.0.0-alpha1&lt;\/version&gt;  \n        &lt;\/dependency&gt; \n<\/pre>\n<ul class=\"wp-block-list\">\n<li><strong>langchain4j<\/strong>\n<ul class=\"wp-block-list\">\n<li>This is the foundational library for working with LangChain4j in Java.<\/li>\n<li>It includes features for building chains, managing memory, and handling input\/output.<\/li>\n<\/ul>\n<\/li>\n<li><strong>langchain4j-ollama<\/strong>\n<ul class=\"wp-block-list\">\n<li>This module integrates LangChain4j with <strong>Ollama<\/strong>, a local runtime for LLMs such as LLaMA and Mistral.<\/li>\n<li>It allows your application to interact with models running directly on your machine without needing external APIs.<\/li>\n<\/ul>\n<\/li>\n<li><strong>langchain4j-mongodb-atlas<\/strong>\n<ul class=\"wp-block-list\">\n<li>Adds support for using <strong>MongoDB Atlas<\/strong> as the vector store and retrieval database.<\/li>\n<li>Enables storing and querying documents using metadata and embeddings through Atlas Vector Search.<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<h2 class=\"wp-block-heading\">5. Implementing the RAG Application<\/h2>\n<h3 class=\"wp-block-heading\">Application Overview<\/h3>\n<p>The chatbot leverages Retrieval-Augmented Generation (RAG) using the following architecture:<\/p>\n<ul class=\"wp-block-list\">\n<li><strong>Embedding Model<\/strong>: <code>nomic-embed-text<\/code> via Ollama creates vector representations of documents.<\/li>\n<li><strong>Storage<\/strong>: MongoDB Atlas stores the vector embeddings.<\/li>\n<li><strong>Chat Model<\/strong>: <code>orca-mini<\/code> via Ollama generates responses based on user input and retrieved documents.<\/li>\n<li><strong>LangChain4j<\/strong> ties everything together through document ingestion, vector search, and model interaction.<\/li>\n<\/ul>\n<h3 class=\"wp-block-heading\">Sample Dataset (RAG Knowledge Base)<\/h3>\n<p>This use case involves an internal assistant designed for a Smart Home Energy System, capable of answering questions related to system components, installation steps, diagnostics, and routine maintenance. It serves as a helpful tool for customer support engineers, field technicians, and internal operations staff who require accurate and quick access to technical information.<div style=\"display:inline-block; margin: 15px 0;\"> <div id=\"adngin-JavaCodeGeeks_incontent_video-0\" style=\"display:inline-block;\"><\/div> <\/div><\/p>\n<p>Let&#8217;s simulate the contents of five documentation files located in the application\u2019s&nbsp;<code>resources<\/code>&nbsp;folder:<\/p>\n<p><code>doc1.txt<\/code> \u2013 <strong>System Components Overview<\/strong><\/p>\n<pre class=\"brush:plain\">\nThe SmartHome Energy Hub consists of four core components:\n1. Energy Meter \u2013 Tracks real-time energy usage.\n2. Solar Inverter \u2013 Converts solar energy for home use.\n3. Battery Storage Unit \u2013 Stores excess solar power.\n4. Control Panel \u2013 Provides centralized system monitoring.\n\nAll components are connected via Zigbee protocol to the SmartHome central controller.\n<\/pre>\n<p><code>doc2.txt<\/code> \u2013 <strong>Setup Instructions<\/strong><\/p>\n<pre class=\"brush:plain\">\nTo set up the system:\n1. Mount the solar panels and connect them to the inverter.\n2. Connect the inverter output to the Battery Storage Unit.\n3. Link the Energy Meter to the Control Panel via Zigbee.\n4. Configure the SmartHome app with the system ID to start monitoring.\n<\/pre>\n<p><code>doc3.txt<\/code> \u2013 <strong>Faults and Errors<\/strong><\/p>\n<pre class=\"brush:plain\">\nCommon Errors:\n- ERR001: Inverter overheating \u2013 Check ventilation.\n- ERR002: Battery not charging \u2013 Inspect cable connections.\n- ERR003: Zigbee connection lost \u2013 Re-pair the device using the Control Panel.\n\nTo reset errors, hold the Control Panel reset button for 10 seconds.\n<\/pre>\n<p><code>doc4.txt<\/code> \u2013 <strong>Maintenance Guide<\/strong><\/p>\n<pre class=\"brush:plain\">\nMonthly Maintenance Checklist:\n- Inspect solar panels for debris or damage.\n- Verify battery charge levels.\n- Ensure firmware is up to date via the SmartHome app.\n- Test Zigbee connections for all devices.\n\nReport any physical faults using the issue tracker form in the dashboard.\n<\/pre>\n<p><code>doc5.txt<\/code> \u2013 <strong>Operational Workflow<\/strong><\/p>\n<pre class=\"brush:plain\">\nSystem Workflow:\n1. Solar panels generate electricity.\n2. The inverter converts it to AC power.\n3. Power is supplied to the home or stored in the battery.\n4. The Energy Meter records usage statistics.\n5. The Control Panel displays system status and alerts.\n\nBattery discharge occurs automatically during low solar input.\n<\/pre>\n<h3 class=\"wp-block-heading\">Setting Up MongoDB Atlas<\/h3>\n<p>The following snippet initializes the MongoDB client and embedding store:<\/p>\n<pre class=\"brush:java\">\n\/\/ Set your MongoDB configuration\nString mongodbUrl = \"mongodb+srv:\/\/&lt;user&gt;:&lt;password&gt;@cluster.mongodb.net\/?retryWrites=true&amp;w=majority\";\n\n\/\/ Create MongoDB client\nMongoClient mongoClient = MongoClients.create(mongodbUrl);\n\n\/\/ Embedding Store\nEmbeddingStore&lt;TextSegment&gt; embeddingStore = createEmbeddingStore(mongoClient);\n<\/pre>\n<p>This block sets up the MongoDB connection using the Atlas connection string. <code>MongoClient<\/code> is the main interface to interact with the database and will later store our text embeddings for similarity search. The <code>createEmbeddingStore()<\/code> method configures the MongoDB vector store, collection, and index used by LangChain4j for semantic search.<\/p>\n<h3 class=\"wp-block-heading\">Defining the Embedding Store<\/h3>\n<p>The embedding store is backed by MongoDB\u2019s vector capabilities using the <code>MongoDbEmbeddingStore<\/code> class:<\/p>\n<pre class=\"brush:java\">\n    private static EmbeddingStore&lt;TextSegment&gt; createEmbeddingStore(MongoClient mongoClient) {\n        String databaseName = \"rag_app\";\n        String collectionName = \"documents\";\n        String indexName = \"document\";\n        Long maxResultRatio = 10L;\n        CreateCollectionOptions createCollectionOptions = new CreateCollectionOptions();\n        Bson filter = null;\n        Set&lt;String&gt; metadataFields = new HashSet&lt;&gt;();\n        IndexMapping indexMapping = new IndexMapping(768, metadataFields);\n        Boolean createIndex = true;\n\n        return new MongoDbEmbeddingStore(\n                mongoClient,\n                databaseName,\n                collectionName,\n                indexName,\n                maxResultRatio,\n                createCollectionOptions,\n                filter,\n                indexMapping,\n                createIndex\n        );\n    }\n<\/pre>\n<p>This method configures a <code>MongoDbEmbeddingStore<\/code> with:<\/p>\n<ul class=\"wp-block-list\">\n<li>Database: <code>rag_app<\/code><\/li>\n<li>Collection: <code>documents<\/code><\/li>\n<li>Index: <code>document<\/code><\/li>\n<li>Embedding vector size: 768<\/li>\n<\/ul>\n<p>It ensures proper indexing and schema for vector similarity search.<\/p>\n<h3 class=\"wp-block-heading\">Configuring the Embedding Model<\/h3>\n<p>The app uses Ollama to run the embedding and chat models locally:<\/p>\n<pre class=\"brush:java\">\n        \/\/ Create the embedding model with Ollama\n        EmbeddingModel embeddingModel = OllamaEmbeddingModel.builder()\n                .baseUrl(\"http:\/\/localhost:11434\")\n                .modelName(\"nomic-embed-text\")\n                .timeout(Duration.ofMinutes(10))\n                .build();\n<\/pre>\n<p>We define an <strong>embedding model<\/strong> using <code>OllamaEmbeddingModel<\/code>. This model converts text into vectors. The <code>nomic-embed-text<\/code> model is a lightweight, open-source embedding model. Ollama runs it locally and serves it over HTTP.<\/p>\n<h3 class=\"wp-block-heading\">Defining the Chat Language Model<\/h3>\n<pre class=\"brush:java\">\n        ChatLanguageModel chatModel = OllamaChatModel.builder()\n                .baseUrl(\"http:\/\/localhost:11434\")\n                .timeout(Duration.ofMinutes(10))\n                .modelName(\"orca-mini\")\n                .build();\n<\/pre>\n<p>Here, we initialize a <strong>chat model<\/strong> using Ollama again, but this time specifying a conversational LLM &#8211; <code>orca-mini<\/code>. It processes user queries and generates context-aware answers. Ensure you have pulled the required models.<\/p>\n<h3 class=\"wp-block-heading\">Loading and Parsing Documents<\/h3>\n<p>We load multiple text documents from the <code>src\/main\/resources<\/code> directory for ingestion:<\/p>\n<pre class=\"brush:java\">\n       \/\/ Load documents\n        Document doc1 = loadDocumentFromResource(\"doc1.txt\", new TextDocumentParser());\n        Document doc2 = loadDocumentFromResource(\"doc2.txt\", new TextDocumentParser());\n        Document doc3 = loadDocumentFromResource(\"doc3.txt\", new TextDocumentParser());\n        Document doc4 = loadDocumentFromResource(\"doc4.txt\", new TextDocumentParser());\n        Document doc5 = loadDocumentFromResource(\"doc5.txt\", new TextDocumentParser());\n\n        List&lt;Document&gt; documents = List.of(doc1, doc2, doc3, doc4, doc5);\n<\/pre>\n<p>This section loads documents (help guides, internal documentation) from our application&#8217;s <code>resources<\/code> folder. These documents serve as the knowledge base for the assistant. The <code>loadDocumentFromResource<\/code> helper method reads the resource stream and parses it using LangChain4j&#8217;s <code>TextDocumentParser<\/code>.<\/p>\n<p><strong>Helper Method to Load Resources<\/strong><\/p>\n<pre class=\"brush:java\">\nprivate static Document loadDocumentFromResource(String resourceName, DocumentParser parser) throws IOException {\n    try (InputStream inputStream = getResourceAsStream(resourceName)) {\n        Objects.requireNonNull(inputStream, \"Resource not found: \" + resourceName);\n        return parser.parse(inputStream);\n    }\n}\n<\/pre>\n<p>This method reads a resource file and parses it into a <code>Document<\/code>. It is used to load <code>doc1.txt<\/code> to <code>doc5.txt<\/code> from the <code>resources<\/code> folder.<\/p>\n<h3 class=\"wp-block-heading\">Splitting and Ingesting Documents<\/h3>\n<p>To improve retrieval accuracy, documents are split into smaller chunks using a recursive strategy:<\/p>\n<pre class=\"brush:java\">\n        DocumentSplitter splitter = DocumentSplitters.recursive(300, 30);\n\n        EmbeddingStoreIngestor ingestor = EmbeddingStoreIngestor.builder()\n                .documentSplitter(splitter)\n                .embeddingModel(embeddingModel)\n                .embeddingStore(embeddingStore)\n                .build();\n\n        ingestor.ingest(documents);\n<\/pre>\n<p>This step generates vector embeddings for each segment and stores them in MongoDB. We split documents into manageable text segments using <code>DocumentSplitters.recursive<\/code>. Then, the <code>EmbeddingStoreIngestor<\/code> generates embeddings for each segment and stores them in MongoDB.<\/p>\n<h3 class=\"wp-block-heading\">Setting Up the Retriever<\/h3>\n<p>This retriever performs semantic search to fetch the top 3 relevant chunks based on the input query:<\/p>\n<pre class=\"brush:java\">\n        \/\/ Content Retriever\n        ContentRetriever contentRetriever = EmbeddingStoreContentRetriever.builder()\n                .embeddingStore(embeddingStore)\n                .embeddingModel(embeddingModel)\n                .maxResults(3)\n                .minScore(0.6)\n                .build();\n<\/pre>\n<p>This code snippet finds the most relevant document chunks based on a user\u2019s query. It uses vector similarity and returns the top 3 matches above a score threshold of 0.6. (Only results with a semantic similarity score \u2265 0.6 are returned.)<\/p>\n<h3 class=\"wp-block-heading\">Defining the Assistant Interface<\/h3>\n<pre class=\"brush:java\">\npublic interface Assistant {\n\n    @SystemMessage(\"\"\"\n        You are an AI assistant trained exclusively on a set of internal documents containing specialized knowledge. \n        Answer user queries accurately and clearly using only the information contained in these documents. \n        Do not use external data, make assumptions, or speculate. If the information is not covered in the documents, \n        respond with: \"The documents do not contain enough information to answer this question.\"\n        Keep responses factual, concise, and helpful.\n    \"\"\")\n    String answer(String question);\n}\n<\/pre>\n<p>This interface defines the assistant\u2019s contract. The <code>@SystemMessage<\/code> provides instructions to the LLM, restricting its responses strictly to the document set and promoting factual, grounded answers.<\/p>\n<h3 class=\"wp-block-heading\">Creating the Assistant Service<\/h3>\n<p>Using LangChain4j&#8217;s <code>AiServices<\/code>, we bind the <code>Assistant<\/code> interface to the actual models:<\/p>\n<pre class=\"brush:java\">\n       \/\/ Assistant\n        Assistant assistant = AiServices.builder(Assistant.class)\n                .chatLanguageModel(chatModel)\n                .contentRetriever(contentRetriever)\n                .build();\n<\/pre>\n<p>Langchain4j wires everything together into a single assistant object. It uses the chat model for answering and the content retriever for grounding the answers on internal documents.<\/p>\n<h3 class=\"wp-block-heading\">Enabling Interactive Chat<\/h3>\n<p>The chatbot runs in a simple loop that reads user input and sends it to the assistant:<\/p>\n<pre class=\"brush:java\">\n        Scanner scanner = new Scanner(System.in);\n\n        System.out.println(\"AI Assistant is ready. Ask your questions (type 'exit' to quit):\");\n\n        while (true) {\n            System.out.print(\"You: \");\n            String input = scanner.nextLine();\n            if (\"exit\".equalsIgnoreCase(input)) {\n                break;\n            }\n\n            String response = assistant.answer(input);\n            System.out.println(\"Assistant: \" + response);\n        }\n<\/pre>\n<p>This is a simple console interface. The user types a question, which is passed to the assistant. The assistant replies using only the embedded documents. <\/p>\n<h3 class=\"wp-block-heading\">Full Main Class<\/h3>\n<pre class=\"brush:java\">\npublic class ChatBotApp {\n\n    public static void main(String[] args) throws IOException {\n        \/\/ Set your MongoDB configuration\n        String mongodbUrl = \"mongodb+srv:\/\/&lt;user&gt;:&lt;password&gt;@cluster.mongodb.net\/?retryWrites=true&amp;w=majority\";       \/\/ Replace with your MongoDB Atlas connection string\n\n        \/\/ Create MongoDB client\n        MongoClient mongoClient = MongoClients.create(mongodbUrl);\n\n        \/\/ Embedding Store\n        EmbeddingStore&lt;TextSegment&gt; embeddingStore = createEmbeddingStore(mongoClient);\n\n        \/\/ Create the embedding model with Ollama\n        EmbeddingModel embeddingModel = OllamaEmbeddingModel.builder()\n                .baseUrl(\"http:\/\/localhost:11434\")\n                .modelName(\"nomic-embed-text\")\n                .timeout(Duration.ofMinutes(10))\n                .build();\n\n        ChatLanguageModel chatModel = OllamaChatModel.builder()\n                .baseUrl(\"http:\/\/localhost:11434\")\n                .timeout(Duration.ofMinutes(10))\n                .modelName(\"orca-mini\")\n                .build();\n\n        System.out.println(\"LLaMA3 (Ollama) embedding model and MongoDB store initialized.\");\n\n        \/\/ Load documents\n        Document doc1 = loadDocumentFromResource(\"doc1.txt\", new TextDocumentParser());\n        Document doc2 = loadDocumentFromResource(\"doc2.txt\", new TextDocumentParser());\n        Document doc3 = loadDocumentFromResource(\"doc3.txt\", new TextDocumentParser());\n        Document doc4 = loadDocumentFromResource(\"doc4.txt\", new TextDocumentParser());\n        Document doc5 = loadDocumentFromResource(\"doc5.txt\", new TextDocumentParser());\n\n        List&lt;Document&gt; documents = List.of(doc1, doc2, doc3, doc4, doc5);\n\n        System.out.println(\"Loaded \" + documents.size() + \" documents\");\n\n        DocumentSplitter splitter = DocumentSplitters.recursive(300, 30);\n\n        EmbeddingStoreIngestor ingestor = EmbeddingStoreIngestor.builder()\n                .documentSplitter(splitter)\n                .embeddingModel(embeddingModel)\n                .embeddingStore(embeddingStore)\n                .build();\n\n        ingestor.ingest(documents);\n\n        \/\/ Content Retriever\n        ContentRetriever contentRetriever = EmbeddingStoreContentRetriever.builder()\n                .embeddingStore(embeddingStore)\n                .embeddingModel(embeddingModel)\n                .maxResults(3)\n                .minScore(0.6)\n                .build();\n\n        \/\/ Assistant\n        Assistant assistant = AiServices.builder(Assistant.class)\n                .chatLanguageModel(chatModel)\n                .contentRetriever(contentRetriever)\n                .build();\n\n        Scanner scanner = new Scanner(System.in);\n\n        System.out.println(\"AI Assistant is ready. Ask your questions (type 'exit' to quit):\");\n\n        while (true) {\n            System.out.print(\"You: \");\n            String input = scanner.nextLine();\n            if (\"exit\".equalsIgnoreCase(input)) {\n                break;\n            }\n\n            String response = assistant.answer(input);\n            System.out.println(\"Assistant: \" + response);\n        }\n\n    }\n\n    private static Document loadDocumentFromResource(String resourceName, DocumentParser parser) throws IOException {\n        try (InputStream inputStream = getResourceAsStream(resourceName)) {\n            Objects.requireNonNull(inputStream, \"Resource not found: \" + resourceName);\n            return parser.parse(inputStream);\n        }\n    }\n\n    protected static InputStream getResourceAsStream(String resourceName) {\n        return ChatBotApp.class.getClassLoader().getResourceAsStream(resourceName);\n    }\n\n    private static EmbeddingStore&lt;TextSegment&gt; createEmbeddingStore(MongoClient mongoClient) {\n        String databaseName = \"rag_app\";\n        String collectionName = \"documents\";\n        String indexName = \"document\";\n        Long maxResultRatio = 10L;\n        CreateCollectionOptions createCollectionOptions = new CreateCollectionOptions();\n        Bson filter = null;\n        Set&lt;String&gt; metadataFields = new HashSet&lt;&gt;();\n        IndexMapping indexMapping = new IndexMapping(768, metadataFields);\n        Boolean createIndex = true;\n\n        return new MongoDbEmbeddingStore(\n                mongoClient,\n                databaseName,\n                collectionName,\n                indexName,\n                maxResultRatio,\n                createCollectionOptions,\n                filter,\n                indexMapping,\n                createIndex\n        );\n    }\n}\n<\/pre>\n<h3 class=\"wp-block-heading\">Compile and Run<\/h3>\n<p>Use Maven to compile and run the application:<\/p>\n<pre class=\"brush:bash\">\nmvn clean compile\n<\/pre>\n<pre class=\"brush:bash\">\nmvn exec:java -Dexec.mainClass=\"com.jcg.langchain4j.chatbot.ChatBotApp\"\n<\/pre>\n<p>You should now be able to interact with the chatbot, which retrieves context from MongoDB and generates responses using Ollama&#8217;s <code>orca-mini<\/code> model. When the chatbot is up and running, it will display:<\/p>\n<pre class=\"brush:bash\">\nAI Assistant is ready. Ask your questions (type 'exit' to quit):\nYou:\n<\/pre>\n<p>You can try asking questions based on the internal knowledge base, such as: <em>&#8220;What should I do if the battery isn&#8217;t charging?&#8221;<\/em><\/p>\n<p><strong>Assistant Response:<\/strong><\/p>\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-full\"><a href=\"https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2025\/06\/assistance_response.png\"><img decoding=\"async\" width=\"582\" height=\"201\" src=\"https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2025\/06\/assistance_response.png\" alt=\"Sample Response from the Assistant (Java + LangChain4j + MongoDB)\" class=\"wp-image-134502\" srcset=\"https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2025\/06\/assistance_response.png 582w, https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2025\/06\/assistance_response-300x104.png 300w\" sizes=\"(max-width: 582px) 100vw, 582px\" \/><\/a><figcaption class=\"wp-element-caption\"><em>Response from the Assistant (Java + LangChain4j + MongoDB)<\/em><\/figcaption><\/figure>\n<\/div>\n<p>This response is generated based on vector similarity matching from the ingested document content, which includes one or more of the five text files. It is a well-informed answer that directly references the information available within the internal knowledge base.<\/p>\n<p>By inspecting the MongoDB data using MongoDB Compass, you can view the full document content along with the corresponding generated embeddings.<\/p>\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-full\"><a href=\"https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2025\/06\/loaded_embeddings.png\"><img decoding=\"async\" width=\"885\" height=\"636\" src=\"https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2025\/06\/loaded_embeddings.png\" alt=\"\" class=\"wp-image-134504\" srcset=\"https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2025\/06\/loaded_embeddings.png 885w, https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2025\/06\/loaded_embeddings-300x216.png 300w, https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2025\/06\/loaded_embeddings-768x552.png 768w\" sizes=\"(max-width: 885px) 100vw, 885px\" \/><\/a><\/figure>\n<\/div>\n<h2 class=\"wp-block-heading\">6. Conclusion<\/h2>\n<p>In this article, we explored how to build an AI-powered chatbot in Java using LangChain4j and MongoDB Atlas. We walked through setting up the embedding model with Ollama, ingesting documents into a vector store backed by MongoDB, and configuring a conversational assistant that retrieves relevant context from internal documents. By integrating vector-based search with a local LLM, the chatbot can provide accurate, context-aware responses strictly based on your own knowledge base.<\/p>\n<h2 class=\"wp-block-heading\">7. Download the Source Code<\/h2>\n<p>This article explored building applications with Java, LangChain, and MongoDB.<\/p>\n<div class=\"download\"><strong>Download<\/strong><br \/>\nYou can download the full source code of this example here: <a href=\"https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2025\/06\/langchain4j-chatbot.zip\"><strong>java langchain mongodb<\/strong><\/a>\n<\/div>\n","protected":false},"excerpt":{"rendered":"<p>This article explores how to build an AI-powered chatbot using Langchain4j, MongoDB Atlas, and Ollama running locally. This solution leverages the Retrieval-Augmented Generation (RAG) pattern to fetch relevant information from your data and use it to generate accurate and contextual responses. This guide walks through the setup, from data ingestion to chat response generation, while &hellip;<\/p>\n","protected":false},"author":128888,"featured_media":125132,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[8],"tags":[3319,4047,4048,4049,2834,4050,112,3169,4038],"class_list":["post-133760","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-enterprise-java","tag-ai-assistant","tag-ai-chatbot","tag-conversational-ai","tag-embeddings","tag-langchain4j","tag-llm-integration","tag-mongodb","tag-mongodb-atlas","tag-vector-search"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.5 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>Java Langchain MongoDB Example - Java Code Geeks<\/title>\n<meta name=\"description\" content=\"Build intelligent RAG applications in Java using LangChain and MongoDB for real-time, context-aware AI experiences.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.javacodegeeks.com\/java-langchain-mongodb-example.html\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Java Langchain MongoDB Example - Java Code Geeks\" \/>\n<meta property=\"og:description\" content=\"Build intelligent RAG applications in Java using LangChain and MongoDB for real-time, context-aware AI experiences.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.javacodegeeks.com\/java-langchain-mongodb-example.html\" \/>\n<meta property=\"og:site_name\" content=\"Java Code Geeks\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/javacodegeeks\" \/>\n<meta property=\"article:author\" content=\"https:\/\/web.facebook.com\/omos.aziegbe\" \/>\n<meta property=\"article:published_time\" content=\"2025-06-04T07:28:00+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2024\/07\/langchain4j-logo.jpg\" \/>\n\t<meta property=\"og:image:width\" content=\"150\" \/>\n\t<meta property=\"og:image:height\" content=\"150\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/jpeg\" \/>\n<meta name=\"author\" content=\"Omozegie Aziegbe\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@https:\/\/twitter.com\/OAziegbe\" \/>\n<meta name=\"twitter:site\" content=\"@javacodegeeks\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Omozegie Aziegbe\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"8 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/java-langchain-mongodb-example.html#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/java-langchain-mongodb-example.html\"},\"author\":{\"name\":\"Omozegie Aziegbe\",\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/#\\\/schema\\\/person\\\/7d3eac6e45542536e961129ae0fb453e\"},\"headline\":\"Java Langchain MongoDB Example\",\"datePublished\":\"2025-06-04T07:28:00+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/java-langchain-mongodb-example.html\"},\"wordCount\":1617,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/#organization\"},\"image\":{\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/java-langchain-mongodb-example.html#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/www.javacodegeeks.com\\\/wp-content\\\/uploads\\\/2024\\\/07\\\/langchain4j-logo.jpg\",\"keywords\":[\"AI Assistant\",\"AI Chatbot\",\"Conversational AI\",\"Embeddings\",\"LangChain4j\",\"LLM Integration\",\"MongoDB\",\"MongoDB Atlas\",\"Vector Search\"],\"articleSection\":[\"Enterprise Java\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\\\/\\\/www.javacodegeeks.com\\\/java-langchain-mongodb-example.html#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/java-langchain-mongodb-example.html\",\"url\":\"https:\\\/\\\/www.javacodegeeks.com\\\/java-langchain-mongodb-example.html\",\"name\":\"Java Langchain MongoDB Example - Java Code Geeks\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/java-langchain-mongodb-example.html#primaryimage\"},\"image\":{\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/java-langchain-mongodb-example.html#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/www.javacodegeeks.com\\\/wp-content\\\/uploads\\\/2024\\\/07\\\/langchain4j-logo.jpg\",\"datePublished\":\"2025-06-04T07:28:00+00:00\",\"description\":\"Build intelligent RAG applications in Java using LangChain and MongoDB for real-time, context-aware AI experiences.\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/java-langchain-mongodb-example.html#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/www.javacodegeeks.com\\\/java-langchain-mongodb-example.html\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/java-langchain-mongodb-example.html#primaryimage\",\"url\":\"https:\\\/\\\/www.javacodegeeks.com\\\/wp-content\\\/uploads\\\/2024\\\/07\\\/langchain4j-logo.jpg\",\"contentUrl\":\"https:\\\/\\\/www.javacodegeeks.com\\\/wp-content\\\/uploads\\\/2024\\\/07\\\/langchain4j-logo.jpg\",\"width\":150,\"height\":150},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/java-langchain-mongodb-example.html#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/www.javacodegeeks.com\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Java\",\"item\":\"https:\\\/\\\/www.javacodegeeks.com\\\/category\\\/java\"},{\"@type\":\"ListItem\",\"position\":3,\"name\":\"Enterprise Java\",\"item\":\"https:\\\/\\\/www.javacodegeeks.com\\\/category\\\/java\\\/enterprise-java\"},{\"@type\":\"ListItem\",\"position\":4,\"name\":\"Java Langchain MongoDB Example\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/#website\",\"url\":\"https:\\\/\\\/www.javacodegeeks.com\\\/\",\"name\":\"Java Code Geeks\",\"description\":\"Java Developers Resource Center\",\"publisher\":{\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/#organization\"},\"alternateName\":\"JCG\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/www.javacodegeeks.com\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/#organization\",\"name\":\"Exelixis Media P.C.\",\"url\":\"https:\\\/\\\/www.javacodegeeks.com\\\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/#\\\/schema\\\/logo\\\/image\\\/\",\"url\":\"https:\\\/\\\/www.javacodegeeks.com\\\/wp-content\\\/uploads\\\/2022\\\/06\\\/exelixis-logo.png\",\"contentUrl\":\"https:\\\/\\\/www.javacodegeeks.com\\\/wp-content\\\/uploads\\\/2022\\\/06\\\/exelixis-logo.png\",\"width\":864,\"height\":246,\"caption\":\"Exelixis Media P.C.\"},\"image\":{\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/#\\\/schema\\\/logo\\\/image\\\/\"},\"sameAs\":[\"https:\\\/\\\/www.facebook.com\\\/javacodegeeks\",\"https:\\\/\\\/x.com\\\/javacodegeeks\"]},{\"@type\":\"Person\",\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/#\\\/schema\\\/person\\\/7d3eac6e45542536e961129ae0fb453e\",\"name\":\"Omozegie Aziegbe\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/wp-content\\\/uploads\\\/2023\\\/12\\\/cropped-jcg_profile_pic-96x96.jpg\",\"url\":\"https:\\\/\\\/www.javacodegeeks.com\\\/wp-content\\\/uploads\\\/2023\\\/12\\\/cropped-jcg_profile_pic-96x96.jpg\",\"contentUrl\":\"https:\\\/\\\/www.javacodegeeks.com\\\/wp-content\\\/uploads\\\/2023\\\/12\\\/cropped-jcg_profile_pic-96x96.jpg\",\"caption\":\"Omozegie Aziegbe\"},\"description\":\"Omos Aziegbe is a technical writer and web\\\/application developer with a BSc in Computer Science and Software Engineering from the University of Bedfordshire. Specializing in Java enterprise applications with the Jakarta EE framework, Omos also works with HTML5, CSS, and JavaScript for web development. As a freelance web developer, Omos combines technical expertise with research and writing on topics such as software engineering, programming, web application development, computer science, and technology.\",\"sameAs\":[\"https:\\\/\\\/web.facebook.com\\\/omos.aziegbe\",\"https:\\\/\\\/www.linkedin.com\\\/in\\\/omosaziegbe\\\/\",\"https:\\\/\\\/x.com\\\/https:\\\/\\\/twitter.com\\\/OAziegbe\"],\"url\":\"https:\\\/\\\/www.javacodegeeks.com\\\/author\\\/omozegie-aziegbe\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Java Langchain MongoDB Example - Java Code Geeks","description":"Build intelligent RAG applications in Java using LangChain and MongoDB for real-time, context-aware AI experiences.","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.javacodegeeks.com\/java-langchain-mongodb-example.html","og_locale":"en_US","og_type":"article","og_title":"Java Langchain MongoDB Example - Java Code Geeks","og_description":"Build intelligent RAG applications in Java using LangChain and MongoDB for real-time, context-aware AI experiences.","og_url":"https:\/\/www.javacodegeeks.com\/java-langchain-mongodb-example.html","og_site_name":"Java Code Geeks","article_publisher":"https:\/\/www.facebook.com\/javacodegeeks","article_author":"https:\/\/web.facebook.com\/omos.aziegbe","article_published_time":"2025-06-04T07:28:00+00:00","og_image":[{"width":150,"height":150,"url":"https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2024\/07\/langchain4j-logo.jpg","type":"image\/jpeg"}],"author":"Omozegie Aziegbe","twitter_card":"summary_large_image","twitter_creator":"@https:\/\/twitter.com\/OAziegbe","twitter_site":"@javacodegeeks","twitter_misc":{"Written by":"Omozegie Aziegbe","Est. reading time":"8 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.javacodegeeks.com\/java-langchain-mongodb-example.html#article","isPartOf":{"@id":"https:\/\/www.javacodegeeks.com\/java-langchain-mongodb-example.html"},"author":{"name":"Omozegie Aziegbe","@id":"https:\/\/www.javacodegeeks.com\/#\/schema\/person\/7d3eac6e45542536e961129ae0fb453e"},"headline":"Java Langchain MongoDB Example","datePublished":"2025-06-04T07:28:00+00:00","mainEntityOfPage":{"@id":"https:\/\/www.javacodegeeks.com\/java-langchain-mongodb-example.html"},"wordCount":1617,"commentCount":0,"publisher":{"@id":"https:\/\/www.javacodegeeks.com\/#organization"},"image":{"@id":"https:\/\/www.javacodegeeks.com\/java-langchain-mongodb-example.html#primaryimage"},"thumbnailUrl":"https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2024\/07\/langchain4j-logo.jpg","keywords":["AI Assistant","AI Chatbot","Conversational AI","Embeddings","LangChain4j","LLM Integration","MongoDB","MongoDB Atlas","Vector Search"],"articleSection":["Enterprise Java"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/www.javacodegeeks.com\/java-langchain-mongodb-example.html#respond"]}]},{"@type":"WebPage","@id":"https:\/\/www.javacodegeeks.com\/java-langchain-mongodb-example.html","url":"https:\/\/www.javacodegeeks.com\/java-langchain-mongodb-example.html","name":"Java Langchain MongoDB Example - Java Code Geeks","isPartOf":{"@id":"https:\/\/www.javacodegeeks.com\/#website"},"primaryImageOfPage":{"@id":"https:\/\/www.javacodegeeks.com\/java-langchain-mongodb-example.html#primaryimage"},"image":{"@id":"https:\/\/www.javacodegeeks.com\/java-langchain-mongodb-example.html#primaryimage"},"thumbnailUrl":"https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2024\/07\/langchain4j-logo.jpg","datePublished":"2025-06-04T07:28:00+00:00","description":"Build intelligent RAG applications in Java using LangChain and MongoDB for real-time, context-aware AI experiences.","breadcrumb":{"@id":"https:\/\/www.javacodegeeks.com\/java-langchain-mongodb-example.html#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.javacodegeeks.com\/java-langchain-mongodb-example.html"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.javacodegeeks.com\/java-langchain-mongodb-example.html#primaryimage","url":"https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2024\/07\/langchain4j-logo.jpg","contentUrl":"https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2024\/07\/langchain4j-logo.jpg","width":150,"height":150},{"@type":"BreadcrumbList","@id":"https:\/\/www.javacodegeeks.com\/java-langchain-mongodb-example.html#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.javacodegeeks.com\/"},{"@type":"ListItem","position":2,"name":"Java","item":"https:\/\/www.javacodegeeks.com\/category\/java"},{"@type":"ListItem","position":3,"name":"Enterprise Java","item":"https:\/\/www.javacodegeeks.com\/category\/java\/enterprise-java"},{"@type":"ListItem","position":4,"name":"Java Langchain MongoDB Example"}]},{"@type":"WebSite","@id":"https:\/\/www.javacodegeeks.com\/#website","url":"https:\/\/www.javacodegeeks.com\/","name":"Java Code Geeks","description":"Java Developers Resource Center","publisher":{"@id":"https:\/\/www.javacodegeeks.com\/#organization"},"alternateName":"JCG","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.javacodegeeks.com\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/www.javacodegeeks.com\/#organization","name":"Exelixis Media P.C.","url":"https:\/\/www.javacodegeeks.com\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.javacodegeeks.com\/#\/schema\/logo\/image\/","url":"https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2022\/06\/exelixis-logo.png","contentUrl":"https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2022\/06\/exelixis-logo.png","width":864,"height":246,"caption":"Exelixis Media P.C."},"image":{"@id":"https:\/\/www.javacodegeeks.com\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/www.facebook.com\/javacodegeeks","https:\/\/x.com\/javacodegeeks"]},{"@type":"Person","@id":"https:\/\/www.javacodegeeks.com\/#\/schema\/person\/7d3eac6e45542536e961129ae0fb453e","name":"Omozegie Aziegbe","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2023\/12\/cropped-jcg_profile_pic-96x96.jpg","url":"https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2023\/12\/cropped-jcg_profile_pic-96x96.jpg","contentUrl":"https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2023\/12\/cropped-jcg_profile_pic-96x96.jpg","caption":"Omozegie Aziegbe"},"description":"Omos Aziegbe is a technical writer and web\/application developer with a BSc in Computer Science and Software Engineering from the University of Bedfordshire. Specializing in Java enterprise applications with the Jakarta EE framework, Omos also works with HTML5, CSS, and JavaScript for web development. As a freelance web developer, Omos combines technical expertise with research and writing on topics such as software engineering, programming, web application development, computer science, and technology.","sameAs":["https:\/\/web.facebook.com\/omos.aziegbe","https:\/\/www.linkedin.com\/in\/omosaziegbe\/","https:\/\/x.com\/https:\/\/twitter.com\/OAziegbe"],"url":"https:\/\/www.javacodegeeks.com\/author\/omozegie-aziegbe"}]}},"_links":{"self":[{"href":"https:\/\/www.javacodegeeks.com\/wp-json\/wp\/v2\/posts\/133760","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.javacodegeeks.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.javacodegeeks.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.javacodegeeks.com\/wp-json\/wp\/v2\/users\/128888"}],"replies":[{"embeddable":true,"href":"https:\/\/www.javacodegeeks.com\/wp-json\/wp\/v2\/comments?post=133760"}],"version-history":[{"count":0,"href":"https:\/\/www.javacodegeeks.com\/wp-json\/wp\/v2\/posts\/133760\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.javacodegeeks.com\/wp-json\/wp\/v2\/media\/125132"}],"wp:attachment":[{"href":"https:\/\/www.javacodegeeks.com\/wp-json\/wp\/v2\/media?parent=133760"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.javacodegeeks.com\/wp-json\/wp\/v2\/categories?post=133760"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.javacodegeeks.com\/wp-json\/wp\/v2\/tags?post=133760"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}