no

How to Access Wildfly Server Properties in your JavaEE Application

I. Problem You want to access the server log file or maybe your application configuration so that you can display it in your application....

I. Problem

You want to access the server log file or maybe your application configuration so that you can display it in your application.

II. Wildfly Properties

Use the built-in JBoss / Wildfly properties.

Bootstrap Configuration

  • jboss.boot.library.list - The basic jars used to bootstrap the kernel, there are other jars used (TODO explain) - default value log4j-boot.jar, jboss-common.jar, jboss-system.jar
  • jboss.server.type - The fully qualified class name of the org.jboss.system.server.Server implementation - default: org.jboss.system.server.ServerImpl
  • jboss.server.root.deployment.filename - The file to deploy at the end of the bootstrap, relative to the config url - default: jboss-service.xml

Directories and urls

  • jboss.home.dir - The base directory of the jboss distribution - default: $JBOSS_HOME
  • jboss.home.url - The base url of the jboss distribution - default $JBOSS_HOME
  • jboss.lib.url - The url where the kernel jars exist - default: $jboss.home.url/lib
  • jboss.patch.url - A directory where patch jars exist - default: none
  • jboss.server.name - The configuration name of the server - default: default
  • jboss.server.base.dir - The directory where server configurations exist - default: $jboss.home.dir/server
  • jboss.server.base.url - The url where server configurations exist - default: $jboss.home.url/server
  • jboss.server.home.dir - The directory for the current configuration - default: $jboss.server.base.dir/$jboss.server.name
  • jboss.server.home.url - The url for the current configuration - default: $jboss.server.base.url/$jboss.server.name
  • jboss.server.temp.dir - The directory for temporary files - default: $jboss.server.home.dir/tmp
  • jboss.server.data.dir - The directory for data files - default: $jboss.server.home.dir/data
  • jboss.server.config.url - The url for configuration files - default: $jboss.server.home.url/conf
  • jboss.server.lib.url - The url for static jar files - default: $jboss.server.home.url/lib
  • jboss.server.log.dir - The directory where the server logs are written - default: $jboss.server.home.dir/log

Other config

  • jboss.bind.address - The host name or ip address for jboss services to bind to - default: 0.0.0.0 = "any" NIC - (v4.2.), 127.0.0.1 = localhost only
  • jboss.partition.name - The cluster partition - default DefaultPartition
  • jboss.partition.udpGroup - (since v4.0.3) The udp group - no default
  • jboss.server.exitonshutdown - Whether JBoss should do System.exit() on a shutdown - default true
  • jboss.server.blockingshutdown - Whether JBoss should do shutdown synchronously (true) or asynchronously (false) - default false
  • jboss.server.requirejbossurlstreamhandlerfactory - When true an error is thrown if the jboss stream handlers could not be installed - default true
  • jboss.server.temp.dir.overrideJavaTmpDir - (since v3.2.3) whether to override the main java temporary directory (java.io.tmpdir) to the server temporary directory - default false
  • jboss.shutdown.forceHalt - (since v3.0.1) force a Runtime.getRuntime().halt() at the end of the jboss shutdown hook - default true
  • jboss.native.load - whether to to load the native libraries unpacked from deployments - default false
  • jboss.native.dir - location to unpack native libraries in deployments - default tmp/native

Non JBoss properties

  • log4j.configuration - override the location of the log4j bootstrap configuration
These properties are copied from https://developer.jboss.org/wiki/JBossProperties.

III. Accessing these Properties from within your JavaEE Application

To access this property simple use System.getProperty

For example if we wanted the server log:

System.getProperty("jboss.server.log.dir") + File.separator + "server.log";

Related

coding 599864934417408375

Post a Comment Default Comments

item