Why JAVA. Lang. unsatisfiedlinkerror: CC error occurs in the 2ee engine (11:03:29)
Tags: Report software report Tool Web report software download it wishful report |
Category: Basic Concepts |
Java. Lang. unsatisfiedlinkerror is displayed on the "run JSP Report Program" page. The following reasons and solutions are available for CC errors:
1. Check the error message on the console.
A: If the console message is similar
Java. Lang. unsatisfiedlinkerror: No mrchklib in Java. Library. Path, error loading library mrchklib
This error message is caused by mrchklib. the DLL is not copied to the System32 directory of windows. (mrchklib. DLL is a Java interface file with encryption locks. The file can be found in the Report installation directory dogdriver/javaapi). Note that the PATH environment variable must contain the System32 directory. (If the server operating system is Linux, use the libmrchklib. So file under dogdriver/javaapi to copy libmrchklib. So to the webserver startup bin directory. If
Not Load Library error. Set the value of the system environment variable LD_LIBRARY_PATH to the directory where libmrchklib. So is located.
For example, if libmrchklib. So is in the/somedir directory, export LD_LIBRARY_PATH = $ LD_LIBRARY_PATH:/somedir)
B: If the console message is similar
Java. Lang. unsatisfiedlinkerror: Native libery C:/winnt/system32/mrchklib. dll already loaded in another classloader error loading mrchklib. dll
This error message is caused by the failure to load the dynamic library after the webapp is restarted. This is a Java constraint. Java does not allow an instance to load the dynamic library multiple times. you can solve this problem by setting mr. jar copy to the lib directory of Webserver, delete the mr. jar, and then restart webserver.
2. If a webserver has multiple report applications, place/WEB-INF/lib/Mr. jar is moved to the lib directory of webserver to ensure that no Mr is found in each web application directory. jar, and only the file in the lib directory of WebServer is available. Restart webserver.
3. a webserver can only have one mr. jar file. Delete the redundant Mr *. jar file, clear the temporary webserver file, and restart webserver. ========================================================== ========================================================== === JNI is used in recent projects, so I installed CDT and mingw of eclipse for use. I haven't touched C language before. I found the next tutorial on the Internet, but it was quite easy. I didn't prompt any errors when I got it all the way, however, when calling the local method at the end, it encountered a major problem and always prompted that the method could not be found. The same is true even for a simple helloworld.
Exception in thread "Main" Java. Lang. unsatisfiedlinkerror: helloworld. Print () V
It's strange that loadlibrary () is no problem. Why can't I find a method? Use the DLL export viewer to check whether the export method is
Function Name address offset
Java_helloworld_print @ 8 0x67741250 0x00001250
There is no way, so we have to install a large Visual Studio to re-compile and call it!
Run the DLL export viewer again to check whether the function name is preceded by an underscore.
Function Name address offset
_ Java_helloworld_print @ 8 0x67741250 0x00001250
It seems that a parameter is missing for mingw. After checking the information online, I finally found a solution: specify a parameter -- kill-at for the LD command of mingw.
Gcc-wl, -- kill-at-shared-O jnihello. dll helloworld. c
Use the DLL export viewer again to check whether the exported function name is changed
Function Name address offset
Java_helloworld_print 0x67741250 0x00001250
-- The kill-AT command removes the @ Suffix of the function name, and does not add the prefix underline as msvc does.
========================================================== ================================== Symptom: java. lang. unsatisfiedlinkerror: Native library XXX. DLL already loaded in another classloader at java. lang. classloader. loadlibrary0 (classloader. java: 1551) at java. lang. classloader. loadlibrary (classloader. java: 1511) at java. lang. runtime. loadlibrary0 (runtime. java: 788)
At java. lang. system. loadlibrary (system. java: 834) Analysis: this error occurs when we use hot start to publish a web application using JNI technology, and independently deploy the jar package that calls the native method in this application, this error is thrown when the native method encapsulated in the jar package is called after the web application is updated. (The above OS is windows. If it is Linux or UNIX, it should be xxx. so error) this is because the Web server has loaded the DLL when loading the application for the first time. When the application is hot again, the DLL will be loaded again, so an error is reported.
Solution: 1. Deploy the jar package containing JNI calls in the public lib library of the Web server. The Web application does not need to be loaded when it is released again. 2. The jar package deployment remains unchanged. A listener is implemented in the Web to check whether the listener is started for the first time. If it is not started for the first time, block the loading of the DLL contained in the jar package. ========================================================== ======================================
Class Loading Problem: unsatisfiedlinkerror |
Author: Simon Burns Source: IBM organization Date: |
Unsatisfiedlinkerror When linking a local call to the corresponding local definition, the Class Loader plays an important role. If the program tries to mount a library that does not exist or is misplaced, the parsing process in the Link phase will occur.UnsatisfiedLinkError . JVM SpecificationUnsatisfiedLinkError Yes:
Fornative If the Java Virtual Machine cannot find the corresponding local language definition, this exception will be thrown.
When a local method is called, the Class Loader tries to load the local library that defines the method. If the database cannot be found, this error will be thrown. Listing 6 demonstrates how to throwUnsatisfiedLinkError Test cases: Listing 6. unsatisfiedlinkerror.Java
public class UnsatisfiedLinkErrorTest {public native void call_A_Native_Method();static {System.loadLibrary("myNativeLibrary");}public static void main(String[] args) {new UnsatisfiedLinkErrorTest().call_A_Native_Method();}} |
This Code calls the local methodcall_A_Native_Method() , This method is in the local librarymyNativeLibrary . Because this library does not exist, the following error occurs during the program running:
The java class could not be loaded. java.lang.UnsatisfiedLinkError:Cant find library myNativeLibrary (myNativeLibrary.dll)in sun.boot.library.path or java.library.pathsun.boot.library.path=D:/sdk/jre/binjava.library.path= D:/sdk/jre/binat java.lang.ClassLoader$NativeLibrary.load(Native Method)at java.lang.ClassLoader.loadLibrary0(ClassLoader.java:2147)at java.lang.ClassLoader.loadLibrary(ClassLoader.java:2006)at java.lang.Runtime.loadLibrary0(Runtime.java:824)at java.lang.System.loadLibrary(System.java:908)at UnsatisfiedLinkErrorTest.<clinit>(UnsatisfiedLinkErrorTest.java:6) |
The mounting of the library is calledSystem.loadLibrary() The class loader of the method class is started -- in Listing 6UnsatisfiedLinkErrorTest Class Loader. Based on the class loader used, different locations will be searched:
- Search for Classes loaded by the bootstrap Class Loader
sun.boot.library.path .
- Search for Classes loaded by the extended Class Loader first
java.ext.dirs And thensun.boot.library.path And thenjava.library.path .
- Search for Classes loaded by the system Class Loader
sun.boot.library.path And thenjava.library.path .
In Listing 6,UnsatisfiedLinkErrorTest Classes are loaded by the system class loader. To mount the referenced library, this class loader first lookssun.boot.library.path , And then findjava.library.path . Because no library is required in both locations, the Class Loader throwsUnsatisfiedLinkageError . |
========================================================== ========================================
This error occurs in Java. Lang. unsatisfiedlinkerror because the Java Virtual Machine cannot find the local language definition declared as the native method. In my understanding, I generally think it is caused by incorrect DLL or lib File Import. There are some issues that require static import (that is, adding static to import the Lib file). If static import is not added, it means dynamic import, you need to add a catch throw exception to solve the problem, as shown in figure Try { System. loadlibrary ("vtkcommonjava "); System. loadlibrary ("vtkfilteringjava "); System. loadlibrary ("vtkiojava "); System. loadlibrary ("vtkimagingjava "); System. loadlibrary ("vtkgraphicsjava "); System. loadlibrary ("vtkrenderingjava "); } Catch (throwable E) { System. Out. println ("the load problem "); } This method to determine, or directly add Static { System. loadlibrary ("vtkcommonjava "); System. loadlibrary ("vtkfilteringjava "); System. loadlibrary ("vtkiojava "); System. loadlibrary ("vtkimagingjava "); System. loadlibrary ("vtkgraphicsjava "); System. loadlibrary ("vtkrenderingjava "); ========================================================== ========================================================== =
About java. Lang. unsatisfiedlinkerror (JNI) |
|
|
Objective: to move the Java package and native of pbp1.0 to the Gem and enable the gem to run normally on the new virtual machine. Background: Gem (1) has a bunch of Java packages and native functions. pbp1.0 is a virtual machine and a basic java package. To remove the Virtual Machine of pbp1.0, it only uses its Java basic package and native function. Problem: After the native functions of GEM and pbp1.0 generate a dynamic library, the system. loadlibrary () cannot be loaded in the program, and Java. Lang. unsatisfiedlinkerror is reported. Solution Process: 1. Theory We know that when Java calls the native function, it must load the dynamic library of its native function to the virtual machine through system. loadlibrary () or system. Load. Specify-djava. Library. path or-dsun. boot. Library. Path during running, and point it to the location of the dynamic library containing the native number of letters. 2. Implementation After following these steps, I cannot load the dynamic library libgem. so, other dynamic libraries used in this library include RT, pthread, FreeType, DL, and directfb. The dynamic libraries used by directfb include RT, DL, pthread, FreeType, JPEG, and PNG, these libraries must be generated in the/lib directory except for directfb. 3. Ideas First, I wrote a hello test case. It is found that when other dynamic libraries are used in native, they still cannot be loaded regardless of whether they exist in the relevant directory. Then, modify the compilation option to dynamically connect the used dynamic library to the target library, as shown below: $ (GCC)-FPIC-shared-O libdirectfb. So...-lpng-ljpeg-lpthread-LRT-LDL,-lfreetype After such a modification, directfb can be loaded. This also indicates that all the symbols referenced by the dynamic library loaded by system. loadlibrary () must be located. If one cannot be found, it cannot be loaded. You can write an empty main () function to connect your dynamic library. If the symbols referenced in the dynamic library cannot be found in the specified dynamic library and cannot be compiled, this dynamic library cannot be loaded. 4. Problem Solving Follow these steps to modify the makefile for libgem. So compilation and solve the problem! Add the directory where the dynamic library is located in LD_LIBRARY_PATH.(1) MHP (Multimedia Home Platform) was developed by the DVB Project as the world's first open standard for interactive television. it is a Java-based environment which defines a generic interface between interactive digital applications and the terminals on Which those applications execute. MHP was designed to run on DVB platforms but there was a demand to extend the interoperability it offers to other digital television platforms. This demand gave rise to gem, or Globally executable MHP, a framework which allows other organizations to define specifications based on MHP. |
|
========================================================== ========================================================== ==== In addition, it may be a problem with the DLL itself. Use the release version instead of the debug version. |
========================================================== ============================================ --
This mistake has also left me depressed for a long time. Now I have written it to reduce your detours. Generally, there are two types of errors:
1.Unsatisfiedlinkerror: DLL nameIt means that you didn't place the DLL in the proper position. Generally, it is put together with the class that calls the native function. Of course, the premise is that you have successfully generated the DLL.
2.Unsatisfiedlinkerror: Method Name,At this time, the DLL has been successfully generated and the location is correct. It means that you have not defined the function. You may say that I have clearly defined it, in fact, when you find the problem, you can only abuse yourself. it must be because some letters are incorrectly written when you define a function in the C file, because they are automatically generated elsewhere and will not make any mistakes. This problem often occurs when the source program is directly copied from the Internet. Some authors are not responsible and paste the program with errors.