views:

33

answers:

2

Hello,

My problem is with respect to debugging web application on an already installed glassfish using eclipse.

If I create a web project using eclipse then eclipse will let be deploy and debug application on an already installed glassfish application server. However, if I have created a web project using maven archetype, eclipse does not let me debug the application.

I can use maven's jetty or tomcat plugin and debug the application but I need to debug application on an already installed glassfish. Basically I have followings 1) Web application created using maven archetype 2) Eclipse IDE 3) Glassfish which is already installed outside of Eclipse IDE

I came across maven's glassfish plugin but as far as I understood it is not for debugging the application.

Please let me know your suggestions.

Thanks

A: 

I don't know about eclipse, but IntelliJ IDEA has a remote debug feature. You start your server with something like

-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=5055

and then the IDE will connect to that port and you'll have a regular debug.

I'm sure eclipse has this feature.

EDIT: This article shows how to use this feature with eclipse.

tulskiy
Thanks Tulskiy,
Chir
How will eclipse know that it should debug a particular web application and not others which might be running at the same time. The scenario is that the web application will be packaged and deployed using maven. Please let me know... Thanks
Chir
One more question. In case of regular eclipse project debugging, if any change is made to the source file, eclipse will rebuild the project and deploy it again, a kind of hot deployment. Will it be possible in maven based web applications and already installed glassfish. Thanks in advance
Chir
@Chir: hmm, that's a good question, I don't know. I used it with WebSphere, deployed with Maven, and it just stops wherever I have a breakpoint. And it will not recompile/redeploy your app, you'd have to do it yourself.
tulskiy
A: 

If I create a web project using eclipse then eclipse will let be deploy and debug application on an already installed glassfish application server. However, if I have created a web project using maven archetype, eclipse does not let me debug the application.

This is not true. Whether you use the Maven Eclipse Plugin (which provides WTP support) or m2eclipse (with the optional Maven Integration for WTP installed from the m2eclipse Extras), you can deploy a project created outside Eclipse to an existing "Server" (that you can start in Debug mode), as long as you imported it appropriately (Import... > Existing Project into Workspace if you use the former, Import... > Maven Projects if you use the later).

Basically I have followings 1) Web application created using maven archetype 2) Eclipse IDE 3) Glassfish which is already installed outside of Eclipse IDE

I use the same setup with several projects with no problem (and can debug them on my locally installed GlassFish server).

I came across maven's glassfish plugin but as far as I understood it is not for debugging the application.

There is no need for extra Maven plugins, you can just rely on your IDE if you follow the right steps.

Pascal Thivent
Thanks, I will try it out
Chir
Thanks Pascal, I followed complete steps and now I can debug maven based project in eclipse.
Chir
@Chir You're welcome.
Pascal Thivent
@Chir BTW, feel free to mark the answer as accepted then (the green tick below the vote counter on the left) ;)
Pascal Thivent
I ran into another issue. In addition to a maven web project, I have maven ejb project. Both are independent project. Both of them are imported into eclipse. I have declared a dependency for web project on ejb project through eclipse. I can debug web project but when I refer to EJBs of ejb project and deploy the application on Glassfish it throws ClassNotFoundException when deploying the web project. I tried resolving the issue but could not. Please suggest. Thanks
Chir
@Chir This is somehow a different question and I'm not going to discuss it in a small comment box. Please open a new question and provide full details.
Pascal Thivent