Kubernetes CrashLoopBackOff InvocationTargetException - java

when a try to start my pod of a spring boot application, I get stuck in the errors bellows:
2022-06-02 14:07:21,189 main DEBUG Apache Log4j Core 2.17.1 initializing configuration XmlConfiguration[location=jar:file:/usr/app/api-0.0.1-SNAPSHOT.jar!/BOOT-INF/classes!/log4j2.xml]
2022-06-02 14:07:21,201 main DEBUG Installed 0 script engines
2022-06-02 14:07:21,201 main DEBUG PluginManager 'Core' found 127 plugins
2022-06-02 14:07:21,201 main DEBUG PluginManager 'Level' found 0 plugins
2022-06-02 14:07:21,204 main DEBUG PluginManager 'Lookup' found 16 plugins
2022-06-02 14:07:21,218 main DEBUG Building Plugin[name=layout, class=org.apache.logging.log4j.core.layout.PatternLayout].
2022-06-02 14:07:21,230 main DEBUG PluginManager 'TypeConverter' found 26 plugins
2022-06-02 14:07:21,241 main DEBUG PatternLayout$Builder(pattern="%highlight{%-5p|%d{ISO8601}{GMT}|thread id:%tid|%X{Slf4jMDCFilter.UUID}| [%t] %logger{36} - %msg%n}{FATAL=red blink, ERROR=red, WARN=yellow bold, INFO=blue, DEBUG=green bold, TRACE=blue}", PatternSelector=null, Configuration(jar:file:/usr/app/api-0.0.1-SNAPSHOT.jar!/BOOT-INF/classes!/log4j2.xml), Replace=null, charset="UTF-8", alwaysWriteExceptions="null", disableAnsi="false", noConsoleNoAnsi="null", header="null", footer="null")
2022-06-02 14:07:21,241 main DEBUG PluginManager 'Converter' found 48 plugins
2022-06-02 14:07:21,288 main DEBUG Building Plugin[name=appender, class=org.apache.logging.log4j.core.appender.ConsoleAppender].
2022-06-02 14:07:21,295 main DEBUG ConsoleAppender$Builder(target="SYSTEM_OUT", follow="null", direct="null", bufferedIo="null", bufferSize="null", immediateFlush="null", ignoreExceptions="null", PatternLayout(%highlight{%-5p|%d{ISO8601}{GMT}|thread id:%tid|%X{Slf4jMDCFilter.UUID}| [%t] %logger{36} - %msg%n}{FATAL=red blink, ERROR=red, WARN=yellow bold, INFO=blue, DEBUG=green bold, TRACE=blue}), name="LogToConsole", Configuration(jar:file:/usr/app/api-0.0.1-SNAPSHOT.jar!/BOOT-INF/classes!/log4j2.xml), Filter=null, ={})
2022-06-02 14:07:21,298 main DEBUG Starting OutputStreamManager SYSTEM_OUT.false.false
2022-06-02 14:07:21,298 main DEBUG Building Plugin[name=appenders, class=org.apache.logging.log4j.core.config.AppendersPlugin].
2022-06-02 14:07:21,298 main DEBUG createAppenders(={LogToConsole})
2022-06-02 14:07:21,299 main DEBUG Building Plugin[name=AppenderRef, class=org.apache.logging.log4j.core.config.AppenderRef].
2022-06-02 14:07:21,301 main DEBUG createAppenderRef(ref="LogToConsole", level="null", Filter=null)
2022-06-02 14:07:21,302 main DEBUG Building Plugin[name=logger, class=org.apache.logging.log4j.core.config.LoggerConfig].
2022-06-02 14:07:21,303 main DEBUG createLogger(additivity="false", level="INFO", name="com.obs.dqsc.api", includeLocation="null", ={LogToConsole}, ={}, Configuration(jar:file:/usr/app/api-0.0.1-SNAPSHOT.jar!/BOOT-INF/classes!/log4j2.xml), Filter=null)
2022-06-02 14:07:21,305 main DEBUG Building Plugin[name=AppenderRef, class=org.apache.logging.log4j.core.config.AppenderRef].
2022-06-02 14:07:21,305 main DEBUG createAppenderRef(ref="LogToConsole", level="null", Filter=null)
2022-06-02 14:07:21,305 main DEBUG Building Plugin[name=root, class=org.apache.logging.log4j.core.config.LoggerConfig$RootLogger].
2022-06-02 14:07:21,306 main DEBUG createLogger(additivity="false", level="INFO", includeLocation="null", ={LogToConsole}, ={}, Configuration(jar:file:/usr/app/api-0.0.1-SNAPSHOT.jar!/BOOT-INF/classes!/log4j2.xml), Filter=null)
2022-06-02 14:07:21,306 main DEBUG Building Plugin[name=loggers, class=org.apache.logging.log4j.core.config.LoggersPlugin].
2022-06-02 14:07:21,307 main DEBUG createLoggers(={com.obs.dqsc.api, root})
2022-06-02 14:07:21,308 main DEBUG Configuration XmlConfiguration[location=jar:file:/usr/app/api-0.0.1-SNAPSHOT.jar!/BOOT-INF/classes!/log4j2.xml] initialized
2022-06-02 14:07:21,308 main DEBUG Starting configuration XmlConfiguration[location=jar:file:/usr/app/api-0.0.1-SNAPSHOT.jar!/BOOT-INF/classes!/log4j2.xml]
2022-06-02 14:07:21,308 main DEBUG Started configuration XmlConfiguration[location=jar:file:/usr/app/api-0.0.1-SNAPSHOT.jar!/BOOT-INF/classes!/log4j2.xml] OK.
2022-06-02 14:07:21,310 main DEBUG Shutting down OutputStreamManager SYSTEM_OUT.false.false-1
2022-06-02 14:07:21,310 main DEBUG OutputStream closed
2022-06-02 14:07:21,310 main DEBUG Shut down OutputStreamManager SYSTEM_OUT.false.false-1, all resources released: true
2022-06-02 14:07:21,310 main DEBUG Appender DefaultConsole-1 stopped with status true
2022-06-02 14:07:21,311 main DEBUG Stopped org.apache.logging.log4j.core.config.DefaultConfiguration#6073f712 OK
Exception in thread "main" java.lang.reflect.InvocationTargetException
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:78)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:567)
at org.springframework.boot.loader.MainMethodRunner.run(MainMethodRunner.java:49)
at org.springframework.boot.loader.Launcher.launch(Launcher.java:108)
at org.springframework.boot.loader.Launcher.launch(Launcher.java:58)
at org.springframework.boot.loader.JarLauncher.main(JarLauncher.java:88)
Caused by: java.lang.InternalError: java.lang.reflect.InvocationTargetException
at java.base/jdk.internal.platform.Metrics.systemMetrics(Metrics.java:65)
at java.base/jdk.internal.platform.Container.metrics(Container.java:43)
at jdk.management/com.sun.management.internal.OperatingSystemImpl.<init>(OperatingSystemImpl.java:48)
at jdk.management/com.sun.management.internal.PlatformMBeanProviderImpl.getOperatingSystemMXBean(PlatformMBeanProviderImpl.java:279)
at jdk.management/com.sun.management.internal.PlatformMBeanProviderImpl$3.nameToMBeanMap(PlatformMBeanProviderImpl.java:198)
at java.management/java.lang.management.ManagementFactory.lambda$getPlatformMBeanServer$0(ManagementFactory.java:487)
at java.base/java.util.stream.ReferencePipeline$7$1.accept(ReferencePipeline.java:273)
at java.base/java.util.stream.ReferencePipeline$2$1.accept(ReferencePipeline.java:179)
at java.base/java.util.HashMap$ValueSpliterator.forEachRemaining(HashMap.java:1766)
at java.base/java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:484)
at java.base/java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:474)
at java.base/java.util.stream.ForEachOps$ForEachOp.evaluateSequential(ForEachOps.java:150)
at java.base/java.util.stream.ForEachOps$ForEachOp$OfRef.evaluateSequential(ForEachOps.java:173)
at java.base/java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234)
at java.base/java.util.stream.ReferencePipeline.forEach(ReferencePipeline.java:596)
at java.management/java.lang.management.ManagementFactory.getPlatformMBeanServer(ManagementFactory.java:488)
at org.apache.logging.log4j.core.jmx.Server.reregisterMBeansAfterReconfigure(Server.java:140)
at org.apache.logging.log4j.core.LoggerContext.setConfiguration(LoggerContext.java:637)
at org.apache.logging.log4j.core.LoggerContext.reconfigure(LoggerContext.java:699)
at org.apache.logging.log4j.core.LoggerContext.reconfigure(LoggerContext.java:716)
at org.apache.logging.log4j.core.LoggerContext.start(LoggerContext.java:270)
at org.apache.logging.log4j.core.impl.Log4jContextFactory.getContext(Log4jContextFactory.java:155)
at org.apache.logging.log4j.core.impl.Log4jContextFactory.getContext(Log4jContextFactory.java:47)
at org.apache.logging.log4j.LogManager.getContext(LogManager.java:196)
at org.apache.commons.logging.LogAdapter$Log4jLog.<clinit>(LogAdapter.java:155)
at org.apache.commons.logging.LogAdapter$Log4jAdapter.createLog(LogAdapter.java:122)
at org.apache.commons.logging.LogAdapter.createLog(LogAdapter.java:89)
at org.apache.commons.logging.LogFactory.getLog(LogFactory.java:67)
at org.apache.commons.logging.LogFactory.getLog(LogFactory.java:59)
at org.springframework.boot.SpringApplication.<clinit>(SpringApplication.java:201)
at com.obs.dqsc.api.ApiApplication.main(ApiApplication.java:37)
... 8 more
Caused by: java.lang.reflect.InvocationTargetException
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:78)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:567)
at java.base/jdk.internal.platform.Metrics.systemMetrics(Metrics.java:61)
... 38 more
Caused by: java.lang.ExceptionInInitializerError
at java.base/jdk.internal.platform.CgroupSubsystemFactory.create(CgroupSubsystemFactory.java:107)
at java.base/jdk.internal.platform.CgroupMetrics.getInstance(CgroupMetrics.java:167)
... 43 more
Caused by: java.lang.NullPointerException
at java.base/java.util.Objects.requireNonNull(Objects.java:208)
at java.base/sun.nio.fs.UnixFileSystem.getPath(UnixFileSystem.java:260)
at java.base/java.nio.file.Path.of(Path.java:147)
at java.base/java.nio.file.Paths.get(Paths.java:69)
at java.base/jdk.internal.platform.CgroupUtil.lambda$readStringValue$1(CgroupUtil.java:66)
at java.base/java.security.AccessController.doPrivileged(AccessController.java:554)
at java.base/jdk.internal.platform.CgroupUtil.readStringValue(CgroupUtil.java:68)
at java.base/jdk.internal.platform.CgroupSubsystemController.getStringValue(CgroupSubsystemController.java:65)
at java.base/jdk.internal.platform.CgroupSubsystemController.getLongValue(CgroupSubsystemController.java:124)
at java.base/jdk.internal.platform.cgroupv1.CgroupV1Subsystem.getLongValue(CgroupV1Subsystem.java:272)
at java.base/jdk.internal.platform.cgroupv1.CgroupV1Subsystem.getHierarchical(CgroupV1Subsystem.java:218)
at java.base/jdk.internal.platform.cgroupv1.CgroupV1Subsystem.setPath(CgroupV1Subsystem.java:201)
at java.base/jdk.internal.platform.cgroupv1.CgroupV1Subsystem.setSubSystemControllerPath(CgroupV1Subsystem.java:173)
at java.base/jdk.internal.platform.cgroupv1.CgroupV1Subsystem.lambda$initSubSystem$5(CgroupV1Subsystem.java:113)
at java.base/java.util.stream.ForEachOps$ForEachOp$OfRef.accept(ForEachOps.java:183)
at java.base/java.util.stream.ReferencePipeline$2$1.accept(ReferencePipeline.java:179)
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:1801)
at java.base/java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:484)
at java.base/java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:474)
at java.base/java.util.stream.ForEachOps$ForEachOp.evaluateSequential(ForEachOps.java:150)
at java.base/java.util.stream.ForEachOps$ForEachOp$OfRef.evaluateSequential(ForEachOps.java:173)
at java.base/java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234)
at java.base/java.util.stream.ReferencePipeline.forEach(ReferencePipeline.java:596)
at java.base/jdk.internal.platform.cgroupv1.CgroupV1Subsystem.initSubSystem(CgroupV1Subsystem.java:113)
at java.base/jdk.internal.platform.cgroupv1.CgroupV1Subsystem.<clinit>(CgroupV1Subsystem.java:47)
I'm wondering if that could be because I'm using log4j2 within springAOP with a generic method that uses Reflection api to trace logs.
this errors happens occasionally, sometimes it auto-correct itself and I don't know why, there is also a mention of UnixFileSystem.java in the exception but I don't know what does it mean, it might be a problem on the server and not related to the application?

Related

Struggling sending e-mails with log4j2 and SMTP Appender

I'm completely new to springboot and log4j2, and I cannot manage to send e-mail for a certain type of log (Warn&Error). I dont' understand why i get "ERROR Unable to invoke factory method in class org.apache.logging.log4j.core.appender.SmtpAppender" message. Does anyone have a clue?
log4j2.xml
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE Configuration SYSTEM "log4j2.dtd">
<Configuration status="debug" monitorInterval="30">
<Appenders>
<SMTP name="Mailer" subject="Error Log" to="email#email.com"
from="email2#email.com"
smtpHost="host" smtpUsername="username"
smtpPassword="mdp" smtpProtocol="smtp"
bufferSize="50">
<HtmlLayout />
<PatternLayout pattern="%d{yyyy-MM-dd HH:mm:ss} %-5p %c:%L - %m%n" />
</SMTP>
</Appenders>
<Loggers>
<Root level="info">
<AppenderRef ref="Mailer" />
</Root>
</Loggers>
</Configuration>
pom.xml
<?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 https://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>3.0.2</version>
<relativePath /> <!-- lookup parent from repository -->
</parent>
<groupId>com.example</groupId>
<artifactId>smtp</artifactId>
<version>0.0.1-SNAPSHOT</version>
<name>smtp</name>
<description>Demo project for Spring Boot</description>
<properties>
<java.version>17</java.version>
</properties>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter</artifactId>
<exclusions>
<exclusion>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-logging</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-mail</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-log4j2</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-mail</artifactId>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
</plugins>
</build>
</project>
SmtpApplication.java
package com.example.smtp;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
#SpringBootApplication
public class SmtpApplication {
private static final Logger logger = LogManager.getLogger(SmtpApplication.class);
public static void main(String[] args) {
SpringApplication.run(SmtpApplication.class, args);
logger.debug("Debugging log");
logger.info("Info log");
logger.warn("Hey, This is a warning!");
logger.error("Oops! We have an Error. OK");
logger.fatal("Damn! Fatal error. Please fix me.");
}
}
LOG
2023-01-24 17:30:17,730 main DEBUG AsyncLogger.ThreadNameStrategy=UNCACHED (user specified null, default is UNCACHED)
2023-01-24 17:30:17,731 main DEBUG org.apache.logging.log4j.core.util.SystemClock supports precise timestamps.
2023-01-24 17:31:47,540 Log4j2-TF-4-Scheduled-2 INFO Source 'C:\Users\theo.lalande\Desktop\smtp\target\classes\log4j2.xml' was modified on Tue Jan 24 17:31:33 CET 2023 (1674577893351), previous modification was on Tue Jan 24 17:29:57 CET 2023 (1674577797490)
2023-01-24 17:31:47,542 Log4j2-TF-3-ConfigurationFileWatcher-3 DEBUG Reconfiguration started for context 6d5380c2 (org.apache.logging.log4j.core.LoggerContext#7674b62c)
2023-01-24 17:31:47,544 Log4j2-TF-3-ConfigurationFileWatcher-3 DEBUG PluginManager 'Lookup' found 17 plugins
2023-01-24 17:31:47,546 Log4j2-TF-3-ConfigurationFileWatcher-3 DEBUG Closing FileInputStream java.io.FileInputStream#465ecc51
2023-01-24 17:31:47,550 Log4j2-TF-3-ConfigurationFileWatcher-3 DEBUG Watching configuration 'C:\Users\theo.lalande\Desktop\smtp\target\classes\log4j2.xml' for lastModified Tue Jan 24 17:31:33 CET 2023 (1674577893351)
2023-01-24 17:31:47,552 Log4j2-TF-3-ConfigurationFileWatcher-3 DEBUG Apache Log4j Core 2.19.0 initializing configuration XmlConfiguration[location=C:\Users\theo.lalande\Desktop\smtp\target\classes\log4j2.xml]
2023-01-24 17:31:47,553 Log4j2-TF-3-ConfigurationFileWatcher-3 DEBUG PluginManager 'Core' found 131 plugins
2023-01-24 17:31:47,554 Log4j2-TF-3-ConfigurationFileWatcher-3 DEBUG PluginManager 'Level' found 0 plugins
2023-01-24 17:31:47,554 Log4j2-TF-3-ConfigurationFileWatcher-3 DEBUG PluginManager 'Lookup' found 17 plugins
2023-01-24 17:31:47,556 Log4j2-TF-3-ConfigurationFileWatcher-3 DEBUG Building Plugin[name=layout, class=org.apache.logging.log4j.core.layout.HtmlLayout].
2023-01-24 17:31:47,557 Log4j2-TF-3-ConfigurationFileWatcher-3 DEBUG HtmlLayout$Builder(locationInfo="null", title="null", contentType="null", charset="null", fontSize="null", fontName="null", datePattern="null", timezone="null")
2023-01-24 17:31:47,557 Log4j2-TF-3-ConfigurationFileWatcher-3 DEBUG Building Plugin[name=layout, class=org.apache.logging.log4j.core.layout.PatternLayout].
2023-01-24 17:31:47,558 Log4j2-TF-3-ConfigurationFileWatcher-3 DEBUG PatternLayout$Builder(pattern="%d{yyyy-MM-dd HH:mm:ss} %-5p %c:%L - %m%n", PatternSelector=null, Configuration(C:\Users\theo.lalande\Desktop\smtp\target\classes\log4j2.xml), Replace=null, charset="null", alwaysWriteExceptions="null", disableAnsi="null", noConsoleNoAnsi="null", header="null", footer="null")
2023-01-24 17:31:47,558 Log4j2-TF-3-ConfigurationFileWatcher-3 DEBUG PluginManager 'Converter' found 48 plugins
2023-01-24 17:31:47,559 Log4j2-TF-3-ConfigurationFileWatcher-3 DEBUG Building Plugin[name=appender, class=org.apache.logging.log4j.core.appender.SmtpAppender].
2023-01-24 17:31:47,561 Log4j2-TF-3-ConfigurationFileWatcher-3 DEBUG SmtpAppender$Builder(to="email#email.com", cc="null", bcc="null", from="email2#email.com", replyTo="null", subject="Error Log", smtpProtocol="smtp", smtpHost="host", smtpPort="null", smtpUsername="username", smtpPassword="*****", smtpDebug="null", bufferSize="50", SSL=null, ignoreExceptions="null", HtmlLayout(org.apache.logging.log4j.core.layout.HtmlLayout#42614042), name="Mailer", Configuration(C:\Users\theo.lalande\Desktop\smtp\target\classes\log4j2.xml), Filter=null, ={})
2023-01-24 17:31:47,563 Log4j2-TF-3-ConfigurationFileWatcher-3 ERROR appender SMTP has no parameter that matches element PatternLayout
2023-01-24 17:31:47,566 Log4j2-TF-3-ConfigurationFileWatcher-3 ERROR Could not create plugin of type class org.apache.logging.log4j.core.appender.SmtpAppender for element SMTP: java.lang.NoClassDefFoundError: javax/mail/MessagingException java.lang.NoClassDefFoundError: javax/mail/MessagingException
at org.apache.logging.log4j.core.appender.SmtpAppender$Builder.lambda$build$0(SmtpAppender.java:288)
at java.base/java.util.Optional.orElseGet(Unknown Source)
at org.apache.logging.log4j.core.appender.SmtpAppender$Builder.build(SmtpAppender.java:288)
at org.apache.logging.log4j.core.appender.SmtpAppender$Builder.build(SmtpAppender.java:92)
at org.apache.logging.log4j.core.config.plugins.util.PluginBuilder.build(PluginBuilder.java:124)
at org.apache.logging.log4j.core.config.AbstractConfiguration.createPluginObject(AbstractConfiguration.java:1138)
at org.apache.logging.log4j.core.config.AbstractConfiguration.createConfiguration(AbstractConfiguration.java:1063)
at org.apache.logging.log4j.core.config.AbstractConfiguration.createConfiguration(AbstractConfiguration.java:1055)
at org.apache.logging.log4j.core.config.AbstractConfiguration.doConfigure(AbstractConfiguration.java:664)
at org.apache.logging.log4j.core.config.AbstractConfiguration.initialize(AbstractConfiguration.java:258)
at org.apache.logging.log4j.core.config.AbstractConfiguration.start(AbstractConfiguration.java:304)
at org.apache.logging.log4j.core.LoggerContext.setConfiguration(LoggerContext.java:621)
at org.apache.logging.log4j.core.LoggerContext.onChange(LoggerContext.java:757)
at org.apache.logging.log4j.core.util.AbstractWatcher$ReconfigurationRunnable.run(AbstractWatcher.java:93)
at java.base/java.lang.Thread.run(Unknown Source)
Caused by: java.lang.ClassNotFoundException: javax.mail.MessagingException
at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(Unknown Source)
at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(Unknown Source)
at java.base/java.lang.ClassLoader.loadClass(Unknown Source)
... 15 more
2023-01-24 17:31:47,571 Log4j2-TF-3-ConfigurationFileWatcher-3 ERROR Unable to invoke factory method in class org.apache.logging.log4j.core.appender.SmtpAppender for element SMTP: java.lang.IllegalStateException: No factory method found for class org.apache.logging.log4j.core.appender.SmtpAppender java.lang.IllegalStateException: No factory method found for class org.apache.logging.log4j.core.appender.SmtpAppender
at org.apache.logging.log4j.core.config.plugins.util.PluginBuilder.findFactoryMethod(PluginBuilder.java:260)
at org.apache.logging.log4j.core.config.plugins.util.PluginBuilder.build(PluginBuilder.java:136)
at org.apache.logging.log4j.core.config.AbstractConfiguration.createPluginObject(AbstractConfiguration.java:1138)
at org.apache.logging.log4j.core.config.AbstractConfiguration.createConfiguration(AbstractConfiguration.java:1063)
at org.apache.logging.log4j.core.config.AbstractConfiguration.createConfiguration(AbstractConfiguration.java:1055)
at org.apache.logging.log4j.core.config.AbstractConfiguration.doConfigure(AbstractConfiguration.java:664)
at org.apache.logging.log4j.core.config.AbstractConfiguration.initialize(AbstractConfiguration.java:258)
at org.apache.logging.log4j.core.config.AbstractConfiguration.start(AbstractConfiguration.java:304)
at org.apache.logging.log4j.core.LoggerContext.setConfiguration(LoggerContext.java:621)
at org.apache.logging.log4j.core.LoggerContext.onChange(LoggerContext.java:757)
at org.apache.logging.log4j.core.util.AbstractWatcher$ReconfigurationRunnable.run(AbstractWatcher.java:93)
at java.base/java.lang.Thread.run(Unknown Source)
2023-01-24 17:31:47,575 Log4j2-TF-3-ConfigurationFileWatcher-3 DEBUG Building Plugin[name=appenders, class=org.apache.logging.log4j.core.config.AppendersPlugin].
2023-01-24 17:31:47,577 Log4j2-TF-3-ConfigurationFileWatcher-3 ERROR Null object returned for SMTP in Appenders.
2023-01-24 17:31:47,579 Log4j2-TF-3-ConfigurationFileWatcher-3 DEBUG createAppenders(={})
2023-01-24 17:31:47,580 Log4j2-TF-3-ConfigurationFileWatcher-3 DEBUG Building Plugin[name=AppenderRef, class=org.apache.logging.log4j.core.config.AppenderRef].
2023-01-24 17:31:47,581 Log4j2-TF-3-ConfigurationFileWatcher-3 DEBUG createAppenderRef(ref="Mailer", level="null", Filter=null)
2023-01-24 17:31:47,581 Log4j2-TF-3-ConfigurationFileWatcher-3 DEBUG Building Plugin[name=root, class=org.apache.logging.log4j.core.config.LoggerConfig$RootLogger].
2023-01-24 17:31:47,582 Log4j2-TF-3-ConfigurationFileWatcher-3 DEBUG LoggerConfig$RootLogger$Builder(additivity="null", level="INFO", levelAndRefs="null", includeLocation="null", ={Mailer}, ={}, Configuration(C:\Users\theo.lalande\Desktop\smtp\target\classes\log4j2.xml), Filter=null)
2023-01-24 17:31:47,583 Log4j2-TF-3-ConfigurationFileWatcher-3 DEBUG Building Plugin[name=loggers, class=org.apache.logging.log4j.core.config.LoggersPlugin].
2023-01-24 17:31:47,584 Log4j2-TF-3-ConfigurationFileWatcher-3 DEBUG createLoggers(={root})
2023-01-24 17:31:47,585 Log4j2-TF-3-ConfigurationFileWatcher-3 ERROR Unable to locate appender "Mailer" for logger config "root"
2023-01-24 17:31:47,586 Log4j2-TF-3-ConfigurationFileWatcher-3 DEBUG Configuration XmlConfiguration[location=C:\Users\theo.lalande\Desktop\smtp\target\classes\log4j2.xml] initialized
2023-01-24 17:31:47,587 Log4j2-TF-3-ConfigurationFileWatcher-3 DEBUG Starting configuration XmlConfiguration[location=C:\Users\theo.lalande\Desktop\smtp\target\classes\log4j2.xml]
2023-01-24 17:31:47,588 Log4j2-TF-3-ConfigurationFileWatcher-3 DEBUG Log4j2 ConfigurationScheduler starting 1 threads
2023-01-24 17:31:47,589 Log4j2-TF-3-ConfigurationFileWatcher-3 DEBUG Started configuration XmlConfiguration[location=C:\Users\theo.lalande\Desktop\smtp\target\classes\log4j2.xml] OK.
2023-01-24 17:31:47,590 Log4j2-TF-3-ConfigurationFileWatcher-3 DEBUG Log4jBridgeHandler.propertyChange(): java.beans.PropertyChangeEvent[propertyName=config; oldValue=XmlConfiguration[location=C:\Users\theo.lalande\Desktop\smtp\target\classes\log4j2.xml]; newValue=XmlConfiguration[location=C:\Users\theo.lalande\Desktop\smtp\target\classes\log4j2.xml]; propagationId=null; source=org.apache.logging.log4j.core.LoggerContext#7674b62c]
2023-01-24 17:31:47,591 Log4j2-TF-3-ConfigurationFileWatcher-3 DEBUG Log4jBridgeHandler.propagateLogLevels(): XmlConfiguration[location=C:\Users\theo.lalande\Desktop\smtp\target\classes\log4j2.xml]
2023-01-24 17:31:47,593 Log4j2-TF-3-ConfigurationFileWatcher-3 DEBUG Log4j2 ConfigurationScheduler shutting down threads in java.util.concurrent.ScheduledThreadPoolExecutor#6302a2c0[Running, pool size = 1, active threads
= 0, queued tasks = 1, completed tasks = 3]
2023-01-24 17:31:47,595 Log4j2-TF-3-ConfigurationFileWatcher-3 DEBUG Stopped XmlConfiguration[location=C:\Users\theo.lalande\Desktop\smtp\target\classes\log4j2.xml] OK
2023-01-24 17:31:47,596 Log4j2-TF-3-ConfigurationFileWatcher-3 DEBUG Log4jBridgeHandler.propertyChange(): java.beans.PropertyChangeEvent[propertyName=config; oldValue=XmlConfiguration[location=C:\Users\theo.lalande\Desktop\smtp\target\classes\log4j2.xml]; newValue=XmlConfiguration[location=C:\Users\theo.lalande\Desktop\smtp\target\classes\log4j2.xml]; propagationId=null; source=org.apache.logging.log4j.core.LoggerContext#7674b62c]
2023-01-24 17:31:47,599 Log4j2-TF-3-ConfigurationFileWatcher-3 DEBUG Log4jBridgeHandler.propagateLogLevels(): XmlConfiguration[location=C:\Users\theo.lalande\Desktop\smtp\target\classes\log4j2.xml]
2023-01-24 17:31:47,602 Log4j2-TF-3-ConfigurationFileWatcher-3 DEBUG Registering MBean org.apache.logging.log4j2:type=6d5380c2
2023-01-24 17:31:47,603 Log4j2-TF-3-ConfigurationFileWatcher-3 DEBUG Registering MBean org.apache.logging.log4j2:type=6d5380c2,component=StatusLogger
2023-01-24 17:31:47,604 Log4j2-TF-3-ConfigurationFileWatcher-3 DEBUG Registering MBean org.apache.logging.log4j2:type=6d5380c2,component=ContextSelector
2023-01-24 17:31:47,606 Log4j2-TF-3-ConfigurationFileWatcher-3 DEBUG Registering MBean org.apache.logging.log4j2:type=6d5380c2,component=Loggers,name=
2023-01-24 17:31:47,606 Log4j2-TF-3-ConfigurationFileWatcher-3 DEBUG Reconfiguration completed for 6d5380c2 (org.apache.logging.log4j.core.LoggerContext#7674b62c) in 65 milliseconds.
I've tried plenty of things, but cannot mannage du make it work. Does anyone avec a clue?
Your are facing one of the side-effects of the gap between Java EE 8 and Jakarta EE 9 (it's a very disruptive renaming of classes): Spring Boot 3.x contains an implementation of Jakarta Mail 2.0, while the SMTP appender in Log4j2 Core requires and implementation of Java Mail 1.6.
To fill the gap, we published an alternative implementation of MailManager (the engine behind the SMTP appender) in the log4j-jakarta-smtp artifact. To use it, you just need to add it to your runtime classpath:
<dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-jakarta-smtp</artifactId>
<scope>runtime</scope>
<exclusions>
<exclusion>
<groupId>com.sun.activation</groupId>
<artifactId>jakarta-activation</artifactId>
</exclusion>
<exclusion>
<groupId>com.sun.mail</groupId>
<artifactId>smtp</artifactId>
</exclusion>
</exclusions>
</dependency>
(the version is managed by Spring Boot).
Try replacing
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-mail</artifactId>
</dependency>
with the following the dependencies
<dependency>
<groupId>com.sun.mail</groupId>
<artifactId>javax.mail</artifactId>
<version>1.6.2</version>
</dependency>
<dependency>
<groupId>javax.activation</groupId>
<artifactId>javax.activation-api</artifactId>
<version>1.2.0</version>
<scope>runtime</scope>
</dependency>

multi-pom in intellijIDEA. Error adding module to project: null

I wanted to make a multi-pom project in Intellij (2020.3.4). In one Maven project, I right-click ->New -> Module -> Maven. select parent to "my project". However, even if parent is not specified, I get the error: Error adding module to project: null. (at the same time, it adds a regular folder with the module name and an empty pom.xml inside) (This happens with any archetype). I didn't find any solutions on the Internet at all. Only downgrade to the old version of Intellij IDEA and that solution was published 10 years ago. Tell me what is the problem? Or what to do? Does not work only with "Maven". With "Java" and "Spring Inizializr" it works.
idea.log
2022-03-23 15:54:05,382 [81624884] WARN - il.projectWizard.ModuleBuilder -
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 java.base/java.util.Properties.put(Properties.java:1340)
at java.base/java.util.Properties.setProperty(Properties.java:228)
at org.jetbrains.idea.maven.utils.MavenUtil.runOrApplyMavenProjectFileTemplate(MavenUtil.java:384)
at org.jetbrains.idea.maven.utils.MavenUtil.runOrApplyMavenProjectFileTemplate(MavenUtil.java:341)
at org.jetbrains.idea.maven.wizards.MavenModuleBuilderHelper.lambda$configure$0(MavenModuleBuilderHelper.java:85)
at com.intellij.openapi.command.WriteCommandAction$BuilderImpl$2.run(WriteCommandAction.java:122)
at com.intellij.openapi.application.RunResult.run(RunResult.java:35)
at com.intellij.openapi.command.WriteCommandAction.lambda$performWriteCommandAction$1(WriteCommandAction.java:253)
at com.intellij.openapi.application.impl.ApplicationImpl.runWriteAction(ApplicationImpl.java:1000)
at com.intellij.openapi.command.WriteCommandAction.lambda$performWriteCommandAction$2(WriteCommandAction.java:252)
at com.intellij.openapi.command.WriteCommandAction.lambda$doExecuteCommand$4(WriteCommandAction.java:310)
at com.intellij.openapi.command.impl.CoreCommandProcessor.executeCommand(CoreCommandProcessor.java:220)
at com.intellij.openapi.command.impl.CoreCommandProcessor.executeCommand(CoreCommandProcessor.java:187)
at com.intellij.openapi.command.WriteCommandAction.doExecuteCommand(WriteCommandAction.java:312)
at com.intellij.openapi.command.WriteCommandAction.performWriteCommandAction(WriteCommandAction.java:251)
at com.intellij.openapi.command.WriteCommandAction.execute(WriteCommandAction.java:232)
at com.intellij.openapi.command.WriteCommandAction$BuilderImpl.compute(WriteCommandAction.java:124)
at org.jetbrains.idea.maven.wizards.MavenModuleBuilderHelper.configure(MavenModuleBuilderHelper.java:79)
at org.jetbrains.idea.maven.wizards.AbstractMavenModuleBuilder.lambda$setupRootModel$0(AbstractMavenModuleBuilder.java:77)
at org.jetbrains.idea.maven.utils.MavenUtil.runDumbAware(MavenUtil.java:211)
at org.jetbrains.idea.maven.utils.MavenUtil.runWhenInitialized(MavenUtil.java:231)
at org.jetbrains.idea.maven.wizards.AbstractMavenModuleBuilder.setupRootModel(AbstractMavenModuleBuilder.java:70)
at com.intellij.ide.util.projectWizard.ModuleBuilder.setupModule(ModuleBuilder.java:260)
at com.intellij.ide.util.projectWizard.ModuleBuilder.createModule(ModuleBuilder.java:253)
at com.intellij.ide.util.projectWizard.ModuleBuilder.createAndCommitIfNeeded(ModuleBuilder.java:292)
at com.intellij.ide.util.projectWizard.ModuleBuilder.lambda$commitModule$4(ModuleBuilder.java:338)
at com.intellij.openapi.application.impl.ApplicationImpl.runWriteActionWithClass(ApplicationImpl.java:988)
at com.intellij.openapi.application.impl.ApplicationImpl.runWriteAction(ApplicationImpl.java:1014)
at com.intellij.ide.util.projectWizard.ModuleBuilder.commitModule(ModuleBuilder.java:337)
at com.intellij.openapi.roots.ui.configuration.actions.NewModuleAction.createModuleFromWizard(NewModuleAction.java:59)
at com.intellij.openapi.roots.ui.configuration.actions.NewModuleAction.actionPerformed(NewModuleAction.java:49)
at com.intellij.openapi.actionSystem.ex.ActionUtil.performActionDumbAware(ActionUtil.java:281)
at com.intellij.openapi.actionSystem.impl.ActionMenuItem$ActionTransmitter.lambda$actionPerformed$0(ActionMenuItem.java:310)
at com.intellij.openapi.wm.impl.FocusManagerImpl.runOnOwnContext(FocusManagerImpl.java:286)
at com.intellij.openapi.wm.impl.IdeFocusManagerImpl.runOnOwnContext(IdeFocusManagerImpl.java:77)
at com.intellij.openapi.actionSystem.impl.ActionMenuItem$ActionTransmitter.actionPerformed(ActionMenuItem.java:299)
at java.desktop/javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:1967)
at com.intellij.openapi.actionSystem.impl.ActionMenuItem.lambda$fireActionPerformed$0(ActionMenuItem.java:110)
at com.intellij.openapi.application.TransactionGuardImpl.performUserActivity(TransactionGuardImpl.java:95)
at com.intellij.openapi.actionSystem.impl.ActionMenuItem.fireActionPerformed(ActionMenuItem.java:110)
at com.intellij.ui.plaf.beg.BegMenuItemUI.doClick(BegMenuItemUI.java:514)
at com.intellij.ui.plaf.beg.BegMenuItemUI$MyMouseInputHandler.mouseReleased(BegMenuItemUI.java:544)
at java.desktop/java.awt.Component.processMouseEvent(Component.java:6652)
at java.desktop/javax.swing.JComponent.processMouseEvent(JComponent.java:3345)
at java.desktop/java.awt.Component.processEvent(Component.java:6417)
at java.desktop/java.awt.Container.processEvent(Container.java:2263)
at java.desktop/java.awt.Component.dispatchEventImpl(Component.java:5027)
at java.desktop/java.awt.Container.dispatchEventImpl(Container.java:2321)
at java.desktop/java.awt.Component.dispatchEvent(Component.java:4859)
at java.desktop/java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4918)
at java.desktop/java.awt.LightweightDispatcher.processMouseEvent(Container.java:4547)
at java.desktop/java.awt.LightweightDispatcher.dispatchEvent(Container.java:4488)
at java.desktop/java.awt.Container.dispatchEventImpl(Container.java:2307)
at java.desktop/java.awt.Window.dispatchEventImpl(Window.java:2780)
at java.desktop/java.awt.Component.dispatchEvent(Component.java:4859)
at java.desktop/java.awt.EventQueue.dispatchEventImpl(EventQueue.java:778)
at java.desktop/java.awt.EventQueue$4.run(EventQueue.java:727)
at java.desktop/java.awt.EventQueue$4.run(EventQueue.java:721)
at java.base/java.security.AccessController.doPrivileged(Native Method)
at java.base/java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:85)
at java.base/java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:95)
at java.desktop/java.awt.EventQueue$5.run(EventQueue.java:751)
at java.desktop/java.awt.EventQueue$5.run(EventQueue.java:749)
at java.base/java.security.AccessController.doPrivileged(Native Method)
at java.base/java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:85)
at java.desktop/java.awt.EventQueue.dispatchEvent(EventQueue.java:748)
at com.intellij.ide.IdeEventQueue.defaultDispatchEvent(IdeEventQueue.java:976)
at com.intellij.ide.IdeEventQueue.dispatchMouseEvent(IdeEventQueue.java:911)
at com.intellij.ide.IdeEventQueue._dispatchEvent(IdeEventQueue.java:840)
at com.intellij.ide.IdeEventQueue.lambda$dispatchEvent$8(IdeEventQueue.java:454)
at com.intellij.openapi.progress.impl.CoreProgressManager.computePrioritized(CoreProgressManager.java:773)
at com.intellij.ide.IdeEventQueue.lambda$dispatchEvent$9(IdeEventQueue.java:453)
at com.intellij.openapi.application.impl.ApplicationImpl.runIntendedWriteActionOnCurrentThread(ApplicationImpl.java:822)
at com.intellij.ide.IdeEventQueue.dispatchEvent(IdeEventQueue.java:507)
at java.desktop/java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:203)
at java.desktop/java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:124)
at java.desktop/java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:113)
at java.desktop/java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:109)
at java.desktop/java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:101)
at java.desktop/java.awt.EventDispatchThread.run(EventDispatchThread.java:90)
2022-03-23 15:54:05,981 [81625483] ERROR - plication.impl.ApplicationImpl - Cannot reconnect.
java.lang.RuntimeException: Cannot reconnect.
at org.jetbrains.idea.maven.server.RemoteObjectWrapper.perform(RemoteObjectWrapper.java:82)
at org.jetbrains.idea.maven.server.MavenIndexerWrapper.getArchetypes(MavenIndexerWrapper.java:143)
at org.jetbrains.idea.maven.indices.MavenIndicesManager.getArchetypes(MavenIndicesManager.java:337)
at org.jetbrains.idea.maven.wizards.MavenArchetypesStep.lambda$updateArchetypesList$3(MavenArchetypesStep.java:223)
at com.intellij.util.RunnableCallable.call(RunnableCallable.java:20)
at com.intellij.util.RunnableCallable.call(RunnableCallable.java:11)
at com.intellij.openapi.application.impl.ApplicationImpl$1.call(ApplicationImpl.java:270)
at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
at java.base/java.util.concurrent.Executors$PrivilegedThreadFactory$1$1.run(Executors.java:668)
at java.base/java.util.concurrent.Executors$PrivilegedThreadFactory$1$1.run(Executors.java:665)
at java.base/java.security.AccessController.doPrivileged(Native Method)
at java.base/java.util.concurrent.Executors$PrivilegedThreadFactory$1.run(Executors.java:665)
at java.base/java.lang.Thread.run(Thread.java:834)
Caused by: java.rmi.ConnectException: Connection refused to host: 127.0.0.1; nested exception is:
java.net.ConnectException: Connection refused: connect
at java.rmi/sun.rmi.transport.tcp.TCPEndpoint.newSocket(TCPEndpoint.java:623)
at java.rmi/sun.rmi.transport.tcp.TCPChannel.createConnection(TCPChannel.java:209)
at java.rmi/sun.rmi.transport.tcp.TCPChannel.newConnection(TCPChannel.java:196)
at java.rmi/sun.rmi.server.UnicastRef.invoke(UnicastRef.java:132)
at java.rmi/java.rmi.server.RemoteObjectInvocationHandler.invokeRemoteMethod(RemoteObjectInvocationHandler.java:217)
at java.rmi/java.rmi.server.RemoteObjectInvocationHandler.invoke(RemoteObjectInvocationHandler.java:162)
at com.sun.proxy.$Proxy146.createIndexer(Unknown Source)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:566)
at com.intellij.execution.rmi.RemoteUtil.invokeRemote(RemoteUtil.java:150)
at com.intellij.execution.rmi.RemoteUtil.access$400(RemoteUtil.java:21)
at com.intellij.execution.rmi.RemoteUtil$1.lambda$invoke$0(RemoteUtil.java:134)
at com.intellij.openapi.util.ClassLoaderUtil.computeWithClassLoader(ClassLoaderUtil.java:31)
at com.intellij.execution.rmi.RemoteUtil.executeWithClassLoader(RemoteUtil.java:202)
at com.intellij.execution.rmi.RemoteUtil$1.invoke(RemoteUtil.java:134)
at com.sun.proxy.$Proxy146.createIndexer(Unknown Source)
at org.jetbrains.idea.maven.server.MavenServerConnectorImpl.createIndexer(MavenServerConnectorImpl.java:197)
at org.jetbrains.idea.maven.server.MavenServerManager$4.create(MavenServerManager.java:381)
at org.jetbrains.idea.maven.server.MavenServerManager$4.create(MavenServerManager.java:377)
at org.jetbrains.idea.maven.server.RemoteObjectWrapper.getOrCreateWrappee(RemoteObjectWrapper.java:41)
at org.jetbrains.idea.maven.server.MavenIndexerWrapper.lambda$getArchetypes$6(MavenIndexerWrapper.java:143)
at org.jetbrains.idea.maven.server.RemoteObjectWrapper.perform(RemoteObjectWrapper.java:76)
... 14 more
Caused by: java.net.ConnectException: Connection refused: connect
at java.base/java.net.PlainSocketImpl.connect0(Native Method)
at java.base/java.net.PlainSocketImpl.socketConnect(PlainSocketImpl.java:101)
at java.base/java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:399)
at java.base/java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:242)
at java.base/java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:224)
at java.base/java.net.SocksSocketImpl.connect(SocksSocketImpl.java:392)
at java.base/java.net.Socket.connect(Socket.java:609)
at java.base/java.net.Socket.connect(Socket.java:558)
at java.base/java.net.Socket.<init>(Socket.java:454)
at java.base/java.net.Socket.<init>(Socket.java:231)
at com.intellij.execution.rmi.RemoteServer$1.createSocket(RemoteServer.java:122)
at java.rmi/sun.rmi.transport.tcp.TCPEndpoint.newSocket(TCPEndpoint.java:617)
... 37 more
2022-03-23 15:54:05,981 [81625483] ERROR - plication.impl.ApplicationImpl - IntelliJ IDEA 2020.3.4 Build #IU-203.8084.24
2022-03-23 15:54:05,981 [81625483] ERROR - plication.impl.ApplicationImpl - JDK: 11.0.10; VM: OpenJDK 64-Bit Server VM; Vendor: JetBrains s.r.o.
2022-03-23 15:54:05,981 [81625483] ERROR - plication.impl.ApplicationImpl - OS: Windows 10
2022-03-23 15:54:05,981 [81625483] ERROR - plication.impl.ApplicationImpl - Last Action: NewModuleInGroup
2022-03-23 15:54:06,580 [81626082] INFO - .diagnostic.PerformanceWatcher - Indexable file iteration took 1922ms; general responsiveness: ok; EDT responsiveness: ok
2022-03-23 15:54:06,580 [81626082] INFO - indexing.UnindexedFilesUpdater - Unindexed files update started: 0 files to index
2022-03-23 15:54:06,580 [81626082] INFO - .diagnostic.PerformanceWatcher - Indexable file iteration took 1922ms; general responsiveness: ok; EDT responsiveness: ok
2022-03-23 15:54:06,595 [81626097] INFO - indexing.UnindexedFilesUpdater - Unindexed files update started: 0 files to index
2022-03-23 15:54:08,524 [81628026] INFO - rationStore.ComponentStoreImpl - Saving appFileTypeManager took 16 ms
I reinstalled windows. (I needed it anyway) and installed intellij IDEA 2021.3 instead of 2020.3. Everything worked. Some of this has affected. Perhaps reinstalling the same version would also solve this problem.
In Intellij goto File -> Project Structure -> Project SDK -> [Select Your Installed SDK Version] -> Ok
And try to add the new module, it worked for me.

Titan loading problems with elastic search

I'm using the following code to load Titan:
TitanFactory.Builder config = TitanFactory.build();
config.set("storage.backend", "berkeleyje");
config.set("storage.directory", DIRECTORY);
//config.set("storage.conf-file", "file:////" + DIRECTORY + "/cassandra/cassandra.yaml");
config.set("index." + INDEX_NAME + ".backend", "elasticsearch");
config.set("index." + INDEX_NAME + ".DIRECTORY", DIRECTORY + File.separator + "es");
config.set("index." + INDEX_NAME + ".elasticsearch.local-mode", true);
config.set("index." + INDEX_NAME + ".elasticsearch.client-only", false);
graph = config.open();
loading dependencies with gradle:
compile group: 'com.thinkaurelius.titan', name: 'titan-all', version: '1.0.0'
My project directory is:
/home/ray/IdeaProjects/BAG - Byzantine fault-tolerant Architecture for Graph database/
my titan is in this project directory in the folder "TITAN"
That's what I set in the Directory variable.
Still on start it always crashes:
22:56:01.420 [main] DEBUG c.t.t.d.b.BerkeleyJEStoreManager - Opened database system_properties
java.lang.Throwable: null
at com.thinkaurelius.titan.diskstorage.berkeleyje.BerkeleyJEStoreManager.openDatabase(BerkeleyJEStoreManager.java:172) [titan-berkeleyje-1.0.0.jar:na]
at com.thinkaurelius.titan.diskstorage.berkeleyje.BerkeleyJEStoreManager.openDatabase(BerkeleyJEStoreManager.java:34) [titan-berkeleyje-1.0.0.jar:na]
at com.thinkaurelius.titan.diskstorage.keycolumnvalue.keyvalue.OrderedKeyValueStoreManagerAdapter.openDatabase(OrderedKeyValueStoreManagerAdapter.java:76) [titan-core-1.0.0.jar:na]
at com.thinkaurelius.titan.diskstorage.keycolumnvalue.keyvalue.OrderedKeyValueStoreManagerAdapter.openDatabase(OrderedKeyValueStoreManagerAdapter.java:69) [titan-core-1.0.0.jar:na]
at com.thinkaurelius.titan.diskstorage.keycolumnvalue.keyvalue.OrderedKeyValueStoreManagerAdapter.openDatabase(OrderedKeyValueStoreManagerAdapter.java:25) [titan-core-1.0.0.jar:na]
at com.thinkaurelius.titan.diskstorage.Backend.getStandaloneGlobalConfiguration(Backend.java:449) [titan-core-1.0.0.jar:na]
at com.thinkaurelius.titan.graphdb.configuration.GraphDatabaseConfiguration.<init>(GraphDatabaseConfiguration.java:1322) [titan-core-1.0.0.jar:na]
at com.thinkaurelius.titan.core.TitanFactory.open(TitanFactory.java:94) [titan-core-1.0.0.jar:na]
at com.thinkaurelius.titan.core.TitanFactory.open(TitanFactory.java:84) [titan-core-1.0.0.jar:na]
at com.thinkaurelius.titan.core.TitanFactory$Builder.open(TitanFactory.java:139) [titan-core-1.0.0.jar:na]
at main.java.com.bag.server.database.TitanDatabaseAccess.start(TitanDatabaseAccess.java:56) [main/:na]
at main.java.com.bag.server.TestServer.<init>(TestServer.java:105) [main/:na]
at main.java.com.bag.server.TestServer.main(TestServer.java:428) [main/:na]
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:1.8.0_112]
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[na:1.8.0_112]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:1.8.0_112]
at java.lang.reflect.Method.invoke(Method.java:498) ~[na:1.8.0_112]
at com.intellij.rt.execution.application.AppMain.main(AppMain.java:147) [idea_rt.jar:na]
22:56:01.423 [main] DEBUG c.t.t.d.k.k.OrderedKeyValueStoreAdapter - Used key length 0 for database system_properties
22:56:01.429 [main] DEBUG c.t.t.c.u.ReflectiveConfigOptionLoader$LoaderConfiguration - Option loading enabled by default
22:56:01.431 [main] DEBUG c.t.t.c.u.ReflectiveConfigOptionLoader - Added preferred classloader to config option loader chain: sun.misc.Launcher$AppClassLoader#63e31ee
22:56:01.431 [main] DEBUG c.t.t.c.u.ReflectiveConfigOptionLoader - Added thread context classloader to config option loader chain: sun.misc.Launcher$AppClassLoader#63e31ee
22:56:01.431 [main] DEBUG c.t.t.c.u.ReflectiveConfigOptionLoader - Added caller classloader to config option loader chain: sun.misc.Launcher$AppClassLoader#63e31ee
22:56:01.442 [main] DEBUG c.t.t.c.u.ReflectiveConfigOptionLoader - Loaded class com.thinkaurelius.titan.diskstorage.hbase.HBaseStoreManager with loader sun.misc.Launcher$AppClassLoader#63e31ee
22:56:01.442 [main] DEBUG c.t.t.c.u.ReflectiveConfigOptionLoader - Located functioning classloader sun.misc.Launcher$AppClassLoader#63e31ee; using it for remaining classload attempts
22:56:01.447 [main] DEBUG c.t.t.c.u.ReflectiveConfigOptionLoader - Loaded class com.thinkaurelius.titan.diskstorage.cassandra.astyanax.AstyanaxStoreManager with selected loader sun.misc.Launcher$AppClassLoader#63e31ee
22:56:01.447 [main] DEBUG c.t.t.c.u.ReflectiveConfigOptionLoader - Loaded class com.thinkaurelius.titan.diskstorage.cassandra.AbstractCassandraStoreManager with selected loader sun.misc.Launcher$AppClassLoader#63e31ee
22:56:01.452 [main] DEBUG c.t.t.c.u.ReflectiveConfigOptionLoader - Loaded class com.thinkaurelius.titan.diskstorage.cassandra.thrift.CassandraThriftStoreManager with selected loader sun.misc.Launcher$AppClassLoader#63e31ee
22:56:01.459 [main] DEBUG c.t.t.c.u.ReflectiveConfigOptionLoader - Loaded class com.thinkaurelius.titan.diskstorage.es.ElasticSearchIndex with selected loader sun.misc.Launcher$AppClassLoader#63e31ee
22:56:01.460 [main] DEBUG c.t.t.c.u.ReflectiveConfigOptionLoader - Unable to load class com.thinkaurelius.titan.diskstorage.solr.SolrIndex with selected loader sun.misc.Launcher$AppClassLoader#63e31ee
java.lang.ClassNotFoundException: com.thinkaurelius.titan.diskstorage.solr.SolrIndex
at java.net.URLClassLoader.findClass(URLClassLoader.java:381) ~[na:1.8.0_112]
at java.lang.ClassLoader.loadClass(ClassLoader.java:424) ~[na:1.8.0_112]
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:331) ~[na:1.8.0_112]
at java.lang.ClassLoader.loadClass(ClassLoader.java:357) ~[na:1.8.0_112]
at java.lang.Class.forName0(Native Method) ~[na:1.8.0_112]
at java.lang.Class.forName(Class.java:348) ~[na:1.8.0_112]
at com.thinkaurelius.titan.core.util.ReflectiveConfigOptionLoader.loadStandard(ReflectiveConfigOptionLoader.java:136) ~[titan-core-1.0.0.jar:na]
at com.thinkaurelius.titan.diskstorage.configuration.ConfigNamespace.getChild(ConfigNamespace.java:68) [titan-core-1.0.0.jar:na]
at com.thinkaurelius.titan.diskstorage.configuration.ConfigElement.parse(ConfigElement.java:180) [titan-core-1.0.0.jar:na]
at com.thinkaurelius.titan.diskstorage.configuration.BasicConfiguration.getAll(BasicConfiguration.java:80) [titan-core-1.0.0.jar:na]
at com.thinkaurelius.titan.graphdb.configuration.GraphDatabaseConfiguration.<init>(GraphDatabaseConfiguration.java:1327) [titan-core-1.0.0.jar:na]
at com.thinkaurelius.titan.core.TitanFactory.open(TitanFactory.java:94) [titan-core-1.0.0.jar:na]
at com.thinkaurelius.titan.core.TitanFactory.open(TitanFactory.java:84) [titan-core-1.0.0.jar:na]
at com.thinkaurelius.titan.core.TitanFactory$Builder.open(TitanFactory.java:139) [titan-core-1.0.0.jar:na]
at main.java.com.bag.server.database.TitanDatabaseAccess.start(TitanDatabaseAccess.java:56) [main/:na]
at main.java.com.bag.server.TestServer.<init>(TestServer.java:105) [main/:na]
at main.java.com.bag.server.TestServer.main(TestServer.java:428) [main/:na]
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:1.8.0_112]
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[na:1.8.0_112]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:1.8.0_112]
at java.lang.reflect.Method.invoke(Method.java:498) ~[na:1.8.0_112]
at com.intellij.rt.execution.application.AppMain.main(AppMain.java:147) [idea_rt.jar:na]
22:56:01.462 [main] DEBUG c.t.t.c.u.ReflectiveConfigOptionLoader - Loaded class com.thinkaurelius.titan.diskstorage.log.kcvs.KCVSLog with selected loader sun.misc.Launcher$AppClassLoader#63e31ee
22:56:01.463 [main] DEBUG c.t.t.c.u.ReflectiveConfigOptionLoader - Loaded class com.thinkaurelius.titan.diskstorage.log.kcvs.KCVSLogManager with selected loader sun.misc.Launcher$AppClassLoader#63e31ee
22:56:01.463 [main] DEBUG c.t.t.c.u.ReflectiveConfigOptionLoader - Loaded class com.thinkaurelius.titan.graphdb.configuration.GraphDatabaseConfiguration with selected loader sun.misc.Launcher$AppClassLoader#63e31ee
22:56:01.464 [main] DEBUG c.t.t.c.u.ReflectiveConfigOptionLoader - Loaded class com.thinkaurelius.titan.graphdb.database.idassigner.placement.SimpleBulkPlacementStrategy with selected loader sun.misc.Launcher$AppClassLoader#63e31ee
22:56:01.465 [main] DEBUG c.t.t.c.u.ReflectiveConfigOptionLoader - Loaded class com.thinkaurelius.titan.graphdb.database.idassigner.VertexIDAssigner with selected loader sun.misc.Launcher$AppClassLoader#63e31ee
22:56:01.465 [main] DEBUG c.t.t.c.u.ReflectiveConfigOptionLoader - Loaded class com.thinkaurelius.titan.diskstorage.berkeleyje.BerkeleyJEStoreManager with selected loader sun.misc.Launcher$AppClassLoader#63e31ee
22:56:01.465 [main] INFO c.t.t.c.u.ReflectiveConfigOptionLoader - Loaded and initialized config classes: 11 OK out of 12 attempts in PT0.035S
22:56:01.466 [main] DEBUG c.t.t.c.u.ReflectiveConfigOptionLoader - Added preferred classloader to config option loader chain: sun.misc.Launcher$AppClassLoader#63e31ee
22:56:01.466 [main] DEBUG c.t.t.c.u.ReflectiveConfigOptionLoader - Added thread context classloader to config option loader chain: sun.misc.Launcher$AppClassLoader#63e31ee
22:56:01.466 [main] DEBUG c.t.t.c.u.ReflectiveConfigOptionLoader - Added caller classloader to config option loader chain: sun.misc.Launcher$AppClassLoader#63e31ee
22:56:01.493 [main] DEBUG org.reflections.Reflections - going to scan these urls:
file:/home/ray/IdeaProjects/BAG%20-%20Byzantine%20fault-tolerant%20Architecture%20for%20Graph%20database/build/classes/main/
22:56:01.497 [main] DEBUG org.reflections.Reflections - could not scan file main/java/com/bag/server/TestServer.class in url file:/home/ray/IdeaProjects/BAG%20-%20Byzantine%20fault-tolerant%20Architecture%20for%20Graph%20database/build/classes/main/ with scanner TypeAnnotationsScanner
22:56:01.497 [main] DEBUG org.reflections.Reflections - could not scan file main/java/com/bag/server/TestServer.class in url file:/home/ray/IdeaProjects/BAG%20-%20Byzantine%20fault-tolerant%20Architecture%20for%20Graph%20database/build/classes/main/ with scanner SubTypesScanner
22:56:01.497 [main] DEBUG org.reflections.Reflections - could not scan file main/java/com/bag/server/ConflictHandler.class in url file:/home/ray/IdeaProjects/BAG%20-%20Byzantine%20fault-tolerant%20Architecture%20for%20Graph%20database/build/classes/main/ with scanner TypeAnnotationsScanner
22:56:01.498 [main] DEBUG org.reflections.Reflections - could not scan file main/java/com/bag/server/ConflictHandler.class in url file:/home/ray/IdeaProjects/BAG%20-%20Byzantine%20fault-tolerant%20Architecture%20for%20Graph%20database/build/classes/main/ with scanner SubTypesScanner
22:56:01.502 [main] DEBUG org.reflections.Reflections - could not scan file main/java/com/bag/server/database/Neo4jDatabaseAccess.class in url file:/home/ray/IdeaProjects/BAG%20-%20Byzantine%20fault-tolerant%20Architecture%20for%20Graph%20database/build/classes/main/ with scanner TypeAnnotationsScanner
22:56:01.503 [main] DEBUG org.reflections.Reflections - could not scan file main/java/com/bag/server/database/Neo4jDatabaseAccess.class in url file:/home/ray/IdeaProjects/BAG%20-%20Byzantine%20fault-tolerant%20Architecture%20for%20Graph%20database/build/classes/main/ with scanner SubTypesScanner
22:56:01.506 [main] DEBUG org.reflections.Reflections - could not scan file main/java/com/bag/server/database/OrientDBDatabaseAccess.class in url file:/home/ray/IdeaProjects/BAG%20-%20Byzantine%20fault-tolerant%20Architecture%20for%20Graph%20database/build/classes/main/ with scanner TypeAnnotationsScanner
22:56:01.506 [main] DEBUG org.reflections.Reflections - could not scan file main/java/com/bag/server/database/OrientDBDatabaseAccess.class in url file:/home/ray/IdeaProjects/BAG%20-%20Byzantine%20fault-tolerant%20Architecture%20for%20Graph%20database/build/classes/main/ with scanner SubTypesScanner
22:56:01.508 [main] DEBUG org.reflections.Reflections - could not scan file main/java/com/bag/client/TestClient.class in url file:/home/ray/IdeaProjects/BAG%20-%20Byzantine%20fault-tolerant%20Architecture%20for%20Graph%20database/build/classes/main/ with scanner TypeAnnotationsScanner
22:56:01.508 [main] DEBUG org.reflections.Reflections - could not scan file main/java/com/bag/client/TestClient.class in url file:/home/ray/IdeaProjects/BAG%20-%20Byzantine%20fault-tolerant%20Architecture%20for%20Graph%20database/build/classes/main/ with scanner SubTypesScanner
22:56:01.516 [main] INFO org.reflections.Reflections - Reflections took 22 ms to scan 1 urls, producing 6 keys and 13 values
22:56:01.518 [main] DEBUG c.t.t.c.u.ReflectiveConfigOptionLoader - Preloaded 0 config option(s) via Reflections (0 class(es) with errors)
22:56:01.518 [main] DEBUG c.t.t.d.c.BasicConfiguration - Ignored configuration entry for index.search.DIRECTORY since it does not map to an option
java.lang.IllegalArgumentException: Unknown configuration element in namespace [root.index]: DIRECTORY
at com.google.common.base.Preconditions.checkArgument(Preconditions.java:145) ~[guava-18.0.jar:na]
at com.thinkaurelius.titan.diskstorage.configuration.ConfigElement.parse(ConfigElement.java:181) ~[titan-core-1.0.0.jar:na]
at com.thinkaurelius.titan.diskstorage.configuration.BasicConfiguration.getAll(BasicConfiguration.java:80) ~[titan-core-1.0.0.jar:na]
at com.thinkaurelius.titan.graphdb.configuration.GraphDatabaseConfiguration.<init>(GraphDatabaseConfiguration.java:1327) [titan-core-1.0.0.jar:na]
at com.thinkaurelius.titan.core.TitanFactory.open(TitanFactory.java:94) [titan-core-1.0.0.jar:na]
at com.thinkaurelius.titan.core.TitanFactory.open(TitanFactory.java:84) [titan-core-1.0.0.jar:na]
at com.thinkaurelius.titan.core.TitanFactory$Builder.open(TitanFactory.java:139) [titan-core-1.0.0.jar:na]
at main.java.com.bag.server.database.TitanDatabaseAccess.start(TitanDatabaseAccess.java:56) [main/:na]
at main.java.com.bag.server.TestServer.<init>(TestServer.java:105) [main/:na]
at main.java.com.bag.server.TestServer.main(TestServer.java:428) [main/:na]
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:1.8.0_112]
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[na:1.8.0_112]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:1.8.0_112]
at java.lang.reflect.Method.invoke(Method.java:498) ~[na:1.8.0_112]
at com.intellij.rt.execution.application.AppMain.main(AppMain.java:147) [idea_rt.jar:na]
22:56:01.557 [main] DEBUG c.t.t.d.c.BasicConfiguration - Ignored configuration entry for index.search.DIRECTORY since it does not map to an option
java.lang.IllegalArgumentException: Unknown configuration element in namespace [root.index]: DIRECTORY
at com.google.common.base.Preconditions.checkArgument(Preconditions.java:145) ~[guava-18.0.jar:na]
at com.thinkaurelius.titan.diskstorage.configuration.ConfigElement.parse(ConfigElement.java:181) ~[titan-core-1.0.0.jar:na]
at com.thinkaurelius.titan.diskstorage.configuration.BasicConfiguration.getAll(BasicConfiguration.java:80) ~[titan-core-1.0.0.jar:na]
at com.thinkaurelius.titan.graphdb.configuration.GraphDatabaseConfiguration.<init>(GraphDatabaseConfiguration.java:1383) [titan-core-1.0.0.jar:na]
at com.thinkaurelius.titan.core.TitanFactory.open(TitanFactory.java:94) [titan-core-1.0.0.jar:na]
at com.thinkaurelius.titan.core.TitanFactory.open(TitanFactory.java:84) [titan-core-1.0.0.jar:na]
at com.thinkaurelius.titan.core.TitanFactory$Builder.open(TitanFactory.java:139) [titan-core-1.0.0.jar:na]
at main.java.com.bag.server.database.TitanDatabaseAccess.start(TitanDatabaseAccess.java:56) [main/:na]
at main.java.com.bag.server.TestServer.<init>(TestServer.java:105) [main/:na]
at main.java.com.bag.server.TestServer.main(TestServer.java:428) [main/:na]
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:1.8.0_112]
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[na:1.8.0_112]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:1.8.0_112]
at java.lang.reflect.Method.invoke(Method.java:498) ~[na:1.8.0_112]
at com.intellij.rt.execution.application.AppMain.main(AppMain.java:147) [idea_rt.jar:na]
22:56:01.563 [main] DEBUG c.t.t.d.b.BerkeleyJEStoreManager - Removed database system_properties
22:56:01.613 [main] INFO c.t.t.g.c.GraphDatabaseConfiguration - Generated unique-instance-id=c0a8000d21256-Laptop1
22:56:01.641 [main] INFO c.t.titan.diskstorage.Backend - Configuring index [search]
Exception in thread "main" java.lang.IllegalArgumentException: Could not instantiate implementation: com.thinkaurelius.titan.diskstorage.es.ElasticSearchIndex
at com.thinkaurelius.titan.util.system.ConfigurationUtil.instantiate(ConfigurationUtil.java:55)
at com.thinkaurelius.titan.diskstorage.Backend.getImplementationClass(Backend.java:473)
at com.thinkaurelius.titan.diskstorage.Backend.getIndexes(Backend.java:460)
at com.thinkaurelius.titan.diskstorage.Backend.<init>(Backend.java:147)
at com.thinkaurelius.titan.graphdb.configuration.GraphDatabaseConfiguration.getBackend(GraphDatabaseConfiguration.java:1805)
at com.thinkaurelius.titan.graphdb.database.StandardTitanGraph.<init>(StandardTitanGraph.java:123)
at com.thinkaurelius.titan.core.TitanFactory.open(TitanFactory.java:94)
at com.thinkaurelius.titan.core.TitanFactory.open(TitanFactory.java:84)
at com.thinkaurelius.titan.core.TitanFactory$Builder.open(TitanFactory.java:139)
at main.java.com.bag.server.database.TitanDatabaseAccess.start(TitanDatabaseAccess.java:56)
at main.java.com.bag.server.TestServer.<init>(TestServer.java:105)
at main.java.com.bag.server.TestServer.main(TestServer.java:428)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at com.intellij.rt.execution.application.AppMain.main(AppMain.java:147)
Caused by: java.lang.reflect.InvocationTargetException
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
at com.thinkaurelius.titan.util.system.ConfigurationUtil.instantiate(ConfigurationUtil.java:44)
... 16 more
Caused by: java.lang.NoSuchFieldError: LUCENE_3_6
at org.elasticsearch.Version.<clinit>(Version.java:43)
at com.thinkaurelius.titan.diskstorage.es.ElasticSearchIndex.checkExpectedClientVersion(ElasticSearchIndex.java:1059)
at com.thinkaurelius.titan.diskstorage.es.ElasticSearchIndex.<init>(ElasticSearchIndex.java:186)
... 21 more
My gradle file:
testCompile group: 'junit', name: 'junit', version: '4.11'
compile files('libs/BFT-SMaRt.jar')
compile "org.neo4j:neo4j-enterprise:${neo4jVersion}"
compile group: 'commons-codec', name: 'commons-codec', version: '1.5'
compile group: 'io.netty', name: 'netty-all', version: '4.0.36.Final'
compile group: 'com.thinkaurelius.titan', name: 'titan-all', version: '1.0.0'
compile group: 'com.sparsity', name: 'sparkseejava', version: '5.2.0'
compile group: 'com.orientechnologies', name: 'orientdb-graphdb', version: '2.2.11'
compile group: 'org.jboss.spec.javax.ws.rs', name: 'jboss-jaxrs-api_2.0_spec', version: '1.0.0.Final'
compile group: 'com.esotericsoftware', name: 'kryo', version: '4.0.0'
compile 'com.intellij:annotations:+#jar'
compile group: 'org.apache.tinkerpop', name: 'gremlin-core', version: '3.0.0.M9-incubating'
You should be more specific on your Titan dependencies so you don't pull in unintended artifacts. Instead of using titan-all, try something like this:
compile group: 'com.thinkaurelius.titan', name: 'titan-berkeleyje', version: '1.0.0'
compile group: 'com.thinkaurelius.titan', name: 'titan-es', version: '1.0.0'
You should not need to include gremlin-core explicitly because it is a dependency of titan-core, however if you do add it, it should be aligned with the TinkerPop version that Titan 1.0 uses:
compile group: 'org.apache.tinkerpop', name: 'gremlin-core', version: '3.0.1-incubating'
Updated
Your previous failed attempts have likely created an invalid graph instance stored under DIRECTORY. You must recursively remove DIRECTORY before attempting to create a new graph using the same directory.
Elasticsearch indexing backend does not work with a index.search.DIRECTORY configuration (note the case). This is the relevant part of the stack trace:
Ignored configuration entry for index.search.DIRECTORY since it does not map to an option
java.lang.IllegalArgumentException: Unknown configuration element in namespace [root.index]: DIRECTORY
You can read more about the various Elasticsearch configuration options in Chapter 22 of the Titan documentation.
Instead of Elasticsearch, consider using Lucene. Its configuration looks similar to BerkeleyJE storage, and both are well-suited for a single-machine Titan.
TitanFactory.Builder config = TitanFactory.build();
config.set("storage.backend", "berkeleyje");
config.set("storage.directory", DIRECTORY + File.separator + "berkeleyje");
config.set("index." + INDEX_NAME + ".backend", "lucene");
config.set("index." + INDEX_NAME + ".directory", DIRECTORY + File.separator + "lucene");
graph = config.open();
Also update build.gradle with the dependency for lucene:
compile group: 'com.thinkaurelius.titan', name: 'titan-berkeleyje', version: '1.0.0'
compile group: 'com.thinkaurelius.titan', name: 'titan-lucene', version: '1.0.0'
I'd also recommend trying to build a Titan project without Neo4j, OrientDB, Sparksee, and other non-Titan dependencies first to ensure you have a simple project that works without any dependency conflicts.
You appear to have a classpath issue:
Caused by: java.lang.NoSuchFieldError: LUCENE_3_6 at org.elasticsearch.Version.(Version.java:43)
Titan-es 1.0.0 depends on Elasticsearch 1.5.1 which again depends on Lucene 4.10.4 which has a deprecated field org.apache.lucene.util.Version.LUCENE_3_6. This field was removed in later versions of Lucene. You need to check your classpath and make sure you are pulling in the correct version of Lucene.

Unable to invoke factory method in class class org.apache.logging.log4j.core.layout.JsonLayout for element JsonLayout

I am trying to log in JSON format through log4j2.
This is my log4j2.xml file:
<?xml version="1.0" encoding="UTF-8"?>
<Configuration status="debug" name="MyApp" packages="org.apache.logging.log4j.core.layout.JSONLayout">
<Appenders>
<RollingRandomAccessFile name="RollingRandomAccessFile" fileName="logs/app3.log"
filePattern="logs/$${date:yyyy-MM}/app-%d{MM-dd-yyyy}-%i.log.gz" append="false">
<JsonLayout/>
<Policies>
<TimeBasedTriggeringPolicy />
<SizeBasedTriggeringPolicy size="250 MB"/>
</Policies>
<DefaultRolloverStrategy max="20"/>
</RollingRandomAccessFile>
</Appenders>
<Loggers>
<Root level="trace">
<AppenderRef ref="RollingRandomAccessFile"/>
</Root>
</Loggers>
</Configuration>
These are the dependencies I have used:
<dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-api</artifactId>
<version>2.5</version>
</dependency>
<dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-core</artifactId>
<version>2.5</version>
</dependency>
<dependency>
<groupId>net.logstash.log4j</groupId>
<artifactId>jsonevent-layout</artifactId>
<version>1.7</version>
</dependency><dependency>
<groupId>org.codehaus.jackson</groupId>
<artifactId>jackson-core-asl</artifactId>
<version>1.9.13</version>
</dependency>
When I run the program I get an error as follows:
543 main ERROR Unable to invoke factory method in class class org.apache.logging.log4j.core.layout.JsonLayout for element JsonLayout.
Debug:
2016-05-09 16:06:04,909 main DEBUG Initializing configuration XmlConfiguration[location=/home/mrunal/repo/jigsaw/jigsaw/jigsaw-solution/jigsaw-matchmanager-business/target/classes/log4j2.xml]
2016-05-09 16:06:04,916 main DEBUG Installed script engines
2016-05-09 16:06:05,717 main DEBUG Oracle Nashorn Version: 1.8.0_91, Language: ECMAScript, Threading: Not Thread Safe, Compile: true, Names: {nashorn, Nashorn, js, JS, JavaScript, javascript, ECMAScript, ecmascript}
2016-05-09 16:06:05,823 main DEBUG Took 0.104995 seconds to load 14 plugins from package org.apache.logging.log4j.core.layout
2016-05-09 16:06:05,824 main DEBUG PluginManager 'Core' found 97 plugins
2016-05-09 16:06:05,824 main DEBUG PluginManager 'Level' found 0 plugins
2016-05-09 16:06:05,831 main DEBUG No scheduled items
2016-05-09 16:06:05,835 main DEBUG PluginManager 'Lookup' found 13 plugins
2016-05-09 16:06:05,837 main DEBUG Building Plugin[name=layout, class=org.apache.logging.log4j.core.layout.JsonLayout].
2016-05-09 16:06:05,853 main DEBUG PluginManager 'TypeConverter' found 23 plugins
2016-05-09 16:06:05,863 main DEBUG createLayout(locationInfo="false", properties="false", complete="false", compact="false", eventEol="false", charset="UTF-8")
2016-05-09 16:06:05,864 main ERROR Unable to invoke factory method in class class org.apache.logging.log4j.core.layout.JsonLayout for element JSONLayout.
2016-05-09 16:06:05,865 main DEBUG Building Plugin[name=TimeBasedTriggeringPolicy, class=org.apache.logging.log4j.core.appender.rolling.TimeBasedTriggeringPolicy].
2016-05-09 16:06:05,867 main DEBUG createPolicy(interval="null", modulate="null")
2016-05-09 16:06:05,868 main DEBUG Building Plugin[name=SizeBasedTriggeringPolicy, class=org.apache.logging.log4j.core.appender.rolling.SizeBasedTriggeringPolicy].
2016-05-09 16:06:05,869 main DEBUG createPolicy(size="250 MB")
2016-05-09 16:06:05,872 main DEBUG Building Plugin[name=Policies, class=org.apache.logging.log4j.core.appender.rolling.CompositeTriggeringPolicy].
2016-05-09 16:06:05,882 main DEBUG createPolicy(={TimeBasedTriggeringPolicy(nextRolloverMillis=0, interval=1, modulate=false), SizeBasedTriggeringPolicy(size=262144000)})
2016-05-09 16:06:05,882 main DEBUG Building Plugin[name=DefaultRolloverStrategy, class=org.apache.logging.log4j.core.appender.rolling.DefaultRolloverStrategy].
2016-05-09 16:06:05,887 main DEBUG createStrategy(max="20", min="null", fileIndex="null", compressionLevel="null", ={}, stopCustomActionsOnError="true", Configuration(/home/mrunal/repo/jigsaw/jigsaw/jigsaw-solution/jigsaw-matchmanager-business/target/classes/log4j2.xml))
2016-05-09 16:06:05,888 main DEBUG Building Plugin[name=appender, class=org.apache.logging.log4j.core.appender.RollingRandomAccessFileAppender].
2016-05-09 16:06:05,892 main DEBUG createAppender(fileName="logs/app3.log", filePattern="logs/${date:yyyy-MM}/app-%d{MM-dd-yyyy}-%i.log.gz", append="false", name="RollingRandomAccessFile", immediateFlush="null", bufferSize="null", Policies(CompositeTriggeringPolicy(policies=[TimeBasedTriggeringPolicy(nextRolloverMillis=0, interval=1, modulate=false), SizeBasedTriggeringPolicy(size=262144000)])), DefaultRolloverStrategy(DefaultRolloverStrategy(min=1, max=20)), JSONLayout(null), Filter=null, ignoreExceptions="null", advertise="null", advertiseURI="null", Configuration(/home/mrunal/repo/jigsaw/jigsaw/jigsaw-solution/jigsaw-matchmanager-business/target/classes/log4j2.xml))
2016-05-09 16:06:05,893 main INFO Log4j appears to be running in a Servlet environment, but there's no log4j-web module available. If you want better web container support, please add the log4j-web JAR to your web archive or server lib directory.
2016-05-09 16:06:05,894 main DEBUG PluginManager 'Converter' found 38 plugins
2016-05-09 16:06:05,895 main DEBUG Starting OutputStreamManager SYSTEM_OUT.false-2
2016-05-09 16:06:05,909 main DEBUG Starting RollingRandomAccessFileManager logs/app3.log
2016-05-09 16:06:05,914 main DEBUG PluginManager 'FileConverter' found 2 plugins
2016-05-09 16:06:05,935 main DEBUG Building Plugin[name=appenders, class=org.apache.logging.log4j.core.config.AppendersPlugin].
2016-05-09 16:06:05,936 main DEBUG createAppenders(={RollingRandomAccessFile})
2016-05-09 16:06:05,936 main DEBUG Building Plugin[name=AppenderRef, class=org.apache.logging.log4j.core.config.AppenderRef].
2016-05-09 16:06:05,937 main DEBUG createAppenderRef(ref="RollingRandomAccessFile", level="null", Filter=null)
2016-05-09 16:06:05,937 main DEBUG Building Plugin[name=root, class=org.apache.logging.log4j.core.config.LoggerConfig$RootLogger].
2016-05-09 16:06:05,938 main DEBUG createLogger(additivity="null", level="TRACE", includeLocation="null", ={RollingRandomAccessFile}, ={}, Configuration(/home/mrunal/repo/jigsaw/jigsaw/jigsaw-solution/jigsaw-matchmanager-business/target/classes/log4j2.xml), Filter=null)
2016-05-09 16:06:05,941 main DEBUG Building Plugin[name=loggers, class=org.apache.logging.log4j.core.config.LoggersPlugin].
2016-05-09 16:06:05,943 main DEBUG createLoggers(={root})
2016-05-09 16:06:05,944 main DEBUG Configuration XmlConfiguration[location=/home/mrunal/repo/jigsaw/jigsaw/jigsaw-solution/jigsaw-matchmanager-business/target/classes/log4j2.xml] initialized
2016-05-09 16:06:05,952 main DEBUG Starting configuration XmlConfiguration[location=/home/mrunal/repo/jigsaw/jigsaw/jigsaw-solution/jigsaw-matchmanager-business/target/classes/log4j2.xml]
2016-05-09 16:06:05,952 main DEBUG Started configuration XmlConfiguration[location=/home/mrunal/repo/jigsaw/jigsaw/jigsaw-solution/jigsaw-matchmanager-business/target/classes/log4j2.xml] OK.
2016-05-09 16:06:05,953 main DEBUG Shutting down OutputStreamManager SYSTEM_OUT.false-1
2016-05-09 16:06:05,953 main DEBUG Stopped org.apache.logging.log4j.core.config.DefaultConfiguration#7de26db8 OK
2016-05-09 16:06:06,027 main DEBUG Registering MBean org.apache.logging.log4j2:type=1a6c5a9e
2016-05-09 16:06:06,030 main DEBUG Registering MBean org.apache.logging.log4j2:type=1a6c5a9e,component=StatusLogger
2016-05-09 16:06:06,032 main DEBUG Registering MBean org.apache.logging.log4j2:type=1a6c5a9e,component=ContextSelector
2016-05-09 16:06:06,034 main DEBUG Registering MBean org.apache.logging.log4j2:type=1a6c5a9e,component=Loggers,name=
2016-05-09 16:06:06,036 main DEBUG Registering MBean org.apache.logging.log4j2:type=1a6c5a9e,component=Appenders,name=RollingRandomAccessFile
2016-05-09 16:06:06,041 main DEBUG Reconfiguration complete for context[name=1a6c5a9e] at URI /home/mrunal/repo/jigsaw/jigsaw/jigsaw-solution/jigsaw-matchmanager-business/target/classes/log4j2.xml (org.apache.logging.log4j.core.LoggerContext#732c2a62) with optional ClassLoader: null
2016-05-09 16:06:06,041 main DEBUG Shutdown hook enabled. Registering a new one.
16-05-09 16:06:06,043 main DEBUG LoggerContext[name=1a6c5a9e, org.apache.logging.log4j.core.LoggerContext#732c2a62] started OK.
Is there a dependency I am missing out or this some other problem? Please suggest possible things I can try for solving this problem. If you know a better solution to write logs in Logstash Json format you may suggest.
I suspect you are missing one of the Jackson dependencies.
You have jackson-core-asl, I think you need these three:
com.fasterxml.jackson.core:jackson-core:jar:2.6.3
com.fasterxml.jackson.core:jackson-databind:jar:2.6.3
com.fasterxml.jackson.core:jackson-annotations:jar:2.6.0
The ultimate source of truth for dependencies is the dependency tree of the Log4j 2 implementation module.
You may be able to get more details on the problem by setting <Configuration status="debug" ... in your configuration.

log4j2 LoggerContext not showing up in JMX Gui or JConsole

My Google foo is letting me down today! I am trying to configure log4j2 so that I can access the loggers via JMX and change their log levels.
However, when I hook everything up, none of the loggers show up in the JMX tree (or log4j-jmx-gui) as shown in the log4j2 JMX docs. Only the log4j2 ContextSelector and StatusLogger in the JConsole attribute tree and the StatusLogger tab in the log4j-jmx-gui (stand-alone or as a plugin) show up. No LoggerContext elements.
I've googled and not come up with anything! That probably means I'm missing something somewhere. Any help would be greatly appreciated by me and wall which I'm banging my head against :)
I'm using Log4j2 beta9 with Java 1.6.0_45-b06 on win7. I have tried it on Java 7 and it results in the same behaviour.
The log4j2 dependencies being used:
log4j-api-2.0-beta9.jar
log4j-core-2.0-beta9.jar
My log4j2.xml:
<?xml version="1.0" encoding="UTF-8" ?>
<Configuration status="debug">
<Appenders>
<Console name="log-test" target="SYSTEM_OUT">
<PatternLayout pattern="%d{DATE} %-5p LJX2 %c{1}: %m%n" />
</Console>
</Appenders>
<Loggers>
<Logger name="top.Log4J2TestApp" level="debug" additivity="false">
<AppenderRef ref="log-test" />
</Logger>
<Root level="trace">
<AppenderRef ref="log-test" />
</Root>
</Loggers>
</Configuration>
My test program:
package top;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
public class Log4J2TestApp {
public static void main(String[] args) {
System.out.println("******** Started ZZZ ****************");
Logger log = LogManager.getLogger(Log4J2TestApp.class);
int cnt = 0;
while (true) {
log.warn("=========== Test message: {} ================", cnt++);
Thread.sleep(1000);
}
}
}
The output of the test program looks like this:
******** Started ZZZ ****************
2013-11-06 15:07:29,720 DEBUG Generated plugins in 0.000020959 seconds
2013-11-06 15:07:29,733 DEBUG Calling createLayout on class org.apache.logging.log4j.core.layout.PatternLayout for element PatternLayout with params(pattern="%d{DATE} %-5p LJX2 %c{1}: %m%n", Configuration(log4j2.xml), null, charset="null",alwaysWriteExceptions="null")
2013-11-06 15:07:29,735 DEBUG Generated plugins in 0.000013687 seconds
2013-11-06 15:07:29,737 DEBUG Calling createAppender on class org.apache.logging.log4j.core.appender.ConsoleAppender for element Console with params(PatternLayout(%d{DATE} %-5p LJX2 %c{1}: %m%n), null, target="SYSTEM_OUT", name="log-test",follow="null", ignoreExceptions="null")
2013-11-06 15:07:29,739 DEBUG Jansi is not installed, cannot find org.fusesource.jansi.WindowsAnsiOutputStream2013-11-06 15:07:29,740 DEBUG Calling createAppenders on class org.apache.logging.log4j.core.config.plugins.AppendersPlugin for element Appenders with params(Appenders={log-test})
2013-11-06 15:07:29,742 DEBUG Generated plugins in 0.000012832 seconds
2013-11-06 15:07:29,743 DEBUG Calling createAppenderRef on class org.apache.logging.log4j.core.config.AppenderRef for element AppenderRef with params(ref="log-test", level="null", null)
2013-11-06 15:07:29,746 DEBUG Calling createLogger on class org.apache.logging.log4j.core.config.LoggerConfig for element Logger with params(additivity="false", level="debug", name="top.Log4J2TestApp", includeLocation="null", AppenderRef={log-test}, Properties={}, Configuration(log4j2.xml), null)
2013-11-06 15:07:29,749 DEBUG Calling createAppenderRef on class org.apache.logging.log4j.core.config.AppenderRef for element AppenderRef with params(ref="log-test", level="null", null)
2013-11-06 15:07:29,751 DEBUG Calling createLogger on class org.apache.logging.log4j.core.config.LoggerConfig$RootLogger for element Root with params(additivity="null", level="trace", includeLocation="null", AppenderRef={log-test}, Properties={}, Configuration(log4j2.xml), null)
2013-11-06 15:07:29,754 DEBUG Calling createLoggers on class org.apache.logging.log4j.core.config.plugins.LoggersPluginfor element Loggers with params(Loggers={top.Log4J2TestApp, root})
2013-11-06 15:07:29,755 DEBUG Reconfiguration completed
06 Nov 2013 15:07:29,763 WARN LJX2 Log4J2TestApp: =========== Test message: 0 ================
....
06 Nov 2013 15:07:36,766 WARN LJX2 Log4J2TestApp: =========== Test message: 7 ================
2013-11-06 15:07:51,450 DEBUG ServletContext not present - WebLookup not added
2013-11-06 15:07:51,451 DEBUG Shutting down OutputStreamManager SYSTEM_OUT
The StatusLogger tab in the log4j-jmx-gui does have one exception but it would seem to have nothing to do with the loggers.
2013-11-06 15:41:01,403 WARN Multiple logging implementations found:
Factory: org.apache.logging.log4j.core.impl.Log4jContextFactory, Weighting: 10
Using factory: org.apache.logging.log4j.core.impl.Log4jContextFactory
2013-11-06 15:41:01,505 WARN JmDNS or serviceInfo class not found java.lang.ClassNotFoundException: javax.jmdns.JmDNS
at java.net.URLClassLoader$1.run(URLClassLoader.java:202)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
at java.lang.ClassLoader.loadClass(ClassLoader.java:247)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:171)
at org.apache.logging.log4j.core.net.MulticastDNSAdvertiser.initializeJMDNS(MulticastDNSAdvertiser.java:228)
at org.apache.logging.log4j.core.net.MulticastDNSAdvertiser.<clinit>(MulticastDNSAdvertiser.java:41)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:171)
at org.apache.logging.log4j.core.config.plugins.PluginManager.decode(PluginManager.java:241)
at org.apache.logging.log4j.core.config.plugins.PluginManager.collectPlugins(PluginManager.java:152)
at org.apache.logging.log4j.core.config.plugins.PluginManager.collectPlugins(PluginManager.java:130)
at org.apache.logging.log4j.core.pattern.PatternParser.<init>(PatternParser.java:116)
at org.apache.logging.log4j.core.pattern.PatternParser.<init>(PatternParser.java:102)
at org.apache.logging.log4j.core.layout.PatternLayout.createPatternParser(PatternLayout.java:183)
at org.apache.logging.log4j.core.layout.PatternLayout.<init>(PatternLayout.java:115)
at org.apache.logging.log4j.core.layout.PatternLayout.createLayout(PatternLayout.java:219)
at org.apache.logging.log4j.core.config.DefaultConfiguration.<init>(DefaultConfiguration.java:51)
at org.apache.logging.log4j.core.LoggerContext.<init>(LoggerContext.java:63)
at org.apache.logging.log4j.core.selector.ClassLoaderContextSelector.locateContext(ClassLoaderContextSelector.java:217)
at org.apache.logging.log4j.core.selector.ClassLoaderContextSelector.getContext(ClassLoaderContextSelector.java:114)
at org.apache.logging.log4j.core.selector.ClassLoaderContextSelector.getContext(ClassLoaderContextSelector.java:81)
at org.apache.logging.log4j.core.impl.Log4jContextFactory.getContext(Log4jContextFactory.java:83)
at org.apache.logging.log4j.core.impl.Log4jContextFactory.getContext(Log4jContextFactory.java:34)
at org.apache.logging.log4j.LogManager.getLogger(LogManager.java:387)
at org.apache.logging.log4j.LogManager.getLogger(LogManager.java:332)
at top.Log4J2TestApp.main(Log4J2TestApp.java:10)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.eclipse.jdt.internal.jarinjarloader.JarRsrcLoader.main(JarRsrcLoader.java:58)
2013-11-06 15:41:01,612 DEBUG Generated plugins in 0.000017537 seconds
2013-11-06 15:41:01,625 DEBUG Calling createLayout on class org.apache.logging.log4j.core.layout.PatternLayout for element PatternLayout with params(pattern="%d{DATE} %-5p LJX2 %c{1}: %m%n", Configuration(log4j2.xml), null, charset="null", alwaysWriteExceptions="null")
2013-11-06 15:41:01,627 DEBUG Generated plugins in 0.000011977 seconds
2013-11-06 15:41:01,629 DEBUG Calling createAppender on class org.apache.logging.log4j.core.appender.ConsoleAppender for element Console with params(PatternLayout(%d{DATE} %-5p LJX2 %c{1}: %m%n), null, target="SYSTEM_OUT", name="log-test", follow="null", ignoreExceptions="null")
2013-11-06 15:41:01,631 DEBUG Jansi is not installed, cannot find org.fusesource.jansi.WindowsAnsiOutputStream
2013-11-06 15:41:01,632 DEBUG Calling createAppenders on class org.apache.logging.log4j.core.config.plugins.AppendersPlugin for element Appenders with params(Appenders={log-test})
2013-11-06 15:41:01,633 DEBUG Generated plugins in 0.000011977 seconds
2013-11-06 15:41:01,635 DEBUG Calling createAppenderRef on class org.apache.logging.log4j.core.config.AppenderRef for element AppenderRef with params(ref="log-test", level="null", null)
2013-11-06 15:41:01,637 DEBUG Calling createLogger on class org.apache.logging.log4j.core.config.LoggerConfig for element Logger with params(additivity="false", level="debug", name="top.Log4J2TestApp", includeLocation="null", AppenderRef={log-test}, Properties={}, Configuration(log4j2.xml), null)
2013-11-06 15:41:01,640 DEBUG Calling createAppenderRef on class org.apache.logging.log4j.core.config.AppenderRef for element AppenderRef with params(ref="log-test", level="null", null)
2013-11-06 15:41:01,642 DEBUG Calling createLogger on class org.apache.logging.log4j.core.config.LoggerConfig$RootLogger for element Root with params(additivity="null", level="trace", includeLocation="null", AppenderRef={log-test}, Properties={}, Configuration(log4j2.xml), null)
2013-11-06 15:41:01,644 DEBUG Calling createLoggers on class org.apache.logging.log4j.core.config.plugins.LoggersPlugin for element Loggers with params(Loggers={top.Log4J2TestApp, root})
2013-11-06 15:41:01,646 DEBUG Reconfiguration completed
Your config looks good, the only thing a bit suspicious is the error. The error does seem to occur in the LoggerContext constructor, so it may be related after all.
You may have found a bug. Would you mind reporting this issue in the log4j2 issue tracker so the log4j team can look at it?
Log4j2 uses ClassLoaderContextSelector as ContextSelector by default. In some cases (it is not clear for me, may be for simple applications like yours) it returns nothing as getLoggerContexts() method call result. No logger contexts - nothing no show, so LoggerContext category doesn't present in the tree. It can be fixed by selecting another ContextSelector implementation. I used org.apache.logging.log4j.core.selector.BasicContextSelector for this purpose. It can be set using system property named "Log4jContextSelector". See docs for more info.
It solves my problem, I hope it helps to solve yours too.

Categories

Resources