Configure Event Listener in Keycloak - jboss

I'm configuring a event listener in KeyCloak in a Wildfly 9.0.1.
I have created a .jar with two clases, implements a provider like Keycloak explains in his github's example.
In this example, Keycloak people explain it's necessary to register the provider editing "standalone/configuration/standalone.xml" and adding the module to the providers element.
I code this definition inside the tag "subsystem":
<spi name="eventsListener">
<provider name="my-event-listener" enabled="true">
<properties>
<property name="max" value="100" />
</properties>
</provider>
</spi>
When I start the server, it gives me a error like this:
ERROR [org.jboss.as.server] (Controller Boot Thread) WFLYSRV0055: Caught exception during boot: org.jboss.as.controller.persistence.ConfigurationPersistenceException: WFLYCTL0085: Failed to parse configuration
at org.jboss.as.controller.persistence.XmlConfigurationPersister.load(XmlConfigurationPersister.java:131)
at org.jboss.as.server.ServerService.boot(ServerService.java:350)
at org.jboss.as.controller.AbstractControllerService$1.run(AbstractControllerService.java:271)
at java.lang.Thread.run(Thread.java:745)
Caused by: javax.xml.stream.XMLStreamException: Unknown keycloak-server subsystem tag: spi
at org.keycloak.subsystem.server.extension.KeycloakSubsystemParser.readElement(KeycloakSubsystemParser.java:55)
at org.keycloak.subsystem.server.extension.KeycloakSubsystemParser.readElement(KeycloakSubsystemParser.java:39)
at org.jboss.staxmapper.XMLMapperImpl.processNested(XMLMapperImpl.java:110)
at org.jboss.staxmapper.XMLExtendedStreamReaderImpl.handleAny(XMLExtendedStreamReaderImpl.java:69)
at org.jboss.as.server.parsing.StandaloneXml.parseServerProfile(StandaloneXml.java:1199)
at org.jboss.as.server.parsing.StandaloneXml.readServerElement_1_4(StandaloneXml.java:457)
at org.jboss.as.server.parsing.StandaloneXml.readElement(StandaloneXml.java:144)
at org.jboss.as.server.parsing.StandaloneXml.readElement(StandaloneXml.java:106)
at org.jboss.staxmapper.XMLMapperImpl.processNested(XMLMapperImpl.java:110)
at org.jboss.staxmapper.XMLMapperImpl.parseDocument(XMLMapperImpl.java:69)
at org.jboss.as.controller.persistence.XmlConfigurationPersister.load(XmlConfigurationPersister.java:123)
... 3 more
FATAL [org.jboss.as.server] (Controller Boot Thread) WFLYSRV0056: Server boot has failed in an unrecoverable manner; exiting. See previous messages for details.
Someone knows what is wrong? I need help.
Thanks you.

I think you must code your definition inside : <subsystem xmlns="urn:jboss:domain:keycloak-server:1.1">

Related

Specification of javax.management.MBeanPermission in permissions.xml ineffective in JBoss EAP 7.4

I have a war file that I run under JBoss EAP 7.4. That war file contains a permissions.xml file that has the following:
<permissions version="7">
<!-- additional permissions omitted for brevity -->
<permission>
<class-name>javax.management.MBeanPermission</class-name>
<name>*</name>
<actions>queryNames,registerMBean,unregisterMBean</actions>
</permission>
</permissions>
Yet, when I run JBoss, I see the following error in the server.log, apparently caused by some hawtio code:
2022-11-17 19:36:30,507 ERROR
[org.jboss.as.controller.management-operation] (Controller Boot
Thread) WFLYCTL0013: Operation ("deploy") failed - address:
([("deployment" =>
"hawtio-wildfly-2.0.0.fuse-sb2-7_11_0-00036-redhat-00001.war")]) -
failure description: {"WFLYCTL0080: Failed services" =>
{"jboss.deployment.unit."hawtio-wildfly-2.0.0.fuse-sb2-7_11_0-00036-redhat-00001.war".undertow-deployment"
=> "java.lang.RuntimeException: java.lang.RuntimeException: java.security.AccessControlException: WFSM000001: Permission check
failed (permission "("javax.management.MBeanPermission"
"io.hawt.jmx.About#-[hawtio:type=About]" "registerMBean")" in
code source
"(vfs:/content/hawtio-wildfly-2.0.0.fuse-sb2-7_11_0-00036-redhat-00001.war/WEB-INF/lib/hawtio-system-2.0.0.fuse-sb2-7_11_0-00036-redhat-00001.jar
)" of "ModuleClassLoader for Module
"deployment.hawtio-wildfly-2.0.0.fuse-sb2-7_11_0-00036-redhat-00001.war"
from Service Module Loader")
It looks like there was a Red Hat Fuse defect similar to mine that got addressed around 2018. Why might I still be facing this problem? Is there something I can do on my end to resolve it? (I don't want to give all permissions.)

Classes inside persistence.xml will be ignored

I have here a wildfly 24.0.1 (on OpenJDK 11) and a ear with following structure:
MyPrj.ear
|- MyPrj_EJB.jar
`- MyPrj_Web.war
My persistence.xml is placed in MyPrj.ear/MyPrj_EJB.jar/META-INF/persistence.xml. I'm sure the persistence.xml isn't anywhere else.
The persistence.xml has following contents:
<persistence xmlns="http://java.sun.com/xml/ns/persistence"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" version="1.0" xsi:schemaLocation="http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_1_0.xsd">
<persistence-unit name="myPrj">
<provider>org.eclipse.persistence.jpa.PersistenceProvider</provider>
<jta-data-source>java:/myPrj</jta-data-source>
<class>my.prj.cfg.Config</class>
<properties>
<property name="eclipselink.query-results-cache" value="true"/>
<property name="eclipselink.cache.shared.default" value="true"/>
<property name="eclipselink.target-server" value="JBoss"/>
<property name="eclipselink.weaving" value="false"/>
<property name="jboss.as.jpa.providerModule" value="org.eclipse.persistence"/>
<!-- property name="eclipselink.logging.level" value="FINE" / -->
</properties>
</persistence-unit>
</persistence>
I'm sure that the persistence.xml can be readed, because if I put an invalid character into the persistence-unit name (like an "/": <persistence-unit name="/myPrj">) I get the following error while deploying the application:
Caused by: java.lang.IllegalArgumentException: WFLYJPA0043: Persistence unit name (/myPrj) contains illegal '/' character
So I'm assuming that my persistence.xml is put in the right place and can be read successfully.
But its seems that my <class>-definition will be ignored. Every time if I deploy the ear, I get in the wildfly log file:
...
2022-07-04 18:51:15,694 INFO [org.jboss.as.jpa] (MSC service thread 1-4) WFLYJPA0002: Read persistence.xml for myPrj
2022-07-04 18:52:48,400 INFO [org.jboss.as.jpa] (ServerService Thread Pool -- 141) WFLYJPA0003: Starting Persistence Unit Service 'MyPrj.ear/MyPrj_EJB.jar#myPrj'
...
2022-07-04 18:53:16,182 WARN [org.eclipse.persistence] (ServerService Thread Pool -- 184) session_manager_no_partition
...
If I start the application (open the web site) I get:
...
2022-07-04 18:57:45,366 INFO [org.eclipse.persistence] (default task-1) EclipseLink, version: Eclipse Persistence Services - 2.6.0.v20150309-bf26070
2022-07-04 18:57:45,444 INFO [org.eclipse.persistence.connection] (default task-1)
connecting(DatabaseLogin(
platform=>PostgreSQLPlatform
user name=> ""
connector=>JNDIConnector datasource name=>null
))
2022-07-04 18:57:45,444 INFO [org.eclipse.persistence.connection] (default task-1)
Connected: jdbc:postgresql://localhost:5432/myDB
User: myUser
Database: PostgreSQL Version: 9.2.24
Driver: PostgreSQL JDBC Driver Version: 42.2.23
2022-07-04 18:57:45,444 INFO [org.eclipse.persistence.connection] (default task-1)
connecting(DatabaseLogin(
platform=>PostgreSQLPlatform
user name=> ""
connector=>JNDIConnector datasource name=>null
))
2022-07-04 18:57:45,444 INFO [org.eclipse.persistence.connection] (default task-1)
Connected: jdbc:postgresql://localhost:5432/myDB
User: myUser
Database: PostgreSQL Version: 9.2.24
Driver: PostgreSQL JDBC Driver Version: 42.2.23
2022-07-04 18:57:45,446 INFO [org.eclipse.persistence.connection] (default task-1)
/vfs:/content/MyPrj.ear/MyPrj_EJB.jar/_myPrj login successful
2022-07-04 18:57:45,509 WARN [org.eclipse.persistence.metamodel] (default task-1) The
collection of metamodel types is empty. Model classes may not have been found
during entity search for Java SE and some Java EE container managed persistence
units. Please verify that your entity classes are referenced in persistence.xml
using either <class> elements or a global <exclude-unlisted-
classes>false</exclude-unlisted-classes> element
2022-07-04 18:57:45,606 ERROR [org.jboss.as.ejb3.invocation] (default task-1)
WFLYEJB0034: Jakarta Enterprise Beans Invocation failed on component ConfigDAO for
method public my.prj.cfg.Config
my.prj.cfg.ConfigDAO.loadByKey(java.lang.String):
javax.ejb.EJBTransactionRolledbackException: An exception occurred while creating
a query in EntityManager:
Exception Description: Problem compiling [SELECT obj FROM Config obj WHERE
obj.key=:parKey].
[16, 22] The abstract schema type 'Config' is unknown.
[33, 40] The state field path 'obj.key' cannot be resolved to a valid type.
at org.jboss.as.ejb3#24.0.1.Final//org.jboss.as.ejb3.tx.CMTTxInterceptor.invokeInCallerTx(CMTTxInterceptor.java:219)
Take also note of the warning 2022-07-04 18:57:45,509 WARN org.eclipse.persistence.metamodel] (default task-1) The collection of metamodel types is empty. Model classes may not have been found during entity search for Java SE and some Java EE container managed persistence units. Please verify that your entity classes are referenced in persistence.xml using either <class> elements or a global <exclude-unlisted- classes>false</exclude-unlisted-classes> element.
Also to use <exclude-unlisted-classes>false</exclude-unlisted-classes> instead of the <class>-definition makes no difference.
Here the #Resource annotation of the EntityManager:
#PersistenceContext(unitName="myPrj")
private EntityManager em = null;
And the annotation of the Config entity:
#Entity(name="Config")
#Table(name = "Cfg")
public class Config implements Serializable {
...
#Column(name="key")
private String key = null;
...
}
On the same wildfly I have another EAR running (in a separate standalone instance) which also have JPA access to a database (also eclipselink via persistence.xml) which works without any problems.
What can be wrong here?
Found it! After upgrading eclipselink to V2.7.10 (store eclipselink.jar into .../wildfly-24.0.1.Final/modules/system/layers/base/org/eclipse/persistence/main/) I can deploy and start the application. Not sure which version of eclipselink was used before that (the jar file name don't contains the version information ...)
Switching to eclipselink 3.0.2 don't works because of this problem: Wildfly 21 with eclipselink 3.0 getting error as Persistence Provider not found

Problem during deployment to Wildfly, with error "name is empty"

we are migrating from Jboss 4.2.2 to Wildfly. During deployment we are facing the following error.
Googling the error diidn't find anything. The error doesn't provide useful details.
my-server.jar defines several ejb3 beans.
Does anybody has an idea what might be wrong?
16:51:55,788 ERROR [org.jboss.msc.service.fail] (MSC service thread 1-5) MSC000001: Failed to start service jboss.deployment.subunit."myapp.ear"."my-server.jar".POST_MODULE: org.jboss.msc.service.StartException in service jboss.deployment.subunit."myapp.ear"."my-server.jar".POST_MODULE: WFLYSRV0153: Failed to process phase POST_MODULE of subdeployment "my-server.jar" of deployment "myapp.ear"
at org.jboss.as.server.deployment.DeploymentUnitPhaseService.start(DeploymentUnitPhaseService.java:189)
at org.jboss.msc.service.ServiceControllerImpl$StartTask.startService(ServiceControllerImpl.java:1739)
at org.jboss.msc.service.ServiceControllerImpl$StartTask.execute(ServiceControllerImpl.java:1701)
at org.jboss.msc.service.ServiceControllerImpl$ControllerTask.run(ServiceControllerImpl.java:1559)
at org.jboss.threads.ContextClassLoaderSavingRunnable.run(ContextClassLoaderSavingRunnable.java:35)
at org.jboss.threads.EnhancedQueueExecutor.safeRun(EnhancedQueueExecutor.java:1982)
at org.jboss.threads.EnhancedQueueExecutor$ThreadBody.doRunTask(EnhancedQueueExecutor.java:1486)
at org.jboss.threads.EnhancedQueueExecutor$ThreadBody.run(EnhancedQueueExecutor.java:1363)
at java.lang.Thread.run(Thread.java:745)
Caused by: java.lang.IllegalArgumentException: name is empty
at org.jboss.modules.ConcurrentClassLoader.performLoadClass(ConcurrentClassLoader.java:391)
at org.jboss.modules.ConcurrentClassLoader.loadClass(ConcurrentClassLoader.java:116)
at org.jboss.as.ee.component.deployers.ResourceReferenceProcessor.getResourceRefEntries(ResourceReferenceProcessor.java:157)
at org.jboss.as.ee.component.deployers.ResourceReferenceProcessor.processDescriptorEntries(ResourceReferenceProcessor.java:74)
at org.jboss.as.ee.component.deployers.AbstractDeploymentDescriptorBindingsProcessor.deploy(AbstractDeploymentDescriptorBindingsProcessor.java:100)
at org.jboss.as.server.deployment.DeploymentUnitPhaseService.start(DeploymentUnitPhaseService.java:182)
... 8 more
Try to delete every file and folder in wildfly --> standalone --> deployments and then run the standalone.bat file in wildfly --> bin.
Also, what made it work for us was to include the following dependency in the pom.xml file:
<dependency>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId>
<version>3.3.1</version>
</dependency>

Arquillian - Wildfly cannot deploy test.war (Could not connect to http-remoting://127.0.0.1:9990. The connection failed)

I am trying to run a simple JPA test (persist, read, JSON serialize) with Arquillian and Wildfly (8.1.0.Final and 8.2.0.Final tested) container, but until now I was not able to deploy test.war to the embedded server. The test runs with Jboss 7.1.1.Final container.
I have used arquillian-tutorial package given on Arquillian Getting Started Guide and Arquillian Example Project (google: github arquillian tutorial)
I have used Arquillian - Wildfly configuration given here
You can find a downloadable project package on google drive. You can see Maven and Arquillian configurations in that package. I have tried with or without Management realm credentials. On profile wildfy81-embedded-credentials (which is the default in the package), the build first unpacks wildfly package and then overwrites mgmt-users.properties and mgmt-groups.properties where admin user credentials and role is defined.
The exception is
INFO [org.jboss.ws.common.management] JBWS022052: Starting JBoss Web Services - Stack CXF Server 4.2.4.Final
INFO [org.jboss.as] JBAS015961: Http management interface listening on http://127.0.0.1:9990/management
INFO [org.jboss.as] JBAS015951: Admin console listening on http://127.0.0.1:9990
INFO [org.jboss.as] JBAS015874: WildFly 8.1.0.Final "Kenny" started in 3401ms - Started 184 of 233 services (81 services are lazy, passive or on-demand)
INFO [org.xnio] XNIO version 3.2.0.Beta4
INFO [org.xnio.nio] XNIO NIO Implementation Version 3.2.0.Beta4
INFO [org.jboss.remoting] JBoss Remoting version 4.0.3.Final
ERROR [org.jboss.remoting.remote.connection] JBREM000200: Remote connection failed: java.io.IOException: JBREM000202: Abrupt close on Remoting connection 0a93e136 to /127.0.0.1:9990
ERROR [org.jboss.remoting.remote.connection] JBREM000200: Remote connection failed: java.io.IOException: An existing connection was forcibly closed by the remote host
ERROR [org.jboss.remoting.remote.connection] JBREM000200: Remote connection failed: java.io.IOException: JBREM000202: Abrupt close on Remoting connection 084cf5d6 to /127.0.0.1:9990
ERROR [org.jboss.remoting.remote.connection] JBREM000200: Remote connection failed: java.io.IOException: An existing connection was forcibly closed by the remote host
WARN [org.jboss.as.arquillian.container.ArchiveDeployer] Cannot undeploy: test.war: org.jboss.as.controller.client.helpers.standalone.ServerDeploymentHelper$ServerDeploymentException: java.lang.RuntimeException: java.net.ConnectException: JBAS012174: Could not connect to http-remoting://127.0.0.1:9990. The connection failed
at org.jboss.as.controller.client.helpers.standalone.ServerDeploymentHelper.undeploy(ServerDeploymentHelper.java:109) [wildfly-controller-client-8.1.0.Final.jar:8.1.0.Final]
at org.jboss.as.arquillian.container.ArchiveDeployer.undeploy(ArchiveDeployer.java:55) [wildfly-arquillian-common-8.1.0.Final.jar:8.1.0.Final]
at org.jboss.as.arquillian.container.CommonDeployableContainer.undeploy(CommonDeployableContainer.java:152) [wildfly-arquillian-common-8.1.0.Final.jar:8.1.0.Final]
Caused by: java.lang.RuntimeException: java.net.ConnectException: JBAS012174: Could not connect to http-remoting://127.0.0.1:9990. The connection failed
at org.jboss.as.controller.client.impl.AbstractModelControllerClient.executeAsync(AbstractModelControllerClient.java:103) [wildfly-controller-client-8.1.0.Final.jar:8.1.0.Final]
at org.jboss.as.controller.client.helpers.standalone.impl.ModelControllerClientServerDeploymentManager.executeOperation(ModelControllerClientServerDeploymentManager.java:50) [wildfly-controller-client-8.1.0.Final.jar:8.1.0.Final]
at org.jboss.as.controller.client.helpers.standalone.impl.AbstractServerDeploymentManager.execute(AbstractServerDeploymentManager.java:79) [wildfly-controller-client-8.1.0.Final.jar:8.1.0.Final]
at org.jboss.as.controller.client.helpers.standalone.ServerDeploymentHelper.undeploy(ServerDeploymentHelper.java:106) [wildfly-controller-client-8.1.0.Final.jar:8.1.0.Final]
... 82 more
Caused by: java.net.ConnectException: JBAS012174: Could not connect to http-remoting://127.0.0.1:9990. The connection failed
at org.jboss.as.protocol.ProtocolConnectionUtils.connectSync(ProtocolConnectionUtils.java:117) [wildfly-protocol-8.1.0.Final.jar:8.1.0.Final]
at org.jboss.as.protocol.ProtocolConnectionManager$EstablishingConnection.connect(ProtocolConnectionManager.java:256) [wildfly-protocol-8.1.0.Final.jar:8.1.0.Final]
Could you please help me to find the issue here?
Thanks in advance.
Edit 1
From arquillian.xml
<container qualifier="wildfly-embedded-credentials">
<configuration>
<property name="jbossHome">target/wildfly-8.1.0.Final</property>
<property name="modulePath">target/wildfly-8.1.0.Final/modules</property>
<property name="managementAddress">127.0.0.1</property>
<property name="managementPort">9990</property>
<property name="username">admin</property>
<property name="password">admin</property>
<property name="outputToConsole">true</property>
</configuration>
</container>
Deployment code:
#Deployment
public static WebArchive createDeployment() {
return ShrinkWrap.create(WebArchive.class, "test.war")
.addPackage(MyBean.class.getPackage())
.addAsLibraries(new File("target/test-libs/commons-collections.jar"),
new File("target/test-libs/flexjson.jar"))
.addAsResource("test-persistence.xml", "META-INF/persistence.xml")
.addAsWebInfResource("jboss-ds.xml")
.addAsWebInfResource(EmptyAsset.INSTANCE, "beans.xml");
}
I wonder if this is because of URL
INFO Http management interface listening on http://127.0.0.1:9990/management
Edit 2
In the attached project (google drive link above), you will see there is another profile wildfy81-embedded in pom.xml with different arquillian configuration where I do not supply management address or username and password, only jbossHome and modulePath folders are defined. I get same exception (same port as well, 9990).
<container qualifier="wildfly-embedded">
<configuration>
<property name="jbossHome">target/wildfly-8.1.0.Final</property>
<property name="modulePath">target/wildfly-8.1.0.Final/modules</property>
<property name="outputToConsole">true</property>
</configuration>
</container>
On my last test, I have noticed one more exception cause (maybe because of java version or eclipse version that I am using at home). This was the exception at the bottom of other exception lines Could not connect to http-remoting://127.0.0.1:9990. The connection failed
Caused by: java.io.IOException: Invalid response
at org.xnio.http.HttpUpgradeParser.parseVersion(HttpUpgradeParser.java:150) [xnio-api-3.2.0.Beta4.jar:3.2.0.Beta4]
at org.xnio.http.HttpUpgradeParser.parse(HttpUpgradeParser.java:53) [xnio-api-3.2.0.Beta4.jar:3.2.0.Beta4]
at org.xnio.http.HttpUpgrade$HttpUpgradeState$UpgradeResultListener.handleEvent(HttpUpgrade.java:299) [xnio-api-3.2.0.Beta4.jar:3.2.0.Beta4]
at org.xnio.http.HttpUpgrade$HttpUpgradeState$UpgradeResultListener.handleEvent(HttpUpgrade.java:279) [xnio-api-3.2.0.Beta4.jar:3.2.0.Beta4]
at org.xnio.ChannelListeners.invokeChannelListener(ChannelListeners.java:92) [xnio-api-3.2.0.Beta4.jar:3.2.0.Beta4]
at org.xnio.conduits.ReadReadyHandler$ChannelListenerHandler.readReady(ReadReadyHandler.java:66) [xnio-api-3.2.0.Beta4.jar:3.2.0.Beta4]
at org.xnio.nio.NioSocketConduit.handleReady(NioSocketConduit.java:87) [xnio-nio-3.2.0.Beta4.jar:3.2.0.Beta4]
at org.xnio.nio.WorkerThread.run(WorkerThread.java:531) [xnio-nio-3.2.0.Beta4.jar:3.2.0.Beta4]
at ...asynchronous invocation...(Unknown Source)
at org.jboss.remoting3.EndpointImpl.doConnect(EndpointImpl.java:272) [jboss-remoting-4.0.3.Final.jar:4.0.3.Final]
at org.jboss.remoting3.EndpointImpl.doConnect(EndpointImpl.java:253) [jboss-remoting-4.0.3.Final.jar:4.0.3.Final]
at org.jboss.remoting3.EndpointImpl.connect(EndpointImpl.java:351) [jboss-remoting-4.0.3.Final.jar:4.0.3.Final]
at org.jboss.remoting3.EndpointImpl.connect(EndpointImpl.java:339) [jboss-remoting-4.0.3.Final.jar:4.0.3.Final]
at org.jboss.as.protocol.ProtocolConnectionUtils.connect(ProtocolConnectionUtils.java:78) [wildfly-protocol-8.1.0.Final.jar:8.1.0.Final]
at org.jboss.as.protocol.ProtocolConnectionUtils.connectSync(ProtocolConnectionUtils.java:109) [wildfly-protocol-8.1.0.Final.jar:8.1.0.Final]
... 95 more
I have encountered this exception (invalid response part) a few times because of Nvidia drivers on windows platform. NVIDIA Network Service is using the same port WildFly/JBoss AS is using. If you are using windows with nvidia, then please go to local services and stop this service, then check if the tests work :).
A few comments:
I have tried jboss/wildfly embedded a million times and never gotten it to work. It seems to merge the classpath with your maven or IDE environment with Wildfly. As a result I always have to revert to -managed deployment. Your example project works for me in this sense when I change it to managed.
I would recommend upgrading Arquillian to the latest version: 1.1.9.Final. A lot of bug fixes happen between releases
Your DeploymentFactory is referring to jar files in the /target/ directory but those don't exist under a normal maven run. (maybe your IDE is putting them there?). A better way to get the jar files you need is to use the shrinkwrap maven resolver.
<dependency>
<groupId>org.jboss.shrinkwrap.resolver</groupId>
<artifactId>shrinkwrap-resolver-depchain</artifactId>
<version>2.1.0</version>
<scope>test</scope>
<type>pom</type>
</dependency>
ConfigurableMavenResolverSystem mvnResolver = Maven.configureResolver();
PomEquippedResolveStage pers = mvnResolver.loadPomFromFile("pom.xml");
return ShrinkWrap.create(WebArchive.class, "test.war")
.addPackage(MyBean.class.getPackage())
.addAsLibraries(pers.resolve("commons-collections:commons-collections").withTransitivity().asFile())
.addAsLibraries(pers.resolve("net.sf.flexjson:flexjson").withTransitivity().asFile())
.addAsResource("test-persistence.xml", "META-INF/persistence.xml")
.addAsWebInfResource("jboss-ds.xml")
.addAsWebInfResource(EmptyAsset.INSTANCE, "beans.xml");
Changing management port in Wildfly worked for me:
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-failsafe-plugin</artifactId>
<version>2.18.1</version>
<configuration>
<forkCount>1</forkCount>
<systemPropertyVariables>
<java.util.logging.manager>org.jboss.logmanager.LogManager</java.util.logging.manager>
<jboss.home>${project.basedir}/container/wildfly-8.1.0.Final</jboss.home>
<module.path>${project.basedir}/container/wildfly-8.1.0.Final/modules</module.path>
<jboss.http.port>8181</jboss.http.port>
<jboss.management.http.port>9090</jboss.management.http.port>
</systemPropertyVariables>
<redirectTestOutputToFile>false</redirectTestOutputToFile>
</configuration>
<executions>
<execution>
<goals>
<goal>integration-test</goal>
<goal>verify</goal>
</goals>
</execution>
</executions>
</plugin>
Remember to configure management port for Arquillian in arquillian.xml:
<container qualifier="wildfly-embedded" default="true">
<configuration>
<property name="managementPort">9090</property>
</configuration>
</container>

How to configure startup sequence of JBoss services (JmsActivation)

When I deploy my application on JBoss 5 the EJBs are created before the QueueService is started. Creation of Message Driven beans now fails miserably because the queues are not yet available:
17:11:29,151 INFO [EJBContainer] STARTED EJB: .....
17:11:29,266 INFO [JndiSessionRegistrarBase] Binding the following Entries in Global JNDI:
..
..
17:11:29,928 WARN [JmsActivation] Failure in jms activation org.jboss.resource.adapter.jms.inflow.JmsActivationSpec#11694c ...
javax.naming.NameNotFoundException: ... not bound
at org.jnp.server.NamingServer.getBinding(NamingServer.java:771)
at org.jnp.server.NamingServer.getBinding(NamingServer.java:779)
at org.jnp.server.NamingServer.getObject(NamingServer.java:785)
at org.jnp.server.NamingServer.lookup(NamingServer.java:443)
at org.jnp.server.NamingServer.lookup(NamingServer.java:399)
at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:722)
at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:682)
at javax.naming.InitialContext.lookup(InitialContext.java:392)
at org.jboss.util.naming.Util.lookup(Util.java:222)
at org.jboss.resource.adapter.jms.inflow.JmsActivation.setupDestination(JmsActivation.java:464)
at org.jboss.resource.adapter.jms.inflow.JmsActivation.setup(JmsActivation.java:352)
at org.jboss.resource.adapter.jms.inflow.JmsActivation$SetupActivation.run(JmsActivation.java:729)
at org.jboss.resource.work.WorkWrapper.execute(WorkWrapper.java:213)
at org.jboss.util.threadpool.BasicTaskWrapper.run(BasicTaskWrapper.java:260)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
at java.lang.Thread.run(Thread.java:619)
17:11:30,027 INFO [QueueService] Queue[/queue/....] started, fullSize=200000, pageSize=2000, downCacheSize=2000
How can the deploy sequence be configured?
Found the answer myself. I added the following annotation to the message driven bean:
#Depends({"jboss.messaging.destination:service=Topic,name=XxxxTopic"})
<?xml version="1.0" encoding="UTF-8"?>
<!--
Null persistence config.
Use this if you don't actually want to persist anything
$Id$
-->
<server>
<!-- Persistence Manager MBean configuration
======================================== -->
<mbean code="org.jboss.messaging.core.jmx.NullPersistenceManagerService"
name="jboss.messaging:service=PersistenceManager"
xmbean-dd="xmdesc/NullPersistenceManager-xmbean.xml"/>
<!-- Messaging Post Office MBean configuration
========================================= -->
<mbean code="org.jboss.messaging.core.jmx.MessagingPostOfficeService"
name="jboss.messaging:service=PostOffice"
xmbean-dd="xmdesc/MessagingPostOffice-xmbean.xml">
<depends optional-attribute-name="ServerPeer">jboss.messaging:service=ServerPeer</depends>
<depends optional-attribute-name="TransactionManager">jboss:service=TransactionManager</depends>
<!-- The name of the post office -->
<attribute name="PostOfficeName">JMS post office</attribute>
<!-- This post office is clustered. If you don't want a clustered post office then set to false -->
<attribute name="Clustered">false</attribute>
</mbean>
<!-- Messaging JMS User Manager MBean config
======================================= -->
<mbean code="org.jboss.jms.server.plugin.JDBCJMSUserManagerService"
name="jboss.messaging:service=JMSUserManager"
xmbean-dd="xmdesc/JMSUserManager-xmbean.xml">
<depends optional-attribute-name="TransactionManager">jboss:service=TransactionManager</depends>
</mbean>
</server>
save this as 'null-persistence-service.xml' and put this deploy/messaging/
Now it will works