Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug]: NullPointerException in hop/registerPipeline Rest API when log_file flag is enabled #4677

Open
chaturvedakanksha opened this issue Dec 6, 2024 · 1 comment

Comments

@chaturvedakanksha
Copy link

Apache Hop version?

2.7.0

Java version?

22.0.2

Operating system

Windows

What happened?

When invoking the hop/registerPipeline REST API with the payload provided below, the API throws a NullPointerException if the log_file flag is set to Y and a log_filename is specified.

The specified log file gets created in the container, but the exception occurs afterward, halting further execution.

Error Details:
Exception Message:
java.lang.NullPointerException
at java.base/java.util.concurrent.ConcurrentHashMap.putVal(ConcurrentHashMap.java:1011)
at java.base/java.util.concurrent.ConcurrentHashMap.put(ConcurrentHashMap.java:1006)
at org.apache.hop.core.logging.LoggingRegistry.registerLogChannelFileWriterBuffer(LoggingRegistry.java:261)
at org.apache.hop.core.logging.LogChannelFileWriter.(LogChannelFileWriter.java:74)
at org.apache.hop.core.logging.LogChannelFileWriter.(LogChannelFileWriter.java:87)
at org.apache.hop.www.BaseWorkflowServlet.createPipeline(BaseWorkflowServlet.java:146)
at org.apache.hop.www.RegisterPipelineServlet.generateBody(RegisterPipelineServlet.java:56)

Steps to Reproduce:

  1. Start the Apache Hop server using the provided Docker script:
    docker run -it --rm
    --env HOP_SERVER_USER=admin
    --env HOP_SERVER_PASS=admin
    --env HOP_SERVER_SHUTDOWNPORT=8080
    --env HOP_SERVER_PORT=8181
    --env HOP_SERVER_HOSTNAME=0.0.0.0
    -p 8080:8080
    -p 8181:8181
    --name my-hop-server-container
    apache/hop:2.7.0

  2. Make a POST request to hop/registerPipeline REST API with the following payload:
    <pipeline_configuration>
    ...
    <log_file>Y</log_file>
    <log_filename>/tmp/generateRowsLog.log</log_filename>
    ...
    </pipeline_configuration>

  3. Observe that the log file is created inside the container, but a NullPointerException is thrown during the pipeline registration process.

Attached full xml payload
payload.txt

Expected Behavior:
The pipeline should register successfully, and logs should be written to the specified file without errors.

image

Issue Priority

Priority: 3

Issue Component

Component: Hop Server

@chaturvedakanksha
Copy link
Author

  1. In BaseWorkflowServlet.java, SimpleLoggingObject is created at line 118

image

  1. Which further creating LogChannelFileWriter at line 143, serveletLoggingObject is used to get log channel Id which is of type SimpleLoggingObject.

image

  1. SimpleLoggingObject class return LogChannelId as null at line 88

image

  1. Above LogChannelFileWriter if furter send to registerLogChannelFileWriterBuffer which is using Log Channel Id as key thus further throwing null pointer exception at line 261

image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant