Use netstat command to get application list running on specific ports.
netstat -anob
Run the above command as administrator in command prompt.
Monday, August 13, 2018
Thursday, June 21, 2018
Protect PDF using password in iText
When you need to protect PDF files using password, you can use following iText codes to encrypt PDF using passwords.
String ownerPasswd="owner";
String userPasswd="user";
PdfReader reader = new PdfReader("/apps/abc.pdf");
PdfStamper stamper = new PdfStamper(reader, new FileOutputStream("/apps/abc_pw.pdf"));
stamper.setEncryption(userPasswd.getBytes(), ownerPasswd.getBytes(),
PdfWriter.ALLOW_PRINTING, PdfWriter.ENCRYPTION_AES_128 | PdfWriter.DO_NOT_ENCRYPT_METADATA);
stamper.close();
reader.close();
Library versions used,
itextpdf-5.5.10.jar
bcprov-ext-jdk14-1.47.jar
You can use preferred encryption algorithms. Refer documentations.
String ownerPasswd="owner";
String userPasswd="user";
PdfReader reader = new PdfReader("/apps/abc.pdf");
PdfStamper stamper = new PdfStamper(reader, new FileOutputStream("/apps/abc_pw.pdf"));
stamper.setEncryption(userPasswd.getBytes(), ownerPasswd.getBytes(),
PdfWriter.ALLOW_PRINTING, PdfWriter.ENCRYPTION_AES_128 | PdfWriter.DO_NOT_ENCRYPT_METADATA);
stamper.close();
reader.close();
Library versions used,
itextpdf-5.5.10.jar
bcprov-ext-jdk14-1.47.jar
You can use preferred encryption algorithms. Refer documentations.
Wednesday, March 21, 2018
Weblogic certificate issues
"The loading of the trusted certificate list
raised a certificate parsing exception PKIX: Unsupported OID in the
AlgorithmIdentifier object:"
"javax.net.ssl.SSLKeyException: FATAL Alert:BAD_CERTIFICATE - A corrupt or unuseable certificate was received"
Above error was raised while accessing https URL in application server. To avoid this error, we have following options.
curl - k https://www.google.com
wget https://www.google.com
Since, this is a valid http request server will install certificate in Linux server and validate requests against it.
"javax.net.ssl.SSLKeyException: FATAL Alert:BAD_CERTIFICATE - A corrupt or unuseable certificate was received"
Above error was raised while accessing https URL in application server. To avoid this error, we have following options.
- Install certificate in cacert to trust the certificate (JAVA_HOME/jre/lib/security)
- Install certificate in a key store and refer it
- Install certificate in Linux server
curl - k https://www.google.com
wget https://www.google.com
Since, this is a valid http request server will install certificate in Linux server and validate requests against it.
Sunday, February 18, 2018
java.lang.LinkageError: loader constraint violation in interface itable initialization: when resolving method
Above error was occurred in Maven project while running application in weblogic server. It can be ignored by modifying pom.xml file as below.
<dependency>
<groupId>axis</groupId>
<artifactId>axis</artifactId>
<version>1.4</version>
<exclusions>
<exclusion> <!-- declare the exclusion here -->
<groupId>org.apache.axis</groupId>
<artifactId>axis-jaxrpc</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>axis</groupId>
<artifactId>axis</artifactId>
<version>1.4</version>
<exclusions>
<exclusion> <!-- declare the exclusion here -->
<groupId>org.apache.axis</groupId>
<artifactId>axis-jaxrpc</artifactId>
</exclusion>
</exclusions>
</dependency>
Monday, October 2, 2017
JAVA application Monitoring using JMX
Your application can be started with following JMX parameter.
-Dcom.sun.management.jmxremote.port=12345
Or
You can set System property as JMX port as follows to enable JMX monitoring.
System.setProperty("com.sun.management.jmxremote.port", 12345);
Then, use VisualVM to monitor your application. You can monitor CPU, Memory, Threads etc using this VisualVM tool.
https://visualvm.github.io/
For more information visit :-
https://dzone.com/articles/java-memory-and-cpu-monitoring-tools-and-technique
-Dcom.sun.management.jmxremote.port=12345
Or
You can set System property as JMX port as follows to enable JMX monitoring.
System.setProperty("com.sun.management.jmxremote.port", 12345);
Then, use VisualVM to monitor your application. You can monitor CPU, Memory, Threads etc using this VisualVM tool.
https://visualvm.github.io/
For more information visit :-
https://dzone.com/articles/java-memory-and-cpu-monitoring-tools-and-technique
Tuesday, August 29, 2017
Find files in Linux and move files
Following command can be used to find files in a directory and move found files into /home/sujith/files/ location.
find . -name "*" -maxdepth 1 -exec mv -t /home/sujith/files {} +
find . -name "*" -maxdepth 1 -exec mv -t /home/sujith/files {} +
Monday, August 28, 2017
Copy large number of files between Linux servers
You can use "rsync" command to sync data between two locations.
rsync -r dir1/ dir2
sync the contents of dir1 to dir2 on the same system (-r option for recursive)
rsync -a dir1 username@remote_host:destination_directory
sync directory from the local system to a remote system ( pushing files to destination)
rsync -a username@remote_host:/home/dir1 place_to_sync_on_local_machine
sync a remote directory to the local system (pulling files from remote machine)
Also, you can compressed and sync files between locations using following command.
rsync -az source destination
https://www.digitalocean.com/community/tutorials/how-to-use-rsync-to-sync-local-and-remote-directories-on-a-vps
rsync -r dir1/ dir2
sync the contents of dir1 to dir2 on the same system (-r option for recursive)
rsync -a dir1 username@remote_host:destination_directory
sync directory from the local system to a remote system ( pushing files to destination)
rsync -a username@remote_host:/home/dir1 place_to_sync_on_local_machine
sync a remote directory to the local system (pulling files from remote machine)
Also, you can compressed and sync files between locations using following command.
rsync -az source destination
https://www.digitalocean.com/community/tutorials/how-to-use-rsync-to-sync-local-and-remote-directories-on-a-vps
Subscribe to:
Posts (Atom)