java - Log4j nosql appender Failed to authenticate against MongoDB server -
i'm trying use apache log4j nosql appender. i've configured connect mongodb instance, seem getting authentication error when running project maven install:
error failed authenticate against mongodb server. unknown error.
i using mongodb 3.0.4 , have created following user with:
use test db.createuser({ user:"loguser", pwd:"pwd", roles:["readwrite","dbadmin"] })
and checked can connect using:
mongo -u loguser -p pwd
my log4j2.xml:
<?xml version="1.0" encoding="utf-8"?> <configuration status="debug"> <appenders> <nosql name="databaseappender"> <mongodb databasename="test" collectionname="logging" server = "localhost" port="27017" username = "loguser" password = "pwd"/> </nosql> </appenders> <loggers> <root level="debug"> <appenderref ref="databaseappender"/> </root> </loggers> </configuration>
following pom.xml configuration changes:
<dependencymanagement> <dependencies> <dependency> <groupid>org.mongodb</groupid> <artifactid>mongo-java-driver</artifactid> <version>2.12.3</version> </dependency> </dependencies> </dependencymanagement> <dependencies> <dependency> <groupid>org.mongodb</groupid> <artifactid>mongo-java-driver</artifactid> </dependency> <dependency> <groupid>org.apache.logging.log4j</groupid> <artifactid>log4j-api</artifactid> <version>2.3</version> </dependency> <dependency> <groupid>org.apache.logging.log4j</groupid> <artifactid>log4j-core</artifactid> <version>2.3</version> </dependency> <dependency> <groupid>org.apache.logging.log4j</groupid> <artifactid>log4j-nosql</artifactid> <version>2.3</version> </dependency> </dependencies>
Comments
Post a Comment