Hi All,

I have the strangest problem. I'm running a Glassfish server with the
JackRabbit v1.5 resource adapter. For my application I have a JSF front-end
which makes use of a stateless session bean to connect to JackRabbit. I have
methods to create a test folder and to remove a test folder, as follow:

JSF:

@EJB
private RepositoryBean repositoryBean;

public void createFolder(ActionEvent event) {
  repositoryBean.createFolder("Test Folder");
}

public void removeFolder(ActionEvent event) {
  repositoryBean.removeFolder("Test Folder");
}

RepositoryBean:

@Resource(name = "jcr/repository")
private Repository repository;

private Session session;

public void createFolder(String folderName) throws RepositoryException {
  openSession();
  session.getRootNode().addNode(folderName);
  session.save();
  closeSession();
}

public void removeFolder(String folderName) throws RepositoryException {
  openSession();
  session.getRootNode().getNode(folderName).remove();
  session.save();
  closeSession();
}

private void openSession() {
  SimpleCredentials credentials = new SimpleCredentials("user",
"pass".toCharArray());
  try {
    session = repository.login(lCredentials);
  }
  catch (Exception exception) {
    throw new RuntimeException(exception)
  }
}

private void closeSession() {
  session.close();
}

Problem is, this works about half the time, and the other half of the time I
receive the following exception:

 Transaction aborted; nested exception is:
javax.transaction.RollbackException javax.ejb.EJBException: Transaction
aborted; nested exception is: javax.transaction.RollbackException
javax.transaction.RollbackException at
Which doesn't tell me what the underlying problem is at all. I've tried
debugging both the JSF and the Session bean methods and they execute without
a problem. The exception occurs sometime after the Session bean method has
finished, but before the JSF method receives control again. I am fairly
confident that this problem is somehow related to JackRabbit, as I have
other Session beans that work without problem.

Any ideas? Is there anyway I can easily find the root of the problem?

Thank you,
Jaco

Reply via email to