[Preconditions]
I have NFSv4 fileshare running on RHEL, and I can successfully mount shared folder on another RHEL machine and see it's content (Thus configuration seems fine).
[PROBLEM]
I would like to also read shared folder from java client code on Windows (without mounting file share anywhere) but currently no success.
[WHAT I'VE TRIED]
Tried YANFS but it only supports NFSv2 and NFSv3; also there's dCache library but it looks like it mostly NFS server (However I've looked through it, it has some client classes but I did not succeed in reading remote file share with it).
[QUESTION]
How to read remote NFSv4 shared folder from java client without mounting?
Related
Is there a way to change the path of a file present in C folder in a java program and put it into tomcat apache server. This whole code is running on Eclipse IDE and a java program takes the path of a file which is present in C: of the local machine. Can I change that path and somehow store or re-direct that path from the Tomcat apache server.
We are running the code through tomcat apache server on the local machine, now we would like to implement CI/CD pipeline and host the code on rancher for which the code is hosted on gitlab first and then the pipeline starts. Is there a way I can change this path and store the file in tomcat apache server or re-direct the path of the file from the server. Or will the project face any problem when processing through the pipeline? I'm using eclipse as IDE. Any help is much appreciated.
private final static String Word2VecModelPath = "C:\\german.model";
// change this path
Here:
private final static String Word2VecModelPath = "C:\\german.model"
That is not a "path" on a file system! At this point, it is nothing but a string, a sequence of character. You can turn to the operating system, and given the fact that this string resembles a directory in your local file system, you can then use the Java APIs the access the corresponding file.
Thing is: it doesn't really matter whether that file sits on a local machine, or on a remote system. What matters for your use case is that you can access it via your file system.
In other words: if your server writes its files to a network drive, and your client has access to that, then you just need to change that path string, to maybe point to a different drive.
But most likely, things are more complicated: because that resource isn't sitting on some file system you have access to.
And then you have to first talk to your server for example, and download that file from there.
In other words is: the first thing for you is to understand the difference between having access to a file in your local file system, and a resource that is owned by some server, and is only accessible to you via the APIs that this server offers.
I have an application running on a server which is doing stuff and writing everything it does to a log file.
I also have secondary application which is kind of like a monitoring panel also running on the server but is a different process. What I would like to do is the following:
I would like my monitoring file to be able to copy the log file which currently has a lock on it from the other application and then email it to me.
I have tried using scp to connect to the server and copy it manually to my computer(and it did work), however I would like to be able to do that through my java monitoring application. And I have no idea where to start.
I have tried using scp to connect to the server and copy it manually to my computer(and it did work)
The JSch library has a ScpFrom module that you can use to scp copy the data from the server to your computer or application. This can be done by one of the following:
Manually running the module (eg java -jar)
Copying the source of the module into your project and adding the JSch library to classpath (more programmatic control - preferred approach)
Using the library module programmatically eg String[] args = {user#remotehost:file1" "localfile"}; SCPFrom.main(args);
I wanna modify remote runtime class file(Already loaded in JVM at remote server).
How many steps should I do? I know some APIs, such as Instrumentation, classfiletransformer, ASM, etc. I can modify a class file loacted at local hard disk, using ASM. I can get all names of current loaded classes in locate JVM, by attach JVM's PID. But, what's the next? Does it need to do socket programming to transfer remote classfile to local machine? And I am confusing about this. Any references or advices. thx for ur consideration.
Get the file from the remote server, modify it locally and push it back to the remote server. Getting the file from the remote server can be using FTP, HTTP or may be write a small socket server running on the reomte machine and a client on your machine.
About how will the class be reloaded in the JVM(since you said its already loaded), I have no idea :)
I need to upload a .pdf file on oracle server directory(not table) using java and hibernate.
Any suggestions?
Thanks.
Hibernate has nothing to do with your current problem, and neither will it be useful in this context. Hibernate is meant to access logical database objects like tables, views, etc. and not physical database objects like directories or files on the server. Therefore, I am going to assume that your current requirement is to place uploaded PDF files onto a directory that is accessible by an Oracle database server process, with the database server located on a remote machine.
In this context, you should use a file transfer protocol like FTP, SSH(SFTP), SMB, or any other suitable protocol, to transfer the uploaded file to the directory. There are several other related questions on this topic:
SSH library for Java
Running commands over ssh with Java
FTP upload via sockets
upload files to remote linux server WITHOUT ftp or scp
You'll need to first choose a supported protocol (on the database server) that you wish to use, and then build a solution around that.
i have 2 csv files on my windows machine that i want to transfer to a unix server every hour (because the 2 files are updated every 30min).
so i search on the web and i found this possibility: to ftp the files from windows to unix using a batch and task scheduler.
i want to know if it's possible to do it from the unix server with a cron job or with java timer and not from the windows machine and if if there's other easier solutions.
thanks for your help
The main problem you would have is in allowing the Unix machine to access a Windows file.
You didn't specify what kind of networking configuration you use and what version of Windows it is, as some later versions provide facilities for file sharing across platforms.
In the worst case, you could set up an FTP (or SFTP) server on your windows machine, share a specific directory in which you will put the file, and then write a script on the UNIX that will download the file from the windows machine. A variation on this is to install a web server on the windows machine, and have the script on the unix make an HTTP request for the file.
You could install a webserver like http://www.aprelium.com/abyssws/
It seems to be free and should be not that hard to set up. Afterwards put your files in the htdocs-folder and configure your Vista-firewall to let requests on port 80 pass.
Then you can access your files via
http://IPofYourWindowsComputer/yourfile.zip
If you want to access your windows machine from outside your local network you'd have to setup your router to forward port 80 to your windows machine. Otherwise the machine from outside will be blocked by the router.
PS: Samba (SMB) just works within the same LAN. If you are you could create a shared folder and put the files in there and access them via smbclient or mount.
PPS: Maybe your question is better placed # http://serverfault.com