Where I should place gsdll64.dll in host with windows7 and tomcat7? - java

I use ghost4j GhostScript to manage TIFF and PDF files in a webapp.
I included Ghost4J into my project using Maven and installed Ghostscript into C:\Program Files\gs\... but after this I still get an error:
java.lang.UnsatisfiedLinkError: Unable to load library 'gsdll64'
To solve this, I must place the file gsdll64.dll in working directory (usually c:\eclipse) as proposed here.
Till here everything fine, but when I deploy the app in the integration environment (win7 and tomcat7) I get this exception:
org.springframework.web.util.NestedServletException: Handler processing failed; nested exception is java.lang.NoClassDefFoundError: Could not initialize class org.ghost4j.GhostscriptLibrary.
I installed Ghostscript into C:\Program Files\gs\... in the host and as in this discussion I wrapped code with try {} catch (Exception e) but does not seem to help.
Any idea where I should place the gsdll64.dll or how to solve the error?

One solution is to add dll to %JAVA_HOME%/jre/bin as it is usually on the PATH.
Alternatively add the directory that contains the dll to PATH since on Windows, java.library.path is initialised from the PATH environment variable.
Check this thread on StackOverflow for reference.
For Tomcat 7, can copy gsdll64.dll to %TOMCAT_HOME%\bin directory or create setenv.bat under %TOMCAT_HOME%\bin directory with the following entry.
set PATH=%PATH%;C:\gs\gs9.18\bin
where C:\gs\gs9.18 is the installed Ghostscript folder. Check Apache Tomcat Native Library installation document on this.

Related

HADOOP 3.2.1 Error: java.lang.UnsatisfiedLinkError: org.apache.hadoop.io.nativeio.NativeIO$Windows.access0(Ljava/lang/String;I)Z

I am getting this error during my install of hadoop 3.2.1
I was told to follow this guide: https://towardsdatascience.com/installing-hadoop-3-2-1-single-node-cluster-on-windows-10-ac258dd48aef Everything is working until Step 6. when I try to run .\start-dfs.cmd
I have found solutions, but none worked.
All native files are added to bin from the github site (hadoop.dll etc) also added hadoop.dll to System32 folder
I also tried to edit the src code in InteliJ (adding a package org.apache.hadoop.io.nativeio) and creating a NativeIO.java class as the guide below:
Obtain and patch Hadoop
Hadoop is compatible with JDK 7 and 8. You may check if you have one (or more) of them installed.
The binary of Hadoop can be found at http://hadoop.apache.org/releases.html. Extract all files to a safe
place. For example, C:\hadoop-2.7.3.
Then download patch files from https://github.com/srccodes/hadoop-common-2.2.0-bin/archive/master.zip.
Extract (and replace) all files to the bin folder of your Hadoop binary. In this example, the full path will be C:\hadoop-2.7.3\bin.
Developing with IntelliJ IDEA
The IntelliJ IDEA is a powerful IDE for Java development. You may have it already installed on your
working computer. If not, grab one from https://www.jetbrains.com/idea/. The “Community” version if free
for non-commercial uses.
A nice step-by-step guide about this part can be found at https://mrchief2015.wordpress.com/2015/02/09/compiling-and-debugging-hadoop-applications-with-intellij-idea-for-windows/.
Troubleshooting: 1. You get an exception when debugging that says
Exception in thread "main" java.io.IOException: (null) entry in command string: null chmod 0700 ...
at org.apache.hadoop.util.Shell$ShellCommandExecutor.execute(Shell.java:769)
Solution: You need to set an HADOOP_HOME environment variable. You can either add it as system-wide, or
only for IntelliJ as shown in Setting up and using environment variables in IntelliJ Idea. The name of the environment variable should be
HADOOP_HOME, while its value is the folder path of your Hadoop binary (in this example, the value is
C:\hadoop-2.7.3).
3.2 You may get another exception that says
Exception in thread "main" java.lang.UnsatisfiedLinkError:
org.apache.hadoop.io.nativeio.NativeIO$Windows.access0(Ljava/lang/String;I)Z
at org.apache.hadoop.io.nativeio.NativeIO$Windows.access0(Native Method)
To solve this issue, you need to download the source package of Hadoop from given link in Sec. 1, extract
and copy hadoop-2.7.3-src.tar.gz\hadoop-2.7.3-src\hadoop-common-project\hadoop-common\src
\main\java\org\apache\hadoop\io\nativeio\NativeIO.java to your project, and modify Line 609 (in
function access) from
return access0(path, desiredAccess.accessRight());
to
return true;
What to do?

opencv native library cannot be found

I am using an exmplae from here to apply face recognition using opencv. I have extracted opencv at C:\. However, after running the provided example cod in Java, I get the following exception:
Exception in thread "main" java.lang.UnsatisfiedLinkError: no opencv_java341 in java.library.path
at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1865)
at java.lang.Runtime.loadLibrary0(Runtime.java:870)
at java.lang.System.loadLibrary(System.java:1119)
at detectingfaceinanimage.DetectingFaceInAnImage.main(DetectingFaceInAnImage.java:23)
I used System.out.println(System.getProperty("java.library.path")); to locate path for the java library but I have received numerous paths. Can you let me know how to fix thsi issue? (For Windows platform)
To solve this issue, needed to copy the .dll file from C:\opencv\build\java\x64 (as I am running a 64 bit operating system) into C:\Program Files\Java\jdk1.8.0_31\bin.
You should do these things:
Add the OpenCV Jar file in your project classpath (I think you
already did it)
Locate the OpenCV DLL file location where you extracted it, maybe it
looks like this:
C:\opencv\build\x64\vc15\bin
Then add this path in your system environment variable
In the end, restart your IDE (not your computer), and yes it is that!
Good Luck!!

how do I call sqljdbc_auth.dll

I'm using eclipse and want to make an sql database connection I put the sqljdbc_auth.dll in the buildpath
I'm getting this error message
Dec 18, 2013 10:45:54 AM com.microsoft.sqlserver.jdbc.AuthenticationJNI clinit>
WARNING: Failed to load the sqljdbc_auth.dll cause : no sqljdbc_auth in java.library.path
This driver is not configured for integrated authentication. ClientConnectionId:7a06f...
What am I doing wrong here?
The DLL file has to be present in one of the locations of your PATH environment var.
It may already help to copy the file to the folder windows\system32 or the bin folder of your JRE/JDK. Restart Eclipse and try again.
If this doesn't work you can also specify the parameter java.library.path in your Eclipse Run Configuration like this:
-Djava.library.path=C:\bla\path\where\the\dll\is
Alternativly you can follow this answer which describes in detail how to setup the parameter for a complete project.
See also:
Creating a Java application launch configuration
I solved the problem.
-Djava.library.path=C:\bla\path\where\the\dll\is
just needed quotes around it like this
"-Djava.library.path=C:\Program Files (x86)\jdbc\sqljdbc_4.0\enu\auth\x86"
If the JDBC is still using 32 bit sqljdbc_auth.dll, it could be because the PATH variable has found 64 bit dll before it gets to the newly added PATH environment variable. Add location of the 64 bit sqljdbc_auth.dll in the very beginning of the PATH system variable. In my case it was
C:\nilster\JDBC\sqlserver-sqljdbc_4.2\enu\auth\x64
This helped me get around to the issue.

java.lang.RuntimeException: Registry initialization file not found

When I work with JAI from the Eclipse (all the classes specified)
it works very fine, but when I bundle everything in a jar and make a shell script file from that and try to run that script I have a problem with javax.media.jai.OperationRegistry
looking for a initialization file.
Has anyone else seen this problem?
Exception:
java.lang.RuntimeException: Registry initialization file not found.
at
javax.media.jai.OperationRegistry.initializeRegistry(OperationRegistry.java:365)
at javax.media.jai.JAI.(JAI.java:566)
There is something on this page but I was not able to understand.
Any Help?
So the problem is that the JAI jar exported with the Java application do not work on the Linux. We have to explicitly install JAI on the Linux machine for the installed Java application to use.
The one solution that we found out is we exported our Java Application into a jar file and created a installation script, which when run on the Linux machine install the JAI first and after that it install our application.
So this is a one time installation process while installing the application on any fresh Linux machine.

java: error while loading shared libraries: libjl i.so: cannot open shared object file: No such file or directory

I've researched this and tried everything. Running Debian on a Raspberry Pi.
Trying to run java and getting this error:
"/home/pi/java/ejre1.7.0_21/bin/java: error while loading shared libraries: libjli.so: cannot open shared object file: No such file or directory"
I need someone to help me troubleshoot this.
Added path variable LD_LIBRARY_PATH
Copied libjli.so all over creation
don't know what else to do.
It will never work on that version of Debian, see this.
If you must run 1.7 you'll need a soft-float OS, otherwise try the 1.8 preview release which is hard-float.

Categories

Resources