DCEVM remote debuggin - java

I want to create a development environment in which my java application will run in a virtual machine and the code will be written and managed on the host machine.
The java application inside the virtual machine will use DCEVM because I want to use the enhanced class redefinition while remote debugging the application.
The same version of Java(compatible with DCEVM) will be installed on both virtual machine and host machine.
Is there someone who dealt with a similar setup in the past and who can advise whether this setup is feasible or not ?
I am very interested to know whether the remote debug and enhanced class redefinition will work or not in this setup ?

Yes this will work. You can use DCEVM+HotSwapAgent in the virtual machine and connect to it via your remote debugger in IDE in host machine.
I have worked with a similar setup: Tomcat server + Remote debugging in Eclipse for enhanced class redefinition. They were on the same machine, but the setup and configuration is essentially the same.
Refer https://web.liferay.com/web/enrique.valdes.1/blog/-/blogs/java-classes-instant-reloading-using-dcevm-hotswap-agent for steps on how to set this up. It's the same for a Tomcat server.

Related

Remote debugging - Java

I am currently with a batch process that breaks into production, which is in a weblogic. This process can only be executed on a machine that is configured to run automatically.
My question is if a remote debugging can be done from my machine?
I really would not recommend remotely debugging a machine which is on production. However, if you must, you will need to do three things:
Startup the application with remote debugging turned ON on a port 80 or any other port of your choice by adding the following line to your java -jar command.
-agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=80
For example,
sudo java agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=80 -jar original-example-service-local.war
This port needs to be accessible from your machine, you will need to open this port from your security group in AWS or however you are managing this instance. This step is very important.
Add the configuration in your IDE to do remotely connect to the application. You can find many guides on this online.
For IntelliJ --> https://docs.alfresco.com/5.2/tasks/sdk-debug-intellij.html
For Eclipse --> https://docs.alfresco.com/5.2/tasks/sdk-debug-eclipse.html
Hope this helps.

Run Jetty Website on Azure Virtual Machine

I have created a Java Web Application using Jetty (in Eclipse, using OSGI etc.). The application itself runs quite well (when being tested locally), so I wanted to run it on an Azure virtual machine in order to be accessible for external users (for testing reasons).
What I did so far:
created an Azure account
create a virtual machine with Windows Server running in it
downloaded all my eclipse files etc. to the virtual machine
started the application (in fact in eclipse, not the compiled jar) in the virtual machine; the application is published to port 8080
so, when i run a webbrowser in the VM and connect to localhost:8080, everything works well
but when I try to access the website from external (using my assigned domain of the VM, something.cloudapp.net:8080), it does not work
I also created endpoints in the azure management console for this VM (80, 8080, etc.)
Does anyone ever tried to run a java webapp on Azure or has a hint what could go wrong here?
By default, windows servers in Azure have the windows firewall enabled. This would block external connections to port 8080 by default. Try adding an appropriate exception to the windows firewall rules.
According to your description, I think you have correctly configured the new endpoints for the network traffic of Java Webapp. If not or incorrectly does, please refer to the article https://azure.microsoft.com/en-us/documentation/articles/virtual-networks-create-nsg-arm-pportal/ to configure again.
Then, as #CtrlDot said, you need to configure the firewall for allowing the inbound traffic on Windows Server.
As reference, please see the article about allowing inbound traffic to a specified TCP or UDP port on Windows Server to do it.

How to debug the application deployed in virtual box and source code in Host OS

I am not sure if this is the correct forum to ask this question, please redirect me if this is not so.
I have this arrangement for doing work:
1) VMWare installed, which has virtual images, mainly AS, Linux OS.
2) The host OS is windows i,e. Virtual box is installed in Windows OS.
3) Eclipse and other tools installed in host OS; where we check out code, do development work etc.
Now I have following questions/doubts:
1) In our Host OS, we have putty application from which we are able to connect to cent OS (which runs in Virtual box); we access that 127.0.0.1. How is this possible? Usually 127.0.0l.1 refers to the "localhost", how come using 127.0.0.1 is able to connect to the Guest OS running in virtual box?
2) As the web-application gets deployed in Jboss AS (which again is running in Virtual box), I have need to debug the application, i.e., to check the flow of control in eclipse. Since Eclipse is running in host OS, and the Jboss is running in Virtual box (where .war is deployed), how can I be able to see the flow of control i.e. put break points in eclipse.
EDIT:
When I run the virtual box, it automatically runs the Jboss AS during start-up, and as such I am not sure if I have any control over providing any special instructions because Jboss gets started automatically while starting the virtual appliance (Cent OS, Jboss)
Any help really appreciated.
Anything running in the Guest OS will see the Guest OS as localhost (127.0.0.1).
In order to debug remotely, you need to be able to address the JVM instance's debugger port, which means that you need to address the Guest OS.
Assuming you can already do that to access the web-site hosted by JBoss AS, you just need to open the debug port when starting JBoss, and refer to that from Eclipse, e.g. start JBoss with this argument:
-agentlib:jdwp=transport=dt_socket,address=GUESTOS:8000,server=y,suspend=n
Where GUESTOS is IP of the Guess OS (not 127.0.0.1), then specify the following values in the Eclipse Remove Java Application debug configuration:
Host: GUESTOS
Port: 8000
Port number can be whatever you want it to be.

Debugging Apache Spark clustered application from Eclipse

I am trying to debug Spark application running on eclipse in clustered/distributed environment but not able to succeed.
Application is java based and I am running it through Eclipse. Configurations to spark for Master/worker is provided through Java only.
Though I can debug the code on driver side but as the code flow moves in Spark(i.e call to .map(..)), the debugger doesn't stop. Because that code is running in Workers JVM.
Is there anyway I can achieve this ?
I have tried giving following configurations in Tomcat through Eclipse :
-Xdebug -Xrunjdwp:server=y,transport=dt_socket,address=7761,suspend=n
and setting respective port in Debug->remote java application.
But after these settings I get the error: Failed to connect to remote VM. Connection Refused
If anybody has any solution to this, please help.
I was facing the same issue while configuring the spark debugging on remote master. But after that I've installed the spark on my Ubuntu machine then it worked fine. If you really want to debug, my suggestions are
1- configure spark on your testing machine then you can easily debug applications.
2- use IntelliJ IDEA, I've used it for for debugging if I've to use remote spark.
EDITED:
If you are going to use IntelliJ IDEA then you can easily configure remote debugging as explained here. Debugging Apache Spark Jobs

How do I build, deploy and debug standalone java app on remote machine?

How do I build, deploy and debug standalone java app on remote machine with IDEA ?
I have remote machine with certain hardware device connected to it. I want to develop standalone Java app on my PC, build it locally but the app should be deployed and running on remote machine accessible via SSH. Thus I'll be using Java remote debug.
I've googled extensively but couldn't understand if it's possible to achieve in IDEA (even though IDEA allows to do so for java servlet containers). I tried "Remote SSH External Tools" plugin. I'm not sure what to specify in following dialog (which seems to have bug)
What options do I have ?
If the machine is only reachable via SSH you need to do two things:
Configure your java application for remote debugging
Connect to the application via SSH
This tutorial should get you going: Remote Debug of a Java App Using SSH Tunneling

Categories

Resources