[Solved] Randomly @Before method runs twice


#1

Arquillian version: 1.1.8 Final
Arquillian mode: in-container, jboss-as-remote
Jboss version: 7.1.2 Final

I am using Arquillian 1.1.8 Final in container mode. I observed that, not always, but sometimes @Before method gets executed twice. That causes test method to fail with exception (java.lang.reflect.UndeclaredThrowableException).

I did not add stacktrace, but please let me know if that would help.


#2

Getting same problem with older version of Arquillian as well. So it might be problem with JBoss container adapter for Arquillian. So opened post with Jboss as well. But please let me know if more information is needed to investigate this problem as I will try to provide.

Link for JBoss discussion forum with the post on same subject: https://developer.jboss.org/message/933315#933315


#3

Have you tried using the Servlet Protocol instead of the default JMX based on?

Setting the defaultProtocol in arquillian.xml: https://github.com/arquillian/arquillian-showcase/blob/master/multinode/src/test/resources/arquillian.xml#L6
and including the arquillian-protocol-servlet artifact: https://github.com/arquillian/arquillian-showcase/blob/master/multinode/pom.xml#L41


#4

Thanks. I switched to Servlet Protocol.
Since its a random issue for me (and I cant yet figure out steps to reproduce), I will come back if it fails again.

Out of curiosity, is it a know issue for JMX protocol?


#5

Not that I’m aware off. It’s just become a general rule, if JMX doesn’t work try Servlet.

JMX was never really intended to be used by Users of JBoss AS. It’s the protocol that is used to test JBoss AS it self, and you can get into some more internals, but it has it’s fair share of quirks…


#6

I can confirm with Servlet Protocol issue is resolved.

Just for information if anyone finds helpful.

Basically, issue is reproducible with JMX protocol when put Thread.sleep with delay of more than a minute. In that case @Before method for next test method get invoked, even before first is not finished. This doesn’t happen when switched to Servlet Protocol.