aspose file tools*
The moose likes JNLP and Web Start and the fly likes webview worked in standalone version but hangs when embedded Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » JNLP and Web Start
Bookmark "webview worked in standalone version but hangs when embedded" Watch "webview worked in standalone version but hangs when embedded" New topic
Author

webview worked in standalone version but hangs when embedded

Azure Iaorth
Greenhorn

Joined: Mar 04, 2013
Posts: 10

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 tried signing the applet with:

however i still see the security warning when running the applet, but if i check certificate details it shows all my info and its valid until 2014

after i did this, i still have the same problem.
its strange that it only happens to this particular page, is it because this page required some extra certificates?

thanks.
Luke Leber
Ranch Hand

Joined: Sep 20, 2013
Posts: 45
    
    2

I find it odd that your CPU usage stays high during the hangs, but you could try adding the VM argument

java.security.debug=all


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.


http://www.linkedin.com/in/lukeleber
Azure Iaorth
Greenhorn

Joined: Mar 04, 2013
Posts: 10

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

is there anyway to disable the security manager?
Luke Leber
Ranch Hand

Joined: Sep 20, 2013
Posts: 45
    
    2

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.
Azure Iaorth
Greenhorn

Joined: Mar 04, 2013
Posts: 10

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
Luke Leber
Ranch Hand

Joined: Sep 20, 2013
Posts: 45
    
    2

This site has never failed me for determining if reverse lookups are working properly.

http://remote.12dt.com/
Azure Iaorth
Greenhorn

Joined: Mar 04, 2013
Posts: 10

I tried using that with the IP I got from wireshark, and it did resolved to top level domain.

any other ideas?
Luke Leber
Ranch Hand

Joined: Sep 20, 2013
Posts: 45
    
    2

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.

Sorry I couldn't help.
Azure Iaorth
Greenhorn

Joined: Mar 04, 2013
Posts: 10

I probably wont have the time nor skill to trace the source code, what kind of profiling were you talking about?
you already helped me a lot,
thank you,
Azure Iaorth
Greenhorn

Joined: Mar 04, 2013
Posts: 10

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

and the embedding javascript


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
Azure Iaorth
Greenhorn

Joined: Mar 04, 2013
Posts: 10

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 agree. Here's the link: http://aspose.com/file-tools
 
subject: webview worked in standalone version but hangs when embedded