Search code examples
javaspring-bootmavensftp

java.lang.NoClassDefFoundError: com/jcraft/jzlib/ZStream With Spring Boot Maven


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

I'm using this code with this POM dependency

<dependency>
    <groupId>com.jcraft</groupId>
    <artifactId>jsch</artifactId>
    <version>0.1.55</version>
    <scope>provided</scope>
</dependency>

I'm facing this error in the runtime environment:

java.lang.NoClassDefFoundError: com/jcraft/jzlib/ZStream


Solution

  • enter image description here

    when I saw the source code of downloaded Jar in the Library didn't reach out this com/jcraft/jzlib/ZStream path then i'll find out another Maven Dependency of jcraft

        <dependency>
            <groupId>com.jcraft</groupId>
            <artifactId>jzlib</artifactId>
            <version>1.1.3</version>
        </dependency>
    

    enter image description here

    and they have the same classes which are missing in base dependency. Now its work for me.