weblogic.Deployer gets slow when running multiple times - java

I deploy some EAR to a remote weblogic server with
java weblogic.Deployer -adminurl http://weblogic:7001/ -username weblogic -password weblogic1 -deploy /tmp/package.ear -remote
But when I run this command multiple times, it's getting really slow to deploy (like 10-15 minutes to deploy a small EAR/WAR).
Why ?

Solution is to add the parameter -Djava.security.egd=file:/dev/./urandom to the java command. See this answer and this post for more details.
The complete command becomes
java -Djava.security.egd=file:/dev/./dev/urandom weblogic.Deployer -adminurl http://weblogic:7001/ -username weblogic -password weblogic1 -deploy /tmp/package.ear -remote

Related

JVM arguments not being passed to java application at run time

I try to give VM parameters (jmx parameters) to run a jar file. For some reason, the VM parameters configured not being passed to the java application at run time (log statement in main method confirms that aswell). Application launches successfully but unable to access jmx service. It all works fine with Intellij though.
JVM_OPTS="-Dcom.sun.management.jmxremote \
-Djava.rmi.server.hostname=localhost \
-Dcom.sun.management.jmxremote.port=8020 \
-Dcom.sun.management.jmxremote.rmi.port=8021 \
-Dcom.sun.management.jmxremote.authenticate=false \
-Dcom.sun.management.jmxremote.ssl=false"
eval "java $JVM_OPTS -Djava.security.egd=file:/dev/./urandom -jar target/shopfront-0.0.1-SNAPSHOT.jar"
I tried to access jmx via visual vm but I am unsuccessful.
Version: Java 11
I expect to access jmx via visual client
Any help is appreciated!
The above script works fine. It is bash script

Debug embedded tomcat on heroku

I'm working on a Java web application. I already deploy it to heroku. Now I'm trying to remote debug my application using IntelliJ with no results. To deploy it I use git, then heroku starts it reading and executing the Procfile. And here is the problem. Everywhere I see that to debug I must use this line in my Procfile: web: java -agentlib:jdwp=transport=dt_socket,server=y,address=9090,suspend=n -jar target/myapp.jar. But I can't put this line on my Procfile because I execute my app using web: sh target/bin/webapp and not java. There's some workaround to simply debug my application.
You'll need Heroku Exec and the Heroku Java CLI.
First, put your agentlib args into the JAVA_TOOL_OPTIONS env var:
$ heroku config:set JAVA_TOOL_OPTIONS="-agentlib:jdwp=transport=dt_socket,server=y,address=9090,suspend=n"
This way, the java process in your target/bin/webapp script will pick it up automatically.
Then run:
$ heroku ps:forward 9090
And you can connect to localhost:9090 from your IDE.

Restarted service, getting killed in debian postinst script.

I have written jenkins job for deploying my package into one of my servers. Am using debian package management system. Am updating all the packages of machine by sudo apt-get update command and installing the required package by sudo apt-get install package_name in a deployment_script (where we make .deb file and specify servers to install). Also am copying the script am using to start / stop package to /etc/init.d/package_name. This script can take parameters start / stop. In my debian postinst script I have mentioned /etc/init.d/package_name start to start the package. For deploying I'll just trigger the jenkins job and give deployment_script to the job. It can install package, then calling postinst script where it restart service properly as well in the intended machine. But while exiting postinst script the restarted service getting killed. Any help on finding the reason and how to fix it?
Am starting my service like sudo -u user_name java -server some_vm_options with jar of the package, configs > /dev/null &.
I just changed it to sudo -u user_name nohup java -server some_vm_options with jar of the package, configs > /dev/null &. Now my started service doesn't get killed.

Address binding issue

I am trying to run a web application (which is a servlet + gradle project). I am using Jetty to run the application. When I run the application , I am getting the error:
Address already in use
Could not execute build using Gradle distribution 'https://services.gradle.org/distributions/gradle-2.0-bin.zip'.
When, I enter localhost:8080 , I used to get jenkins default page, So I uninstalled jenkins and tried again, but getting the same error.
Please help in resolving this issue, also how do we get to know which application is running on corresponding port?
You can use the command "netstat". Look for the line in which the column "remote address" ends with ":8080".
Depending on the OS you're running:
Windows:
netstat -b -n -a -p TCP
The process is printed above the line.
Linux:
netstat -a -n -p | grep 8080
The process is printed as the last column of the line.

Launching a JBoss AS Cluster on Separate Machines to run EJBCA

Right now I am running my EJBCA project on single Jboss server using following command
run.sh -c default -b test.mywebsite.net
and it works fine, but now I want to launch my EJBCA application on clustered jboss machines
for this I have read following links
1.1.2. Launching a JBoss AS Cluster
1.1.3. Web Application Clustering Quick Start
then further I read that There are two aspects to setting up web tier clustering:
Configuring an External Load Balancer.
Configuring Your Web Application for Clustering.
now my questions are
When I go with the External Load Balancer. and when I go with second
option
If I go with second option how it will work ? and what will be my -b
option while running this Jboss servers.
because in point 1.1.2 I read that
Two processes can't bind sockets to the same address and port, so we'll have to tell JBoss to use different ports for the two instances.
EJBCA Version :- ejbca_4_0_12
JBOSS Version :- jboss-6.1.0.Final
EDIT 1
right now I am running my server like this
/run.sh -c default -b test.mysite.net
so it will listen on
https://test.mysite.net:8443/ejbca/
now I have to run my application as
Machine 1
./run.sh -c node1 -g DocsPartition -u 239.255.100.100 \
-b test.mysite.net -Djboss.messaging.ServerPeerID=1 \
-Djboss.service.binding.set=ports-default
Machine 2
./run.sh -c node2 -g DocsPartition -u 239.255.100.100 \
-b test.mysite.net -Djboss.messaging.ServerPeerID=2 \
-Djboss.service.binding.set=ports-default
so that I can only access to
https://test.mysite.net:8443/ejbca/
Please can any one explain this In brife so That I can clear with this things Thanks..
When you follow the documentation you mentioned (Scenario 3: Two Nodes on a Single, Non-Multihomed, Server) you have two JBoss instances:
./run.sh -c node1 -g DocsPartition -u 239.255.100.100 \
-b 192.168.0.101 -Djboss.messaging.ServerPeerID=1 \
-Djboss.service.binding.set=ports-default
./run.sh -c node2 -g DocsPartition -u 239.255.100.100 \
-b 192.168.0.101 -Djboss.messaging.ServerPeerID=2 \
-Djboss.service.binding.set=ports-01
They will listen on:
1) http://192.168.0.101:8080
2) http://192.168.0.101:8180
So to which node you will point your browser to reach the cluster? You can't use either of the two if you want failover. You need to configure a load-balancer.
Furthermore JBoss needs to know that it should replicate the http-session. Therefore you need to configure your web application for clustering. Hence you need to configure 1) and 2) not 1) or 2).
The -b x.x.x.x points to a (the) public IP-address of your server.

Categories

Resources