Android ssh connection JSch - java

I try to open ssh connection via JSch. I added com.jcraft.jsch and com.jcraft.jzlib package in my src folder. But when I try to run my application I had an error org.ietf.jgss package. That package I successfully found and added but at this moment I have a problem with package sun.security.jgss.spi and package sun.security.util
As I found packet sun.security is no available more. Thats correct?
I must use another library for ssh connection?

Related

Error "Sun.security.validator.ValidatorException" throwing when downloading the agent of the remote server via SSH tunnel using Jprofiler [duplicate]

This question already has answers here:
"PKIX path building failed" and "unable to find valid certification path to requested target"
(53 answers)
Closed 3 years ago.
I have established a SSH connection via Jprofiler to a remote server. I have used the following configurations.
Tunnel mode : Direct SSH connection
Authentication : Password
Discover running JVMs and attach to selected process
Then, start to download the agent, I got the following error message. Please advise me to solve this problem.
For some reason the JRE cannot make an SSH connection to the download server, maybe you have a proxy in between?
There is a way to manually install the agent archive: Download
https://download.ej-technologies.com/jprofiler/jprofiler_agent_linux-x86_11_0_1.tar.gz
replacing "11_0_1" with the installed JProfiler version and "linux-x86" with the platform of the remote machine and extract this file into your JProfiler installation. Note that the archive has a prefix directory "jprofiler11" that corresponds to the installation directory. Then the remote attach mechanism will not have to download the agent.

Issue any command using sftp in JSch

Hi I am currently using the below code line to issue commands to the remote server
ChannelSftp sftp = (ChannelSftp)session.openChannel("sftp");
sftp.connect();
System.out.println("Current Directory: " + sftp.pwd()); <= This Line
But pwd is already be defined as a method in Class ChannelSftp, My Question is what if I want to issue some command or run any .sh file which is not a method in JSch?
Let say if I want to run : sudo /opt/bin/run.sh file.
OR is there any method which I can use to do the job
(Kindly note I have a Jump Server in between localhost and web Server. And web server can only be accessed via the jump server.So that is the reason I am not using exec or shell).
The ChannelSftp class is implementing the SFTP protocol, which is cabable of preforming FTP operations. Executing a random command is clearly not permitted via SFTP. What you need in this case is using a different class of the jsch lib: ChannelExec.
Example is here.

RMI ClassNotFoundException _Stub

I've been trying multiple variations of this and have not succeeded at all. The following is what I'm writing on the command-line to start the RMI Server. I've started the rmiregistry while in the same folder (/usr/local/shared/.../RMIServer) and try to run the command below but still get a java.lang.ClassNotFoundException: FileDiscovery_Stub
java -Djava.security.policy=security.policy -Djava.rmi.server.codebase=file:/usr/local/shared/.../RMIServer/RMIFTServer.jar -jar RMIFTServer.jar
The jar file for the RMIServer is in the same folder (/usr/local/shared.../RMIServer) as well as the security.policy file needed.
Any help would be greatly appreciated.
Don't start the RMI registry in the same folder as the server. You don't want it to use the server's CLASSPATH, you want it to rely on the codebase feature.
Your class is out of date. If you specify port zero when exporting or constructing your remote object, you won't need a _Stub at all.

Java DB doesn't run without NetBean [duplicate]

I have a Java application, which uses Apache Derby. Using Eclipse Export option, I exported it as JAR file. When I am running Eclipse, and the server is connected to port 1527, the JAR executes correctly.
However when eclipse is closed, (and the server is not connected to 1527) on executing jar, i get this error
java.sql.SQLNonTransientConnectionException: java.net.ConnectException
: Error connecting to server localhost on port 1527 with message
Connection refused.
This is understandable. But i want to distribute the JAR. So is there a way to start the server programmatically, whenever JAR is executed?
You can start the NetworkServer programmatically:
NetworkServerControl serverControl = new NetworkServerControl(InetAddress.getByName("myhost"),1621)
serverControl.shutdown();
Simplest is to use embedded Derby
Class.forName("org.apache.derby.jdbc.EmbeddedDriver");
conn = DriverManager.getConnection("jdbc:derby:" + DATA_STORE + ";create=true");
You need to start the server programmatically.
How this is done is documented in the manual:
http://db.apache.org/derby/docs/10.8/adminguide/tadminconfig814963.html

Java Telnet Applet with jsch1.4.8 cannot input

My application was using jsch 1.28 version previously and I was also
using JTA 2.0 for Telnet/SSH terminal everything was working fine until I
moved to the latest version of jsch 1.48, the problem I'm facing is that
I am able to open the SSH Terminal and connect as well but when I try to
execute some command from Keyboard on the Connection terminal it is not
all responding to keystrokes.
I moved to jsch 1.48 because with jsch 1.28 after trying connect via ssh i got error: "Algorithm negotiation fault"
Thanks
It works
I had to add: out_.flush(); after out_ = channel_.getOutputStream(); in the JTAJSch.java plugin file
I have tried the Shell.java example given in the link http://www.jcraft.com/jsch/examples/Shell.java.html. It works properly with the jsch 1.48.
Could you try it seperatelly from your project to find out the route cause.

Categories