how do i integrate jboss with eclipse to run debug process - java

hey guys please help me to find a way out for debugging my application on eclipse helios.
i have to configure jboss and debug my application
please guide me
thanks a lot

If you're deploying your application via Eclipse, then heldt's comment above is enough for you. However, if you're not you can make use of the remote debugging capabilities built-in to the Java platform.
Import your project into Eclipse
Start JBoss in debug mode (make note of the port being used, it's usually 8787) by editing the configurations to look like the following:
set JAVA_OPTS=-Xdebug -Xrunjdwp:transport=dt_socket,address=8787,server=y,suspend=n %JAVA_OPTS%
Use the debugger in Eclipse to connect to the server process on the debug port. On my setup of Eclipse 3.5, I need to go to Run > Debug Configurations, select Remote Java Application from the sidebar, create a new configuration and set the appropriate connection parameters.
Here are are links to a few tutorials that explain this process in more detail:
http://blog.mangar.com.br/?p=53
http://www.jacoozi.com/index.php?option=com_content&task=view&id=119&Itemid=134
http://onjava.com/onjava/2005/08/31/eclipse-jboss-remote-debug.html
http://java.sys-con.com/node/44918

Related

How to hot reload Tomcat server in VSCode

I'm migrating from Eclipse IDE (+ VSCode for coding Java servlets and HTML/CSS/JS webpages, respectively) to only Visual Studio Code for its lightweight.
I have several Java extensions installed for VSCode:
Language Support for Java(TM) by Red Hat
Tomcat for Java
Debugger for Java
Eclipse has a series of settings for hot reloading:
- Automatically publish when resources change
- Refresh using native hooks or polling
while VSCode doesn't seem to have any for me.
A few things I've try to reload my Java and web code:
Restart Tomcat server
Delete and re-adding Tomcat server
Delete and regenerate .war package (not sure if this does anything, it can run well without a .war package)
Good news...
It works automatically now. With Tomcat for Java Extension (And the rest of the Java Extension Pack):
https://marketplace.visualstudio.com/items?itemName=adashen.vscode-tomcat
Just make sure your settings are like this (search for "java.autobuild" to get those two in the first results):
Very important is, that you wont see any logs in the console on the HCR (Hot Code Replacement) like it happens in Eclipse ... but you in fact will see the replaced code behavior. Just debug over the piece of code you changed, and you will see it in fact changed in the running server.
UPDATE: I've found it works better with the 'manual'(default) setting. Just clicking once in the lightning icon. (Testing in Ubuntu 18.04 LTS)
[I say it works better because if I added lines to a Class' code with the 'auto' setting it will not add that code ... only if I change code in the existing lines. But with the manual setting I just save the file, and then click the lightning icon wait ~3 seconds myself and debug over the new code ... and everything goes well!!
... This solves my coding needs(lightweight Editor/IDE with Hot-Code-Replacement in Tomcat)]
Enjoy !
This article may be helpful, I migrate from other IDE to Vscode.
According to the article, if you install Debugger for Java, it enabled Hot code replacement(HCR) and then :
You can start a debugging session and change a Java file in your development environment, and the debugger will replace the code in the JVM running your code.
Hot code replacement for java comes to visual studio code
Install “Tomcat for java” extension in VScode.
Configure the Path of Tomcat in the above extension.
Now you should be able to run tomcat in usual build -> deploy mode. Now install DCEVM, By using “java -jar installer-light.jar”. (Select “Install DCEVM as altjvm”)
Place HotSwap Agent Jar in directory of your choice.
Now In VScode right-click the Tomcat server you have created. (The one from Step 3 ) And select “Customise JVM Options”.
In the file opened, Place “-XXaltjvm=dcevm
-javaagent:/[your_directory]/hotswap-agent-1.3.1-SNAPSHOT.jar” Now Right-click the tomcat server in VScode and select “Debug WAR package”, And select the WAR file.
If everything goes well, The WAR will be start in TOMCAT in debug mode with text “HOTSWAP AGENT” in the log.
Now your every save to your file will trigger Hot Reloading.
https://medium.com/#manoj_makkuboy/hot-reload-java-8-tomcat-server-in-vscode-ba6233d632e?

Remote execution / debugging of Java code from Eclipse (or IntelliJ IDEA)

I'm wondering if there is an easy way to test my code on remote boxes.
What I'd like to do:
Edit my code in Eclipse locally.
Set up a run configuration that points at a remote host (with login
credentials).
Click "run" and have it just work.
The IDE would connect via SSH, copy over or synchronize all of the files in the project to the remote box, run the java command remotely, and let me step through the code in my local IDE.
Possible?
I use Eclipse, but I'd pay for Intellij IDEA if it would do this one thing.
IntelliJ Idea has remote debugging feature.
There is a "remote" debug configuration option available
Run > Debug > Edit Configuration > Add New > Remote
. You have to provide server configuration and connection parameters.
Both the Community Edition and Ultimate Editions have this feature.
I hope this is the feature you are looking.

Eclipse skipping breakpoints

My issue isn't a new one, and I found several threads about it, yet no one was helpful for me.
I hope this one will.
I can't debug with eclipse. It recognizes breakpoints, switches to debug view, but somehow it gets out of sync and I can't debug my code. Sometimes It works, but after a while It happens again.
I work with JDK 1.6.0_24, Glassfish 3.1, eclipse INDIGO (but it also happens on HELIOS).
I tried (as I found in this site) to set eclipse to use Parallel GC. I tried put it in the eclipse.ini file, I tried to put in the glassfish VM arguments itself, and I tried to put it at eclipse JDK additional VM arguments (preference -> installed JRE-> JDK -> etc). Nothing seem to work for me. I also tried them all together.
Help me please..
Thank you all from advance,
Ido
EDIT:
OK, I noticed few more things:
On the Debug view, in my stck trace, I found the exact class with the breakpoint is paused and it had this comment: "(Suspended breakpoint at line XX)". When I clicked the line, suddenly the green line appeared. Yet, as soon as I clicked F6 to continue, It went out of sync again, just the next line became suspended. Weird.
I checked the processes running on my computer and found that there are several "java.exe" processes running at the same time. (eclipse runs on javaw.exe). Maybe this is why glassfish and eclipse refuse to work together.
I checked the build path and found that this is my output folder: project-name/target/classes. Is this good?
Any thoughts?
Ido
So, I couldn't fix this but I found a workaround that completely solves this - FINALLY!.
I just stopped using glassfish WTP for debugging and set a remote debug to my local glassfish. it works perfectly with few minor annoying things - but breakpoints finally noticed.
Set remote debug
Go to your glassfish admin console and set your glassfish to work on debug mode.
Click on configuration --> server-config --> JVM settings, and check debug enabled check box.
Restart server
In eclipse - start server on normal mode (not debug - it is useless).
Go to Debug configurations and locate "Remote Java Application"
Create a new Remote java app debug config
Enter name (lets say Glassfish-Debug)
Choose project to debug
Enter your own IP address in the host section and set the port to 9009
This is optional but it is more comfortable to work with:
Go to "Common" tab, and check the Debug check box. This will make this Glassfish remote debugging configuration constant on your debug menu.
That's it. Now all you have to do is always start your Glassfish in normal mode and then go to Debug configurations and run This Glassfish remote debugging you just set.
And now I'm getting to the annoying part: After rebuild your project, sometimes you might get again out of sync. You just need to disconnect the remote debugging session and run it again. Small price to pay.
I hope it helps..
I had faced similar issues, But it turned out to be a simpler problem of multiple versions of JREs/JDKs installed.
Try Debug -> Run Configuration -> JRE -> Alternate JRE -> select JDK 1.6.0_24.
Also check for project build paths if correct Jars are been used.
Hope this helps.

hot-replace debugging with maven on jboss

I'm currently using jboss/maven/eclipse to debug a web app. I've enabled remote debugging in the jboss run.conf file and then use mvn war:inplace to compile and with that I can successfully add a breakpoint and step through code.
However I remember a while back using Tomcat I was able to hotswap or hot-replace a java class by making changes, saving it and then having the debugger re-enter the method. I'm thinking there has to be a way to do this but don't know how.
You can try JBoss Tools Eclipse plugin, or if all else fails, JRebel (however, its not free).

Is it possible to debug GWT client code on a REMOTE server using IntelliJ 9 Community Edition?

I'm trying to move our Google Web Toolkit (GWT) development from Eclipse to IntelliJ 9 Community edition. So far I've been able to run and debug client/server code successfully via the GWT Maven plugin and its embedded Jetty container.
However, I'm having trouble debugging client code when it is already running on a remote machine (and hence there's no need for the embedded Jetty container).
Has anyone been successful at achieving this? Any help would be appreciated!
UPDATE: I was finally able to accomplish this. Please see my own answer below...
I was finally able to accomplish this by using GWT's DevMode class, as described in the documentation.
In short -
Add your project to IntelliJ 9 Community edition
Add an Application run/debug configuration
Use com.google.gwt.dev.DevMode as your main class (make sure to include gwt-user and gwt-dev jars to the project classpath. See here)
Add the following program parameters:
-noserver -war "[full path to your exploded war]" -gen "[full path to generated files]" -logLevel INFO -port [remote server port] -startupUrl "[URL of the remote page]" [com.company.YourEntryPoint]
This way, the DevMode runner will not instantiate the built in container and will allow your remote server's JavaScript to be debugged in its original Java form.
Note that for builds that don't require debugging remote client code you may use Maven or Ant integration, which is much simpler. I don't have any experience with the webAppCreator generated build.xml, but with Maven you could simply run the gwt:run or gwt:debug goals with this parameter: -DrunTarget=
Hope it helps!
When running a GWT app deployed on a remote server, the client part of your app will have been translated into javascript so I do not think you will be able to debug this from IntelliJ. The server side part of your app will still be Java code. You should be able to start up this remote server with java debugging parameters (things like a transporttype and a port to listen to). From IntelliJ, you should be able to start up a remote debugging session using the same transporttype and port.
If you look into remote debugging, you should be able to find how to do this.

Categories

Resources