java.lang.UnsatisfiedLinkError: com.chrysalisits.crypto.LunaAPI.Initialize()V - hsm

I am getting below exception while running my application.
Caused by: java.lang.UnsatisfiedLinkError:
com.chrysalisits.crypto.LunaAPI.Initialize()V
at com.chrysalisits.crypto.LunaAPI.Initialize(Native Method)
at com.chrysalisits.crypto.LunaTokenManager.(LunaTokenManager.java:107)
at com.chrysalisits.crypto.LunaTokenManager.getInstance(LunaTokenManager.java:62)
I have added LunaProvider.jar and libLunaAPI in $JAVA_HOME/jre/lib/ext.

I strongly recommend that you ask the HSM Support Team for help on this instead of Stackoverflow.
This error comes up if Java is not able to find the concerned .so / .dll (Library) file. Also, make sure that you have the correct 32 / 64 Bit version of the Library in the location.
That said, in the VM Arguments you could also set :
-Djava.library.path=/location_to_the_libLunaAPI_so_file (possibly, /usr/lunasa/JSP/lib .. or something)

I have solved my problem.
Actual Problem was mismatch between native client library (libLunaAPI.so) and Luna client.
My application was using old library's com.chrysalisits.crypto.* classes to interact with Luna client however my Luna client got updated and functions which it exposed in its native library was not present in current library.
I updated my client application by using com.safenetinc.luna.* classes and latest client library.

Related

Library class doesn't know of ConfigureWebHostDefaults extension method

I'm building a suite of REST micro-services using .Net Core 3.0 Preview 6. All these services will have the same start up logic. So, I'm trying to place all the code in a .Net Standard library.
The goal is to have the IHostBuilder:CreateHostBuilder method, as well as the Startup:Configure and Startup:ConfigureServices class and methods in the library. The library will also contain error handling logic, customized http response messages, etc.
However, I can't seem to find the correct package that contains the ConfigureWebHostDefaults method. I tried adding the Microsoft.AspNetCore package 2.2.0, but that didn't resolve the issue.
I added the Microsoft.Extensions.Hosting (3.0.0-preview-6) package, that also doesn't resolve the issue.
Is what I'm attempting even possible?
Thanks
-marc
I resolved it, not the best way, but it works. I decided to make the library targeted specifically for .NET Core 3.0. So, I changed the targetframework in the project file. That change automatically resolved my other issue.
Import the Microsoft.AspNetCore package, and use WebHost.CreateDefaultBuilder() instead. According to the code it is built from, both CreateDefaultBuilder() and ConfigureWebHostDefaults() call the same internal method: ConfigureWebDefaults().
The only downside of this is that the returned host will be an IWebHost instead of an IHost.

Can the ConfigurationAPI in Liferay DXP be used for Plugin sdk portlet?

I have followed given 2 tutorials to use COnfigurationAPI in a Liferay dxp plugins SDK portlet built using Ant/Ivy.
COnfiguration API 1
COnfiguration API 2.
Below is the configuration class used:
package com.preferences.interfaces;
import com.liferay.portal.configuration.metatype.annotations.ExtendedObjectClassDefinition;
import aQute.bnd.annotation.metatype.Meta;
#ExtendedObjectClassDefinition(
category = "preferences",
scope = ExtendedObjectClassDefinition.Scope.GROUP
)
#Meta.OCD(
id = "com.preferences.interfaces.UnsupportedBrowserGroupServiceConfiguration",
name = "UnsupportedBrowser.group.service.configuration.name"
)
public interface UnsupportedBrowserGroupServiceConfiguration {
#Meta.AD(deflt = "", required = false)
public String displayStyle();
#Meta.AD(deflt = "0", required = false)
public long displayStyleGroupId(long defaultDisplayStyleGroupId);
}
Post following the steps,I am getting the below error:
ERROR [CM Configuration Updater (ManagedService Update: pid=[com.preferences.interfaces.UnsupportedBrowserGroupServiceConfiguration])][org_apache_felix_configadmin:97] [org.osgi.service.cm.ManagedService, id=7082, bundle=297//com.liferay.portal.configuration.settings-2.0.15.jar?lpkgPath=C:\dev\Liferay\osgi\marketplace\Liferay Foundation.lpkg]: Unexpected problem updating configuration com.preferences.interfaces.UnsupportedBrowserGroupServiceConfiguration {org.osgi.service.cm.ConfigurationAdmin}={service.vendor=Apache Software Foundation, service.pid=org.apache.felix.cm.ConfigurationAdmin, service.description=Configuration Admin Service Specification 1.2 Implementation, service.id=56, service.bundleid=643, service.scope=bundle}
Caused by: java.lang.IllegalArgumentException: wrong number of arguments
So,does this process need a osgi module as mandatory or can we do it using plusings sdk portlet built using ant as well?
Without disecting the error message Caused by: java.lang.IllegalArgumentException: wrong number of arguments:
The way you build your plugin (Ant, Maven, Gradle, manually) doesn't make a difference, as long as you build a plugin that will be understood by the runtime. aQute.bnd.annotation.metatype.Meta points firmly into the OSGi world, and makes it almost certain that you'll need an OSGi module. You can build this with Ant, of course. Even in Ant you can embed tools like bnd, or you can write the proper Manifest.mf to include in your module manually (just kidding - you don't want to do it manually, but it would work).
Recommendation: Instead of moving everything over: Try to reproduce this with a minimal example in gradle or better Liferay Workspace (which is gradle based), just to get all the automatic wiring in. Check if it makes a difference and compare the generated output from your Ant build process with the workspace output. Pay specific attention to the Manifest.
In order to build the proper Manifest, you want to use bnd - if the Manifest turns out to be your issue: Find a way to embrace bnd - if that's by saying goodby to Ant, or by tweaking your build script remains your decision.

When I include google maps my build fails

When I include a "google maps" dependency into pubspec.yaml
google_maps_flutter: ^0.2.0+3
my build fails with:
Launching lib\main.dart on Android SDK built for x86 in debug mode...
D8: Program type already present: android.support.v4.media.MediaBrowserCompat$ConnectionCallback$ConnectionCallbackInternal
*********************************************************
WARNING: This version of google_maps_flutter will break your Android build if it or its dependencies aren't compatible with AndroidX.
See xxxxxxxxxxx for more information on the problem and how to fix it.
This warning prints for all Android build failures. The real root cause of the error may be unrelated.
*********************************************************
FAILURE: Build failed with an exception.
What went wrong:
Execution failed for task ':app:transformDexArchiveWithExternalLibsDexMergerForDebug'.
com.android.builder.dexing.DexArchiveMergerException: Error while merging dex archives: C:\Users\philb\flutter_course2\build\app\intermediates\transforms\dexBuilder\debug\4.jar, C:\Users\philb\flutter_course2\build\app\intermediates\transforms\dexBuilder\debug\5.jar, C:\Users\philb\flutter_course2\build\app\intermediates\transforms\dexBuilder\debug\6.jar, C:\Users\philb\flutter_course2\build\app\intermediates\transforms\dexBuilder\debug\7.jar, C:\Users\philb\flutter_course2\build\app\intermediates\transforms\dexBuilder\debug\8.jar, C:\Users\philb\flutter_course2\build\app\intermediates\transforms\dexBuilder\debug\9.jar, C:\Users\philb\flutter_course2\build\app\intermediates\transforms\dexBuilder\debug\10.jar, C:\Users\philb\flutter_course2\build\app\intermediates\transforms\dexBuilder\debug\11.jar, C:\Users\philb\flutter_course2\build\app\intermediates\transforms\dexBuilder\debug\12.jar, C:\Users\philb\flutter_course2\build\app\intermediates\transforms\dexBuilder\debug\13.jar, C:\Users\philb\flutter_course2\build\app\intermediates\transforms\dexBuilder\debug\14.jar, C:\Users\philb\flutter_course2\build\app\intermediates\transforms\dexBuilder\debug\15.jar, C:\Users\philb\flutter_course2\build\app\intermediates\transforms\dexBuilder\debug\16.jar, C:\Users\philb\flutter_course2\build\app\intermediates\transforms\dexBuilder\debug\17.jar, C:\Users\philb\flutter_course2\build\app\intermediates\transforms\dexBuilder\debug\18.jar, C:\Users\philb\flutter_course2\build\app\intermediates\transforms\dexBuilder\debug\19.jar, C:\Users\philb\flutter_course2\build\app\intermediates\transforms\dexBuilder\debug\20.jar, C:\Users\philb\flutter_course2\build\app\intermediates\transforms\dexBuilder\debug\21.jar, C:\Users\philb\flutter_course2\build\app\intermediates\transforms\dexBuilder\debug\22.jar, C:\Users\philb\flutter_course2\build\app\intermediates\transforms\dexBuilder\debug\23.jar, C:\Users\philb\flutter_course2\build\app\intermediates\transforms\dexBuilder\debug\24.jar, C:\Users\philb\flutter_course2\build\app\intermediates\transforms\dexBuilder\debug\25.jar, C:\Users\philb\flutter_course2\build\app\intermediates\transforms\dexBuilder\debug\26.jar, C:\Users\philb\flutter_course2\build\app\intermediates\transforms\dexBuilder\debug\27.jar, C:\Users\philb\flutter_course2\build\app\intermediates\transforms\dexBuilder\debug\28.jar, C:\Users\philb\flutter_course2\build\app\intermediates\transforms\dexBuilder\debug\29.jar, C:\Users\philb\flutter_course2\build\app\intermediates\transforms\dexBuilder\debug\30.jar, C:\Users\philb\flutter_course2\build\app\intermediates\transforms\dexBuilder\debug\31.jar, C:\Users\philb\flutter_course2\build\app\intermediates\transforms\dexBuilder\debug\32.jar, C:\Users\philb\flutter_course2\build\app\intermediates\transforms\dexBuilder\debug\33.jar, C:\Users\philb\flutter_course2\build\app\intermediates\transforms\dexBuilder\debug\34.jar, C:\Users\philb\flutter_course2\build\app\intermediates\transforms\dexBuilder\debug\35.jar, C:\Users\philb\flutter_course2\build\app\intermediates\transforms\dexBuilder\debug\36.jar, C:\Users\philb\flutter_course2\build\app\intermediates\transforms\dexBuilder\debug\50.jar, C:\Users\philb\flutter_course2\build\app\intermediates\transforms\dexBuilder\debug\55.jar, C:\Users\philb\flutter_course2\build\app\intermediates\transforms\dexBuilder\debug\60.jar, C:\Users\philb\flutter_course2\build\app\intermediates\transforms\dexBuilder\debug\65.jar, C:\Users\philb\flutter_course2\build\app\intermediates\transforms\dexBuilder\debug\70.jar, C:\Users\philb\flutter_course2\build\app\intermediates\transforms\dexBuilder\debug\75.jar, C:\Users\philb\flutter_course2\build\app\intermediates\transforms\dexBuilder\debug\80.jar, C:\Users\philb\flutter_course2\build\app\intermediates\transforms\dexBuilder\debug\85.jar, C:\Users\philb\flutter_course2\build\app\intermediates\transforms\dexBuilder\debug\90.jar, C:\Users\philb\flutter_course2\build\app\intermediates\transforms\dexBuilder\debug\95.jar, C:\Users\philb\flutter_course2\build\app\intermediates\transforms\dexBuilder\debug\100.jar, C:\Users\philb\flutter_course2\build\app\intermediates\transforms\dexBuilder\debug\105.jar, C:\Users\philb\flutter_course2\build\app\intermediates\transforms\dexBuilder\debug\110.jar, C:\Users\philb\flutter_course2\build\app\intermediates\transforms\dexBuilder\debug\115.jar
Can someone point me in the right direction to understand and track this down. This project built just fine previously.
This is because you have in your app google_maps_plugin version that is using androidx and probably your app and/or some other dependency is using android support library. I had provided some ways to solve this kind of problem here and here.
But what you need to do is migrate all your app to androidx and use updated dependencies versions that already has been migrated too.
Other way is avoid androidx making downgrade of your dependencies packages for versions pre androidx.
For more details about flutter apps androidx migration see the original docs reference
I hope it helps.

JSON Parser -java.lang.NoSuchFieldError: defaultReader

I am using a JSON parser to extract the value and I am using the following jar
json-path-2.1.0, and I am getting the following error when I invoke the use case deployed as webservice on weblogic server
I wrote a small main program to extract the value from the json string and it works fine, but the server version of the use case is giving the issue. I am not sure if there are any other jars part of my ear can negatively impact this
SEVERE: defaultReader
java.lang.NoSuchFieldError: defaultReader
at com.jayway.jsonpath.spi.json.JsonSmartJsonProvider.<init>(JsonSmartJsonProvider.java:39)
at com.jayway.jsonpath.internal.DefaultsImpl.jsonProvider(DefaultsImpl.java:21)
at com.jayway.jsonpath.Configuration.defaultConfiguration(Configuration.java:174)
at com.jayway.jsonpath.internal.JsonContext.<init>(JsonContext.java:52)
at com.jayway.jsonpath.JsonPath.parse(JsonPath.java:596)
Stumbled about the same problem.
The reason why it does not work is not the JDK 8.
The reason why you encounter this issue, is the fact that weblogic 12.2.1.X is bundling some old version of json-smart.
On my machine this would be found here:
jar:file:/C:/dev/WLS_12_2_1_2_0/oracle_common/modules/net.minidev.json-smart.jar!/net/minidev/json/JSONValue.class
Now if you are using a library like json-path that depends on json-smart, then by default the container will load the required class using one of its built-in modules.
The blowup you have, seems to be that the JSONValue class that your json-path depends on seemed to have this defaultReder field.
Here is a snipet of the clode that is blowing up.
public JsonSmartJsonProvider() {
this(JSONParser.MODE_PERMISSIVE, JSONValue.defaultReader.DEFAULT_ORDERED);
}
That
JSONValue.defaultReader
Seems not to be valid on weblogs older system class loader class.
You can tell the container to use what you are packing by putting into your weblogic.xml deployment descriptor something like this:
<wls:prefer-application-packages>
<wls:package-name>net.minidev.json.*</wls:package-name>
</wls:prefer-application-packages>
I am having quite a bit of trouble getting weblogic to swallow the fine-grained instruction above.
I found myself to force weblogic to swallog all that goes into the web-inf folder instead doing:
<wls:container-descriptor>
<wls:prefer-web-inf-classes>true</wls:prefer-web-inf-classes>
</wls:container-descriptor>
I would have rather not be using a hammer like the web-inf-classes, but I am dancing with the weblogic system classloader when I do not go coarse grained...
Regards.
I too was facing this issue, It turned out some other library was using json-smart's older version, and it was getting precedence over json-path's json-smart dependency. Removing the other jar solved the issue. Or you can also downgrade your json-path's version to appropriate version such that it support json-smart's older version.
Looks like JsonParser jar is present in JVM 1.8 version and it seems to have more precedence over the JsonParser class available in Json-path.jar. Apparently the us case doesn't work in 12.2.1 version of the weblogic server but it works fine in 12.1.3
I had the same problem but I use Gradle so I had to add:
compile group: 'net.minidev', name: 'json-smart', version: '2.3' to my dependencies.

Strange errors when linking to libmariadb

I'm currently develop an Objective-C library that links to the MariaDB C connector. I believe there is a problem with the library, though.
Every time I execute my code I get very strange errors on the console. The -(id)init method of my library calls mysql_init(NULL) to initialise the library but as soon as I return from -(id)init I get the following errors in the console:
Object 0x10643df70 of class XXX autoreleased with no pool in place - just leaking - break on objc_autoreleaseNoPool() to debug
Thing is, there is no multithreaded code being executed and if I run the same - (id)init without the call to mysql_init(NULL) the errors disappear. I believe the libmariadb library is causing these errors to appear. I don't get why though.
Do I need to build it with any special command line switches? Am I calling the right methods? I obviously used the MySQL online documentation as a guide.
Make sure you add this anytime you have a new thread:
#autoreleasepool {
//enter code here
}
Have you tried latest revision from launchpad?
Also try to build libmariadb with -DUNDEF_THREADS_HACK and
CMAKE_USE_PTHREADS:BOOL=OFF)
I was busy with other stuff for a while. I've since updated MariaDB to the latest version and, as far as I can tell, it works fine.