java.lang.NoClassDefFoundError: com/jcraft/jsch/JSch in JAVA

huangapple go评论52阅读模式
英文:

java.lang.NoClassDefFoundError: com/jcraft/jsch/JSch in JAVA

问题

我们有一个代码,我们试图将一些文件转储到某个用户的sftp账户中,为此,我们使用来自jsch-0.1.45的jsch库。

    JSch jsch = new JSch();  
    session = jsch.getSession(variable1, variable2); 
    session.setPassword(abcd);  
    session.setConfig(config);  
    session.connect();  
    channel = session.openChannel("sftp");  
    channel.connect();  

我已经将JAR文件添加到WEB-INF-lib中,但在将我们的应用部署到WebLogic服务器时,仍然在行JSch jsch = new JSch(); 处遇到以下错误。
"Timer-2"线程中的异常java.lang.NoClassDefFoundError: com/jcraft/jsch/JSch

有人可以帮助我,是什么导致了这个问题?

英文:

We have a code where we are trying to dump some file into sftp account of some user
for that, we use library jsch from jsch-0.1.45.

JSch jsch = new JSch();  
		 session = jsch.getSession(variable1,variable2); 
		 session.setPassword(abcd);  
		 session.setConfig(config);  
		 session.connect();  
		 channel = session.openChannel("sftp");  
		 channel.connect();  

I have added jar under WEB-INF-lib, still getting below error at line JSch jsch = new JSch(); when we deploy our application in WebLogic server.
Exception in thread "Timer-2" java.lang.NoClassDefFoundError: com/jcraft/jsch/JSch

> Blockquote

Could anyone help me, what causing this issue?

答案1

得分: 1

确保 WAR 文件也包含这个文件。

您还可以将库部署到 WebLogic 服务器上,并尝试在 weblogic.xml 中添加库引用。

英文:

Make sure the WAR file contains this file as well.

You can also deploy the library to the WebLogic server as a library and try adding the library reference in the weblogic.xml

huangapple
  • 本文由 发表于 2020年9月26日 03:14:43
  • 转载请务必保留本文链接:https://go.coder-hub.com/64070139.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定