WFLYCTL0362: Capabilities required by resource '/subsystem=microprofile-metrics-smallrye' are not available: - jboss

I am trying to migrate WildFly 21 to 24 .
I have these errors in the console. Server can not running it is stopped.
14:11:19,550 ERROR [org.jboss.as.controller] (Controller Boot Thread) WFLYCTL0362: Capabilities required by resource '/subsystem=microprofile-health-smallrye' are not available:
org.wildfly.extension.health.http-context; There are no known registration points which can provide this capability.
org.wildfly.extension.health.server-probes; There are no known registration points which can provide this capability. 14:11:19,550 ERROR [org.jboss.as.controller] (Controller Boot Thread) WFLYCTL0362: Capabilities required by resource '/subsystem=microprofile-metrics-smallrye' are not available:
org.wildfly.extension.metrics.http-context; There are no known registration points which can provide this capability.
I have added metrics and health extensions to standalone xmls
<extension module="org.wildfly.extension.microprofile.health-smallrye"/>
<extension module="org.wildfly.extension.microprofile.metrics-smallrye"/>
<subsystem xmlns="urn:wildfly:microprofile-health-smallrye:2.0" security-enabled="false" empty-liveness-checks-status="${env.MP_HEALTH_EMPTY_LIVENESS_CHECKS_STATUS:UP}" empty-readiness-checks-status="${env.MP_HEALTH_EMPTY_READINESS_CHECKS_STATUS:UP}"/>
<subsystem xmlns="urn:wildfly:microprofile-metrics-smallrye:2.0" security-enabled="false" exposed-subsystems="*" prefix="${wildfly.metrics.prefix:wildfly}"/>
but for main configuration file I am using a different xml.
I saw in another questions using jboss.cli to add these extensions but jboss cli is not connecting because server can not running currently.
Do you have any suggestions or advices ?
Thanks.

You can still use CLI in "offline" mode to add the extension. First simply enter a CLI session with:
$JBOSS_HOME/bin/jboss-cli.sh
Then you can start the embedded server to make your changes.
embed-server
You should end up seeing something like this:
[disconnected /] embed-server
[standalone#embedded /]
From here you can enter CLI commands like:
/extension=org.wildfly.extension.microprofile.health-smallrye:add
/extension=org.wildfly.extension.microprofile.metrics-smallrye:add
/subsystem=microprofile-health-smallrye:add(security-enabled=false, empty-liveness-checks-status="${env.MP_HEALTH_EMPTY_LIVENESS_CHECKS_STATUS:UP}", empty-readiness-checks-status="${env.MP_HEALTH_EMPTY_READINESS_CHECKS_STATUS:UP}")
The output should look something like:
[standalone#embedded /] /extension=org.wildfly.extension.microprofile.health-smallrye:add
{"outcome" => "success"}
[standalone#embedded /] /extension=org.wildfly.extension.microprofile.metrics-smallrye:add
{"outcome" => "success"}
[standalone#embedded /] /subsystem=microprofile-health-smallrye:add(security-enabled=false, empty-liveness-checks-status="${env.MP_HEALTH_EMPTY_LIVENESS_CHECKS_STATUS:UP}", empty-readiness-checks-status="${env.MP_HEALTH_EMPTY_READINESS_CHECKS_STATUS:UP}")
{"outcome" => "success"}
Then you can just exit CLI.

I found out microprofile.health-smallrye and microprofile.metrics-smallrye are not supported in WildFly 24. You should use subsystem=metrics,subsystem=health.
If you look into this in detail check here.

Related

Can not create jms-queue in wildfly using jboss-cli

I started wildfly 24 server with standalone-full.xml profile, when i run following command in jboss-cli to create jms-queue i get following error
[standalone#localhost:9990 /] jms-queue --profile=full add --queue-address=foo --entries=["java:/jms/queue/foo"]
WFLYCTL0175: Resource [
("subsystem" => "messaging-activemq"),
("server" => "default")
] does not exist; a resource at address [
("subsystem" => "messaging-activemq"),
("server" => "default"),
("jms-queue" => "foo")
] cannot be created until all ancestor resources have been added
What am i missing here? Any reference docs to create the jms server, queues?
Update:
I tried to create the server using web console first
And it filed with the required capabilities are not available, any documentation refernece that indicates what are the required capabilities i need to added prior configuring JMS
Yes don't use the profile parameter which is used in domain mode.
jms-queue add --queue-address=foo --entries=["java:/jms/queue/foo"]
works properly.
The issue is i was using wildfly "WildFly Preview EE 9.1 Distribution" the correct verirsion is "Jakarta EE 8 Full & Web Distribution"

Unable to configure postgreSQL datasource for Keycloak

I'm trying to configure a PostgresSQL datasource by following the
tutorial presented in the documentation:
http://www.keycloak.org/docs/1.9/server_installation_guide/topics/database.html
.
I'm doing the configuration for a standalone server by running
standalone.bat and by configuring everything in
keycloak-3.0.0.Final/standalone/configuration/standalone.xml .
I'm following the documentation step-by-step, but I get the following
error running standalone.bat every-time, and thus I'm unable to connect to the database.
15:33:11,684 ERROR [org.jboss.as.controller.management-operation]
(Controller Boot Thread) WFLYCTL0013: Operation ("add"
) failed - address: ([
("subsystem" => "datasources"),
("data-source" => "KeycloakDS")
]) - failure description: {"WFLYCTL0180: Services with
missing/unavailable dependencies" => [
"org.wildfly.data-source.KeycloakDS is missing
[jboss.jdbc-driver.postgres-driver]",
"jboss.driver-demander.java:jboss/datasources/KeycloakDS is missing
[jboss.jdbc-driver.postgres-driver]"
]}
15:33:11,687 ERROR [org.jboss.as.controller.management-operation]
(Controller Boot Thread) WFLYCTL0013: Operation ("add"
) failed - address: ([
("subsystem" => "datasources"),
("data-source" => "KeycloakDS")
]) - failure description: {"WFLYCTL0180: Services with
missing/unavailable dependencies" => [
"org.wildfly.data-source.KeycloakDS is missing
[jboss.jdbc-driver.postgres-driver]",
"jboss.driver-demander.java:jboss/datasources/KeycloakDS is missing
[jboss.jdbc-driver.postgres-driver]",
"org.wildfly.data-source.KeycloakDS is missing
[jboss.jdbc-driver.postgres-driver]"
I have tried different versions of JDBC drivers provided by:
https://jdbc.postgresql.org/, but to no avail, even by
using the version mentioned in the documentation.
At this point I am stuck since my configuration files look exactly like
in the documentation. What exactly could I be missing? Is the
documentation up to date?
you cant find the same question- http://lists.jboss.org/pipermail/keycloak-user/2017-March/010120.html,
but couldnt find any solution there,so re posting the same here.
I use jboss-cli.sh (or .bat if you're on Windows) to manage this for me. With Keycloak stopped and your PATH including $KEYCLOAK_HOME/bin I put the script below into a file (example: config_db.cli):
embed-server --server-config=standalone.xml --std-out=echo
batch
#
# remove the default provided datasource
#
/subsystem=datasources/data-source=KeycloakDS/:remove
#
# add it back using PostgreSQL
#
module add --name=org.postgres --resources=/path/to/your/postgresql-42.1.4.jar --dependencies=javax.api,javax.transaction.api
/subsystem=datasources/jdbc-driver=postgres:add(driver-name="postgres",driver-module-name="org.postgres",driver-class-name=org.postgresql.Driver)
/subsystem=datasources/data-source=KeycloakDS/:add(connection-url=jdbc:postgresql://localhost:5432/db_name,driver-name=postgres,jndi-name=java:jboss/datasources/KeycloakDS,password=db_password,user-name=db_user)
run-batch
And run with bin/jboss-cli.sh --file=config_db.cli
Note that this assumes you've already created a PostgreSQL database user (db_user above) with a password (db_password) and a database owned by the db_user (db_name).
In this way I can create my datasources the same way on my local machine as I do on my servers.
CORRECTIONS MADE: The format for running the jboss-cl.sh is:
bin/jboss-cli.sh --file=filename

How to add keycloak subsystem to secure WARs using jboss-cli

I am following the keycloak documentation to secure my WAR using wildfly adapter subsystem.
I am trying to add the following using jboss-cli.sh -
<secure-deployment name="WAR MODULE NAME.war">
<realm>bkofc</realm>
<auth-server-url>http://192.168.99.100:30001/auth</auth-server-url>
<bearer-only>true</bearer-only>
<ssl-required>EXTERNAL</ssl-required>
<resource>bkofc-svc</resource>
<credential name="secret">9bcc6d9f-9c72-4b58-b297-79f0f207d9e1</credential>
<use-resource-role-mappings>true</use-resource-role-mappings>
</secure-deployment>
However the "credential" attribute is not recognized :
[standalone#localhost:9990 /]
/subsystem=keycloak/securedeployment=my.war/:add(realm=bkofc,auth-server-
url=http://192.168.99.100/30001/auth, bearer-only=true, ssl-
required=EXTERNAL, resource=bkofc-svc, use-resource-role-mappings=true,
credential=9bcc6d9f-9c72-4b58-b297-79f0f207d9e1)
'credential' is not found among the supported properties: [allow-any-
hostname, always-refresh-token, auth-server-url, auth-server-url-for-
backend-requests, autodetect-bearer-only, bearer-only, client-key-password,
client-keystore, client-keystore-password, connection-pool-size, cors-
allowed-headers, cors-allowed-methods, cors-max-age, disable-trust-manager,
enable-basic-auth, enable-cors, expose-token, min-time-between-jwks-
requests, principal-attribute, public-client, realm, realm-public-key,
register-node-at-startup, register-node-period, resource, ssl-required,
token-minimum-time-to-live, token-store, truststore, truststore-passw
ord, turn-off-change-session-id-on-login, use-resource-role-mappings]
[standalone#localhost:9990 /]
Without the credential property, rest are getting added properly.
How can I fix this ?
You have to add credential a bit later, you should try something like:
/subsystem=keycloak/securedeployment=my.war/:add(realm=bkofc,auth-server-url=http://192.168.99.100/30001/auth, bearer-only=true, ssl-required=EXTERNAL, resource=bkofc-svc, use-resource-role-mappings=true)
/subsystem=keycloak/secure-deployment=my.war/credential=secret:add(value="9bcc6d9f-9c72-4b58-b297-79f0f207d9e1")

WildFly 9 Access Logging

I am trying to set up access logging using WildFly 9 in Domain mode. I have found a few resources which suggest using something like this in the domain.xml file:
<host name="default-host" alias="localhost">
<location name="/" handler="welcome-content"/>
<filter-ref name="server-header"/>
<filter-ref name="x-powered-by-header"/>
<access-log pattern="%A%t%h%l%u%r%s%b%T%I" directory="${jboss.server.log.dir}" prefix="access" suffix=".log"/>
</host>
I then restarted wildfly, but no logging is occurring and there are no errors in the wildfly start up, so I am just banging my head against the wall. I would really appreciate any help that anyone can provide.
Also is there a way to register access logging using the cli in domain mode?
There should be a way to add all resources in CLI for both domain mode and standalone. It's possible you're editing the wrong profile in the XML. Regardless using CLI is the preferred solution.
The first thing you need to know is which profile you're running under. You can determine by the server-group(s) running.
[domain#localhost:9990 /] /server-group=*:read-attribute(name=profile)
{
"outcome" => "success",
"result" => [
{
"address" => [("server-group" => "main-server-group")],
"outcome" => "success",
"result" => "full"
},
{
"address" => [("server-group" => "other-server-group")],
"outcome" => "success",
"result" => "full-ha"
}
]
}
We'll assume here we're using the main-server-group. You then need to add the access-log setting to the undertow subsystem.
/profile=full/subsystem=undertow/server=default-server/host=default-host/setting=access-log:add(pattern="%A%t%h%l%u%r%s%b%T%I", directory="${jboss.server.log.dir}", prefix=access, suffix=".log")
This will add access logging to all servers in that server-group. You will need to access a server via a web request before the log will be created. No restart or reload is required either.
One extra note too you can see what settings are available to the setting resource in undertow with the following command.
/profile=full/subsystem=undertow/server=default-server/host=default-host/setting=*:read-resource-description
If you need to log time taken to process the request, in seconds (format attribute %T) you should add additional parameter:
/profile=full/subsystem=undertow/server=default-server/http-listener=default:write-attribute(name=record-request-start-time,value=true)

In Wildfly 9 is there a way to suspend only certain MDB

I am able to call :suspend and :resume from the cli, however, this suspends all beans (EJB, MDB). Is there a way to only suspend message driven beans MDBs?
In my application all the work comes in via messages. If I can suspend the message consumers, I can be sure that rest of the system will continue to work until all the work in progress is finished. For example if an EJB was trying to put a message on the queue it will be able to do so.
You can use the following CLI operations on the MDB. For details see https://docs.jboss.org/author/display/WFLY10/Message+Driven+Beans+Controlled+Delivery. Though the documentation is for WildFly 10; it also works with WildFly 9.x
For standalone mode:
[standalone#localhost:9990 /] cd deployment=jboss-helloworld-mdb.war/subsystem=ejb3/message-driven-bean=HelloWorldMDB
[standalone#localhost:9990 message-driven-bean=HelloWorldMDB] :stop-delivery
{"outcome" => "success"}
[standalone#localhost:9990 message-driven-bean=HelloWorldMDB] :start-delivery
{"outcome" => "success"}
For domain mode:
Stop delivery
/host=master/server=default/deployment=helloworld.app.war/subsystem=ejb3/message-driven-bean=HelloWorldMDB:stop-delivery
Start delivery:
/host=master/server=default/deployment=helloworld.app.war/subsystem=ejb3/message-driven-bean=HelloWorldMDB:start-delivery
If the MDB resides in an EJB jar inside an EAR file:
/host=master/server=default/deployment=helloworld.app.ear/subdeployment=helloworld.core.impl.jar/subsystem=ejb3/message-driven-bean=HelloWorldMDB:start-delivery