Getting Deeplearning4j exception - nd4j

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

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

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.

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.

Related

Issue with using mockito with mock-maker-inline in Spring boot application

I have a Spring web application that can operate in “special” mode where mockito is used to spy on certain objects. Some of those objects are final (protobuf messages). I know, this may smell like a bad idea but lets say it’s an experiment. When enabling mock-maker-inline extension so final objects can be spied on I’m running into issues that seem to be related to byte buddy and loading some native libraries. When not using extension (and not spying on final classes) everything works as expected. Below is truncated stack trace.
java.lang.IllegalStateException: Could not initialize plugin: interface org.mockito.plugins.MockMaker (alternate: null)
…
Caused by: java.lang.IllegalStateException: Failed to load interface org.mockito.plugins.MockMaker implementation declared in sun.misc.CompoundEnumeration#60cc2b75
…
Caused by: java.lang.reflect.InvocationTargetException
…
Caused by: org.mockito.exceptions.base.MockitoInitializationException:
Could not initialize inline Byte Buddy mock maker.
It appears as if your JDK does not supply a working agent attachment mechanism.
Java : 1.8
JVM vendor name : AdoptOpenJDK
JVM vendor version : 25.265-b01
JVM name : OpenJDK 64-Bit Server VM
JVM version : 1.8.0_265-b01
JVM info : mixed mode
OS name : Mac OS X
OS version : 10.15.7
…
Caused by: java.lang.IllegalStateException: Error during attachment using: net.bytebuddy.agent.ByteBuddyAgent$AttachmentProvider$Compound#633c165e
…
Caused by: java.lang.reflect.InvocationTargetException
…
Caused by: java.lang.UnsatisfiedLinkError: Native Library /Users/…/.sdkman/candidates/java/8.0.265.hs-adpt/jre/lib/libattach.dylib already loaded in another classloader
This is an unfortunate limitation of JVMs that is solved in Java 9+. In Java 8-, the attachment library can only be bound by a single class loader. It seems as if Byte Buddy and another library attemts a self-attach (maybe EhCache) and bind the virtual machine API.
Can you identify what other library is self-attaching and possibly prevent this?
In my case the project contained an older version of JMockit 'org.jmockit:jmockit:1.24' which was clashing with mockit-inline. Removing JMockit entirely or upgrading it to 1.49 resolves the problem
https://github.com/mockito/mockito/issues/1879#issuecomment-783326979

Caused by: java.lang.NoSuchMethodException: org.apache.myfaces.custom.aliasbean.AliasBeanTagHandler.<init>(javax.faces.view.facelets.ComponentConfig)

I have recently upgraded my project to richfaces 4 from richfaces3 and also JSF 1 is been upgraded to JSF 2. I find no issues during the build and build is successful. But when I am trying to deploy application using JBOSS 6 I get below error:
Caused by: java.lang.NoSuchMethodException: org.apache.myfaces.custom.aliasbean.AliasBeanTagHandler.<init>(javax.faces.view.facelets.ComponentConfig)
at java.lang.Class.getConstructor0(Class.java:2892) [:1.7.0_72]
at java.lang.Class.getConstructor(Class.java:1723) [:1.7.0_72]
at com.sun.faces.facelets.tag.AbstractTagLibrary$UserComponentHandlerFactory.<init>(AbstractTagLibrary.java:290) [:2.0.3-]
... 93 more
I have tried a lots of things but nothing worked. Any kinda help would be much appreciated. Thanks a lot in advance

java.io.NotSerializableException in OutputPanel - Primefaces

I'm using Glashfish 3 & Primefaces 3.5
Small update
I tried the following but without any luck.
Cleaned my application.
Re-Built the project.
Undeployed the app from Glassfish admin console.
Restarted Glassfish server.
Deployed again from JDeveloper.
While accessing my jsf page I'm getting the below exception in the browser.
java.io.NotSerializableException: org.primefaces.component.outputpanel.OutputPanel
And in my log:
WARNING|glassfish3.1.2|javax.enterprise.system.container.web.com.sun.enterprise.web|_ThreadID=24;_ThreadName=Thread-2;|StandardWrapperValve[Faces Servlet]: PWC1406: Servlet.service() for servlet Faces Servlet threw exception
java.io.NotSerializableException: org.primefaces.component.outputpanel.OutputPanel
at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1164)
at java.io.ObjectOutputStream.defaultWriteFields(ObjectOutputStream.java:1518)
at java.io.ObjectOutputStream.writeSerialData(ObjectOutputStream.java:1483)
at java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:1400)
at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1158)
at java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:330)
at java.util.HashMap.writeObject(HashMap.java:1001)
at sun.reflect.GeneratedMethodAccessor69.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at java.io.ObjectStreamClass.invokeWriteObject(ObjectStreamClass.java:940)
at java.io.ObjectOutputStream.writeSerialData(ObjectOutputStream.java:1469)
at java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:1400)
at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1158)
at java.io.ObjectOutputStream.defaultWriteFields(ObjectOutputStream.java:1518)
at java.io.ObjectOutputStream.writeSerialData(ObjectOutputStream.java:1483)...
What may be wrong here.? It was working fine just the day before, and I've done no changes (to the application or server) whatsoever.
Update
Issue got resolved. There was an issue with my jsf file which somehow got corrupted. Thankfully I had a backup of it.
Thanks all for you support and suggestion.

NoClassDefFoundError ActionBarSherlock

I'm getting reports of my new app crashing from some users.
java.lang.NoClassDefFoundError: com.actionbarsherlock.R$layout
at com.actionbarsherlock.internal.ActionBarSherlockCompat.generateLayout(ActionBarSherlockCompat.java:1039)
at com.actionbarsherlock.internal.ActionBarSherlockCompat.installDecor(ActionBarSherlockCompat.java:919)
at com.actionbarsherlock.internal.ActionBarSherlockCompat.setContentView(ActionBarSherlockCompat.java:853)
at com.actionbarsherlock.app.SherlockActivity.setContentView(SherlockActivity.java:218)
at com.androidProjects.personal.GAAClubFinderActivity.onCreate(GAAClubFinderActivity.java:58)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1069)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2751)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2803)
at android.app.ActivityThread.access$2300(ActivityThread.java:135)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2136)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:144)
at android.app.ActivityThread.main(ActivityThread.java:4937)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:521)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:858)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616)
at dalvik.system.NativeStart.main(Native Method)
I have no idea what could be causing this because the same version is working fine on my own phone using Android 4.0.4.
Is there some issues with ABS and older version of the Android OS?
I have decalred my min and target versions as follows:
<uses-sdk android:targetSdkVersion="15" android:minSdkVersion="7"/>
Any help would be greatly appreciated.
ActionBar does not exist for old Android SDK versions. See here: http://developer.android.com/guide/topics/ui/actionbar.html
Therefore you can't run your app in the Android lover then 3.0 when you use ActionBar.
MinSdk version doesn't check usages in the compile time because you can programmatically create if/switch and call different code for different platforms.

hudson codenarc issue

I am developing a grails application which has codenarc plugin. And also I am using hudson build tool. I am integrating the application with hudson build tool. In the hudson I have configured violation plugin. But when I build the app I am getting following error.
hudson.util.IOException2: Cannot parse CodeNarcReport.xml
at hudson.plugins.violations.parse.AbstractTypeParser.parse(AbstractTypeParser.java:64)
at hudson.plugins.violations.ViolationsCollector.doType(ViolationsCollector.java:189)
at hudson.plugins.violations.ViolationsCollector.invoke(ViolationsCollector.java:116)
at hudson.plugins.violations.ViolationsCollector.invoke(ViolationsCollector.java:27)
at hudson.FilePath.act(FilePath.java:757)
at hudson.FilePath.act(FilePath.java:739)
at hudson.plugins.violations.ViolationsPublisher.perform(ViolationsPublisher.java:74)
at hudson.tasks.BuildStepMonitor$3.perform(BuildStepMonitor.java:36)
at hudson.model.AbstractBuild$AbstractRunner.perform(AbstractBuild.java:622)
at hudson.model.AbstractBuild$AbstractRunner.performAllBuildSteps(AbstractBuild.java:601)
at hudson.model.AbstractBuild$AbstractRunner.performAllBuildSteps(AbstractBuild.java:579)
at hudson.model.Build$RunnerImpl.post2(Build.java:156)
at hudson.model.AbstractBuild$AbstractRunner.post(AbstractBuild.java:548)
at hudson.model.Run.run(Run.java:1386)
at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:46)
at hudson.model.ResourceController.execute(ResourceController.java:88)
at hudson.model.Executor.run(Executor.java:145)
Caused by: java.lang.NullPointerException
at hudson.plugins.violations.model.Violation.compareTo(Violation.java:192)
at hudson.plugins.violations.model.Violation.compareTo(Violation.java:8)
at java.util.TreeMap.put(Unknown Source)
at java.util.TreeSet.add(Unknown Source)
at hudson.plugins.violations.model.FullFileModel.addViolation(FullFileModel.java:24)
at hudson.plugins.violations.types.codenarc.CodenarcParser.parseFileElement(CodenarcParser.java:90)
at hudson.plugins.violations.types.codenarc.CodenarcParser.execute(CodenarcParser.java:47)
at hudson.plugins.violations.parse.AbstractTypeParser.parse(AbstractTypeParser.java:59)
... 16 more
Can anyone please help me to fix this issue?
Grails version : 1.3.7
Hudson version : 1.398
By updating violation plugin to 0.7.8 snapshot version fixed the issue. Download link
I recommend asking CodeNarc questions on the CodeNarc mailing list.
Also, be aware the the Hudson/Jenkins plugin usually has an older version of CodeNarc bundled with it. It's not maintained by the CodeNarc team. I recommend sticking with the Grails plugin, which is maintained by the team.
Thanks,
Hamlet (CodeNarc developer)

Resources