I am using the svnkit to get some information about our svn repository. I used the examples mentioned in the svnkit documentation and I was able to fetch the details when I run the example in my local eclipse. Our repository is accessible via https protocol.
import java.io.IOException;
import javax.servlet.ServletException;
import javax.servlet.http.*;
import org.eclipse.jetty.server.Server;
import org.eclipse.jetty.servlet.*;
import org.tmatesoft.svn.core.SVNDirEntry;
import org.tmatesoft.svn.core.SVNException;
import org.tmatesoft.svn.core.SVNNodeKind;
import org.tmatesoft.svn.core.SVNURL;
import org.tmatesoft.svn.core.auth.ISVNAuthenticationManager;
import org.tmatesoft.svn.core.internal.io.dav.DAVRepositoryFactory;
import org.tmatesoft.svn.core.internal.io.fs.FSRepositoryFactory;
import org.tmatesoft.svn.core.internal.io.svn.SVNRepositoryFactoryImpl;
import org.tmatesoft.svn.core.io.SVNRepository;
import org.tmatesoft.svn.core.io.SVNRepositoryFactory;
import org.tmatesoft.svn.core.wc.SVNWCUtil;
public class HelloWorld extends HttpServlet {
public static String abc="";
@Override
protected void doGet(HttpServletRequest req, HttpServletResponse resp)
throws ServletException, IOException {
resp.getWriter().print("Hello from Java! The repository UUID is \n"+ abc);
}
public static void main(String[] args) throws Exception{
Server server = new Server(Integer.valueOf(System.getenv("PORT")));
ServletContextHandler context = new ServletContextHandler(ServletContextHandler.SESSIONS);
context.setContextPath("/");
server.setHandler(context);
context.addServlet(new ServletHolder(new HelloWorld()),"/*");
//If I use these set I am able to fetch the details from SVN.
//String url = "http://svn.svnkit.com/repos/svnkit/trunk/doc";
// String name = "anonymous";
//String password = "anonymous";
String url = "https://svn.ourComplanyRepo";
String name = "username";
String password = "password";
long startRevision = 0;
long endRevision = -1;
DAVRepositoryFactory.setup();
SVNRepository repository = null;
repository = SVNRepositoryFactory.create(SVNURL.parseURIEncoded(url));
ISVNAuthenticationManager authManager = SVNWCUtil.createDefaultAuthenticationManager(name, password);
repository.setAuthenticationManager(authManager);
SVNURL XYZ = repository.getLocation();
abc = repository.getRepositoryUUID(true);
server.start();
server.join();
}
}
WHen I deployed my code to the heroku, I am running into an issue. When I check the heroku logs this the issue that I found
0m Exception in thread "main" org.tmatesoft.svn.core.SVNException: svn: E175002: connection refused by the server
Could you please help me on how to resolve this?
A Google-search for the error yields some promising leads, try running with:
-Dsvnkit.http.sslProtocols="SSLv3"
... as suggested here .
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.