• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Liutauras Vilda
  • Paul Clapham
  • Bear Bibeault
  • Jeanne Boyarsky
Sheriffs:
  • Ron McLeod
  • Tim Cooke
  • Devaka Cooray
Saloon Keepers:
  • Tim Moores
  • Tim Holloway
  • Jj Roberts
  • Stephan van Hulst
  • Carey Brown
Bartenders:
  • salvin francis
  • Scott Selikoff
  • fred rosenberger

Nothing shows in Eclipse Console View when Remote Debugging Wildfly

 
Ranch Hand
Posts: 70
Eclipse IDE Firefox Browser Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello,

Previously, I was running both Eclipse Oxygen and Wildfly 10 in the same Virtual Machine. When I debugged in Eclipse I would right click the Wildfly server in the Servers View and select "Debug". I could set breakpoints and the Wildfly log appeared in the Console View.

I have recently upgraded to Eclipse 2020-06 and Wildfly 20 but this time they are each running in a separate VM. I now start debugging by running the Remote Debug Configuration and then I start Remoter debugging with <Alt><Shft>d,r.

The breakpoints are triggered so that is working well but nothing is showing in the Console View.

How do I get the Wildfly log to appear in the Eclipse Console View as it did previously? Other than version upgrades the only significant difference is that Eclipse and Wildfly are no longer running in the same VM.

Thank you in advance.
 
Saloon Keeper
Posts: 22658
153
Android Eclipse IDE Tomcat Server Redhat Java Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Eclipse provides debugging services by adding a GUI overlay to the command-line debugger that's built into every JVM. But in order to debug, the target JVM must have been started with debugging enabled and Eclipse has to know which network port number the JVM being debugged is using.

Enabling debugging on a JVM is at its root a command-llne option, although complex Java apps (like WildFly) may get that option's value from a config file or environment variable. Check the WildFly docs.

The JVM's debugger setting (on/off and port number) are referenced only at JVM startup time. You cannot switch the JVM debugger on and off later, only connect and disconnect  from remote clients (like Eclipse).
 
Master Rancher
Posts: 4700
49
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The debugging's not the question, really.
It's whatever special bit that existed in the Eclipse/Wildfly set up where they were in the same JVM.
I expect that's it, though. Wildfly was running int he Eclipse JVM, so used the same Sys.out, which would be the Eclipse console.
Now it's in its own JVM they no longer share an output stream, so Wildfly's output no longer appears in the console.

Personally?
I would run up Wildfly outside of Eclipse entirely, then you can watch the Wildfly console in a terminal if you want.
 
Tim Holloway
Saloon Keeper
Posts: 22658
153
Android Eclipse IDE Tomcat Server Redhat Java Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Actually, no.

When you launch an application in Eclipse, it gets its own VM. Remote debugging is thus used whether or not Eclipse launched WildFly or you launched WildFly independently. The only difference being that when Eclipse does it, it already has knowledge of both ends of the pipeline whereas if you launch independently you have to let Eclipse know what the IP address/port of the WildFly JVM is.

You really wouldn't want Eclipse to debug apps of any sort within its own VM. Current mainstream JVMs don't partition themselves well enough to ensure that all the crud from a buggy program wouldn't contaminate the Eclipse processes and data.
 
Al Koch
Ranch Hand
Posts: 70
Eclipse IDE Firefox Browser Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks to Tim and Dave but do you have any idea what I'm actually doing wrong/missing that is causing me to no longer see Wildfly output in the Eclipse console when both were previously running in the same VM? What exactly do I need to do to get this working again?
 
Tim Holloway
Saloon Keeper
Posts: 22658
153
Android Eclipse IDE Tomcat Server Redhat Java Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I suspect that what you're really doing wrong is writing to stdout (System.out.println) instead of logging.

The Eclipse console window is a stdout capture and since Eclipse didn't start and doesn't own the externally-started WildFly, it cannot redirect WildFly's stdio streams.

Then again, you should never use stdio (System) input/output in a web application. Officially, stdio does not exist in a webapp, and while technically it does in a webapp server (since that's a Java command-line application), the webapp server has the right to send its stdio streams anywhere it pleases. Including straight to the Twlight Zone.

WildFly does have its own logging and there may even be a log display function in the WildFly console. I haven't looked lately, but I know there is in IBM's WebSphere. If not, the stdout/stderr would by default got to the command-line window that WildFly was started in. Unless Wildfly wants to send it somewhere else.

Having said that, there's probably some way that you could redirect WildFly's stdout stream via a named pipe to some sort of Eclipse plugin if you absolutely, positively MUST see output there. But it's a lot of trouble for what's usually veru little reward. As I said, the webapps have to do their own logging and as long as the webapp deploys properly, there usually isn't going to be much of interest the WildFly's server log, since that only tells you what the server itself is doing.
 
Al Koch
Ranch Hand
Posts: 70
Eclipse IDE Firefox Browser Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Tim,

As with several other recent posts your responses contain helpful "background" info

Both Wildfly and our servlet use Log4j to log (by default) to system.out/console. (Our servlet also used log4j to log to a set of rotating files for a history.)

In the past, this has been very helpful for quick debug message monitoring of both a Wildfly startup failure or servlet bug. (This was for Wildfly as a dev server.) For local infrastructure reasons we've now upgraded both Wildfly and Eclipse to current versions and also installed them into different VMs. In the past when both Wildfly and Eclipse were running in the same VM the Eclipse console "automatically" showed the Wildfly console output in the Eclipse Console View. We never had to configure this and assumed that JBoss Tools set that up.

As I understand it, even when both systems were in the same VM Eclipse launched Wildfly in a JVM different from its own JVM so I don't understand why this is now failing; it would seem that since Eclipse and Wildfly have been set up to to support remote deployment and debugging that JBoss Tools would have also gotten the "console capture" working.

Any other ideas?

Thanks again.
 
Tim Holloway
Saloon Keeper
Posts: 22658
153
Android Eclipse IDE Tomcat Server Redhat Java Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Eclipse cannot do "console capture". What you see when Eclipse launches a Java application is that the Eclipse application spawning process has the option to redirect stdin, stdout, and stderr in the environment that the VM will be run in. You can see this option on one of the Run/Debug dialog tabs if you have an applicable run configuration defines. You can't do that when you connect to an already-running application, since the stdio streams are set up when the external launch is done. Same as the debugger itself. It's a startup option, not switchable at runtime.

Again, stdout is a terrible place to log webservers and webapps to, even when using a logger. In production, the server itself typically runs as a detached process, a/k/a Windows System Process or Unix/Linux daemon. Such beasts are by definition non-interactive. Conventionally, in Unix/Linux, you'd have a dedicated directory where logfiles went such /var/log/wildfly. Windows isn't as tidy, so I'm not sure what common practice is. Another complication in Linux is the way that systemd has been slowly eating a lot of the traditional systems mechanisms and that evolution is still ongoing.

So really stdout is only a safe solution for running on development and debugging systems.

Having said all that, on Linux, there is a possible way or two for you to get what you want.

A) There's at least one command shell plugin available for Eclipse that can be used to run stand-alone applications from within Eclipse. I've used one that employed ssh to allow Eclipse to do command-line things on remote systems, in fact. If you launch WildFly that way, the shell plugin will have its stdout/stderr displaying in its console window.

B) A very old and popular trick to monitor output in real time when stuff is being directed to a logfile is via the Unix "tail" command. For example:



The -f option indicates to follow changes to the logfile and display them to stdout. It's not "capture" as such, but close enough. You can run this from a command window on your PC desktop or via a command-shell plugin like what I mentioned in item A), above.



 
On my planet I'm considered quite beautiful. Thanks to the poetry in this tiny ad:
the value of filler advertising in 2020
https://coderanch.com/t/730886/filler-advertising
reply
    Bookmark Topic Watch Topic
  • New Topic