Intellij IDEA (Ultimate) with Glassfish 5.0 (Local) Debugger Settings - java

I have a Java Web Application and a web container Glassfish 5.0 with some custom java agent attached to the container.
I want to Debug my application as well as attach a Remote Debugger to Debug my Agent code simultaneously.
I am using Intellij IDEA Ultimate.
Now in the Intellij Run Configuration for Glassfish, I do the usual settings with some domain name. For Debug options "-agentlib:jdwp=transport=dt_socket,address=9100,server=y,suspend=n"
I want to make 'servey=y, suspend=y' , NO COMPROMISE ON THAT.
I try doing that by changing the 'domain.xml' but when I open my intellij glassfish configuration setting it gives me 'Warning : Debugger Settings are Invalid...' , I click Fix and the domain.xml is changed back to default with 'server=n,suspend=y'.
I tried changing from the Glassfish Administration console as well, both the default-config and server-config, but no luck.
WORKAROUND : I can deploy a WAR / Exploded WAR of my Application in glassfish domain folder, and customize 'domain.xml' and run the domain in debug mode ./asadmin start-domain --debug domain1, then I can successfully attach a Remote Debugger. BUT THIS ALLOWS TO ONLY DEBUG MY AGENT CODE and NOT MY APPLICATION
I suppose this is a problem with Intellij IDEA. Does anyone have a fix for this ?

Related

debug java part of the flex application in separate IDE

I am using two separate Eclipse IDE; one for Flex code and one for Java services.
I can run my Flex application by right clicking the application and debug as > flex appication, it works fine;
but at the same instance i want to debug the java side.
Is it possible ?
You would use your Java Eclipse IDE and then configure it for remote debugging "as usual". If you are running your Java service with Tomcat then you could follow these instructions:
Make sure that Tomcat is started in remote debugging mode ... and that your app is deployed.
Make sure that you have the sources for the code that you are trying to debug in your IDE. For the libraries and for Tomcat itself you can "attach" the sources to the jar files: open a class file and then click "Attach Source..." button.
If you have a servlet or something, set a breakpoint where it is sure to hit on the next request.
Go to "Run->Debug Configurations...". Click on "Remote Java Applications", then click "New". Type in the title. Note that port 8000 from the Tomcat instructions. Save and run.
Eclipse will connect to the JVM that Tomcat is running under. Wow, that was easy!
Now run your Flex application and execute the part which is calling your specific Java service code. Boom you hit the breakpoint!

Where is the "server log" for Tomcat when running externally from IntelliJ Ultimate?

When running my Vaadin app on Tomcat 8.5 externally from IntelliJ Ultimate 2017.2 on macOS Sierra, I get an error message:
Artifact timepiece-ui:war exploded: Error during artifact deployment. See server log for details.
➠ Where is this ‘server log’?
When I look in apache-tomcat-8.5.20 > logs, the folder is empty. Indeed, I cannot find any trace of my app being deployed within apache-tomcat-8.5.20.
➠ Is there some other place where IntelliJ+Tomcat is placing my app and the server logs?
IntelliJ displays Tomcat logs
The accepted Answer by CrazyCoder is correct.
In addition, as commented by Jerry06, IntelliJ Ultimate does automatically display the logs as tabs in the server output pane.
The files backing those logs are stored in the CATALINA_BASE as explained in the other Answer.
IntelliJ IDEA shows the log files you configure in the Run/Debug configuration settings as the separate tabs in the Run or Debug tool window.
For Tomcat the actual logs are placed under CATALINA_BASE/logs directory. The value of the CATALINA_BASE set by IntelliJ IDEA will be printed in the console of the Run or Debug tool window.
You can also find the log files under idea.system.path/tomcat/<configuration name>/logs/.
For Linux, I'm not sure if its the same for IntelliJ Ultimate, but in the community edition, you can find the Catalina server logs in /home/.SmartTomcat///${catalina.base}/logs. If you couldn't find the .SmartTomcat folder, enable Show hidden files in your file explorer. Since community edition of IntelliJ doesn't support Tomcat, we need to use the Smart tomcat plugin and so the server logs are available in the SmartTomcat directory.

How to debug a maven application after deploying it using tomcat?

I am new to maven and tomcat . I have created a project. After running, created a jar file.So, I deployed it in the tomcat. Now It is running on my localhost properly.Now I have added one print statement in the code. So,where will this get printed , because I already deployed that jar file of the code. So, what is the way to debug an application after deploying it ?
You have two options - either start tomcat from your IDE or use remote debugging. Here are some tutorials for you:
Intellij:
IntelliJ IDEA – Run / debug web application on Tomcat
HOW TO REMOTELY DEBUG APPLICATION RUNNING ON TOMCAT FROM WITHIN INTELLIJ IDEA
Eclipse:
Debugging your Tomcat Webapp with Eclipse (remote debug)
Launching and Debugging Tomcat in Eclipse
Once you make changes to the code you will need to rebuild the project and redeploy. If you used 'System.out.println(..)' it will be printed out to the console. Where that ends up depends on how you run Tomcat.
You can enable remote debugging in the jvm that runs Tomcat. To do that edit the catalina.sh or catalina.bat it you are running under Windows. Add the following to the CATALINA_OPTS: '-Xdebug -Xrunjdwp:transport=dt_socket,address=8998,server=y'. You will then need to configure your IDE to connect to that remote debugging session. You did not say, which IDE are you using.

Unable to install breakpoint in Eclipse: Absent Line Number Information

I have a Java 1.6.0 web application that I am developing using a Kepler Version 2 Eclipse development environment. I am using an Oracle Weblogic Server Administration Console 12c.
I'm running the app locally - and trying to debug it. Instead of stopping at any of the breakpoints I've set - I get the following error:
When I installed the application to Weblogic, I ran the Weblogic console and then installed the application by adding the ear file.
I thought I did everything exactly the same as previous web applications I've done this way - but I was always able to debug those applications.
Also - one other thing that is different. When make any changes and re-build the ear file - I actually have to delete and reinstall from the Weblogic console for the changes to take place. I'm thinking this might be related.
Any suggestions?
Thanks!
Have a jar file added to a build path in any of the projects that
include the classes in your project

Configuring IntelliJ 14 to debug an externally deployed Glassfish application

Hi All IntelliJ IDEA experts,
I seek help (if possible please with screenshots) on how to configure IntelliJ IDEA 14 to just debug a Glassfish 3.1 EAR and WAR
App deployed externally. I mean mvn build and deploy via Glassfish
Admin console and only debug from IntelliJ .
I go to set a local debug config in Glassfish and it insists on deployment of artifacts (which I do not want to do via IntelliJ)
Reason for not deploying via IntelliJ is that 2 WAR files depend on the
EAR to be deployed before hand and currently I think IntelliJ (as of version 14) does not let you juggle / or manually sort the deployment order and sorts deployment artifacts by name-wise in the natural sort order (A limitation)
Please help with externally configured artifacts based debug configuration help!
Screenshots for local debug config attached herewith
Just setting local Glassfish debug configuration is enough. There is no difference if the wars/ears are deployed via IDEA or externally.
The message you refer to "No artifacts marked for deployment" is actually a warning, not an error (although the red color of the icon is confusing). ALthough it appears, it does not stops you from running the debug configuration (just hit OK when the message appears).
Delete password in admin configuration.
like this

Categories