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
{{ message }}
Repository navigation
NullPointerException using logger org.slf4j:slf4j-log4j12:jar:1.7.21 with testcontainers #375
From testcontainers documentation: Testcontainers, and many of the libraries it uses, utilize slf4j for logging. In order to see logs from Testcontainers, your project should include an SLF4J implementation (Logback is recommended).
I expect testcontainers to support org.slf4j.slf4j-log4j12
The next NullPointerException appears:
Caused by: java.lang.NullPointerException
at java.util.Hashtable.put(Hashtable.java:459)
at org.apache.log4j.MDC.put0(MDC.java:150)
at org.apache.log4j.MDC.put(MDC.java:85)
at org.slf4j.impl.Log4jMDCAdapter.put(Log4jMDCAdapter.java:60)
at org.slf4j.MDC.put(MDC.java:116)
at org.testcontainers.utility.AuditLogger.doLog(AuditLogger.java:34)
at org.testcontainers.dockerclient.AuditLoggingDockerClient.lambda$startContainerCmd$3(AuditLoggingDockerClient.java:43)
at org.testcontainers.dockerclient.AuditLoggingDockerClient.lambda$wrappedCommand$14(AuditLoggingDockerClient.java:102)
at com.sun.proxy.$Proxy20.exec(Unknown Source)
at org.testcontainers.containers.GenericContainer.tryStart(GenericContainer.java:201)
... 18 more
AuditLoggingDockerClient (for commands START,REMOVE,STOP,KILL,CREATE_NETWORK,REMOVE_NETWORK) has call like this:
So image = null.
org.slf4j.impl.Log4jMDCAdapter uses Hashtable where therev is a check for value != null during call 'put'. So NullPointerException occurs.
Possible fix is to use image="" instead of image=null
Hi, I am also facing the same issue. Can you please tell what's the resolution. What's is meant by 1.3.1 in above comment.
I am having my app deployed over tomcat 8.0.42 version.Please help.
Activity
bsideup commentedon Jun 19, 2017
Hi @IrishkA13,
Thanks for reporting!
The issue is known and already has a PR with a fix:
#370
bsideup commentedon Jun 23, 2017
Closed with #370
@IrishkA13
May I ask you to try 1.3.1 to verify that the issue is gone? Thanks!
islisava commentedon Jul 17, 2017
@bsideup
Thanks for fix! This works now!
balonideepak commentedon Aug 23, 2018
Hi, I am also facing the same issue. Can you please tell what's the resolution. What's is meant by 1.3.1 in above comment.
I am having my app deployed over tomcat 8.0.42 version.Please help.
islisava commentedon Aug 24, 2018
1.3.1 is milestone - https://github.com/testcontainers/testcontainers-java/milestone/25
It is the version of the library of testcontainers. All upper versions should also contain the fix.
Check that you use version of testcontainers is 1.3.1 or higher.