Wildfly subsystem configuration attribute not allowed here - jboss

I would like to set in the WildFly/JBoss ejb3 subsystem enable-graceful-txn-shutdown to true.
Tried two approaches:
<subsystem xmlns="urn:jboss:domain:ejb3:4.0" enable-graceful-txn-shutdown="true">
and
<subsystem xmlns="urn:jboss:domain:ejb3:4.0">
<enable-graceful-txn-shutdown value="true"/>
Both times I got a Validation error in standalone.xml:
'enable-graceful-txn-shutdown' isn't an allowed attribute for the
'subsystem'
element 'enable-graceful-txn-shutdown' isn't an allowed
element here
What is the right place?

Your subsystem tag's namespace is incorrect, enable-graceful-txn-shutdown isn't defined in urn:jboss:domain:ejb3:4.0 but in urn:jboss:domain:ejb3:5.0 (which is new in Wildfly 11).
If you check the XSD defining this namespace (which can be found in the docs/schema dir of your wildfly install, in this case as the wildfly-ejb3_3_5_0.xsd file), you'll find as Omoro pointed out that this tag should be at the root of your subsystem with a value boolean attribute, i.e.
<subsystem xmlns="urn:jboss:domain:ejb3:5.0">
<enable-graceful-txn-shutdown value="true"/>

Related

Set system properties in standalone-full.xml in wildfly 8.2

I have added system-properties tag in standalone-full.xml, but its not working in standalone mode. However, if I add the same tag in domain.xml it's working for domain mode.
<?xml version='1.0' encoding='UTF-8'?>
<server xmlns="urn:jboss:domain:2.2">
<extensions>
....
</extensions>
<system-properties>
<property name="java.util.Arrays.useLegacyMergeSort" value="true"/>
</system-properties>
</server>
According to this article on jBoss General configuration concepts
System property values can be set in a number of places in domain.xml, host.xml and standalone.xml.
Then what about standalone-full.xml?
I don't want to set it through command line and not even in java code.
In standalone it's probably too late to set it in the configuration files. You'll need to add it to the standalone.conf or standalone.conf.bat in the JAVA_OPTS environment variable. A global property like that needs to be set before anything else attempts to use java.util.Arrays.
If you have started the Wildfly server with standalone-full.xml instead of standalone.xml(the default) than this should be reflected in the start of the server:
standalone.sh -b <hostIP> -c standalone-full.xml -Dorg...
Then this will have effect on first start.
If you change something in this config file, you will need to reload Wildfly(configuration) from jboss cli:
[standalone#localhost:9990 /] :reload
For Wildfly 10 it's working nontheless. I was able to read the property for an instance started with the standalone-full.xml containing some properties.
The manual must be outdated then I guess? Because even Wildfly itself inserts a new property in the standalone-full.xml when using the Wildfly admin webinterface: http://localhost:9990 > Configuration > System Properties (Wildfly will add the property of course to the xml config which was used to start the instance). That's enough proof for me.

Meaning of name attribute in JBoss MBean xml descriptor

JBoss 4/5 MBeans such as NamingAlias are defined in XML as follows
<mbean code="org.jboss.naming.NamingAlias" name=":service=NamingAlias,fromName=queue/original">
<attribute name="ToName">queue/linked</attribute>
<attribute name="FromName">queue/original</attribute>
</mbean>
Paying attention to the attributename=":service=NamingAlias,fromName=queue/original I see the parameters service and fromName.
Following the instructions to create a custom MBean here:
https://developer.jboss.org/wiki/ExampleHelloWorldService
The XML configuration for the MBean created is
<server>
<mbean code="com.acme.HelloWorldService" name="acme.com:service=HelloWorld">
<attribute name="Message">Hello World</attribute>
</mbean>
</server>
I noticed only service is specified in the name attribute.
Is service mandatory for all the beans? What about adding additional parameters such as fromName? Can these values be used from within the class that implements the MBean or are those mandated?
The name attribute can be any valid (and unique) JMX ObjectName. The keys and values themselves do not have any special significance other than their subjective significance to the developer.
In the first example, the ObjectName does not specify a domain (the value to the left of the colon) so the MBeanServer assumes the default domain, which in this case would be jboss so notionally:
:service=NamingAlias,fromName=queue/original == jboss:service=NamingAlias,fromName=queue/original
The ObjectName (and it's embedded domain and key/values) can be used within the class. In standard JMX, one would typically make the impl implement MBeanRegistration which injects the MBeanServer and ObjectName when the bean is registered. However, the example you referenced is a specialized JBoss ServiceMBean which does this automatically and your implementation will store the ObjectName in the field called serviceName.

How to change JBoss eap 6.1 deployment folder

I'm trying to change deployment folder for JBoss without success.
Regarding some information which I've found on google I was trying to change standalone.xml configuration file. I've added following lines after <extensions> node :
<system-properties>
<property name="deploydir" value="/home/Artur"/>
</system-properties>
And I've changed <subsystem xmlns="urn:jboss:domain:deployment-scanner:1.1"> as following:
<subsystem xmlns="urn:jboss:domain:deployment-scanner:1.1">
<deployment-scanner path="deployments" relative-to="deploydir" scan-interval="10000"/>
</subsystem>
I have the following path /home/Artur/deployments on my system.
But when i try to run JBoss server I always get an error :
09:05:21,283 ERROR [org.jboss.as.controller.management-operation] (ServerService Thread Pool -- 2) JBAS014612: Operation ("add") failed - address: ([
("subsystem" => "deployment-scanner"),
("scanner" => "default")
]): java.lang.IllegalArgumentException: JBAS014847: Could not find a path called 'deployments'
I was trying to configure it with different paths on my system, I was checking also for spelling in every case. But nothing helps. Does anyone have and idea how to properly configure path for deployment folder in JBoss ? (version as in title)
OK I solved this issue. To change deployment directory it's needed to specyify path to this directory in block :
<paths>
<path name="deploydir" path="/home/Artur"/>
</paths>
instead of
<system-properties>
<property name="deploydir" value="/home/Artur"/>
</system-properties>
which I mentioned about earlier. So i conclusion we need to specify <path> node in standalone.xml configuration file and change <subsystem xmlns="urn:jboss:domain:deployment-scanner:1.1"> to point on newly created path (in this case to "deploydir")

Loading properties from a file in a JBoss 6 Web Application

Can I dump a properties file somewhere in one of the JBoss 6 directories, and pick it up from the classpath?
Or even better, does anybody know the mechanism behind a configuration file like $JBOSS_HOME/server/default/deploy/jboss-logging.xml? Changes to this file seem to trigger an event, so that a running instance can process the modifications (without having to bounce the AS).
A possibility is to configure SystemPropertiesService in ./conf/jboss-service.xml.
This allows you to configure system properties in-place, or load them from a properties file:
<server>
<mbean code="org.jboss.varia.property.SystemPropertiesService"
name="jboss.util:type=Service,name=SystemProperties">
<!-- Load properties from each of the given comma seperated URLs -->
<attribute name="URLList">
http://somehost/some-location.properties,
./conf/somelocal.properties
</attribute>
<!-- Set propertuies using the properties file style. -->
<attribute name="Properties">
property1=This is the value of my property
property2=This is the value of my other property
</attribute>
</mbean>
</server>
For more details, refer to: http://docs.jboss.org/jbossas/admindevel326/html/ch10.html
They have made this even easier in JBoss EAP 6 (AS 7).
Pass Property File as Startup Parameter
This can be added within the main start up script or passed as parameter
./standalone.sh --properties=/Users/john.galt/dev/config/ds/jboss.properties
If these properties are read, they will be rendered in the server log as the first statement.
3:58:41,633 DEBUG [org.jboss.as.config] (MSC service thread 1-6) Configured system properties:
DSsettings.password = password
DSsettings.user-name = admin
DSsettings.connection-url = jdbc:oracle:fat:#activedb:1521:DEV
[Standalone] =
awt.nativeDoubleBuffering = true
NOTE: As these settings are logged in server log, ensure no clear text passwords are in the property files in production
Use passed in system properties
You could use these system properties with following syntax.
Example Usage in a data source file
<xa-datasource jndi-name="java:jboss/ds" pool-name="cPool" jta="true" enabled="true" use-ccm="true">
<xa-datasource-property name="URL">
${DSsettings.connection_url}
</xa-datasource-property>
<driver>oracle</driver>
...
<security>
<user-name>${DSsettings.user-name}</user-name>
<password>${DSsettings.password}</password>
</security>
...
</xa-datasource>
In JBoss 6 use: ./deploy/properties-service.xml
On JBoss AS7 properties-service.xml no longer exist, the below is the solution:
http://www.mastertheboss.com/jboss-server/jboss-configuration/how-to-inject-system-properties-into-jboss

making server.log append=true

How do I make the log server\\log\serve.log to be appended. i.e. whenver I restart JBoss it should not override the content of the log but continue from the end of it?
Add <param name="Append" value="true"/> to the <Appender> in your conf/jboss-log4j.xml file. There may be multiple appenders defined, so make sure you get the one that handles server.log.
Try setting <param name="Append" value="true"/> in your log4j.xml. This may be on a FileAppender och RollingFileAppender section. Just look for the appender that writes to server.log.
Short answer: change the log file name (e.g. myapp.log)
Longer answer: We've also seen a case where the server.log got truncated in jboss. Somewhere, someone is truncating the server.log file in some static initialization block we couldn't find. Changing the file name seems to work and the contents was appended to.
we had the same issue on our remote Ubuntu 16.04 Linuxes running Jboss EAP 6.4.0 but not when we ran our Jboss server locally in Eclipse/Windows.
The append property was already set to true.
I finally made it work by declaring the property append before the filename in the standalone-full.xml.
<properties>
<property name="append" value="true"/>
<property name="fileName" value="${jboss.server.log.dir}/server.log"/>