2013-04-04 31 views
1

我正在使用svnkit獲取有關svn存儲庫的一些信息。我使用svnkit文檔中提到的例子,當我在本地eclipse中運行示例時,我可以獲取詳細信息。我們的存儲庫可通過https協議訪問。無法連接到HTTPS svn服務器使用從Heroku上部署的Heroku應用svnkit

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 

你能幫我對這個問題如何解決呢?

回答

0

一個Google-search for the error產生了一些有希望的線索,試圖與運行:

-Dsvnkit.http.sslProtocols="SSLv3" 

...的建議here

+0

我不確定該聲明的添加位置。在論壇中提到這個聲明需要添加到Eclispe.ini文件中,但由於我不得不將代碼部署到Heroku,我將這個聲明添加到system.properties文件並上傳到Heroku。但仍然沒有運氣。 Heroku日誌繼續顯示相同的錯誤消息。 – Anamadeya 2013-04-05 09:15:29

相關問題