I have a very simple javafx program that embedded in a website and loads a webpage from URL
this works perfectly fine in standalone version, but when I embedded it in a website and click on this one particular webpage, most of the time it will hanged but once a while it will work fine. This page work completely fine in standalone version.
I believe Java is stuck on canvas division which displays a graph from live data, When Java hanged, it takes 50% of my cpu usage, as much as when its loading the webpage.
My guess the problem is the webengine keeps loading the live data non-stop and caused the hang, is there a way to set a timeout of the load?
or is it a different problem that i am not aware of?
I find it odd that your CPU usage stays high during the hangs, but you could try adding the VM argument
and adjusting your java settings to show the java console by default with a trace setting of 5. This way you can see exactly what's happening (security-wise) when it appears to be hanging. The standalone version would most likely only differ in the aspect of whether or not a security manager is present, so that's what I would suspect.
I just try that,
when I clicked on the page that going to hang, it shows that it makes many connections the the site through direct proxy, then loading and loaded certificates and then stopped, java and console both hanged, couldnt get more information.
when the webview loading a page, my cpu does ramp up to 40ish %, and stay at 50% when it hangs.
I tried using different version of java and I still get the problem.
Java 6 wouldnt load, and using java 7 u17 still get the problem
You could try to grant your application <all permissions> and see if it still hangs, but it might be easier to see if the site you're connecting to has its reverse DNS entries set up correctly.
The security manager tries to run a reverse DNS lookup on whatever site you try to connect to (for whatever reason). If the reverse DNS isn't set up properly, this could affect the timeout.
One other thing that would affect the timeout that I can think of off-hand is if you have a server listening on the port you're trying to connect to that doesn't understand HTTP requests. The security manager looks for a crossdomain.xml file at the root of the site in one of its checks, and if your server doesn't respond, the security manager will hang until the connection times out. For example, if you try to connect to example.com:4450, the security manager sends a HTTP request to example.com:4450/crossdomain.xml
The information provided here isn't documented at all by oracle, so I can't link you to a reference...I had to find it all out the hard way.
Hope it helps, be sure to post a follow-up in any case.
the application does have all permissions on all files.
how do i check if the site i am connecting to has reverse DNS? Its a site under CISCO, i would assume it has it setup correctly.
I tried access the the crossdomain with www.example.ort/crossdomain.xml, it says 403 forbidden, probably not a correct way of doing it
I'm afraid that the next step in debugging this is either profiling, or source code tracing if no one else has any suggestions.
If you decide to trace the source code, you'll need to access the src folder that should have came with your JDK as well as decompile whichever libraries that are shipped with the JRE that you're using. I had to do this last week, and it took me roughly a day and a half to find the root cause(s) in my particular case. You've confirmed that your problems are not the same as the ones I recently came across, so I'm out of ideas.
i think i may have found something, I tried to recreate the application from scratch, with default resolution 800 x 600, it works no problem embedded in html
but when I change the resolution to 1280 x 720 then it hangs again,
I tried setting the resolution using code
so the problem actually is not caused by java security manager, it hangs when I trying to stretch the content
even so, i dont know how to fix that... haha
i tried with different resolution sizes and found out that anything greater than 900 width will cause the issue to appears
also, i notice the crashed page is wider than others with a horizontal bar, whereas other pages dont
I’ve looked at a lot of different solutions, and in my humble opinion Aspose is the way to go. Here’s the link: http://aspose.com
subject: webview worked in standalone version but hangs when embedded