0

I am getting the following exception at runtime using the latest Deeplearning4j release. The exception cause is listed below. I do not get the full trace so not sure which class it is not finding. I am not sure where the log can be found for that exception in hopes of seeing the full trace. It is not in my app server log. I am running using Java 1.8 using the Wildfly app server on Windows 10 prof.

Thanks for any help. -Tony

Caused by: java.lang.NoClassDefFoundError: Could not initialize class org.nd4j.linalg.factory.Nd4j at org.deeplearning4j.util.ModelSerializer.restoreMultiLayerNetworkHelper(ModelSerializer.java:283) at org.deeplearning4j.util.ModelSerializer.restoreMultiLayerNetwork(ModelSerializer.java:238) at org.deeplearning4j.util.ModelSerializer.restoreMultiLayerNetwork(ModelSerializer.java:222) at org.deeplearning4j.util.ModelSerializer.restoreMultiLayerNetwork(ModelSerializer.java:380) at com.myuniportal.service.MyUniPortalMapMobileAIResource.(Unknown Source) at com.myuniportal.service.MapAIApplication.(Unknown Source) at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source) at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source) at java.lang.reflect.Constructor.newInstance(Unknown Source) at org.jboss.resteasy.core.ConstructorInjectorImpl.construct(ConstructorInjectorImpl.java:150) ... 36 more

Tony Anecito
  • 347
  • 2
  • 13

3 Answers3

0

I fixed this by copying dlls from jars to a folder pointed to in the path. I hope this answer helps others. -Tony

Tony Anecito
  • 347
  • 2
  • 13
  • I eventually added the windows-x86_64 jars and removed the platform jars since they only had poms in them and did not need to copy any dlls except for the ones needed from the CUDA development kit from Nvidia. – Tony Anecito Oct 30 '20 at 19:00
  • There are a few other options other than manually managing the artifacts: https://github.com/bytedeco/javacpp-presets/wiki/Reducing-the-Number-of-Dependencies – Samuel Audet Nov 02 '20 at 00:54
  • Thanks Samuel. I will look into that. – Tony Anecito Nov 03 '20 at 06:58
0

Deeplearning4j maintainer here. You should never need to do this and I hope folks don't actually do this in the future. Javacpp (underlying component for native components) manages all of this in a .javcpp folder and already handles this.

If you have to do something more than add the dependency to your pom.xml/gradle file, you likely did something wrong.

The jars already contain the dlls and load them automatically.

Adam Gibson
  • 3,055
  • 1
  • 10
  • 12
0

I solved the problem (with out unjaring dlls) and was able to get a program running in eclipse. I am working on getting a servlet to run right now

Again, many thanks.

Tony Anecito
  • 347
  • 2
  • 13