You need to add the certificate for App2 to the truststore file of the used JVM located at %JAVA_HOME%\lib\security\cacerts
.
First you can check if your certificate is already in the truststore by running the following command:
keytool -list -keystore "%JAVA_HOME%/jre/lib/security/cacerts"
(you don't need to provide a password)
If your certificate is missing, you can get it by downloading it with your browser and add it to the truststore with the following command:
keytool -import -noprompt -trustcacerts -alias <AliasName> -file <certificate> -keystore <KeystoreFile> -storepass <Password>
Example:
keytool -import -noprompt -trustcacerts -alias myFancyAlias -file /path/to/my/cert/myCert.cer -keystore /path/to/my/jdk/jre/lib/security/cacerts/keystore.jks -storepass changeit
After import you can run the first command again to check if your certificate was added.
Sun/Oracle information can be found here.
You can define a mandatory file lock on Unix, for this purpose.
However, it's necessary to (re-)mount file system, so that it honors mandatory locks.
1 For example to remount the root fs, use (as root):
mount -oremount,mand /
2 Now, let's create our secret file:
echo "big secret" > locked_file
3 We need to set-group-id, and disable group execution privileges on the file:
chmod g+s,g-x locked_file
And our C code to lock that file:
(The code will lock the file, and keep it locked for a while, you can try another terminal to read it, the read will be delayed until lock is released)
#include <fcntl.h>
#include <stdio.h>
#include <unistd.h>
int main() {
struct flock fl;
int fd;
fl.l_type = F_WRLCK; /* read/write lock */
fl.l_whence = SEEK_SET; /* beginning of file */
fl.l_start = 0; /* offset from l_whence */
fl.l_len = 0; /* length, 0 = to EOF */
fl.l_pid = getpid(); /* PID */
fd = open("locked_file", O_RDWR | O_EXCL); /* not 100% sure if O_EXCL needed */
fcntl(fd, F_SETLKW, &fl); /* set lock */
usleep(10000000);
printf("\n release lock \n");
fl.l_type = F_UNLCK;
fcntl(fd, F_SETLK, &fl); /* unset lock */
}
More info at
http://kernel.org/doc/Documentation/filesystems/mandatory-locking.txt
Best Answer
I had to issue this command in DOS to solve the problem in VS 2015:
Strangely this was only needed when I moved the project to a different PC. On the original PC I didn't need it.