JaamSim crashing on Start up under Eclipse - java

I am really new to this and trying to get the JaamSim Tool running within Eclipse to run a Simulation for my Bachelors Thesis.
When ever I try to run the config im getting an libc++abi.dylib: terminating with uncaught exception of type NSException. The JaamSim Loading Window always opens for a brief moment and then closes again with the note "GUIFrame was unexpectedly closed"
I tried for days new and im out of ideas... installed the newest jdk from adoptopenjdk, as well as apache ant and maven. Also linked everything within the .bash_profile
I would be really grateful if somebody could guide me to an solution.I added the terminal log form eclipse here1
Btw I am on Mac if that helps

The "exception" you are encountering is not a Java exception. It is a native Objective-C NSException. The "NS" stands for NeXTSTEP. It is a shibboleth of the old NeXTSTEP OS that is the ancestor of OS X and macOS. I can understand your confusion because both Objective-C and Java use the term "exception".
The logs you posted are, likewise, not a Java stack trace but an NSLog based thread dump from the native frameworks that your Java graphics depend on. You cut off the text of the actual exception in the image you linked. I'm guessing you didn't recognize the format and so didn't see the helpful message.
I'm going to guess that full text of the NSException message was "NSWindow drag regions should only be invalidated on the Main Thread!" If this is the case, then I think your problem is likely caused by changing some graphics from a background thread.
System graphics, such as windows, alerts, etc. are managed in macOS through a framework called "Cocoa". NSWindow is a Cocoa object. One of the important rules of Cocoa (and most UI frameworks) is that you should only alter Cocoa objects (like NSWindow) from the main thread. Probably, you are making some alterations to your GUI (specifically, invalidating drag regions) from a background thread. Java doesn't have any inherent problem with this, but Cocoa does. So you get a native error instead of a Java error.
TL;DR: Only work with your GUI from the main thread. You are getting this error because you are changing the GUI from a background thread.
EDIT: After doing a little research.
It appears that this particular issue occurs with certain Java OpenGL libraries, in particular lwjgl. You can see a very determined but ultimately fruitless effort to fix the problem here. I'm not sure what OpenGL Java interface is used in JaamSim, but they documented this same problem as far back as 2018, saying
The bug turns out to be a known problem with the JOGL software we use for 3d graphics. Unfortunately, it will take a while to get a fix in place.
The same JOGL bug was documented again in 2019. There, it seems to be resolved. Their report of the fix was
encapsulated both construction fully to run on the Main-Thread
I'm not sure how much control over this you have. Your best bet is to start by adding the -XstartOnFirstThread flag to your java command. I would also check if anyone in your class has been able to make this work on a Mac. Sometimes, it's nice to do a quick impossibility check before wasting time.

Related

jdbc mssql connection causes EXCEPTION_ACCESS_VIOLATION [duplicate]

When a Java VM crashes with an EXCEPTION_ACCESS_VIOLATION and produces an hs_err_pidXXX.log file, what does that indicate? The error itself is basically a null pointer exception. Is it always caused by a bug in the JVM, or are there other causes like malfunctioning hardware or software conflicts?
Edit: there is a native component, this is an SWT application on win32.
Most of the times this is a bug in the VM.
But it can be caused by any native code (e.g. JNI calls).
The hs_err_pidXXX.log file should contain some information about where the problem happened.
You can also check the "Heap" section inside the file. Many of the VM bugs are caused by the garbage collection (expecially in older VMs). This section should show you if the garbage was running at the time of the crash. Also this section shows, if some sections of the heap are filled (the percentage numbers).
The VM is also much more likely to crash in a low memory situation than otherwise.
Answer found!
I had the same error and noticed that others who provided the contents of the pid log file were running 64 bit Windows. Just like me. At the end log file, it included the PATH statement. There I could see C:\Windows\SysWOW64 was incorrectly listed ahead of: %SystemRoot%\system32. Once I corrected it, the exception disappeared.
First thing you should do is upgrade your JVM to the latest you can.
Can you repeat the issue? Or does it seem to happen randomly? We recently had a problem where our JVM was crashing all over the place, at random times. Turns out it was a hardware problem. We put the drives in a new server and it completely went away.
Bottom line, the JVM should never crash, as the poster above mentioned if your not doing any JNI then my gut is that you have a hardware problem.
The cause of the problem will be documented in the hs_err* file, if you know what to look for. Take a look, and if it still isn't clear, consider posting the first 5 or 10 lines of the stack trace and other pertinent info (don't post the whole thing, there's tons of info in there that won't help - but you have to figure out which 1% is important :-) )
Are you using a Browser widget and executing javascript in the Browser widget? If so, then there are bugs in some versions of SWT that causes the JVM to crash in native code, in various Windows libraries.
Two examples (that I opened) are bug 217306 and bug 127960. These two bug reports are not the only bug reports of the JVM crashing in SWT, however.
If you aren't using the Browser widget then these suggestions won't help you. In that case, you can search for a list of SWT bugs causing a JVM crash. If none of those are your issue, then I highly recommend that you open a bug report with SWT.
I have the same problem with a JNLP application that I have been using for a long time and is pretty reliable. The problem started immediately after I upgraded from Windows 7 to Windows 10. According to my investigation, it is most likely a bug in Win 10.
The following is not a solution, but an ugly workaround. In jre/bin directory, there is javaws.exe. If I right-clicked /Properties/Compatibility and ticked Run this program as an administrator, the JNLP app started to work.
Please, be aware that this approach could cause security issues and use it only if you have no other option and 100% know what you are doing.

Getting error "Failed to write core dump" while writing a multithreaded program [duplicate]

When a Java VM crashes with an EXCEPTION_ACCESS_VIOLATION and produces an hs_err_pidXXX.log file, what does that indicate? The error itself is basically a null pointer exception. Is it always caused by a bug in the JVM, or are there other causes like malfunctioning hardware or software conflicts?
Edit: there is a native component, this is an SWT application on win32.
Most of the times this is a bug in the VM.
But it can be caused by any native code (e.g. JNI calls).
The hs_err_pidXXX.log file should contain some information about where the problem happened.
You can also check the "Heap" section inside the file. Many of the VM bugs are caused by the garbage collection (expecially in older VMs). This section should show you if the garbage was running at the time of the crash. Also this section shows, if some sections of the heap are filled (the percentage numbers).
The VM is also much more likely to crash in a low memory situation than otherwise.
Answer found!
I had the same error and noticed that others who provided the contents of the pid log file were running 64 bit Windows. Just like me. At the end log file, it included the PATH statement. There I could see C:\Windows\SysWOW64 was incorrectly listed ahead of: %SystemRoot%\system32. Once I corrected it, the exception disappeared.
First thing you should do is upgrade your JVM to the latest you can.
Can you repeat the issue? Or does it seem to happen randomly? We recently had a problem where our JVM was crashing all over the place, at random times. Turns out it was a hardware problem. We put the drives in a new server and it completely went away.
Bottom line, the JVM should never crash, as the poster above mentioned if your not doing any JNI then my gut is that you have a hardware problem.
The cause of the problem will be documented in the hs_err* file, if you know what to look for. Take a look, and if it still isn't clear, consider posting the first 5 or 10 lines of the stack trace and other pertinent info (don't post the whole thing, there's tons of info in there that won't help - but you have to figure out which 1% is important :-) )
Are you using a Browser widget and executing javascript in the Browser widget? If so, then there are bugs in some versions of SWT that causes the JVM to crash in native code, in various Windows libraries.
Two examples (that I opened) are bug 217306 and bug 127960. These two bug reports are not the only bug reports of the JVM crashing in SWT, however.
If you aren't using the Browser widget then these suggestions won't help you. In that case, you can search for a list of SWT bugs causing a JVM crash. If none of those are your issue, then I highly recommend that you open a bug report with SWT.
I have the same problem with a JNLP application that I have been using for a long time and is pretty reliable. The problem started immediately after I upgraded from Windows 7 to Windows 10. According to my investigation, it is most likely a bug in Win 10.
The following is not a solution, but an ugly workaround. In jre/bin directory, there is javaws.exe. If I right-clicked /Properties/Compatibility and ticked Run this program as an administrator, the JNLP app started to work.
Please, be aware that this approach could cause security issues and use it only if you have no other option and 100% know what you are doing.

Locating UI code not on the platform / dispatch thread

I'm currently attempting to debug a medium scale (in the 10's of thousands of lines ballpark) Java project which uses both JavaFX and Swing, and I'm hitting some odd exceptions every so often which I'm pretty sure are because of UI code not being called on the correct thread. The stack trace for these exceptions isn't really helpful at all, since they pretty much all originate from the UI drawing thread.
Now, sure I could sit down with a toothcomb and debug every UI call until I find one that's not being called on the correct thread, and keep doing that for the entire project, but that would be an incredibly long task. Is there some form of easier way to do this sort of debugging? For instance, somehow cause UI code to print out a debug message or throw an exception when it's not been called from its appropriate thread?
Running JavaFX and Swing on the same thread might help fix your threading issues.
There is an experimental feature in Java 8 to run JavaFX and Swing on the same thread:
https://javafx-jira.kenai.com/browse/RT-30694
http://bugs.sun.com/view_bug.do?bug_id=8015477
I think -Djavafx.embed.singleThread=true is the command line property setting to enable the experimental single threading system.
I am not sure if the experimental feature is available in the current Java 8 builds, but I think it might be now, so you may wish to try it.
If you need more information on the experimental single threading feature, you could ask the developers on the openjfx-dev mailing list.
Java 8 has better inbuilt reporting of when code is not run on the correct thread, it's not comprehensive, but it might assist you in locating the source of your error, even if you are not using the single threading option.
Some other users running large applications merging Swing and JavaFX reported similar hard to debug threading issues, so you could check those threads to see if your issues have the same cause.
You could turn on thread checks in glass by -Dglass.disableThreadChecks=false. This would switch on the thread checks in the lowest layer of JavaFX which is responsible for working with OS level APIs. In most cases those checks would be sufficient, because most of the calls are ending up in Glass. These checks would be enabled by default soon.

Possible JInput memory leak

This post checking-for-similar-controllers would seem to indicate that controller connection/disconnection functionality doesn't exist. Our GUI has a requirement to detect when a device gets removed (e.g. cable pulling ) currently it does this by allocating a DirectAndRawInputEnvironmentPlugin object - on a timer (once a second).
However, if the device is left unplugged for over nine hours the app freezes and an OOME is thrown. jvisualvm's memory sampler indicated that the DIDeviceObject had quite a few instances occupying a large chunk of memory which doesn't get released until the app closes. Binaries for the Jinput java code were replaced with library java source code to facilitate debugging etc, after reviewing the constructor for the DirectInputEnvironmentPlugin I noticed that there was a ShutdownHook added as a privileged action. After commenting out the ShutdownHook code, the memory leak was resolved but the code still fails (in a different way) as the library fails to create a dummy window needed for win32 device enumeration. I've tried to build the jinput library to debug the dll but have failed todo so thus far, Java as not been on my radar until now so everything is new !.
Any ideas regarding any of the above gratefully received.
Allocating a new plugin is not something you should be doing, if you need to detect controllers being plugged in or removed, implement the interface that is already there. I've asked for volunteers before to implement it, but suddenly it becomes a lower priority. If you wish to help out JInput and implement the interface, feel free to contact us over at the javagaming.org forums.

Java applet white screen

I'm trying to get to the bottom of a problem with our Java applet based program. It quite regularly seizes up with an unresponsive GUI (or a white screen). This of course only happens when deployed at a customer site :-(. They are running a version of the Sun JVM in 1.5 series (not sure the exact release).
We have a theory that it's to do with the applet running out of heap space - does that sound plausible? The other thing that I have set up on my machine is disabling direct draw, but that was mainly to avoid weird artefacts on other applications.
They are seeing the problem on Citrix and on regular PCs, but obviously there is a limit to what the users on Citrix can do.
Any suggestions?
Running out of heap space should cause an OutOfMemoryError to be thrown. This case sounds like a typical deadlock. To find where that is you want a stack dump of all the threads. IIRC< you can do it through the console, or from IIRC 1.6 the JDK includes jps and jstack.
First of all ensure the customer uses the latest release of the JVM they are using, and make them enable the Java console inside their browser (this requires some research from you).
Then when it happens again, tell them to look at the console window and cut-paste the contents in a mail to you.
In order to solve the problem, you must first be able to reproduce the problem. You will need an identical system in order to troubleshoot this, making one change at a time while keeping everything else equal to determine the cause(s).
Just to add to this answer (to build the knowledge base as I'm currently looking into this).
There's (at least) 2 distinct white screens related to applets.
Deadlock (as mentioned by Tom) - area will not refresh when you drag a window in front of it, so you get the strange tails left effect.
VM crash - area will become white, Java VM closes (search for hs_err_pid*.log, location dependent on browser)

Categories

Resources