XNSIO
  About   Slides   Home  

 
Managed Chaos
Naresh Jain's Random Thoughts on Software Development and Adventure Sports
     
`
 
RSS Feed
Recent Thoughts
Tags
Recent Comments

svn: Unable to open an ra_local session to URL

Currently I’m working on adding Revision Control support to FitNesse. In the process, I’m creating a SVN adapter using svnkit library.

Once I’ve added a file, if I try to commit the file using

1
2
3
4
5
6
protected void commit(File file) throws SVNException {
final SVNClientManager manager = SVNClientManager.newInstance();
final SVNCommitClient commitClient = manager.getCommitClient();
final File[] filesToCommit = new File[] { file };
commitClient.doCommit(filesToCommit, false, "Auto Commit", false, false);
}

I get the following exception:

1
2
3
4
5
svn: Unable to open an ra_local session to URL
at org.tmatesoft.svn.core.internal.wc.SVNErrorManager.error(SVNErrorManager.java:55)
at org.tmatesoft.svn.core.internal.wc.SVNErrorManager.error(SVNErrorManager.java:40)
at org.tmatesoft.svn.core.wc.SVNCommitClient.doCommit(SVNCommitClient.java:582)
at org.tmatesoft.svn.core.wc.SVNCommitClient.doCommit(SVNCommitClient.java:549)

Trying to Google for this, did not take me anywhere. Finally after debugging thru svnkit’s code, I stumbled upon the following line which throws the exception:

1
SVNRepository repository = SVNRepositoryFactory.create(SVNURL.parseURIDecoded(url));

Basically, they have SVNRepositoryFactory class which expects the client to register an appropriate driver to handle the given protocol. Their javadocs says:

Depending on what protocol a user exactly would like to use to access the repository he should first of all set up an appropriate extension of this factory. So, if the user is going to work with the repository via the custom svn-protocol (or svn+xxx) he initially calls

1
SVNRepositoryFactoryImpl.setup();

More details: http://svnkit.com/kb/javadoc/org/tmatesoft/svn/core/io/SVNRepositoryFactory.html

Solution: Since I’m using File System (file://) protocol, I had to add the following line in a static block of my adapter class:

1
FSRepositoryFactory.setup();

    Licensed under
Creative Commons License