[英]How to set classpath on Talend Open Studio
我創建了一個依賴於Apache HTTP Components的例程,因此我下載了jar文件並將這些文件添加到Build Path中。
我已經在Java \\ Build Path下設置了Classpath變量和User Libraries ,但是仍然無法使用。
我的代碼編譯沒有任何錯誤,但是由於以下異常而無法運行:
Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/http/client/RedirectStrategy
at routines.downloadXls.start(downloadXls.java:10)
[...]
以下是Java代碼,它與Eclipse一起運行:
private CloseableHttpClient createHttpClient() {
HttpClientBuilder builder = HttpClientBuilder.create();
httpCtx.setAttribute(HttpClientContext.COOKIE_STORE, store);
return builder.setRedirectStrategy(LaxRedirectStrategy.INSTANCE).build();
}
我已經在talend社區上看到了類似的問題 ,但這並沒有幫助我。
有什么建議嗎?
謝謝
您需要使用tLibraryLoad
組件(每個jar一個)在您的Talend作業中tLibraryLoad
jar。
tLibraryLoad
|
OnSubjobOk
|
Code using apache components
在創建作業時,罐子將與它捆綁在一起並添加到您的類路徑中(在.bat和.sh啟動器中)。
我注意到您在代碼中設置了cookie,也許如果您提供有關需求的更多信息,我可以推薦使用專用Talend組件的解決方案,因為最好是盡可能使用本機組件(或者您可以提出一個單獨的問題)。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.