How do I integrate JNI code into weblogic? - weblogic

I am writing an application which will be deployed in weblogic. As part of this application, we are using a third party library which uses JNI. How do I make the .so file available to weblogic?
I tried setting the LD_LIBRARY_PATH and restarting weblogic with no luck

The LD_LIBRARY_PATH environment variable should be set in the setWLSEnv.sh or the startWLS.sh scripts.
Can you show us where and how you did that?

You can include the path of the .so files for LD_LIBRARY_PATH in the commEnv.sh . In <WL_install_dir>/common/bin/commEnv.sh based on your OS case block you can update with .so folder like below
LD_LIBRARY_PATH=/usr/vardhan/SOfiles/:${PATCH_LIBPATH}:${LD_LIBRARY_PATH}
export LD_LIBRARY_PATH
Obviously after updating you need restart all the services.

Related

ZBS ZeroBraneStudio lua libs location in Mac OS

I wanted to debug openresty lua which is running in my local host. I installed ZBS IDE for that purpose in my MAC. I am going through the documentation available at.
The instruction says I need to set the below in the nginx conf
lua_package_path '{ZBS}/lualibs/?/?.lua;{ZBS}/lualibs/?.lua;;';
lua_package_cpath '{ZBS}/bin/clibs/?.dll;;';
I am finding it really hard to find out the location of in my mac. I installed the IDE my moving the dmg inside the application directory. Since I could not set this path, my ngix is failing to find the module 'mobdebug'.
Any idea as how to find the ZBS lua lib path in Mac OS.?
If you installed ZBS as the application, then {ZBS} in the paths needs to be replaced with something like /Applications/ZeroBraneStudio.app/Contents/ZeroBraneStudio, so the full paths becomes:
lua_package_path '/Applications/ZeroBraneStudio.app/Contents/ZeroBraneStudio/lualibs/?/?.lua;/Applications/ZeroBraneStudio.app/Contents/ZeroBraneStudio/lualibs/?.lua;;';
lua_package_cpath '/Applications/ZeroBraneStudio.app/Contents/ZeroBraneStudio/bin/clibs/?.dylib;;';

Why won't OSA_LIBRARY_PATH not work as documented for JXA?

According to Apple's Developer Docs the Library global allows one to import compiled scripts so they can be used as a library in one's current script. This works just fine if you were to do something like the below code with myLibName.scpt located at ~/Library/Script Libraries:
myLib = Library('myLibName');
myLib.myLibMethod() // Works just fine
But, the docs also claim that one can export an environment variable — OSA_LIBRARY_PATH containing a string of : delimited paths — and Library() would then defer to that list of paths before proceeding to it's default path: ~/Library/Script Libraries. Ya know, like the bash environment variable Path. Here's the relevant piece of documentation below; it describes the path hierarchy:
The basic requirement for a script to be a script
library is its location: it must be a script document in a “Script
Libraries” folder in one of the following folders. When searching for
a library, the locations are searched in the order listed, and the
first matching script is used:
If the script that references the library is a bundle, the script’s
bundle Resources directory. This means that scripts may be packaged
and distributed with the libraries they use.
If the application running the script is a bundle, the application’s bundle Resources
directory. This means that script applications (“applets” and
“droplets”) may be packaged and distributed with the libraries they
use. It also enables applications that run scripts to provide
libraries for use by those scripts.
Any folders specified in the environment variable OSA_LIBRARY_PATH. This allows using a library
without installing it in one of the usual locations. The value of this
variable is a colon-separated list of paths, such as /opt/local/Script
Libraries:/usr/local/Script Libraries. Unlike the other library
locations, paths specified in OSA_LIBRARY_PATH are used exactly as-is,
without appending “Script Libraries”. Supported in OS X v10.11 and
later.
The Library folder in the user’s home directory, ~/Library.
This is the location to install libraries for use by a single user,
and is the recommended location during library development.
The
computer Library folder, /Library. Libraries located here are
available to all users of the computer.
The network Library folder,
/Network/Library. Libraries located here are available to multiple
computers on a network.
The system Library folder, /System/Library.
These are libraries provided by OS X.
Any installed application
bundle, in the application’s bundle Library directory. This allows
distributing libraries that are associated with an application, or
creating applications that exist solely to distribute libraries.
Supported in OS X v10.11 and later.
The problem is that it doesn't work. I've tried exporting the OSA_LIBRARY_PATH variable — globally via my .zshrc file — and then running a sample script just like the one above via both the Script Editor and the osascript executable. Nothing works; I get a "file not found" error. I found this thread-where-the-participants-give-up-hope online; it doesn't explain much. Any thoughts?
On a somewhat related note, the Scripting Additions suite provides two other methods — loadScript and storeScript — that seem like they might be useful here. Unfortunately, when you try to use them, osascript gives you the finger. Though, I did manage to return what looked like a hexadecimal buffer from a compiled script using loadScript. Anyway, any insight you guys can shed on this would be much appreciated. Thanks.
The OSA_LIBRARY_PATH environment variable is ignored by restricted executables when running with System Integrity Protection enabled.
To workaround this limitation you can either turn off SIP, or you can use an unrestricted executable.
For instance, to make osascript unrestricted, you should first make a copy, and then re-sign it with an ad-hoc signature:
cp /usr/bin/osascript ./osascript
codesign -f -s - ./osascript
Once you have the unrestricted osascript, you can run it with the OSA_LIBRARY_PATH environment variable set like this:
OSA_LIBRARY_PATH="/path/to/libs" ./osascript path/to/script.scpt
As a lousy alternative, you can put a symlink at one of the "Script Libraries" folders that osascript would look at and point it to the folder you want. Note that the symlink must be a replacement for the entire folder, it can't just exist inside of it.
rm -rf ~/Library/Script\ Libraries
ln -s "/Your/Custom/Path/Goes/Here/" ~/Library/Script\ Libraries
Tested on 10.13.2

How to use WKhtmltopdf Library without using executable

In ruby on rails project.
I am using PDFKit gem for generating pdf reports
PDFKit uses wkhtmltopdf executable which is to be installed on the machine .
And next step to give the path of the executable .
I dont want to use the executable file .because if i use it how to deploy it on server .
the server will need to install it on its local and give the path.
Is it possible to use only library????
The executable is used to wrap the underlying Qt app, so it's technically possible to wrap the library in a gem (using ffi or some other similar lib) but I never heard anybody doing it.
I'm myself bundling the executable with my Rails app, to ship both at once when I deploy (even on Heroku).
To do the same, you can put the binary file in directory (you can call it bin), and configure PDFKit to get the executable where it's at using PDFKit.configure in an initializer for instance (you might wanna check the README).

No 'server' JVM at '...'

I'm running a java application that we distribute as a server-side system. I'm trying to write a launcher ("write" is somewhat of an overstatement here, I'm basically just copying the Java.exe file so that we can get the desired name in the process explorer of windows). This exe is in our bin/ directory of our application file tree.
Now, we also have a jre/ directory in our file tree, which is where Java.exe actually resides (we ship our product with the Java environment). When I use Java.exe as the launcher, which is located in \jre\jre1.6.0_21\bin, or if I place the copy (call this exectuable 'Orange.exe') I made in this directory, it works just fine. But, if I put my 'Orange.exe' in the bin\ directory, then I get the following error:
Error: no 'server' JVM at 'C:\Program Files\Java\jre6\bin\server\jvm.dll'
I think I understand what is happening here - I want to use the server version of the jvm.dll file, which is in our jre directory. The problem is, I don't understand WHY it doesn't look in the jre\jre1.6.0_21 directory in my application path. I've set my JAVA_HOME environment variable to this location. It seems like it's defaulting to another, system-wide expected location.
Does anyone know how I can change this, so that it looks in my application-provided java environment directory? Ideally, this will be an environment variable, as I need to call this application with parameters using a batch file.
There is a little trick to get the server JVM up and running:
Copy "server" folder from the JDK's JRE's bin folder example: C:\Program Files\Java\jdk1.6.0\jre\bin\server
Paste the "server" folder to JRE's bin folder example: C:\Program Files\Java\jre1.6.0\bin
Done
See official readme for details.
I've just been struggling with this same problem in Eclipse and I noted that as suggested by the answer above the JBoss site has a thread on this issue saying the same as the answer above to copy files from the jdk to the jre folder.
I noticed that you can avoid having to do this if you define the runtime to be the jdk when you create the server. I didn't find how to edit an existing server though.
AFAIK, the JRE usually doesn't ship with a server VM (only the client VM). If you really need the server VM, you have to use the JDK installation.
See Oracle Java for Developers Download page for JRE's with Server VM.
I had the same problem here but, in my case, I just had not properly update the JAVA_HOME and my PATH for my recently installed JDK.
I just updated it to my new JDK location and the server started just fine.
Windows looks for DLLs in LIBPATH environment variable.
And make sure your 1.6.0_21 is somewhere first in PATH.
I solved the same problem by setting the JAVA_HOME path to C:\Program Files (x86)\Java\jre1.8.0_131\bin
The easiest fix is simply to copy the contents of client folder inside bin and put in a newly created folder 'server' inside bin.
Copy from C:\Program Files (x86)\Java\jre1.8.0_261\bin\client
Paste in C:\Program Files (x86)\Java\jre1.8.0_261\bin\server
*server is the new folder
Make sure that server/jvm.dll file must be there when we are trying to run servers like servicemix.
Copy "server" folder from the JDK's JRE's bin folder example: C:\Program Files\Java\jdk1.6.0\jre\bin\server
Paste the "server" folder to JRE's bin folder example: C:\Program Files\Java\jre1.6.0\bin
I paced problem, I went through above..That's working fine.
Thanks!

AIX LIBPATH and STICKY BIT Set

I have executable which runs fine in normal way. It loads a shared library. and I setting LIBPATH before launching that exe.
Now If I change the permission of the exe to owned by root and set sticky bit, then it fails to load the shared library.
If I create link in /usr/lib to the shared library everything works fine.
Any reason and solution for this problem.
It's a security feature - LIBPATH from your user environment is not used when running something with the sticky bit set. If it allowed you to use a user-set LIBPATH on an executable with suid set on it, someone could load a malicious library to compromise the system.
Also note that this security feature exists in Linux systems as well - LD_LIBRARY_PATH from a user's environment will be ignored when running a sticky-bit executable.
Possible Solutions
1 - One solution is to grant a user sudo privilege to execute that command, in which case you could do something like...
sudo LIBPATH="..." executable
2 - Another solution is to create a shell script that sets LIBPATH and then executes the executable, and set the sticky bit on your shell script, like this...
#/bin/sh
LIBPATH="/whatever/path" /path/to/executable