Run multiple jar files from intellij idea and change, run and debug through. - debugging

So I basically want to debug through multiple jar files all different microservices that send/receive messages to/from each other's APIs. What I do at the moment is to run each jar files from my command line as java -jar -Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=5005 ***.jar and do a remote debugging with my intellij with the same port.
I was wondering whether it is possible to have all jar files into one configuration and start them all in one debugging session in Intellij?

Are the micro services runnable on a webserver like Tomcat? If so, you can download the webserver, add it to IntelliJ and deploy these three micro services in the same run configuration. You should then be able to debug that run configuration and debug these at the same time.

Related

How to run multiple jars in springboot when i deploy microservice?

Please help me to deploy microservice without using dockers,and how can I run multiple service using single command
Spring boots fat jar enables you to just start the jar by using Java - jar command.
Just write a script, that does it on your server.

How to redeploy WAR inside a JBoss WildFly container?

I am trying to make my local Java development environment more lighter.
Dockerfile multi-stage steps looks like this:
MAVEN CONTAINER
build app from source code
WILDFLY CONTAINER
prepare server (data sources, drivers)
copy WAR from MAVEN
start server and deploy application
This usually takes about 1-3 minutes, even with dependencies-offline-mode.
After making some code changes I have two options - build new image (1-3 minutes) or manually build WAR and redeploy app from WildFly Administration Panel. Is there any tool to automate this?
Maybe this basic approach will be enough:
0. start local env as always
1. make some code changes
2. build WAR in MAVEN conotainer
3. copy WAR into WILDFLY container
4. enter WILDFLY container bash and redeploy using JBOSS-CLI
Are you using some Maven plugins? Bash scripts? Thank you for hints!

Running springboot using maven vs. via java directly?

Essentially, the Jenkins CI job runs mvn spring-boot:run .... in a productions cluster as the only way to run the application. With this build step, in effect, we are running the springboot app only via maven and this has led to a very unstable jvm behavior. Also, I am unable to configure all the possible tweaks to the jvm e.g, turning on gc logging or changing to G1GC etc.. etc..
I just wanted to know if running my java springboot app should indeed be packaged into a fat jar and run with standard jvm flags, rather than from maven.
Please let me know your thoughts
Spring boot maven plugin has jvmArguments in order to set jvm settings.
......
<configuration>
<jvmArguments>-Xdebug</jvmArguments>
</configuration>
.......
The second option is to create a self-executable jar/war and use a standard way to run app - java -jar app.jar <jvm properties>
Our teams have been running fat jars similar to how others have stated with the simple java -jar ****.jar commands. However, once in production, you can utilize a container clustering system to construct the many microservices that make up your app. Seems like running maven and deploying source code, rather than artifacts seems dangerous. Hopefully this helps!

how to tune jvm when using spring boot application as unix service

i'm using the new spring-boot 1.3.0 feature to run tomcat embedded spring-boot application jar as a unix service.
All is working fine but i don't know how to tune jvm (with -Xms and -Xmx parameters for example)
I've searched in spring documentation and around the web without success.
It's missing from the documentation (I've opened an issue to correct that), but you should be able to use the JAVA_OPTS environment variable.
You can configure it in a .conf file that's situated next to the jar. For example, if you jar file is /var/myapp/myapp.jar, the file /var/myapp/myapp.conf will be sourced by the launch script.
There is one more option to achieve the same , if you are running jar with mvn you can do something like this
mvn spring-boot:run -Drun.jvmArguments="-Xmx512m"
And If you are running with java -jar ,you can try something like this
java -Xmx1G -jar myapp.jar

Maven Jetty Run from Jar

Here is want I want to do. I created a maven project and configured the jetty plugin for it in eclipse...
So from Eclipse if I do run and set the maven goal there to be jetty:run it runs my project in jetty on the port specified in web.xml. Now I want to build the jar file and when I do java -jar myapp.jar it will automatically call jetty:run.
How can I do this?
If you want to package your application so that you can hand it to someone and have them run it as a standalone application without having to go through deploying a war file into a web container, then that is a different concern from doing mvn jetty:run at development time, I will call that deployment time to avoid any confusion
At deployment time, we can't assume there will be maven on the machine, thus no mvn jetty:run, and even if there was, this would not work, unless we deliver the source code to run the build as in the development environment!
A standalone web application can be packaged by bundling the jetty jars in the application war along with a Main class to start jetty programmatically, and get it to run the application war. This relies on the fact that the file and directory structure of the WAR and JAR are different, and thus there is no significant overlap between the two, which is what makes this workaround possible, and it also leaves the option of deploying the war file in a web container possible
There is a maven plugin that embeds winstone which is another lightweight servlet container
For jetty, you may start by reading Embedded Jetty 7 webapp executable with Maven

Resources