Maven:NDJ4 有后端,错误说没有

Maven: NDJ4 Has Backend, Error Says It Doesn't

感谢您今天抽出时间。

我收到缺少记录器后端的错误,但我安装了 log4j。我在下面列出了相关的错误和 pom 依赖项:

pom.xml 段:

<!-- https://mvnrepository.com/artifact/log4j/log4j -->
<dependency>
    <groupId>log4j</groupId>
    <artifactId>log4j</artifactId>
    <version>1.2.17</version>
</dependency>

<!-- https://mvnrepository.com/artifact/org.nd4j/nd4j-api -->
<dependency>
    <groupId>org.nd4j</groupId>
    <artifactId>nd4j-api</artifactId>
    <version>1.0.0-M1.1</version>
</dependency>

<!-- https://mvnrepository.com/artifact/org.slf4j/slf4j-api -->
<dependency>
    <groupId>org.slf4j</groupId>
    <artifactId>slf4j-api</artifactId>
    <version>1.7.32</version>
</dependency>

<!-- https://mvnrepository.com/artifact/org.slf4j/slf4j-log4j12 -->
<dependency>
    <groupId>org.slf4j</groupId>
    <artifactId>slf4j-log4j12</artifactId>
    <version>1.7.32</version>
    <scope>test</scope>
</dependency>

错误 #1

SLF4J: No SLF4J providers were found.
SLF4J: Defaulting to no-operation (NOP) logger implementation
SLF4J: See http://www.slf4j.org/codes.html#noProviders for further details.

错误 #2

Exception in thread "main" java.lang.ExceptionInInitializerError
    at com.jmetal.com.jmetal.maven.eclipse.Test.gblup(Test.java:70)
    at com.jmetal.com.jmetal.maven.eclipse.Test.main(Test.java:64)
Caused by: java.lang.RuntimeException: org.nd4j.linalg.factory.Nd4jBackend$NoAvailableBackendException: Please ensure that you have an nd4j backend on your classpath. Please see: https://deeplearning4j.konduit.ai/nd4j/backend
    at org.nd4j.linalg.factory.Nd4j.initContext(Nd4j.java:5095)
    at org.nd4j.linalg.factory.Nd4j.<clinit>(Nd4j.java:270)
    ... 2 more
Caused by: org.nd4j.linalg.factory.Nd4jBackend$NoAvailableBackendException: Please ensure that you have an nd4j backend on your classpath. Please see: https://deeplearning4j.konduit.ai/nd4j/backend
    at org.nd4j.linalg.factory.Nd4jBackend.load(Nd4jBackend.java:196)
    at org.nd4j.linalg.factory.Nd4j.initContext(Nd4j.java:5092)
    ... 3 more

好吧,我不知道如何让 log4j 发挥作用。我尝试了评论中的建议,例如包括 slf4j-log4j12nd4j-x86.

有时解决问题的最佳方法是将其移除:我不再尝试让 log4j 正常运行,而是选择了 nd4j-native