Skip to content
This repository has been archived by the owner on Jan 21, 2024. It is now read-only.

JSON Logger in MUnit fail, need new update in code #37

Open
nylzpt opened this issue Feb 11, 2022 · 0 comments
Open

JSON Logger in MUnit fail, need new update in code #37

nylzpt opened this issue Feb 11, 2022 · 0 comments

Comments

@nylzpt
Copy link

nylzpt commented Feb 11, 2022

Hello, I'm using the JSON Logger Plugin version 2.0.1 and I have a flow that is working with the component and publishing to JMS Queue in Apache ActiveMQ, however when I run Munit, the following error appears:

ERROR 2022-02-11 09:30:14,684 [[MuleRuntime].uber.08: [json-logger-munit].json-logger-munitFlow.BLOCKING @73e9ef28] org.mule.runtime.core.internal.exception.OnErrorPropagateHandler: 
********************************************************************************
Message               : null
Element               : json-logger-munitFlow/processors/1 @ json-logger-munit:json-logger-munit.xml:25 (Logger)
Element DSL           : <json-logger:logger doc:name="Logger" doc:id="a63fedb3-3f22-43be-9bd1-715deeb09863" message="Start of the flow" config-ref="JSON_Logger_Config"></json-logger:logger>
Error type            : MULE:UNKNOWN
FlowStack             : at json-logger-munitFlow(json-logger-munitFlow/processors/1 @ json-logger-munit:json-logger-munit.xml:25 (Logger))
--------------------------------------------------------------------------------
Root Exception stack trace:
java.lang.NullPointerException
	at org.mule.extension.jsonlogger.internal.singleton.LogEventSingleton.publishToExternalDestination(LogEventSingleton.java:46)
	at org.mule.extension.jsonlogger.internal.JsonloggerOperations.logger(JsonloggerOperations.java:229)
	at org.mule.extension.jsonlogger.internal.JsonloggerOperations$logger$MethodComponentExecutor_json_logger_munit.execute(Unknown Source)
	at org.mule.runtime.module.extension.internal.runtime.execution.GeneratedMethodComponentExecutor.execute(GeneratedMethodComponentExecutor.java:98)
	at org.mule.runtime.module.extension.internal.runtime.execution.NonBlockingCompletableMethodOperationExecutor.doExecute(NonBlockingCompletableMethodOperationExecutor.java:38)
	at org.mule.runtime.module.extension.internal.runtime.execution.AbstractCompletableMethodOperationExecutor.execute(AbstractCompletableMethodOperationExecutor.java:63)
	at org.mule.runtime.module.extension.internal.runtime.operation.DefaultExecutionMediator.executeCommand(DefaultExecutionMediator.java:232)
	at org.mule.runtime.module.extension.internal.runtime.operation.DefaultExecutionMediator.executeWithInterceptors(DefaultExecutionMediator.java:216)
	at org.mule.runtime.module.extension.internal.runtime.operation.DefaultExecutionMediator.lambda$execute$1(DefaultExecutionMediator.java:135)
	at org.mule.runtime.module.extension.internal.runtime.operation.DefaultExecutionMediator.lambda$new$0(DefaultExecutionMediator.java:72)
	at org.mule.runtime.module.extension.internal.runtime.operation.DefaultExecutionMediator.withExecutionTemplate(DefaultExecutionMediator.java:316)
	at org.mule.runtime.module.extension.internal.runtime.operation.DefaultExecutionMediator.execute(DefaultExecutionMediator.java:134)
	at org.mule.runtime.module.extension.internal.runtime.operation.ComponentMessageProcessor.executeOperation(ComponentMessageProcessor.java:588)
	at org.mule.runtime.module.extension.internal.runtime.operation.ComponentMessageProcessor.prepareAndExecuteOperation(ComponentMessageProcessor.java:811)
	at org.mule.runtime.module.extension.internal.runtime.operation.ComponentMessageProcessor.access$100(ComponentMessageProcessor.java:204)
	at org.mule.runtime.module.extension.internal.runtime.operation.ComponentMessageProcessor$4.lambda$innerEventDispatcher$6(ComponentMessageProcessor.java:673)
	at reactor.core.* (6 elements filtered from stack; set debug level logging or '-Dmule.verbose.exceptions=true' for everything)(Unknown Source)
	at java.util.concurrent.FutureTask.run(FutureTask.java:266)
	at org.mule.service.scheduler.internal.AbstractRunnableFutureDecorator.doRun(AbstractRunnableFutureDecorator.java:113)
	at org.mule.service.scheduler.internal.RunnableFutureDecorator.run(RunnableFutureDecorator.java:54)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
	at java.lang.Thread.run(Thread.java:748)

This seems to be a bug, when the connector runs in the MUnit suite, a part of the code is not executed, which leaves an attribute/field with an empty initialization, and when trying to access a property, it generates the NullPointer.

Json Logger regular initialization includes the destination
img:
image

Json Logger unit testing initialization does not include the destination
img: https://help.mulesoft.com/sfc/servlet.shepherd/version/renditionDownload?rendition=ORIGINAL_Png&versionId=0682T00000C0J4M&operationContext=CHATTER&contentId=05T2T000011zG8e

Issue in mulesoft site: https://help.mulesoft.com/s/feed/0D52T00005gjYQ4SAM

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

No branches or pull requests

1 participant