Eclipse debug mode not opening - java

I am building a web application with Google Web Toolkit (GWT ) framework.
When i try to run the project in debug mode , it runs normally as in "run" mode itself. I dont get the debug perspective also.
To see if it was problem with my eclipse , i created a simple HelloWorld java application and the debug mode works perfectly .
In a seperate thread with similar issue it was advised to update JDK version. Which i did , but still didnt help
Why when starting GWT in debug mode, my break points don't break
Please help

Try Changing the perspective to Debug.
Windows -> Perspective ->Open Perspective ->Debug

I was able to make the breakpoints work. Basically i was trying to put breakpoints in the onmoduleload method which is in the client side packages. Looks like debug for client side is not provided in eclipse.
I was able to put breakpoints in Serverside classes and the breakpoints were hit.
For client side apparently we can use chrome and view source and see the breakpoints.I am yet to try it

Related

GWT 2.7.0 Super Dev Mode, don't recompile server side code after change

I am starting to learn GWT.
I've picked up newest version (2.7.0).
I have wrote Entry point class to display start page and to call rpc to server to execute some function.
Every change I made in client side source code in Entry point class, cause auto recompile (hot swap), so I can see immediatly changes, that I've apply.
My problem is that it works only for client side code.
It dosen't work for server side code. To see changes in server side code, I have to stop server and console, and run it again, which is very very annoiyng.
So my question is:
Is it normal behaviour of gwt app server in SuperDevMode in 2.7.0 version? Or am I doing something wrong?
How should I deal with that?
Please give me your thougths about it.
By the way: I use GWT with eclipse and Google plugin.
EDIT
I wonder what about Maven GWT projects? How to deal with them?
What you describe is normal behavior.
There are several ways to reload the server side code when refreshing without restarting your server:
The built in web server does support hot swapping code, but only if you do not modify method or class signatures. If you do change them (or add a class or method), a server restart is required.
You might need to configure your Eclipse to auto re-publish any code changes to your web server.
There are 3rd Party Eclipse plugins which improve the hot code reloading mechanism, for example JRebel, which allows hot code replacement even if you change method or class signatures.
There's a "reload webapp" button in DevMode. It's in the "Jetty" tab when using "bare" DevMode, and a yellow double spinning arrow in the Eclipse view when using the GPE. It'll restart the web app just as if you redeployed it in a standalone server.
I found this solution:
https://github.com/jbarop/gwt-hotdeployment
It seems to do the job for developer.
But it is quite old.

How to refresh server code for GWT in IntelliJ (dev mode)?

When running a gwt project in dev mode in IntelliJ, if I make any changes to the server-side code, I need to actually stop and run the app again in order for it to be updated.
Is there any other way to refresh the server-side code, so the whole app doesn't have to be restarted?
GWT server code is real Java code, so no, you can't do that by default. However, you could use JRebel (commercial) to achieve what you want.

GWT Refresh Compile Cycle

According to what I have read concerning gwt, whenever we change the java code and reload the browser, the change is reflected. This is true for client side but not true for localhost serverside.
Does somebody know how to refresh the server side as well on browser refresh for gwt or is it not possible??
If you're executing your GWT webapp from Eclipse. You only need to go to the "Development Mode" tab and use the "Reload Web Server" option.
You can use hot deploy with Eclipse, Netbeans, IDEA etc. But for this usage you must use debug mode. In addition, IDE loses its state because of many changes so debug mode must be restarted.
I think there is no way to refresh changes and I think keyword is hot deploy
If your run GWT in Development mode within Eclipse, with a Spring backend Eclipse is usually clever enough to hot deploy server-side class changes, but not all of them.

Launching Eclipse as a debugger

What’s the equivalent of
System.Diagnostics.Debugger.Break();
in the Java world?
Purpose: I have a tomcat based webapp launched by a custom build tool and need to debug the application in eclipse. In the .net world the above statement when encountered will prompt the OS to attach a debugger and I can attach Visual Studio to debug. I am trying to achieve the equivalent in java with eclipse
Here's an excellent article on remote debugging using Eclipse. They even have a section discussing Tomcat.
Here's a link that I used to debug web apps on Tomcat. It goes through installing Eclipse, Tomcat and Java and then setting up Tomcat to run in Eclipse. Towards the bottom explains how to debug a servlet in Eclipse.
http://www.windofkeltia.com/j2ee/wtp-tutorial.html
In general the Java program cannot tell if the JVM runs in debug mode or not, and there is no way to from your program to say that you always want to start a debugger HERE.
You can, however, tell the DEBUGGER that you want to have a breakpoint at a given location, and you will then enter the debugger when the program reaches that spot.
EDIT: You will need to investigate your launcher to see how you can trick it to contain the options needed to enable debugging in the JVM. You may also see if jvisualvm can give you the information you need as it can attach to an unprepared Sun JVM.

How do you debug a Rails application?

Is it possible to debug a Rails application in a similar way to a Java application - setting breakpoints and stepping into the code?
What are the best tools for this?
I have a hybrid Java/Ruby on Rails application which I can run in Eclipse or Netbeans.
I would like to step into some code in this app and try to figure out the cause of a problem I'm having.
In Eclipse if I set a breakpoint in my blog_controller and then choose the 'Debug' button, it seems to use the ruby-debug-ide gem to execute the code but I get this unhelpful output and no option to step into any source:
Fast Debugger (ruby-debug-ide 0.4.5) listens on localhost:56726
./war/WEB-INF/app/controllers/blog_controller.rb:1
C:/Ruby18/lib/ruby/gems/1.8/gems/ruby-debug-ide-0.4.5/lib/ruby-debug.rb:101:in `debug_load'
C:/Ruby18/lib/ruby/gems/1.8/gems/ruby-debug-ide-0.4.5/lib/ruby-debug.rb:101:in `debug_program'
C:/Ruby18/lib/ruby/gems/1.8/gems/ruby-debug-ide-0.4.5/bin/rdebug-ide:82
C:/Ruby18/bin/rdebug-ide:19:in `load'
C:/Ruby18/bin/rdebug-ide:19
Uncaught exception: uninitialized constant ApplicationController
I'm not sure if I'm doing something wrong or if this is all I can expect.
The debugger I use the most is the ruby-debug gem, which is a gdb-esque command line debugger. Once you learn a few commands it is very quick and effective, and provides you with some handy features like being able to fire up irb in the context of your program and make on-the-fly changes.
And being command line based it comes in handy when you need to debug a on a remote server.
You can expect more. I have used Aptana's RadRails version of Eclipse to debug a Rails app as you describe--setting breakpoints and stepping through the code.
You may be doing something wrong. It looks as if it is trying to debug an individual controller file, rather than debugging the Rails app. When I try to execute a controller file from the command line, I get a similar message:
C:\workspace\myapp\app\controllers>ruby users_controller.rb
users_controller.rb:1: uninitialized constant ApplicationController (NameError)
In Aptana RadRails, I choose Run > Debug As > Ruby Application to debug the app.
For the vim users I strongly recomend looking into the vim-ruby-debugger, which fits in great with Tim Pope's rails.vim scripts.
It gives you a handy :Rdebugger command, allows you to set breakpoints and open a split window to display variable values.
maybe not relevant, but I wanted to post somewhere: got the error: "undefined method `run_init_script' for Debugger:Module" running the debugger in rails 2.3.2. Did a sudo gem install ruby-debug and the problem went away.
I'd recommend just setting up breakpoints (I actually just puts to console) for 99% of debugging with RoR - this method is simple and usable across any IDE, so you never need to learn how a new debugger works.
Actually, I had the same problem with Aptana. Run > Debug As > Ruby Application just doesn't work. I finally made the debugger work by going to the Servers tab, and then start the server in debug mode. After that, set some breakpoints and trigger the corresponding action. Hope this helps.
Debugging? That's just knowing where to look in the case of Ruby (and by extension, Rails) most of the time.
The problem in this case is that you probably still have your ApplicationController called application.rb where it should be renamed to application_controller.rb.
Debuggin in rails is simple if you know how to read the error stacktrace!! But if you need to explicitly watch out the values during the runtime then u can use the rails breakpointer.Below is the link to how-to on breakpointer ..hope this helps!!!
http://destiney.com/blog/rails-breakpointer
I can't speak for Eclipse (never worked well for me) or Aptana (not tried) but from experience I can say that both NetBeans and RubyMine will do what you want. I both cases you should probably make sure that the ruby-debug-base and ruby-debug-ide gems are up-to-date: RubyMine in particular didn't work for me until that was done.

Categories