repository cannot be started because transactions are not enabled
jasdanh Dec 2, 2012 11:10 PMI get this error
javax.jcr.RepositoryException: Error while starting 'my_repository' repository: The 'my_repository' repository cannot be started because transactions are not enabled. Please check your configuration.
Shutting down engine ...
at org.modeshape.jcr.JcrRepository.login(JcrRepository.java:611)
at org.modeshape.jcr.JcrRepository.login(JcrRepository.java:578)
at org.modeshape.jcr.JcrRepository.login(JcrRepository.java:147)
at com.jlencore.service.jcr.example.modeshape.ModeShapeTester.main(ModeShapeTester.java:63)
Caused by: java.lang.IllegalStateException: The 'my_repository' repository cannot be started because transactions are not enabled. Please check your configuration.
at org.modeshape.jcr.JcrRepository$RunningState.validateTransactionsEnabled(JcrRepository.java:1217)
at org.modeshape.jcr.JcrRepository$RunningState.<init>(JcrRepository.java:1046)
at org.modeshape.jcr.JcrRepository$RunningState.<init>(JcrRepository.java:960)
at org.modeshape.jcr.JcrRepository.doStart(JcrRepository.java:352)
at org.modeshape.jcr.JcrRepository.login(JcrRepository.java:609)
... 3 more
My infinispan-configuration.xml
{
"name" : "my_repository",
"jndiName" :"",
"transactionMode" : "auto",
"monitoring" : {
"enabled" : true,
},
"workspaces" : {
"predefined" : ["otherWorkspace"],
"default" : "default",
"allowCreation" : true,
},
"storage" : {
"cacheName" : "my_repository",
"cacheConfiguration" : "infinispan-configuration.xml",
"transactionManagerLookup" = "org.infinispan.transaction.lookup.GenericTransactionManagerLookup",
"binaryStorage" : {
"type" : "file",
"directory" : "my_repository/binaries",
"minimumBinarySizeInBytes" : 4096
}
}
}
Java Code
public static void main(String[] args) {
// TODO Auto-generated method stub
//ModeShapeEngine engine = new ModeShapeEngine();
//engine.start();
// Create and start the engine ...
ModeShapeEngine engine = new ModeShapeEngine();
engine.start();
// Load the configuration for a repository via the classloader (can also use path to a file)...
Repository repository = null;
String repositoryName = null;
try {
URL url = ModeShapeTester.class.getClassLoader().getResource("my_repository.json");
RepositoryConfiguration config = RepositoryConfiguration.read(url);
// We could change the name of the repository programmatically ...
// config = config.withName("Some Other Repository");
// Verify the configuration for the repository ...
Problems problems = config.validate();
if (problems.hasErrors()) {
System.err.println("Problems starting the engine.");
System.err.println(problems);
System.exit(-1);
}
// Deploy the repository ...
repository = engine.deploy(config);
repositoryName = config.getName();
} catch (Throwable e) {
e.printStackTrace();
System.exit(-1);
return;
}
Session session = null;
try {
// Get the repository
repository = engine.getRepository(repositoryName);
// Create a session ...
session = repository.login("default");
// Get the root node ...
Node root = session.getRootNode();
assert root != null;
useWorkspace(root);
session.save();
System.out.println("Found the root node in the \"" + session.getWorkspace().getName() + "\" workspace");
} catch (RepositoryException e) {
e.printStackTrace();
} finally {
if (session != null) session.logout();
System.out.println("Shutting down engine ...");
try {
engine.shutdown().get();
System.out.println("Success!");
} catch (Exception e) {
e.printStackTrace();
}
}
}