I have a java project. This is loading a library .so and in a thread is calling a jni method from this .so.
The problem is every time the method finish ,the app crash too and the message I see is "ERROR: detaching thread with interp frames (count=4)" . What i have to do to clean exit from that native method?
Related
I am able to start the server with the command line 'java -jar jarname.jar
But , while running main method of the spring boot application , server start fails ,saying that a class from an imported dependency project does not exists
Caused by: java.lang.NoClassDefFoundError: Lcom/jj/db/repositories/KKRepository;
Also there is a warning message in the console :
2021-11-15 11:04:47 WARN WebappClassLoaderBase:173 - - The web application [MM] appears to have started a thread named [RxIoScheduler-1 (Evictor)] but has failed to stop it. This is very likely to create a memory leak. Stack trace of thread:
sun.misc.Unsafe.park(Native Method)
java.util.concurrent.locks.LockSupport.parkNanos(LockSupport.java:215) java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject.awaitNanos(AbstractQueuedSynchronizer.java:2078)
Can anyone please help ?
Instead of a multi-module project, make it as a single module project or specify appropriately in the manifest.
I am unable to run sample java application in eclipse IDE,
it is continuously showing the
java.io.IOException: error=12, Cannot allocate memory
this error message
this is my screen shoot
After loading mod_java.so, I am getting exception as class not found in org.freeswitch.Launcher
Getting the below exception on freeswitch console..I have set the librarypath, classpath and some necessary arguments in java.conf.xml.
Exception in thread "Thread-7" java.lang.ClassNotFoundException: org/freeswitch/Launcher.class
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:264)
at org.freeswitch.Launcher.launch(Launcher.java:65)
Main thing I am using JavaSession class of swig package to do dtmf recognition..
Please anyone tell me the solution.
In you java.conf.xml remove or comment out any startup or shutdown class.
Shutdown any running instance of freeswitch and run it again. Mod_java will load perfectly this time.
I have to find system information in an applications and for this I have two native library files as given below:
SystemManagerLinux.so and SystemManagerWin32.dll.
I have to use these library files in my java code to show the information on java GUI. I have put these files on the location: C:\Users\surjit\Documents\NetBeansProjects\SampleMonitor and give it is as vm argument in my netbeans ide on run option as given below:
-Djava.library.path="C:\Users\surjit\Documents\NetBeansProjects\SampleMonitor"
and call the libraries as in the code :
if (os.startsWith("Linux"))
loadTmpLibrary("SystemManagerLinux.so", "libSML", ".so");
else if (os.startsWith("Windows")) {
loadTmpLibrary("SystemManagerWin32.dll", "SMW", ".dll");
But when I am running the application it is giving following error:
Exception in thread "main" java.lang.UnsatisfiedLinkError: SystemManagerWin32.fetchProcessIDs([I)I
at SystemManagerWin32.fetchProcessIDs(Native Method)
at SystemMonitor.refreshPidList(SystemMonitor.java:168)
at SystemMonitor.<init>(SystemMonitor.java:383)
at SystemMonitor.main(SystemMonitor.java:494)
Exception in thread "Thread-2" java.lang.UnsatisfiedLinkError: SystemManagerWin32.fetchSystemMemoryStatus(LSystemMemoryStatus;)Z
at SystemManagerWin32.fetchSystemMemoryStatus(Native Method)
at SystemMonitor.run(SystemMonitor.java:410)
at java.lang.Thread.run(Thread.java:722)
Please suggest me solution.Thanks
The problem appears to be that the native methods you're attempting to call don't exist in your DLL, not that your DLL fails to be loaded.
Assuming loadTmpLibrary effectively performs a System.loadLibrary() call, you need to ensure that your native methods are declared properly. Usually invoking javah on the Java source which includes the native declarations is sufficient to get an accurate header. Compare its output with whatever it is you're currently compiling.
I have a basic java server app that has 100 worker threads that do simple HEAD requests on urls. I'm using HttpClient 4.x for this.
A few minutes into the run my program just freezes for a couple minutes and I cannot figure out why. Check out the screen shot of what visual vm monitor reports. You can see it flatline. During this time I'm unable to get a good thread dump and visual vm just freezes until it's unblocked. Does anyone have any ideas on what I can do to try and start debugging this guy?
Visual VM: http://tinypic.com/view.php?pic=2i915bs&s=7
Here is the output when I tried to take a jstack dump while it was frozen:
jstack -F 4325
Attaching to process ID 4325, please wait...
Debugger attached successfully.
Server compiler detected.
JVM version is 16.3-b01
Deadlock Detection:
No deadlocks found.
Thread 4557: (state = BLOCKED)
Error occurred during stack walking:
sun.jvm.hotspot.debugger.DebuggerException: sun.jvm.hotspot.debugger.DebuggerException: get_thread_regs failed for a lwp
at sun.jvm.hotspot.debugger.linux.LinuxDebuggerLocal$LinuxDebuggerLocalWorkerThread.execute(LinuxDebuggerLocal.java:152)
at sun.jvm.hotspot.debugger.linux.LinuxDebuggerLocal.getThreadIntegerRegisterSet(LinuxDebuggerLocal.java:466)
at sun.jvm.hotspot.debugger.linux.LinuxThread.getContext(LinuxThread.java:65)
at sun.jvm.hotspot.runtime.linux_amd64.LinuxAMD64JavaThreadPDAccess.getCurrentFrameGuess(LinuxAMD64JavaThreadPDAccess.java:92)
at sun.jvm.hotspot.runtime.JavaThread.getCurrentFrameGuess(JavaThread.java:256)
at sun.jvm.hotspot.runtime.JavaThread.getLastJavaVFrameDbg(JavaThread.java:218)
at sun.jvm.hotspot.tools.StackTrace.run(StackTrace.java:76)
at sun.jvm.hotspot.tools.StackTrace.run(StackTrace.java:45)
at sun.jvm.hotspot.tools.JStack.run(JStack.java:60)
at sun.jvm.hotspot.tools.Tool.start(Tool.java:221)
at sun.jvm.hotspot.tools.JStack.main(JStack.java:86)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at sun.tools.jstack.JStack.runJStackTool(JStack.java:118)
at sun.tools.jstack.JStack.main(JStack.java:84)
Caused by: sun.jvm.hotspot.debugger.DebuggerException: get_thread_regs failed for a lwp
at sun.jvm.hotspot.debugger.linux.LinuxDebuggerLocal.getThreadIntegerRegisterSet0(Native Method)
at sun.jvm.hotspot.debugger.linux.LinuxDebuggerLocal.access$800(LinuxDebuggerLocal.java:51)
at sun.jvm.hotspot.debugger.linux.LinuxDebuggerLocal$1GetThreadIntegerRegisterSetTask.doit(LinuxDebuggerLocal.java:460)
at sun.jvm.hotspot.debugger.linux.LinuxDebuggerLocal$LinuxDebuggerLocalWorkerThread.run(LinuxDebuggerLocal.java:127)
I've seen several bug reports about jstack on Linux with a similar trace:
JVM Bug Id: 6494722 (is supposed to be fixed)
Ubuntu Bug #597098 (this one is not)
Do you get the same result with a kill -3 <pid>?
Very likley due to too much memory usage causing GC. Add the params to java:
-verbosegc -XX:+PrintGCDetails
And see if you notice anything obvious in the output/logs
What worked for me was running jstack as the process owner without -F.