For some monitoring purposes I need to start Glassfish domain with custom java agent attached.
If I start domain directly with command:
java -cp /path/to/glassfish3/glassfish/modules/glassfish.jar com.sun.enterprise.glassfish.bootstrap.ASMain bla-bla-bla -javaagent:/path/to/agent.jar
it works as expected.
But how to do the same with domain, which starts with asadmin?
I've tried asadmin create-jvm-options and asadmin create-system-properties - it didn't help me. Any ideas?
Try restarting the domain.
If you set anything JVM-related, that will not be effective until you restart the domain. The GF Admin Console also warns about it it you do it on the web UI.
The asadmin docs also warns about it.
Related
So I'm deploying my Spring Boot application on an Ubuntu LTS Server. It is built with maven and running with embedded Tomcat.
I'm still new to the deployment process, what I did was:
Log into server via ssh
use scp to upload my_application.zip
unzip it in ssh
java -jar my_application.jar
Now all of that works perfectly fine and I've been using it like that for quiet some time. Now I have to make the Application to stay online and available after logging out of the shell.
I have read some documentation about running processes in background on Linux and I've tried it with nohup java -jar myApplication.jar &, with the screen command and with bg. All of them worked fine while I'm logged into the ssh.
Here comes my problem:
As soon as I end the ssh session the Web App is still available (so the process clearly didn't stop) but it just looks & behaves really weird.
CSS is not applied, JS does not work etc.
My guess would be that some paths or file system accesses are messed up, but I have no idea at all how that could origin from the ssh session.
(When I log back into ssh everything is working fine again)
Would be great if someone has a clue here
If your server has encrypted home directory, it will get re-encrypted once you log out and therefore your script will stop working. It does not have a lot of sense to have encrypted homes on servers so you can disable it.
Or just run the script from different directory and avoid working with files under home directory.
I think you should use systemd for this case.
Also You can add new system user for your app.
You can find more information here:
Spring Boot: 59.2.2 Installation as a systemd service
Ubuntu Wiki: Systemd For UpstartUsers
For example:
Create file myunit.service
[Unit]
Description=MySpringService
After=syslog.target
After=network.target
After=mysql.service
[Service]
Type=forking
PIDFile=/work/www/myunit/shared/tmp/pids/service.pid
WorkingDirectory=/work/www/myunit/current
User=myunit
Group=myunit
Environment=RACK_ENV=production
OOMScoreAdjust=-1000
ExecStart=/usr/local/bin/bundle exec service -C /work/www/myunit/shared/config/service.rb --daemon
ExecStop=/usr/local/bin/bundle exec service -S /work/www/myunit/shared/tmp/pids/service.state stop
ExecReload=/usr/local/bin/bundle exec service -S /work/www/myunit/shared/tmp/pids/service.state restart
TimeoutSec=300
[Install]
WantedBy=multi-user.target
Copy file to /etc/systemd/system/
Run:
systemctl enable myunit
systemctl start myunit
I wanted to monitor the JVM of wildfly running as service with jvisualvm/visualvm but I fail to do this. I tried the following things:
setting the %TMP% and %TEMP% to C:\Windows\Temp (wildfly console
tells me this for java.io.tmpdir)
running a console with sysinternals
pstools as system account: psexec -i -s cmd.exe and started visualvm
from within this new console (checked that the temp folders are
correctly set).
In both cases under local applications the process of wildfly was listed but visualvm only told me "not supported for this jvm".
As soon as I run wildfly from the cli, visualvm has no problems and shows me everything. There is only the jdk from oracle installed (with the corresponding jre).
How can I monitor the process of wildfly running as service (local system account)? Why is it not working with the solutions above?
Thanks a lot (for reading)
Thank you Salah
With your hint (local JMX connection) I've managed to make it work by using the following command for visualvm (no change of TMP/TEMP variables in cmd):
visualvm.exe -cp:a "<path-to-wildfly>\bin\client\jboss-client.jar"
and adding the path to the jmx console (don't forget to set the username/pw for the admin gui)
service:jmx:http-remoting-jmx://localhost:9990
I have installed Apache Tomcat server in my "D:" drive and Eclipse is configured with it. When I start the server from Eclipse it shows started.
But when I enter
http://localhost:8080
It shows following error and not load the Apache server.
the netstat shows the following.
So how can I fix this. Need some help. Thank you!
You are running Tomcat from eclipse in that case, the default tomcat project is not available therefor you are not able to see Apache Tomcat.
So you need to try accessing your app as http://localhost:8080/myWebApp. And if you want to see the Apache Tomcat UI than start the Apache Tomcat from the bin folder using startup.bat file or an application exe which shows you CMD prompt (black screen). But than to access your myWebApp than you must deploy it in Apache tomcat's webapps folder.
You may also want to configure the welcone-file or load-on-startup servlet if you are using jsp-servlet technology.
For further information please refer official documentation from Apache Tomcat or search on Google/YouTube for visual examples.
You can try the following steps,
Try with your your_machine_ipaddress:8080
OR
Try with different port say 8181.
Go to tomcat_installed_directory/conf/server.xml
Search for the string "connector port=" and change the port from 8080 to 8181
Restart the tomcat and try with localhost:8181 or localhost:8181/yourwebappname or your_machine_ipaddress:8181
OR
If you are behind proxy server and trying to access tomcat running in some other machine, then add the ip address of the machine where tomcat is running to your browser bypass proxy.
I just installed Glassfish 3. My browser shows me the Glassfish 3 Control Panel at 127.0.0.0:4848.
Since my computer is also running the Apache2 server for my PHP development, and I don't want to use too much memory, I want to be able to turn Glassfish on or off at will. e.g. if I want to turn the Apache2 server off on my Ubuntu machine I use the command
sudo /etc/init.d/apache stop
So what is the procedure to turn the Glassfish server off on Ubuntu?
Change to the glassfish/bin directory
Run the following as needed:
asadmin start-domain domain1
asadmin stop-domain domain1
Visit Chapter 3 Administering Domains for more asadmin commands.
In addition to the valid "asadmin start-domain" & stop-domain option already given, you can utilize operating system services to start/stop GlassFish, much like you do with your PHP environment.
Look into "asadmin create-service" command:
$ asadmin create-service --help
You can also check out the documentation on docs.oracle.com on how to create a service with create-service.
cd [GlassFishHome]/bin
asadmin stop-domain domain1
I am running tomcat 6.0.18 as a windows service. In the service applet the jvm is configured default, i.e. it is using jvm.dll of the JRE.
I am trying to monitor this application with JConsole but cannot connect to it locally. I added the parameter -Dcom.sun.management.jmxremote (which works when starting tomcat with the start.bat script). But the jvm does not seem to pick up the parameter.
There's a nice GUI to edit the options, no need to muck around in the registry.
Open up the C:\Program Files\Apache Software Foundation\Tomcat 6.0\bin\tomcat6.exe (or just double-click on the monitor icon in the task bar). Go to the Java pane, add the following to the list of arguments, and restart Tomcat.
-Dcom.sun.management.jmxremote
-Dcom.sun.management.jmxremote.port=8086
-Dcom.sun.management.jmxremote.ssl=false
-Dcom.sun.management.jmxremote.authenticate=false
Then you can connect with JConsole or the newer VisualVM.
Here's the prescribed way for changing jvmoptions & interacting with the service:
http://tomcat.apache.org/tomcat-5.5-doc/windows-service-howto.html
I would try going into your registry at HKLM/Software/Apache Software Foundation/Procrun 2.0//Parameters/Java and editing the "Options" multi-string value directly.
If Tomcat is running as a Windows service, and you want to attach to the JVM locally, you need to run VisualVM or JConsole as the System account. You can use Sysinternals PsExec.exe to accomplish this.
psexec.exe -i -s c:\visualvm\bin\visualvm.exe
I'm posting it mainly to record this information to myself, I haven't validated it - but this is supposed to work as well:
http://mysqlandsqlserver.blogspot.com/2010/02/jconsolejmap-and-tomcat-as-windows.html
There is still a rather simple way to connect JConsole to Java process started as Windows Service using the local mode which I discovered here.
Basically it says that in order to connect to Java process launched as a Windows Service you need to launch JConsole as a Windows Service (you can do it using windows native api or using any wrapper like yajsw.)
By the way, this will free you from restarting the Java Process which was critical for me.
Add the following near the top of your catalina.bat
set JAVA_OPTS=%JAVA_OPTS% -Dcom.sun.management.jmxremote ^
-Dcom.sun.management.jmxremote.port=8086 ^
-Dcom.sun.management.jmxremote.ssl=false ^
-Dcom.sun.management.jmxremote.authenticate=false
Stop and restart tomcat (obviously)
Run jconsole.exe. If your tomcat is running as service, then run jconsole.exe as administrator.
Select Remote Process and enter localhost:8086