How To Access / Connect Remote Unix Server
Dec 14, 2014a direct solution for connecting a remote Unix server through telnet connection from java application.
View Repliesa direct solution for connecting a remote Unix server through telnet connection from java application.
View RepliesI want to develop a dynamic webpage (using JSP & tomcat hosted on windows server) which will connect to unix server and on button "Show Files" click on dynamic webpage it should display all the files present in the unix server.
The button click should display the files which i can see when i run "ls -ltr" in unix server home directory.
I'm working on an application I made a few years ago. At that time I connected to a local database so my address was 'jdbc:mysql://localhost:3306/'. That database is long gone so I recreated it on one of my hosted servers but I'm a little unsure of how to connect to it. At the moment I'm trying "jdbc:mysql://www.mydomain.com:3306/" but it is giving me an access denied error.
java.sql.SQLException: Access denied for user 'myusername'@'c-[my-ip].hsd1.pa.comcast.net' (using password: YES)Every result on Google seems to use localhost so I'm having a little difficulty figuring out the correct format.
I am trying to connect a remote machine but I can't. There is a shared folder in the remote machine, when I write the path to file browser in local machine, it does not find the path specified. Both machines have successful network condition and ping each other. Also, the shared folder is opened to everyone, there should not be a permission problem, right?
View Replies View RelatedWorking on a project and am in need of some quick guidance to wrap things up. I have a functioning compression server that will create two files after the user gives it some input and a "magic string" to know when to stop reading input for that specific file.
I now need to connect a UDP web server to that compression server. the web server will read from the HTTP POST Request the data that was uploaded and send it to the compression server to create the two files... i have included both programs below
Web Server:
import java.io.*;
import java.net.*;
import java.util.*;
final class HttpRequest implements Runnable {
//Declare Constants and Variables
final static int BUF_SIZE = 1024000;
final static String CRLF = "
";
[Code]...
Compression Server:
import java.net.*; // for DatagramSocket, DatagramPacket, and InetAddress
import java.io.*; // for IOException
import java.util.zip.*;// for Zip
public class CompressionServer {
private static final int ECHOMAX = 65535; // Maximum size of echo datagram
private static final int BUFFER = 2048; // Buffer size for writing to Zip File
[Code]....
I have a doubt about how to design a web application which has their persistent objects in a service layer in a remote server, i mean a business application. So, once we have a web application as a client of this remote business application, how those persistent objects should be mapped in web front?
Should I either pack all jpa annotated classes into the web front application or there is another neat way to do this?
I was intending in copy all persistent classes present in the remote business application into the web app package, i know it's not the best way to get what i need.
What is a more appropriate design for a web application which must get some objects from a remote business application and persist some other objects there?
I am developing a web application in java(JSF 2.0 - Prime Faces). I need to do below operation. My appllication is running on WLS server. WLS is deployed on a server(say Machine-X). In my application i have a requirement , where i have to copy file from Machine-X to another Machine-Y. The Machine-Y is access restricted.
When i tried to copy the file from my app, getting no access exception. I have full control over Machine-Y. We cannot use SFTP as SFTP cannot be installed on target machine(Machine-Y). Robocopy is failing for some use cases. Is there any other way we can copy/write file from one server to other by providing userid/password in java
I am trying to check SFTP connection to remote server using enchanter jar. Mine is not a multi-threaded application. PFB sample code...
.....
SSH ssh = new DefaultSS();
ssh.setTimeOut(10000);
ssh.connect("myserver","myusername","mypassword");
ssh.sendLine("cd /u");
ssh.sendLine("sftp -B batch.file utodldse@claoesdsdd.com");
ssh.getLine();
.....
note - the batch.file contains only 1 statement. Please find below.
---
bye
---
But the above program is getting is stuck at times when the server is not responding. It goes into infinite hung state.
Is there some alternative ways to set timeout ?
I want to connect java program with Ms access.
View Replies View RelatedHow can I connect to an SSH server in Java? I don't need/want a shell. I just want to connect to the SSH server and get the content of, say, file.txt. How can I do that? Example : I get host, user,pass in txt and connect it with java code!
View Replies View RelatedI have a requirement where I have to send a file from a local system to unix box(present on client side) using java code.I have developed a code that is successfully sending the file from local system to client side unix box (I am connecting to client side unix box using VPN) provided I run the code in my eclipse IDE present in local system. But when I am running the same code in the unix box it is throwing null pointer exception.Might be the unix system is not recognising the local system. Please find the code.
package abc;
import java.io.File;
import java.io.FileInputStream;
import java.io.FilenameFilter;
import java.io.IOException;
import java.util.Properties;
import com.jcraft.jsch.Channel;
[Code] ....
Error on unix box which I am getting is :-
Inside sftpConnection method
llllllll
fffffffffffff
Connection Successfull
Channel Connection Succesfull
aaaaa
Inside findFile method
Exception in thread "main" java.lang.NullPointerException
at abc.TranferFile.sftpConnection(TranferFile.java:58)
at abc.TranferFile.main(TranferFile.java:21)
it will shows this kind of error
com.microsoft.sqlserver.jdbc.SQLServerException: The connection to the host localhost, named instance sqlexpress has failed. Error: "java.net.SocketTimeoutException: Receive timed out". Verify the server and instance names, check that no firewall is blocking UDP traffic to port 1434, and for SQL Server 2005 or later verify that the SQL Server Browser Service is running on the host.
at com.microsoft.sqlserver.jdbc.SQLServerException.ma keFromDriverError(SQLServerException.java:171)
at com.microsoft.sqlserver.jdbc.SQLServerConnection.g etInstancePort(SQLServerConnection.java:3174)
at com.microsoft.sqlserver.jdbc.SQLServerConnection.p rimaryPermissionCheck(SQLServerConnection.java:937 )
at com.microsoft.sqlserver.jdbc.SQLServerConnection.l ogin(SQLServerConnection.java:800)
at com.microsoft.sqlserver.jdbc.SQLServerConnection.c onnect(SQLServerConnection.java:700)
at com.microsoft.sqlserver.jdbc.SQLServerDriver.conne ct(SQLServerDriver.java:842)
at java.sql.DriverManager.getConnection(Unknown Source)
at java.sql.DriverManager.getConnection(Unknown Source)
at jdbc.JdbcSQLServerConnection.main(JdbcSQLServerCon nection.java:25)
Java Code:
import java.util.Properties;
import javax.mail.Authenticator;
import javax.mail.Message;
import javax.mail.PasswordAuthentication;
import javax.mail.Session;
import javax.mail.Transport;
[Code] ....
Here is my sample email in java i am enable to send mail .....
I'm facing some problem connecting to a IBM 4690 OS Server with the FTPClient class from the commons-net-1.4.1 library. It seems it can't read the folder on the server. The problem is that using the FTP client from Internet Explorer is works perfectly.
Here is my code (kind of hardcoded but it's only to test).
FTPFile[] files = null;
try {
files = listFiles(remoteFolder);
} catch (ParserInitializationException e) {
[Code] ...
Here is the ParserInitializationException that it throws:
org.apache.commons.net.ftp.parser.ParserInitializationException: Unknown parser type: OS 4690 operating system
at org.apache.commons.net.ftp.parser.DefaultFTPFileEntryParserFactory.createFileEntryParser(DefaultFTPFileEntryParserFactory.java:118)
at org.apache.commons.net.ftp.FTPClient.initiateListParsing(FTPClient.java:2358)
at org.apache.commons.net.ftp.FTPClient.listFiles(FTPClient.java:2141)
...
I've tried to use many of the FTPFileListParser available but without success. How could I handle the problem? Where could I find a Parser that would works?
Is there any option to access OBIEE server home page through java, without sending username and password through URL.
View Replies View RelatedI am new to JMS and Websphere server and I am trying to access a JMS queue configured on Websphere Application Server 8 from my Java code. But I am getting the exception mentioned below:
Exception in thread "main" java.lang.NoClassDefFoundError: com.ibm.ws.naming.util.CommonHelpers
at com.ibm.websphere.naming.WsnInitialContextFactory.getInitialContext(Unknown Source)
at javax.naming.spi.NamingManager.getInitialContext(NamingManager.java:230)
at javax.naming.InitialContext.initializeDefaultInitCtx(InitialContext.java:313)
at javax.naming.InitialContext.getDefaultInitCtx(InitialContext.java:343)
at javax.naming.InitialContext.internalInit(InitialContext.java:281)
[code]...
I am currently trying to access an EJB Session deployed in a Weblogic server from JBOSS.
The client code looks like this :
Hashtable environment = new Hashtable();
environment.put(Context.INITIAL_CONTEXT_FACTORY, "weblogic.jndi.WLInitialContextFactory");
environment.put(Context.URL_PKG_PREFIXES, "weblogic.jndi.factories");
environment.put(Context.PROVIDER_URL, "t3://<ip>:<port>");
InitialContext context = new InitialContext(environment);
ServiceHome home = (ServiceHome)context.lookup("ejb/Service");
When I run this code from a standalone java program it executes ok, but when I try to run it from an application deployed in JBOSS, the line (5) which creates the InitialContext object throws this Exception :
java.lang.ThreadDeath
org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1221)
org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1181)
weblogic.rmi.internal.StubGenerator.getStubClass(StubGenerator.java:696)
weblogic.rmi.internal.StubGenerator.generateStub(StubGenerator.java:742)
[Code]....
In order to be able to use weblogic naming factory I put the archive weblogic-8.1.6.0.jar in jboss's /server/default/lib directory. But I think it has to do with JNDI conflicts between JBOSS and weblogic.
I'm using windows.. and our server is UNIX.. I knew that it's possible to create DOS commands in java programs, I have tried it already..
What I want to know is, is it possible to create a java program (from windows) that can execute UNIX command?
Something like: I have a java program in my windows, and it will create a directory in UNIX server /home/dir..
Based on my research, I can connect to our server in command prompt of my windows using ftp <domain> but the commands there is limited.
i have a program in UNIX directory /home/me/java/src
package bin;
public class HelloWorld {
public static void main(String[] args) {
System.out.println("Hello World");
}
}
I have manage to compile it successfully(class file will be in bin directory) using command below: javac -d /home/t_bmf/java/bin HelloWorld.java
My problem now is how would I execute the class in bin directory in UNIX? I already tried different ways on how to execute it as suggested in my internet research The one I tried is this:
java $CLASSPATH:.:bin/HelloWorld
but I got this error message:
Exception in thread "main" java.lang.NoClassDefFoundError: :/:bin/HelloWorld
Caused by: java.lang.ClassNotFoundException: :.:bin.HelloWorld
[code]....
I need to generate a file in Java with Unix TimeStamp. Want to generate an ordered list of Data entry objects for a defined period of time e.g., getData (long startTimeStamp, endTimeStamp, long resolution).
1) I would like to generate resolution with random numbers by using Random class.
2) How to take Start and end timestamps to generate a file (i.e., writing into a file).
I have a unix program that simulates an accident evolving as a function of time and produces two files. I will focus on the first file before getting to the second. This first file has five output variables/vectors (velocity vs time, pressure vs time, etc), which are selected as part of the simulation input. These are the variables I have to put into Excel if I want to view the transient graphically. Where it gets tedious is that, if I want to view a different set of five variables, I have to rerun, extract, put these in Excel to plot. There can be lots of variables needed to properly characterize the accident.
The second file produced is a really large binary file. This file contains all the information that I'd need, precluding the need to rerun to view a different set of output variables. This is the file that seems tailor-made for a Java or something to be able to extract the information. That is, it seems like Java could be used to do this work: extract variable information from the large binary file. Eventually, I would like to plot it too and I know I could use Java there.
I think my steps are:
1) understand the format of my binary file
2) reconfigure the binary file for use with java (is this demuxing?)
3) learn java programming for this application: extracting information to produce something like a .csv file with time on the leftmost column and variable information populating the rest of the columns.
I am a student, who are doing a software project. The last step will be deploying the software as desktop exe for both windows and unix.
Question1 : my project has a folder structure like this:
+ Input file folder
+ configuration file folder
+ Output file folder
+ my project codes
So my class in project codes should have proper access to the other three folders(input,output,config). Then what can I do to feed the function a relative path?How would that looks like?
Question2:
Is that true, for windows and unix I have to write two versions of codes on system-dependant path?
I have a requirement to convert 'unix time stamp' to 'Date time format'
Input (Unix time stamp) : 1426013480000
Output should show : 3/10/2015 2:51 PM EST (or) 10th March 2015 2:51PM EST
I get the following error when trying to run code.
java.lang.NullPointerException
at conntecttoDB8.SSHCommandExecutor.main(SSHCommandEx ecutor.java:26)
package conntecttoDB8;
import java.io.InputStream;
import com.jcraft.jsch.Channel;
import com.jcraft.jsch.JSch;
import com.jcraft.jsch.Session;
[Code] ....
I want to write a java program which would do remote file transfer without using Byte array..how I can get sample code program??
View Replies View RelatedI am developing a web application using JSF-2.0 on weblogic 10.3.6. I am using Facelets as VDL. I have 5 different machine. They are different according to their OS and their geographical location. On my first xhtml page server (machine) is decided. Then on next page file upload and rest of processing takes place. My restriction is that SSO configuration can be done on only one machine.
So I am restricted to using xhtml files from only my primary server where SSO configuration is done. But I have to connect to servlets or managed-bean of different machine as requests are machine specific and file needs to be uploaded to those machines for processing. So I cannot use redirectUrl as I need to be only on one machine. Is it possible that xhtml on one server can talk to managed-bean on other server(different machine)?.