You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I get the following exception when I try to add elasticsearch appender support for my basic sample. I have also attached my resources folder to show my appender settings. I am unable to understand what could have gone wrong. Kindly let me know. Thanks !
BatchEmitter ERROR PutIndexTemplate: Unable to update index template: Bad Request. status: 400. Root error: errorType: x_content_parse_exception, errorReason: [2:3] [index_template] unknown field [mappings]
2023-08-07 18:48:29,767 ServiceDiscovery ERROR HCServiceDiscovery: Unable to refresh addresses: Cannot invoke "org.appenders.log4j2.elasticsearch.hc.discovery.NodeInfo$PublishAddress.getPublishAddress()" because the return value of "org.appenders.log4j2.elasticsearch.hc.discovery.NodeInfo.getHttpPublishAddress()" is null java.lang.NullPointerException: Cannot invoke "org.appenders.log4j2.elasticsearch.hc.discovery.NodeInfo$PublishAddress.getPublishAddress()" because the return value of "org.appenders.log4j2.elasticsearch.hc.discovery.NodeInfo.getHttpPublishAddress()" is null
at org.appenders.log4j2.elasticsearch.hc.discovery.ElasticsearchNodesQuery.formatAddress(ElasticsearchNodesQuery.java:89)
at java.base/java.util.stream.ReferencePipeline$3$1.accept(ReferencePipeline.java:197)
at java.base/java.util.Iterator.forEachRemaining(Iterator.java:133)
at java.base/java.util.Spliterators$IteratorSpliterator.forEachRemaining(Spliterators.java:1845)
at java.base/java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:509)
at java.base/java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:499)
at java.base/java.util.stream.ReduceOps$ReduceOp.evaluateSequential(ReduceOps.java:921)
at java.base/java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234)
at java.base/java.util.stream.ReferencePipeline.collect(ReferencePipeline.java:682)
at org.appenders.log4j2.elasticsearch.hc.discovery.ElasticsearchNodesQuery.execute(ElasticsearchNodesQuery.java:81)
at org.appenders.log4j2.elasticsearch.hc.discovery.ElasticsearchNodesQuery.execute(ElasticsearchNodesQuery.java:36)
at org.appenders.log4j2.elasticsearch.hc.discovery.HCServiceDiscovery.refresh(HCServiceDiscovery.java:92)
at org.appenders.log4j2.elasticsearch.hc.discovery.HCServiceDiscovery$RefreshServerList.run(HCServiceDiscovery.java:170)
at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:539)
at java.base/java.util.concurrent.FutureTask.runAndReset(FutureTask.java:305)
at java.base/java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:305)
at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1136)
at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635) resources.zip
at java.base/java.lang.Thread.run(Thread.java:833)
2023-08-07 18:48:34,777 ServiceDiscovery ERROR HCServiceDiscovery: Unable to refresh addresses: Cannot invoke "org.appenders.log4j2.elasticsearch.hc.discovery.NodeInfo$PublishAddress.getPublishAddress()" because the return value of "org.appenders.log4j2.elasticsearch.hc.discovery.NodeInfo.getHttpPublishAddress()" is null java.lang.NullPointerException: Cannot invoke "org.appenders.log4j2.elasticsearch.hc.discovery.NodeInfo$PublishAddress.getPublishAddress()" because the return value of "org.appenders.log4j2.elasticsearch.hc.discovery.NodeInfo.getHttpPublishAddress()" is null
at org.appenders.log4j2.elasticsearch.hc.discovery.ElasticsearchNodesQuery.formatAddress(ElasticsearchNodesQuery.java:89)
at java.base/java.util.stream.ReferencePipeline$3$1.accept(ReferencePipeline.java:197)
at java.base/java.util.Iterator.forEachRemaining(Iterator.java:133)
at java.base/java.util.Spliterators$IteratorSpliterator.forEachRemaining(Spliterators.java:1845)
at java.base/java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:509)
at java.base/java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:499)
at java.base/java.util.stream.ReduceOps$ReduceOp.evaluateSequential(ReduceOps.java:921)
at java.base/java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234)
at java.base/java.util.stream.ReferencePipeline.collect(ReferencePipeline.java:682)
at org.appenders.log4j2.elasticsearch.hc.discovery.ElasticsearchNodesQuery.execute(ElasticsearchNodesQuery.java:81)
at org.appenders.log4j2.elasticsearch.hc.discovery.ElasticsearchNodesQuery.execute(ElasticsearchNodesQuery.java:36)
at org.appenders.log4j2.elasticsearch.hc.discovery.HCServiceDiscovery.refresh(HCServiceDiscovery.java:92)
at org.appenders.log4j2.elasticsearch.hc.discovery.HCServiceDiscovery$RefreshServerList.run(HCServiceDiscovery.java:170)
at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:539)
at java.base/java.util.concurrent.FutureTask.runAndReset(FutureTask.java:305)
at java.base/java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:305)
at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1136)
at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635)
at java.base/java.lang.Thread.run(Thread.java:833)
Following is my Application.java code :
`@SpringBootApplication
public class Application {
public static void main(String... args) {
ConfigurableApplicationContext applicationContext =
SpringApplication.run(Application.class, args);
long number = 123;
Logger logger = LogManager.getLogger("elasticsearch");
LogDTO dto = new LogDTO("123", LogType.Technology, LogLevel.INFO);
dto.setAccountId(Long.valueOf(number));
dto.setClientId(Long.valueOf(number));
dto.setUserId(Long.valueOf(number));
dto.setMessage("Hello, World! from HC Spring Boot = " + number);
dto.setEntityId(Long.valueOf(number));
dto.setEntityName("Application");
dto.setMethodName("Main STATIC");
dto.setServiceName("Logger Service");
// ThreadContext.put("myFavouriteVariable", UUID.randomUUID().toString());
// ThreadContext.put("myStructuredJSON", "{\"yes\":100,\"you\":\"can\"}");
// logger.info("Hello, World! from HC Spring Boot 6661");
logger.info(dto);
// ThreadContext.remove("myFavouriteVariable");
// ThreadContext.remove("myStructuredJSON");
LockSupport.parkNanos(TimeUnit.SECONDS.toNanos(5));
//applicationContext.close();
BatchEmitter ERROR PutIndexTemplate: Unable to update index template: Bad Request. status: 400. Root error: errorType: x_content_parse_exception, errorReason: [2:3] [index_template] unknown field [mappings]
indicates that you're using a template for Elasticsearch 7 against Elasticsearch 8 (or the other way around...). Template file must be compatible with Es verison that you use/ Examples may be outdated unfortunately.
I get the following exception when I try to add elasticsearch appender support for my basic sample. I have also attached my resources folder to show my appender settings. I am unable to understand what could have gone wrong. Kindly let me know. Thanks !
BatchEmitter ERROR PutIndexTemplate: Unable to update index template: Bad Request. status: 400. Root error: errorType: x_content_parse_exception, errorReason: [2:3] [index_template] unknown field [mappings]
2023-08-07 18:48:29,767 ServiceDiscovery ERROR HCServiceDiscovery: Unable to refresh addresses: Cannot invoke "org.appenders.log4j2.elasticsearch.hc.discovery.NodeInfo$PublishAddress.getPublishAddress()" because the return value of "org.appenders.log4j2.elasticsearch.hc.discovery.NodeInfo.getHttpPublishAddress()" is null java.lang.NullPointerException: Cannot invoke "org.appenders.log4j2.elasticsearch.hc.discovery.NodeInfo$PublishAddress.getPublishAddress()" because the return value of "org.appenders.log4j2.elasticsearch.hc.discovery.NodeInfo.getHttpPublishAddress()" is null
at org.appenders.log4j2.elasticsearch.hc.discovery.ElasticsearchNodesQuery.formatAddress(ElasticsearchNodesQuery.java:89)
at java.base/java.util.stream.ReferencePipeline$3$1.accept(ReferencePipeline.java:197)
at java.base/java.util.Iterator.forEachRemaining(Iterator.java:133)
at java.base/java.util.Spliterators$IteratorSpliterator.forEachRemaining(Spliterators.java:1845)
at java.base/java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:509)
at java.base/java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:499)
at java.base/java.util.stream.ReduceOps$ReduceOp.evaluateSequential(ReduceOps.java:921)
at java.base/java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234)
at java.base/java.util.stream.ReferencePipeline.collect(ReferencePipeline.java:682)
at org.appenders.log4j2.elasticsearch.hc.discovery.ElasticsearchNodesQuery.execute(ElasticsearchNodesQuery.java:81)
at org.appenders.log4j2.elasticsearch.hc.discovery.ElasticsearchNodesQuery.execute(ElasticsearchNodesQuery.java:36)
at org.appenders.log4j2.elasticsearch.hc.discovery.HCServiceDiscovery.refresh(HCServiceDiscovery.java:92)
at org.appenders.log4j2.elasticsearch.hc.discovery.HCServiceDiscovery$RefreshServerList.run(HCServiceDiscovery.java:170)
at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:539)
at java.base/java.util.concurrent.FutureTask.runAndReset(FutureTask.java:305)
at java.base/java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:305)
at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1136)
at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635)
resources.zip
2023-08-07 18:48:34,777 ServiceDiscovery ERROR HCServiceDiscovery: Unable to refresh addresses: Cannot invoke "org.appenders.log4j2.elasticsearch.hc.discovery.NodeInfo$PublishAddress.getPublishAddress()" because the return value of "org.appenders.log4j2.elasticsearch.hc.discovery.NodeInfo.getHttpPublishAddress()" is null java.lang.NullPointerException: Cannot invoke "org.appenders.log4j2.elasticsearch.hc.discovery.NodeInfo$PublishAddress.getPublishAddress()" because the return value of "org.appenders.log4j2.elasticsearch.hc.discovery.NodeInfo.getHttpPublishAddress()" is null
at org.appenders.log4j2.elasticsearch.hc.discovery.ElasticsearchNodesQuery.formatAddress(ElasticsearchNodesQuery.java:89)
at java.base/java.util.stream.ReferencePipeline$3$1.accept(ReferencePipeline.java:197)
at java.base/java.util.Iterator.forEachRemaining(Iterator.java:133)
at java.base/java.util.Spliterators$IteratorSpliterator.forEachRemaining(Spliterators.java:1845)
at java.base/java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:509)
at java.base/java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:499)
at java.base/java.util.stream.ReduceOps$ReduceOp.evaluateSequential(ReduceOps.java:921)
at java.base/java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234)
at java.base/java.util.stream.ReferencePipeline.collect(ReferencePipeline.java:682)
at org.appenders.log4j2.elasticsearch.hc.discovery.ElasticsearchNodesQuery.execute(ElasticsearchNodesQuery.java:81)
at org.appenders.log4j2.elasticsearch.hc.discovery.ElasticsearchNodesQuery.execute(ElasticsearchNodesQuery.java:36)
at org.appenders.log4j2.elasticsearch.hc.discovery.HCServiceDiscovery.refresh(HCServiceDiscovery.java:92)
at org.appenders.log4j2.elasticsearch.hc.discovery.HCServiceDiscovery$RefreshServerList.run(HCServiceDiscovery.java:170)
at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:539)
at java.base/java.util.concurrent.FutureTask.runAndReset(FutureTask.java:305)
at java.base/java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:305)
at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1136)
at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635)
at java.base/java.lang.Thread.run(Thread.java:833)
Following is my Application.java code :
`@SpringBootApplication
public class Application {
// LoggingSystem.get(logger.getClass().getClassLoader()).getShutdownHandler().run();
}
}
`
The text was updated successfully, but these errors were encountered: