Skip to content

Instantly share code, notes, and snippets.

@jarek-przygodzki
Last active December 21, 2020 09:14
Show Gist options
  • Save jarek-przygodzki/1c86ee69a0b61799a8f7 to your computer and use it in GitHub Desktop.
Save jarek-przygodzki/1c86ee69a0b61799a8f7 to your computer and use it in GitHub Desktop.
Miscellaneous WildFly commands

List deployments

"%JBOSS_HOME%\bin\jboss-cli" --connect --commands="ls deployment"

Basic configuration

curl --digest -u [MgmtUser]:[Password] http://localhost:9990/management/

Restart

 "%JBOSS_HOME%\bin\jboss-cli" --connect --commands=:shutdown(restart=true)

Http subsystem configuration

curl --digest -u [MgmtUser]:[Password] -D - http://localhost:9990/management --header "Content-Type: application/json" -d '{"operation":"read-resource", "include-runtime":"true" , "address":["subsystem","undertow","server","default-server", "http-listener","default"]}'

Password hash

org.jboss.security.auth.spi.Util.createPasswordHash()

Read log file. The logging subsystem now supports direct downloads of log files. The log-file mangagement resource lists all log files defined in the jboss.server.log.dir that are defined in the subsystem.

curl --digest -u [MgmtUser]:[Password] -L -D - http://127.0.0.1:9990/management?useStreamAsResponse --header "Content-Type: application/json"  -d '{"operation":"read-attribute","address":[{"subsystem":"logging"},{"log-file":"server.log"}],"name":"stream"}'

http://localhost:9990/management/subsystem/logging/log-file/server.log?operation=attribute&name=stream&useStreamAsResponse

Find WildFly PID in Windows

"%JAVA_HOME%\bin\jps" -l | grep  org.jboss.modules | cut -f1 -d  ' ' 

Run WildFly in full profile with port offset

 %JBOSS_HOME%\bin\standalone -c standalone-full.xml -Djboss.socket.binding.port-offset=100

Read server state

curl --digest -L -D - http://admin:pass@localhost:9990/management --header "Content-Type: application/json" -d '{"operation":"read-attribute","name":"server-state","json.pretty":1}'

WildFly CLI

# List JDBC drivers
/subsystem=datasources:installed-drivers-list
# List datasources
/subsystem=datasources:read-resource(recursive=true)
# Test connections
/subsystem=datasources/data-source=[DsName]:test-connection-in-pool
# Remove datasource
data-source remove --name=[DsName]
# List interfaces
:read-children-names(child-type=interface)
# Add queue
jms-queue add --queue-address=[QueueName] --entries=java:/jms/queue/[QueueName],java:jboss/exported/jms/queue/[QueueName]
# Enable datasource
data-source enable --name=[DsName]
# Resolved public interface address
/interface=public/:read-attribute(name=resolved-address)
# Read datasource stats
subsystem=datasources/data-source=[DsName]/statistics=pool:read-resource(recursive=true, include-runtime=true)
# Read JMS bridges configuration
/subsystem=messaging/hornetq-server=default/bridge=jms-bridge:read-resource
# List messages scheduled for redelivery in myqueue
/subsystem=messaging/hornetq-server=default/runtime-queue=jms.queue.myqueue/:list-scheduled-messages  
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment