deeplearning4j / deeplearning4j/deeplearning4j

Trying to use deeplearning4j in Web App (.war) with WildFly (JBoss) - RuntimeException

Open
#10,210 2 comments 0 reactions 0 assignees View on GitHub
Dominant language
Java
Stars
14.3k
Forks
3.8k
PR merge metrics
No merged PRs in 30d

Description

hello there,

I'll been trying to create a simple vanilla deeplearning4j application using Wildfly 29 in both Windows and Linux (Docker container) but I'm getting the same error:
```
2025-04-30 17:31:28,633 ERROR [stderr] (default task-1) Caused by: java.lang.RuntimeException: java.lang.NullPointerException: Cannot invoke "org.bytedeco.javacpp.indexer.Raw.putLong(long, long)" because "org.bytedeco.javacpp.indexer.LongRawIndexer.RAW" is null
2025-04-30 17:31:28,633 ERROR [stderr] (default task-1) at deployment.sa-deeplearning-1.0.0-M2.1.war//org.nd4j.linalg.api.buffer.BaseDataBuffer.readContent(BaseDataBuffer.java:1678)
2025-04-30 17:31:28,633 ERROR [stderr] (default task-1) at deployment.sa-deeplearning-1.0.0-M2.1.war//org.nd4j.linalg.api.buffer.BaseDataBuffer.read(BaseDataBuffer.java:1572)
2025-04-30 17:31:28,633 ERROR [stderr] (default task-1) ... 55 more
2025-04-30 17:31:28,633 ERROR [stderr] (default task-1) Caused by: java.lang.NullPointerException: Cannot invoke "org.bytedeco.javacpp.indexer.Raw.putLong(long, long)" because "org.bytedeco.javacpp.indexer.LongRawIndexer.RAW" is null
2025-04-30 17:31:28,633 ERROR [stderr] (default task-1) at deployment.sa-deeplearning-1.0.0-M2.1.war//org.bytedeco.javacpp.indexer.LongRawIndexer.putRaw(LongRawIndexer.java:107)
2025-04-30 17:31:28,633 ERROR [stderr] (default task-1) at deployment.sa-deeplearning-1.0.0-M2.1.war//org.bytedeco.javacpp.indexer.LongRawIndexer.put(LongRawIndexer.java:111)
2025-04-30 17:31:28,633 ERROR [stderr] (default task-1) at deployment.sa-deeplearning-1.0.0-M2.1.war//org.nd4j.linalg.api.buffer.BaseDataBuffer.put(BaseDataBuffer.java:1268)
2025-04-30 17:31:28,633 ERROR [stderr] (default task-1) at deployment.sa-deeplearning-1.0.0-M2.1.war//org.nd4j.linalg.api.buffer.BaseDataBuffer.putByDestinationType(BaseDataBuffer.java:1035)
2025-04-30 17:31:28,633 ERROR [stderr] (default task-1) at deployment.sa-deeplearning-1.0.0-M2.1.war//org.nd4j.linalg.api.buffer.BaseDataBuffer.readContent(BaseDataBuffer.java:1630)
2025-04-30 17:31:28,633 ERROR [stderr] (default task-1) ... 56 more
```

I tried with all the tricks I could find in the web from adding the platform attribute during maven building:
```
mvn -Djavacpp.platform=windows-x86_64 clean install
```

To create an uber Jar file in both Windows and Linux but I'm still getting the same error, sometimes I get the ND4J backend error but that's fixed by adding the proper dependency:

```

org.nd4j
nd4j-native
${dl4j-master.version}

```

When I execute the test directly with Java everything works perfect on both my local Windows machine and in Docker terminal, the example is able to create the model, fit the training data and store the model + normalizer, but when I try to ether train the new model or load the saved model in WildFly I'm always getting this error, please help 🤕

[pom.xml.txt](https://github.com/user-attachments/files/19985777/pom.xml.txt)

[server.log.txt](https://github.com/user-attachments/files/19985781/server.log.txt)

[PredictServlet.java.txt](https://github.com/user-attachments/files/19985790/PredictServlet.java.txt)

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.