GitHub user shivanandullagaddi edited a comment on the discussion: Missing 
essential files (pom.xml and App.java) required for Hop SDK configuration and 
successful pipeline execution

Hi @bamaer 

Thanks for sharing the Hop external plugins build. by using this i have 
modified my pom.xml and App.java files under the maven project to get connect 
to Hop, But while executing the App.java file that should call pipeline instead 
i am facing the errors can you help to resolve it and move on for the 
successful pipeline callout from the Hop Sdk.

Errors:

Initializing Apache Hop Environment...
Hop configuration file not found, not serializing: 
C:\Users\shiva\OneDrive\Desktop\demo\config\hop-config.json
SLF4J: Class path contains multiple SLF4J providers.
SLF4J: Found provider [org.slf4j.nop.NOPServiceProvider@10e8a8f5]
SLF4J: Found provider 
[ch.qos.logback.classic.spi.LogbackServiceProvider@4310f342]
SLF4J: See https://www.slf4j.org/codes.html#multiple_bindings for an 
explanation.
SLF4J: Actual provider is of type [org.slf4j.nop.NOPServiceProvider@10e8a8f5]
? Loading pipeline: 
C:/Users/shiva/Downloads/apache-hop-client-2.15.0/hop/config/projects/default/pipelines/pipeline_example_1.hpl
? Hop Exception:
API error: metadata provider can't be null. When loading a pipeline Hop needs 
to be able to reference external metadata objects

org.apache.hop.core.exception.HopXmlException:
API error: metadata provider can't be null. When loading a pipeline Hop needs 
to be able to reference external metadata objects


This is the pom.xml file

<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0";
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
                             http://maven.apache.org/xsd/maven-4.0.0.xsd";>
 
    <modelVersion>4.0.0</modelVersion>
    <groupId>com.shiva.hopdemo</groupId>
    <artifactId>demo</artifactId>
    <version>1.0-SNAPSHOT</version>
    <name>HopSDKDemo</name>
 
    <properties>
        <maven.compiler.source>17</maven.compiler.source>
        <maven.compiler.target>17</maven.compiler.target>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
    </properties>
 
    <repositories>
        <!-- Apache releases repository for Hop artifacts -->
        <repository>
            <id>apache-releases</id>
            
<url>https://repository.apache.org/content/repositories/releases/</url>
        </repository>
        <!-- Snapshots if needed -->
        <repository>
            <id>apache-snapshots</id>
            
<url>https://repository.apache.org/content/repositories/snapshots/</url>
        </repository>
    </repositories>
 
    <dependencies>
        <!-- Hop Core -->
        <dependency>
            <groupId>org.apache.hop</groupId>
            <artifactId>hop-core</artifactId>
            <version>2.15.0</version>
        </dependency>
 
        <!-- Hop Engine -->
        <dependency>
            <groupId>org.apache.hop</groupId>
            <artifactId>hop-engine</artifactId>
            <version>2.15.0</version>
        </dependency>
 
        <!-- Hop Client (optional, contains useful runtime classes) -->
        <dependency>
            <groupId>org.apache.hop</groupId>
            <artifactId>hop-client</artifactId>
            <version>2.15.0</version>
        </dependency>
 
        <!-- Logging -->
        <dependency>
            <groupId>ch.qos.logback</groupId>
            <artifactId>logback-classic</artifactId>
            <version>1.4.12</version>
        </dependency>
 
        <!-- JUnit for testing -->
        <dependency>
            <groupId>org.junit.jupiter</groupId>
            <artifactId>junit-jupiter-api</artifactId>
            <version>5.10.0</version>
            <scope>test</scope>
        </dependency>
    </dependencies>
 
    <build>
        <plugins>
            <!-- Compiler plugin -->
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <version>3.13.0</version>
                <configuration>
                    <release>17</release>
                </configuration>
            </plugin>
 
            <!-- Exec plugin to run App.java -->
            <plugin>
                <groupId>org.codehaus.mojo</groupId>
                <artifactId>exec-maven-plugin</artifactId>
                <version>3.1.0</version>
                <configuration>
                    <mainClass>com.shiva.hopdemo.App</mainClass>
                </configuration>
            </plugin>
        </plugins>
    </build>
</project>


Here is the App.java file

package com.shiva.hopdemo;
 
import org.apache.hop.core.HopEnvironment;
import org.apache.hop.core.Result;
import org.apache.hop.core.exception.HopException;
import org.apache.hop.core.logging.LogLevel;
import org.apache.hop.core.variables.Variables;
import org.apache.hop.pipeline.PipelineMeta;
import org.apache.hop.pipeline.engine.IPipelineEngine;
import org.apache.hop.pipeline.engine.PipelineEngineFactory;
 
import java.io.File;
 
public class App {
 
    public static void main(String[] args) {
        try {
            System.out.println("Initializing Apache Hop Environment...");
 
            // Initialize Hop Environment
            HopEnvironment.init();
 
            // Create variables
            Variables variables = new Variables();
 
            // Specify pipeline file path
            String pipelineFilePath = "pipelines/pipeline_example_1.hpl";
           
            // Check if file exists
            File pipelineFile = new File(pipelineFilePath);
            if (!pipelineFile.exists()) {
                // Try absolute path as fallback
                pipelineFilePath = 
"C:/Users/shiva/Downloads/apache-hop-client-2.15.0/hop/config/projects/default/pipelines/pipeline_example_1.hpl";
                pipelineFile = new File(pipelineFilePath);
                if (!pipelineFile.exists()) {
                    System.err.println(" Pipeline file not found: " + 
pipelineFilePath);
                    System.err.println(" Please create a sample pipeline first 
using Hop GUI");
                    return;
                }
            }
 
            System.out.println(" Loading pipeline: " + pipelineFilePath);
 
            // Load pipeline metadata
            PipelineMeta pipelineMeta = new PipelineMeta(pipelineFilePath, 
null, variables);
 
            // Create pipeline engine
            IPipelineEngine<PipelineMeta> pipelineEngine = 
PipelineEngineFactory.createPipelineEngine(
                variables,
                "local",
                null,
                pipelineMeta
            );
 
            // Set logging level
            pipelineEngine.setLogLevel(LogLevel.BASIC);
 
            System.out.println(" Starting pipeline execution...");
 
            // Execute pipeline
            pipelineEngine.execute();
 
            // Wait for completion
            pipelineEngine.waitUntilFinished();
 
            // Get results
            Result result = pipelineEngine.getResult();
 
            // Display results
            System.out.println("========================================");
            System.out.println(" PIPELINE EXECUTION RESULTS");
            System.out.println("========================================");
            System.out.println(" Errors: " + result.getNrErrors());
            System.out.println(" Lines Read: " + result.getNrLinesRead());
            System.out.println(" Lines Written: " + result.getNrLinesWritten());
            //System.out.println(" Execution Time: " + 
result.getExecutionDuration() + "ms");
           
            if (result.getNrErrors() == 0) {
                System.out.println(" Result: SUCCESS");
            } else {
                System.out.println(" Result: FAILED ");
            }
            System.out.println("========================================");
 
        } catch (HopException e) {
            System.err.println("Hop Exception: " + e.getMessage());
            e.printStackTrace();
        } catch (Exception e) {
            System.err.println("Unexpected error: " + e.getMessage());
            e.printStackTrace();
        }
    }
}


GitHub link: 
https://github.com/apache/hop/discussions/5960#discussioncomment-14894221

----
This is an automatically sent email for [email protected].
To unsubscribe, please send an email to: [email protected]

Reply via email to