JBoss 7.1.0: Add Default Sender to mail sub system - jboss-eap-7

I have some troubles adding a default sender to my mail subsystem in JBoss EAP 7.1.0. I'm a noob with the JBoss cli ;)
Here is my current standalone.xml:
<subsystem xmlns="urn:jboss:domain:mail:3.0">
<mail-session name="java:jboss/mail/Default" jndi-name="java:jboss/mail/Default">
<smtp-server outbound-socket-binding-ref="mail-smtp"/>
</mail-session>
</subsystem>
What i want (i figured out, that the property I need is call mail.smtp.from)
<subsystem xmlns="urn:jboss:domain:mail:3.0">
<mail-session name="java:jboss/mail/Default" jndi-name="java:jboss/mail/Default">
<smtp-server outbound-socket-binding-ref="mail-smtp">
<property name="mail.smtp.from" value="test#test.de"/>
</smtp-server>
</mail-session>
</subsystem>
I tried a lot with autocompletion in the JBoss CLI, but no success. My current try is:
/subsystem=mail/mail-session=java\:jboss\/mail\/Default/smtp-server/property=mail.smtp.from:write-attribute(name=value, value=test#test.de)
This leads to "Node path format is wrong around 'smtp-server'. Hope someone can help. Thanks in advance!

I believe what you need is the following, with the from attribute held by the mail-session object :
<subsystem xmlns="urn:jboss:domain:mail:3.0">
<mail-session name="java:jboss/mail/Default" jndi-name="java:jboss/mail/Default" from="test#test.de">
<smtp-server outbound-socket-binding-ref="mail-smtp"/>
</mail-session>
</subsystem>
Which you can obtain from your current configuration by running the following CLI command :
/subsystem=mail/mail-session=java\:jboss\/mail\/Default:write-attribute(name=from, value=test#test.de)

Related

How configure Wildfly 11 in HA Mode with preferred master?

I am currently using the default HA configuration in Wildfly 11. I would like to know how can I tell which particular cluster is preferred if it is available.
I believe I should change the singleton subsystem but I do not know how.
<subsystem xmlns="urn:jboss:domain:singleton:1.0">
<singleton-policies default="default">
<singleton-policy name="default" cache-container="server">
<simple-election-policy/>
</singleton-policy>
</singleton-policies>
</subsystem>
EDIT
Run ./jboss-cli
Run the command: /subsystem=singleton/singleton-policy=default/election-policy=simple:write-attribute(name=name-preferences,value=[node3,node2,node1])
The standalone-ha.xml was altered to:
<subsystem xmlns="urn:jboss:domain:singleton:1.0">
<singleton-policies default="default">
<singleton-policy name="default" cache-container="server">
<simple-election-policy>
<name-preferences>node3 node2 node1</name-preferences>
</simple-election-policy>
</singleton-policy>
</singleton-policies>
</subsystem>
Now I'd like to know what is the name to put in place of node3, node2, node1.
How to define the name from my node?
Step 1: Edit the standalone-ha.xml from the master server and enter a name attribute in the tag below:
<server name="master" xmlns="urn:jboss:domain:5.0">
Step 2: Edit the standalone-ha.xml from the slave server and enter a name attribute in the tag below:
<server name="slave" xmlns="urn:jboss:domain:5.0">
Step 3: Edit the subsystem singleton in both servers like below:
<subsystem xmlns="urn:jboss:domain:singleton:1.0">
<singleton-policies default="default">
<singleton-policy name="default" cache-container="server">
<simple-election-policy>
<name-preferences>master</name-preferences>
</simple-election-policy>
</singleton-policy>
</singleton-policies>
</subsystem>
When the master drops then the slave takes over, but when the master get up it reassume the command.

HTTP Service is not getting discovered in OpenNms for tomcat8.5 without SendResonPharse

HttpMonitor Config was working fine with tomcat7 and http service was getting detected however as we have updated to tomcat 8.5 http service is not getting discovered unless we set connector properties as sendReasonPhrase=true, the difference in the curl response is like below in compare to tomcat7 and tomcat 8.5 (withoutsend Reson Phrase parameter set)
tomcat7 gives ok in its header and tomcat8.5 does not.
however option for sendreson phase will be deprecated and removed from tomcat9 and even this option will not be available (https://tomcat.apache.org/tomcat-8.5-doc/config/http.html)
I am not sure why httpMonitor in openNms is not able to detect the http service even the snmpwalk output see port 80 available (both with and without send reason phrase)
in poller-configuration.xml looks like below for http
<service name="HTTP" interval="300000" user-defined="false" status="on">
<parameter key="retry" value="1"/>
<parameter key="timeout" value="3000"/>
<parameter key="port" value="80"/>
<parameter key="url" value="/"/>
<parameter key="rrd-repository" value="/var/lib/opennms/rrd/response"/>
<parameter key="rrd-base-name" value="http"/>
<parameter key="ds-name" value="http"/>
</service>
even we tried setting
<parameter key="response-text" value="~\bOK\b"/>
and
<parameter key="response" value="200"/>
however it did not help, i guess above parameter play its role once service got discovered however the problem here the service is not getting discovered (unless SendReson pharse is turn on ) it will only detect http service in tomcat 8.5 if we have sendreson phase turn on in connector definition inside server.xml
Kindly help to understand this behaviour here and possible solution for this without any change on client side.
openNms version info:

JDBC-backed Infinispan Cache on JBoss EAP/Wildfly

I am trying to create a JDBC-backed Infinispan cache on a JBoss EAP 7 (or Wildfly 10) server. My cache-container definition in standalone-full.xml looks like this:
<cache-container name="SearchCacheContainer" default-cache="SearchCache" module="org.infinispan.cachestore.jdbc">
<local-cache name="SearchCache">
<expiration max-idle="60000" interval="6000"/>
<transaction mode="FULL_XA"/>
<string-keyed-jdbc-store data-source="java:jboss/datasources/InfinispanCacheDS" preload="true" passivation="false" purge="false">
<property name="databaseType">
postgres
</property>
<property name="createTableOnStart">
true
</property>
<string-keyed-table prefix="str_">
<id-column name="id" type="VARCHAR2(200)"/>
<data-column name="datum" type="BLOB"/>
<timestamp-column name="version" type="NUMBER"/>
</string-keyed-table>
</string-keyed-jdbc-store>
</local-cache>
</cache-container>
I have also declared the necessary JDBC datasource in my server like this:
<datasource jndi-name="java:jboss/datasources/InfinispanCacheDS" pool-name="InfinispanCacheDS" enabled="true" use-java-context="true">
<connection-url>jdbc:postgresql://localhost:5432/db_infinispan_cache</connection-url>
<driver>postgresql-jdbc4</driver>
<pool>
<min-pool-size>10</min-pool-size>
<max-pool-size>20</max-pool-size>
<prefill>true</prefill>
<flush-strategy>IdleConnections</flush-strategy>
</pool>
<security>
<user-name>infinispan_cache</user-name>
<password>mypasswordhere</password>
</security>
<validation>
<valid-connection-checker class-name="org.jboss.jca.adapters.jdbc.extensions.postgres.PostgreSQLValidConnectionChecker"/>
<validate-on-match>true</validate-on-match>
<exception-sorter class-name="org.jboss.jca.adapters.jdbc.extensions.postgres.PostgreSQLExceptionSorter"/>
</validation>
<statement>
<track-statements>true</track-statements>
</statement>
</datasource>
However, when I attempt to start my JBoss server, I see the following error and the server fails to start:
14:02:09,692 ERROR [org.jboss.as.controller] (Controller Boot Thread) WFLYCTL0362: Capabilities required by resource '/subsystem=infinispan/cache-container=SearchCacheContainer/local-cache=SearchCache/store=string-jdbc' are not available:
org.wildfly.data-source.java:jboss/datasources/InfinispanCacheDS; There are no known registration points which can provide this capability.
Can anyone explain what it is that I am doing wrong here? The documentation on this particular feature seems pretty thin, so I'm sure there's something I'm missing, but can't figure out what. Thanks!
You need to refer the below links[1], [2]:
[1]http://infinispan.org/docs/5.3.x/user_guide/user_guide.html
[2]http://docs.jboss.org/hibernate/orm/4.2/devguide/en-US/html_single/#d5e1433

How to connect to a Kerberos-secured Apache Phoenix data source with WildFly?

I have recently spent several weeks trying to get WildFly to successfully connect to a Kerberized Apache Phoenix data source. There is a surprisingly limited amount of documentation on how to do this, but now that I have cracked it, I'm sharing.
Environment:
WildFly 9+. An equivalent JBoss version should also work (but untested). WildFly 8 does not contain the required org.jboss.security.negotiation.KerberosLoginModule class (but you can hack it, see Kerberos sql server datasource in Wildfly 8.2). I used WildFly 10.1.0.Final, and used a standalone deployment.
Apache Phoenix 4.2.0.2.2.4.10. I have not tested any other version.
Kerberos v5. My KDC is running on Windows Active Directory, but this should not make a noticable difference.
My Hadoop environment is a HortonWorks version, and maintained by Ambari. Ambari ensures that all of the configuration files and Kerberos implementation settings are correct.
Firstly, you'll want to add a system property to WildFly's standalone.xml to specify the location of the Kerberos configuration file:
...
</extensions>
<system-properties>
<property name="java.security.krb5.conf" value="/path/to/krb5.conf"/>
</system-properties>
...
I'm not going to go into the format of the krb5.conf file here, as it is dependent on your own implementation of Kerberos. What is important is that it contains the default realm and network location of the KDC. On Linux you can normally find it at /etc/krb5.conf or /etc/security/krb5.conf. If you're running WildFly on Windows, then make sure you use forward-slashes in your path, e.g. "C:/Source/krb5.conf"
Secondly, add two new security domains to standalone.xml - one called "Client" which is used by ZooKeeper, and another called "host", which is used by WildFly. Do not ask me why (it caused me so much pain) but the name of the "Client" security domain must match that defined in Zookeeper's JAAS client configuration file on the server. If you've set up with Ambari, "Client" is the default name. Also note that you cannot simply provide a jaas.config file as a system property, you must define it here:
<security-domain name="Client" cache-type="default">
<login-module code="com.sun.security.auth.module.Krb5LoginModule" flag="required">
<module-option name="useTicketCache" value="true"/>
<module-option name="debug" value="true"/>
</login-module>
</security-domain>
<security-domain name="host" cache-type="default">
<login-module code="org.jboss.security.negotiation.KerberosLoginModule" flag="required" module="org.jboss.security.negotiation">
<module-option name="useTicketCache" value="true"/>
<module-option name="debug" value="true"/>
<module-option name="refreshKrb5Config" value="true"/>
<module-option name="addGSSCredential" value="true"/>
</login-module>
</security-domain>
The module options will vary depending on your implementation. I'm getting my tickets from the default Java ticket cache, which is defined in the java.security file of your JRE, but you can supply a keytab here if you want. Note that setting storeKey to true broke my implementation. Check the Java documentation for all of the options. Note that each security domain uses a different login module: this is not by accident - Phoenix does not know how to use the org.jboss... version.
Now you need to provide WildFly with the org.apache.phoenix.jdbc.PhoenixDriver class in phoenix-<version>-client.jar. Create the following directory tree under the WildFly directory:
/modules/system/layers/base/org/apache/phoenix/main/
In the main directory, paste the phoenix--client.jar which you can find on the server (e.g. /usr/hdp/<version>/phoenix/client/bin) and create a module.xml file:
<?xml version="1.0" ?>
<module xmlns="urn:jboss:module:1.1" name="org.apache.phoenix">
<resources>
<resource-root path="phoenix-<version>-client.jar">
<filter>
<exclude-set>
<path name="javax" />
<path name="org/xml" />
<path name="org/w3c/dom" />
<path name="org/w3c/sax" />
<path name="javax/xml/parsers" />
<path name="com/sun/org/apache/xerces/internal/jaxp" />
<path name="org/apache/xerces/jaxp" />
<path name="com/sun/jersey/core/impl/provider/xml" />
</exclude-set>
</filter>
</resource-root>
<resource-root path=".">
</resource-root>
</resources>
<dependencies>
<module name="javax.api"/>
<module name="sun.jdk"/>
<module name="org.apache.log4j"/>
<module name="javax.transaction.api"/>
<module name="org.apache.commons.logging"/>
</dependencies>
</module>
You also need to paste the hbase-site.xml and core-site.xml from the server into the main directory. These are typically located in /usr/hdp/<version>/hbase/conf and /usr/hdp/<version>/hadoop/conf. If you don't add these, you will get a lot of unhelpful ZooKeeper getMaster errors! If you want the driver to log to the same place as WildFly, then you should also create a log4j.xml file in the main directory. You can find an example elsewhere on the web. The <resource-root path="."></resource-root> element is what adds those xml files to the classpath when deployed by WildFly.
Finally, add a new datasource and driver in the <subsystem xmlns="urn:jboss:domain:datasources:2.0"> section. You can do this with the CLI or by directly editing standalone.xml, I did the latter:
<datasource jndi-name="java:jboss/datasources/PhoenixDS" pool-name="PhoenixDS" enabled="true" use-java-context="true">
<connection-url>jdbc:phoenix:first.quorumserver.fqdn,second.quorumserver.fqdn:2181/hbase-secure</connection-url>
<connection-property name="phoenix.connection.autoCommit">true</connection-property>
<driver>phoenix</driver>
<validation>
<check-valid-connection-sql>SELECT 1 FROM SYSTEM.CATALOG LIMIT 1</check-valid-connection-sql>
</validation>
<security>
<security-domain>host</security-domain>
</security>
</datasource>
<drivers>
<driver name="phoenix" module="org.apache.phoenix">
<xa-datasource-class>org.apache.phoenix.jdbc.PhoenixDriver</xa-datasource-class>
</driver>
</drivers>
It's important that you replace first.quorumserver.fqdn,second.quorumserver.fqdn with the correct ZooKeeper quorum string for your environment. You can find this in hbase-site.xml in the HBase configuration directory: hbase.zookeeper.quorum. You don't need to add Kerberos information to the connection URL string!
tl;dr
Make sure that hbase-site.xml and core-site.xml are in your classpath.
Make sure that you have a <security-domain> with a name that ZooKeeper expects (probably "Client"), that uses the com.sun.security.auth.module.Krb5LoginModule.
The Phoenix connection URL must contain the entire ZooKeeper quorum. You can't miss one server out! Make sure it matches the value in hbase-site.xml.
References:
Using Kerberos for Datasource Authentication
Phoenix data source configuration by Mark S

How do I set the number of "webcontainer worker-threads" in jboss as 7?

Most app. servers provide a way of tuning the number of WebContainer worker-threads when it goes down to tuning. Is it possible to do that in JBoss AS 7.x?
Thanks.
you can tune the HTTP Conector of the AS7 web subsystem. The available attributes you can tune for the HTTP Connector are described here The Http Connector. To define the max-connections for this connector you need change it in $JBOSS_HOME/standalone/configuration/standalone.xml or $JBOSS_HOME/domain/configuration/domain.xml
See this piece of configuration:
<subsystem xmlns="urn:jboss:domain:web:1.1" default-virtual-server="default-host" native="false">
<connector name="http"
protocol="HTTP/1.1"
scheme="http"
socket-binding="http"
max-connections="250"/>
...
</subsystem>
To define a thread pool specific for the HTTP Connector you need to use the AS7 threads subsystem like this one:
<subsystem xmlns="urn:jboss:domain:threads:1.0">
<bounded-queue-thread-pool name="http-executor" blocking="true">
<core-threads count="10" per-cpu="20" />
<queue-length count="10" per-cpu="20" />
<max-threads count="10" per-cpu="20" />
<keepalive-time time="10" unit="seconds" />
</bounded-queue-thread-pool>
</subsystem>
and then you need to reference it in the executor attribute of the HTTP Connector. See this piece of config:
<subsystem xmlns="urn:jboss:domain:web:1.1" default-virtual-server="default-host" native="false">
<connector name="http"
protocol="HTTP/1.1"
scheme="http"
socket-binding="http"
max-connections="250"
executor="http-executor"/>
...
</subsystem>
For more details about tuning the AS7 see this post JBoss AS 7 Performance tuning - Tuning Web server thread pool on the masterjboss.com.

Resources