java - 无法使用部署在 Heroku 上的 Java 应用程序中的 svnkit 连接到 HTTPS svn 服务器

标签 java svn heroku svnkit

我正在使用 svnkit 获取有关我们的 svn 存储库的一些信息。我使用了 svnkit 文档中提到的示例,当我在本地 eclipse 中运行该示例时,我能够获取详细信息。我们的存储库可通过 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();      
}

}

当我将我的代码部署到 heroku 时,我遇到了一个问题。当我检查 heroku 日志时,我发现了这个问题

 0m Exception in thread "main" org.tmatesoft.svn.core.SVNException: svn: E175002: connection refused by the server

你能帮我解决这个问题吗?

最佳答案

A Google-search for the error产生一些有希望的线索,尝试运行:

-Dsvnkit.http.sslProtocols="SSLv3"

...按照建议here .

关于java - 无法使用部署在 Heroku 上的 Java 应用程序中的 svnkit 连接到 HTTPS svn 服务器,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15812040/

相关文章:

java - 从 activeMQ 获取所有 Queue

java - Heroku 找不到 groovy 依赖项

ruby-on-rails - Rails 应用程序中的内存泄漏......字符串噩梦

scala - 如何将 Scala HTTP4S 应用程序部署到 Heroku?

java - 这三个特殊的浮点值是什么意思 : positive infinity, 负无穷大,NaN?

java - GWT 事件处理程序的触发顺序

java - Hive JDBC连接设置或与MySQL的映射

linux - TortoiseSVN,如何撤消上次操作?

svn - 存储库 vs 数据库 vs 文件系统

python - 添加到 : How do I protect my Python codebase so that guests can't see certain modules but so it still works?