Is it possible for GWT to give the stack trace for the original Java code after a crash, as opposed to the JS stack trace?
I'm using Chrome 17.
It depends on what browser you're using at the time of the crash, but GWT has built functinality for emulating Java stack traces. Make sure you are compiling and implementing the symbolmap files in your war directory with your cache js files.
Another option is to compile with the output style set to "Detailed", and then looking at the raw javascript in any standard browser javascript console will point you to the right place in your Java code, as nearly every line in the javascript refers to a fully-qualified class name and method.
It is possible to get the original stacktrace but you have to perform Deobfuscation
We had similar issue. It works fine, and with latest GWT version even shows line numbers.
Notice to my comments for Thomas Broyer answer.
Related
See here for original question.
I'm writing a Java service, using Jetty for Webserving and SQLite for database storage. Source is available here.
I found that, although the service ran stably from my laptop, when deployed to an EC2 instance it would crash with no obvious error message in output somewhere between 1 hour and 2 days from starting up. I added some logging options to the startup call (-XX:+HeapDumpOnOutOfMemoryError -XX:HeapDumpPath=...), and got this crashlog.
This is the first time I've encountered such a file, and at first glance it doesn't seem very obvious which part of it refers to the actual error and which parts are just giving contextual information, so I'd really appreciate any good guides to understanding it. In particular, it looks like it's trying to interact with ZipFiles, which I don't use in my project.
This answer links to a blog which was -1'd in the answer comments
This answer links to some Oracle documentation, which I would normally be overjoyed at, but it appears to be a general debugging guide - can't see anything in there about hs_err files (though that may become clear on further reading)
This result from Google claims that "whatever Java code you execute, JVM should never crash. If it does, it is just a JVM bug. So try to log a defect with Sun with all details and hopefully they will look into that.", which sounds pretty absolutist - I think it's highly unlikely that my little toy project has uncovered a JVM bug!
Crashes in Java_java_util_zip_ZipFile_getEntry are most often caused by concurrent access to .zip files, e.g. a file is overwritten while an open instance exists.
See JDK-8042197, JDK-8031691 for details.
BTW, as to original question, here is a presentation on JVM crash dump analysis.
Looking at the crashlog, it appears that something you were unpacking (jar file or zip file) resulted in a JVM crash.
If this occurs during startup, try adding this to your JVM command line to see which file it was possibly working on.
java -verbose:class [more command line]
Is there a way to include whole Java source code into an eclipse project so the program is easier to debbug (e.g. by inserting println in methods you otherwise couldn't insert anything)?
I have a bug in my code. But to better understand why the bug in my code appears, I'd like to see what intermediate results in some system method (on which use the bug occurs) are.
For example, I'd like to know what JViewPort.scrollRectToVisible() exactly does and how my input behaves in it by printing out some intermediate results that occur in the method itself.
EDIT:
Instead of using JRE System Library X, I want to add the source code from JDK as if I had written the code myself. I want to be able to edit any System class just as I am able to edit any class I created myself. I want editable .java files, not packed .jars...
You would need to add the 3rd-party library to your Eclipse workspace as an project. (How you would do that depends on the code you are dealing with.) Once you have done that, you can hack your copy of the library to add trace prints etcetera.
A better alternative is to simply attach the source code for the 3rd-party library so that the debugger can show you source as you step through the code, set breakpoints,. Then use "advanced breakpoint" techniques instead of trace prints; e.g. http://www.vogella.com/articles/EclipseDebugging/article.html#advanced
You cannot change the library code, but you can view it by using de-compiler. The max you can do is this. Now if you change any code in the libraries which you reached via the de-compiler, you would find an error stating "the integrity of the .jar package has changed which is not allowed"
Eclipse have built-in support for what you wanna do.
All you have to do is set breakpoint and execute application in debugging mode.
You can use these icons in Eclipse debugging perspective.
Follow along Eclipse Debugging Tutorial for details.
I'm reading pdf files with python. And in my script, i'm calling a jar file by command line using os.system.
Two things here:
OSX annoyingly keeps redirecting me to desktop everytime the jar is called. I can optmize that, but I don't want OSX to do that; and
Isn't there a way to no actually open java internally ? Like attaching the code inside my python script. Let's just say I don't want the user to see java being opened.
Thanks in advance.
You may want take a look at similar discussion here. To summarize the discussion, you can use Py4J.
There is also another project called JPype, however that seems to be a very old implementation (way back in 2009) and no updates thence.
I just started working on a huge gwt project and asked myself if there is a smart way to find the gwt java classes while researching the HTML with firebug (or simular).
For example, I've a table somewhere on a html page and need to find the gwt class which generated this table.
I'm using gwt 2.4.0, eclipse 3.7, mostly firefox with firebug and the gwt-development-plugin.
You want to use the debugId:
http://ars-codia.raphaelbauer.com/2011/02/when-gwts-debug-ids-come-in-handy.html
You'll need to enable the debug module for that: http://google-web-toolkit.googlecode.com/svn/javadoc/2.4/com/google/gwt/debug/client/package-summary.html
The only way I can think of is finding the table's ID (if it was set) or other attribute and searching through your Java code to see where it was set.
GWT generated code is highly obfuscated, and the variable names are changed to something smaller to save space - so there's no "easy" way to discover the original code from the JS.
You can also set the "Output style" of your compiled JavaSript to detailed, then it keeps the varible and class names of your Java project.
However this will make your JS files 100 times bigger and it never helped me debug an application. I actually found all my errors using the debug mode in eclipse! Code which didn't work correct in compiled mode also didn't work in the emulated debug version (when debugging, they are simulation the JavaSript functions with Java over the browser plugin).
Recently two of our clients have reported problems with our applets. Looking at the java plugin console it is full of ClassNotFoundException so none of our code is executed.
I've been able to reproduce the stack trace using a virtual pc image with 0 free space on disk, but the problem goes away as I restore some disk space, and the users tell me that their disk is not full; they are able to create new files.
Our applet requires java 6, and the problem has appeared with updates 1, 10 and 14 of the jre. We have also tried different browsers (IE and Firefox), clearing the browser and java caches, ...
How can I debug or trace what is the jvm doing to load our applet?
I suppose that the problem lies on some security directive on windows so I'm using Sysinternal's Process Monitor to log the activity but I don't really know where to look at.
The Java cache is most likely messed up. Open Java in the Control Panel and get rid of all temporary files to see if it goes away.
Logging in the Java Console for loading applets can be enabled which helps quite alot (even if the plugin is extremely cryptic). See http://java.sun.com/javase/6/docs/technotes/guides/deployment/deployment-guide/tracing_logging.html
I've been looking at the plugin source from the JDK and I've found that there is additional debug info available in the logs setting the environment variable JPI_PLUGIN2_DEBUG.
Unfortunately I still only see ClassNotFound exceptions.
I've found a piece of the plugin code that swallows all exceptions, so maybe my users problem is there...
had similar problems a while ago. In our case, the problem seems to be how the applet tag is set up on the web page. If it is in a wrong order or contains the codebase attribute, it fails with 6u10+. This works for us:
<applet name="DMGANTT" archive="DMGantt.zip" code="dm.applet.DMGanttApplet"
width='100%' height='100%' mayscript="mayscript">
We had a similar problem with one of our clients. We discovered that it was a strange bug in some versions of Java related to proxy configuration on the client. See this article for the details
http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6723715
Also, our applet failed with new versions for a different reason.
Now, in similar cases I ask them to check javatester.org, so that I can see if applets (in general) load OK in their browser. If that page loads OK, its a problem on our applet (or page). Else it's a problem in their configuration. I help them anyway but it's easier to debug.