3 Replies Latest reply: May 28, 2012 12:28 PM by Bernard Labno RSS

Ho do create an Arquillian test for converscation scope??

Andi D Newbie

Hi again,


I have still troubles with arquillian tests.

During testing my EntityHome and using the persist Method I get the Exception: “javax.enterprise.context.ContextNotActiveException: Conversation Context not active when method called on conversation Transient conversation“.


My test looks like:

  public void testAppInstituteHome() throws LoginException, PermissionException, SecurityException, IllegalStateException, RollbackException, HeuristicMixedException, HeuristicRollbackException, SystemException, NotSupportedException{
    AppInstitute ai = new AppInstitute("Test Institute", "Location", "Street", new Integer(6020), "URL", new Long(854139751));
    transaction.begin();    AppInstituteHome.setInstance(ai);


The persist method in the AppInstituteHome is:

  public String persist() throws LoginException, PermissionException
    if (!isPermissionToPersist()) {
      throw createPermissionException(DroolsConstants.CREATE);


    // some additional code


    return returnTarget(getListOutcome());


Where the Code from the ConversationManager is:

public class ConversationManager implements Serializable
  @Inject private Conversation conversation;

  public void beginConversation() {    if (!conversation.isTransient()) { conversation.end(); }

  public void endConversation() {
    if (!conversation.isTransient())
      log.info("endConversation - really ending one");

  public String currentConversationId() {
    return conversation.getId();


The problem is (as I understand it), that I do not have a conversation in the test case. That's why I can not begin or end a conversation, and I get the "javax.enterprise.context.ContextNotActiveException: Conversation Context not active when method called on conversation Transient



I found some related topics with the solution of using the following code snipped (see for example http://seamframework.org/Community/ConversationScopedInArquillianWithWeldEmbedded) but I have no class ContextLifecycle.



Do you know how I can create a conversation, which is necessary for my test?