<?xml version='1.0' encoding='UTF-8'?><?xml-stylesheet href="http://www.blogger.com/styles/atom.css" type="text/css"?><feed xmlns='http://www.w3.org/2005/Atom' xmlns:openSearch='http://a9.com/-/spec/opensearchrss/1.0/' xmlns:blogger='http://schemas.google.com/blogger/2008' xmlns:georss='http://www.georss.org/georss' xmlns:gd="http://schemas.google.com/g/2005" xmlns:thr='http://purl.org/syndication/thread/1.0'><id>tag:blogger.com,1999:blog-9048812660891698443</id><updated>2024-09-02T09:29:11.088+05:30</updated><category term="java"/><category term="64 bit"/><category term="Collections"/><category term="JMS"/><category term="Oracle"/><category term="crt"/><category term="pre installed zip"/><category term="Ajax"/><category term="CA"/><category term="Certificate signining request"/><category term="Clustering JMS"/><category term="HornetQueue"/><category term="IO Streams"/><category term="Jboss"/><category term="Jdk"/><category term="Jdk 1.7"/><category term="Jdk 1.8"/><category term="Jetty"/><category term="Keystore"/><category term="Keytool"/><category term="Maven"/><category term="Obfuscation"/><category term="Oc4j"/><category term="Openssl"/><category term="Oracle java"/><category term="Pem"/><category term="Production Issues"/><category term="Public key cryptography standards"/><category term="RSA"/><category term="Reflection API"/><category term="Reverse Obfuscation"/><category term="Serializable class"/><category term="Setup Redis 3.2 server in cluster mode in Windows 7 64 bit. Redis"/><category term="Sha2"/><category term="Sorting Objects"/><category term="Spring"/><category term="Spring security"/><category term="XSD schema"/><category term="authentication"/><category term="cer"/><category term="certificate"/><category term="clustering"/><category term="clustering redis"/><category term="csr"/><category term="generate P12"/><category term="generate crt"/><category term="generate csr"/><category term="genrsa"/><category term="jks"/><category term="md5 password encoder"/><category term="merge objects"/><category term="pkcs12"/><category term="pre installed Java"/><category term="root CA"/><category term="sha256"/><category term="ssl"/><category term="web application"/><category term="windows"/><category term="x509"/><title type='text'>Real Experts</title><subtitle type='html'></subtitle><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://throwableobject.blogspot.com/feeds/posts/default'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/9048812660891698443/posts/default'/><link rel='alternate' type='text/html' href='http://throwableobject.blogspot.com/'/><link rel='hub' href='http://pubsubhubbub.appspot.com/'/><author><name>test</name><uri>http://www.blogger.com/profile/06330700265841330179</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><generator version='7.00' uri='http://www.blogger.com'>Blogger</generator><openSearch:totalResults>20</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>25</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-9048812660891698443.post-589218796857558871</id><published>2019-02-07T19:49:00.001+05:30</published><updated>2019-02-07T19:59:40.520+05:30</updated><category scheme="http://www.blogger.com/atom/ns#" term="java"/><category scheme="http://www.blogger.com/atom/ns#" term="Jetty"/><category scheme="http://www.blogger.com/atom/ns#" term="Obfuscation"/><category scheme="http://www.blogger.com/atom/ns#" term="Reverse Obfuscation"/><title type='text'>Jetty Obfuscation and Reverse Obfuscation</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;arial&amp;quot; , &amp;quot;helvetica&amp;quot; , sans-serif;&quot;&gt;Download Jetty : https://www.eclipse.org/jetty/download.html&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;arial&amp;quot; , &amp;quot;helvetica&amp;quot; , sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;font-family: &amp;quot;arial&amp;quot; , &amp;quot;helvetica&amp;quot; , sans-serif;&quot;&gt;&lt;b&gt;For&amp;nbsp;Obfuscation:&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;arial&amp;quot; , &amp;quot;helvetica&amp;quot; , sans-serif;&quot;&gt;Run below command:&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;arial&amp;quot; , &amp;quot;helvetica&amp;quot; , sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;font-family: &amp;quot;arial&amp;quot; , &amp;quot;helvetica&amp;quot; , sans-serif;&quot;&gt;java -cp jetty-util-[VERSION_NUMBER].jar org.eclipse.jetty.util.security.Password [PASSWORD]&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;arial&amp;quot; , &amp;quot;helvetica&amp;quot; , sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;b&gt;&lt;span style=&quot;font-family: &amp;quot;arial&amp;quot; , &amp;quot;helvetica&amp;quot; , sans-serif;&quot;&gt;Example:&lt;/span&gt;&lt;/b&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;$ java -cp lib\jetty-util-9.4.6.v20170531.jar org.eclipse.jetty.util.security.Password SecretPassword123&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #a64d79; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;2017-08-15 18:44:13.036:INFO::main: Logging initialized @148ms to org.eclipse.jetty.util.log.StdErrLog&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #a64d79; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;SecretPassword123&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #a64d79; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;OBF:1fof1j1u1igh1vgt1vn61y101sgo1v1p1ym71v2p1siu1y0q1vnw1vg11idp1iz01fmn&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #a64d79; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;MD5:512d9845442e46f891bafc22f06b171e&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;arial&amp;quot; , &amp;quot;helvetica&amp;quot; , sans-serif;&quot;&gt;&lt;b&gt;For&amp;nbsp;Reverse Obfuscation&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;arial&amp;quot; , &amp;quot;helvetica&amp;quot; , sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;font-family: &amp;quot;arial&amp;quot; , &amp;quot;helvetica&amp;quot; , sans-serif;&quot;&gt;Run below command:&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;java -cp jetty-util-[VERSION_NUMBER].jar org.eclipse.jetty.util.security.Password [OBF:PASSWORD]&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;arial&amp;quot; , &amp;quot;helvetica&amp;quot; , sans-serif;&quot;&gt;&lt;b&gt;Example::&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;$ java -cp lib\jetty-util-9.4.6.v20170531.jar org.eclipse.jetty.util.security.Password OBF:1fof1j1u1igh1vgt1vn61y101sgo1v1p1ym71v2p1siu1y0q1vnw1vg11idp1iz01fmn&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #a64d79;&quot;&gt;2017-08-15 18:45:48.165:INFO::main: Logging initialized @134ms to org.eclipse.jetty.util.log.StdErrLog&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #a64d79;&quot;&gt;SecretPassword123&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #a64d79;&quot;&gt;OBF:1fof1j1u1igh1vgt1vn61y101sgo1v1p1ym71v2p1siu1y0q1vnw1vg11idp1iz01fmn&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #a64d79;&quot;&gt;MD5:f8ad4d396e4cc2eb2955d3911eb14cb9&lt;/span&gt;&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://throwableobject.blogspot.com/feeds/589218796857558871/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://throwableobject.blogspot.com/2019/02/jetty-obfuscation-and-reverse.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/9048812660891698443/posts/default/589218796857558871'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/9048812660891698443/posts/default/589218796857558871'/><link rel='alternate' type='text/html' href='http://throwableobject.blogspot.com/2019/02/jetty-obfuscation-and-reverse.html' title='Jetty Obfuscation and Reverse Obfuscation'/><author><name>test</name><uri>http://www.blogger.com/profile/06330700265841330179</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-9048812660891698443.post-1366738749711860093</id><published>2018-06-12T15:35:00.004+05:30</published><updated>2018-06-12T23:37:16.410+05:30</updated><category scheme="http://www.blogger.com/atom/ns#" term="clustering redis"/><category scheme="http://www.blogger.com/atom/ns#" term="Setup Redis 3.2 server in cluster mode in Windows 7 64 bit. Redis"/><category scheme="http://www.blogger.com/atom/ns#" term="windows"/><title type='text'>Setup Redis 3.2 server in cluster mode in Windows 7 64 bit</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;h2 style=&quot;text-align: left;&quot;&gt;
&lt;/h2&gt;
&lt;h2 style=&quot;text-align: left;&quot;&gt;
Setup Redis 3.2 Cluster based server in windows&lt;/h2&gt;
&lt;h3 style=&quot;text-align: left;&quot;&gt;
Steps:&lt;/h3&gt;
&lt;ol style=&quot;text-align: left;&quot;&gt;
&lt;li&gt;Download Redis 3.2 Server windows from link:&amp;nbsp;&lt;a href=&quot;https://github.com/MicrosoftArchive/redis/releases&quot; target=&quot;_blank&quot;&gt;the MSOpenTech version&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;extract of install above downloaded one.&lt;/li&gt;
&lt;li&gt;Create a folder redis3.2&lt;/li&gt;
&lt;li&gt;go to folder redis3.2&amp;nbsp;&lt;/li&gt;
&lt;li&gt;create cluster node folders&lt;br /&gt;eg: node1,node2, node3&lt;/li&gt;
&lt;li&gt;copy the redis-server.exe and redis-cli.exe into redis3.2 folder from Downloaded Redis zip/installation&lt;/li&gt;
&lt;li&gt;go to each node folder and create redis.conf file and add below content&lt;br /&gt;
&lt;!-- HTML generated using hilite.me --&gt;&lt;div style=&quot;background: #f8f8f8; border-width: 0.1em 0.1em 0.1em 0.8em; border: solid gray; overflow: auto; padding: 0.2em 0.6em3; width: 300px;&quot; title=&quot;Setup Redis 3.2 server in cluster mode in Windows 7 64 bit&quot;&gt;
&lt;table&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;&lt;pre style=&quot;line-height: 125%; margin: 0;&quot;&gt;1
2
3
4
5&lt;/pre&gt;
&lt;/td&gt;&lt;td&gt;&lt;pre style=&quot;line-height: 125%; margin: 0;&quot;&gt;port 6380
cluster-enabled yes
cluster-config-file nodes.conf
cluster-node-timeout 5000
appendonly yes&lt;/pre&gt;
&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;
&lt;/div&gt;
add the unique port number in each node
for node1 6380
for node1 6381
for node1 6382
&lt;/li&gt;
&lt;li&gt;Now Run each node by going to each node folder with below command:&lt;br /&gt;c:\node1&amp;gt;..\redis-server.exe redis.conf&lt;br /&gt;c:\node2&amp;gt;..\redis-server.exe redis.conf&lt;br /&gt;c:\node3&amp;gt;..\redis-server.exe redis.conf&lt;br /&gt;After node started you will see below message&lt;br /&gt;
&lt;pre&gt;Redis 3.2.100 (00000000/0) 64 bit

Running in cluster mode
Port: 6380
PID: 7096

&lt;/pre&gt;
&lt;/li&gt;
&lt;li&gt;Now connect any node with redis-cli.exe&lt;br /&gt;&lt;pre&gt;redis-cli.exe -h &amp;lt;ip or host&amp;gt; -p 6380&lt;/pre&gt;
&lt;/li&gt;
&lt;li&gt;Run below command to make them join cluster:
&lt;pre&gt;CLUSTER MEET &lt;hostname&gt; 6380
CLUSTER MEET &lt;hostname&gt; 6381
CLUSTER MEET &lt;hostname&gt; 6382
&lt;/hostname&gt;&lt;/hostname&gt;&lt;/hostname&gt;&lt;/pre&gt;
&lt;/li&gt;
&lt;li&gt;after run CLUSTER NODES
you will see all nodes&lt;br /&gt;sample output:&lt;br /&gt;72b640cb92b054d51c89d0c28a016573e7ff3631 127.0.0.1:6380 myself,master&lt;br /&gt;above first column is nodeid which is auto generated&lt;/li&gt;
&lt;li&gt;Now all nodes are MASTER nodes&lt;/li&gt;
&lt;li&gt;now change node1 as master and rest as slaves&lt;/li&gt;
&lt;li&gt;connect to each&amp;nbsp; node except master node via redis-cli and run below command&lt;br /&gt;&lt;pre style=&quot;background-color: #eff0f1; border: 0px; box-sizing: inherit; color: #242729; font-family: Consolas, Menlo, Monaco, &amp;quot;Lucida Console&amp;quot;, &amp;quot;Liberation Mono&amp;quot;, &amp;quot;DejaVu Sans Mono&amp;quot;, &amp;quot;Bitstream Vera Sans Mono&amp;quot;, &amp;quot;Courier New&amp;quot;, monospace, sans-serif; font-size: 13px; font-stretch: inherit; font-variant-east-asian: inherit; font-variant-numeric: inherit; line-height: inherit; margin-bottom: 1em; max-height: 600px; overflow: auto; padding: 5px; vertical-align: baseline; width: auto; word-wrap: normal;&quot;&gt;&lt;code style=&quot;border: 0px; box-sizing: inherit; font-family: Consolas, Menlo, Monaco, &amp;quot;Lucida Console&amp;quot;, &amp;quot;Liberation Mono&amp;quot;, &amp;quot;DejaVu Sans Mono&amp;quot;, &amp;quot;Bitstream Vera Sans Mono&amp;quot;, &amp;quot;Courier New&amp;quot;, monospace, sans-serif; font-stretch: inherit; font-style: inherit; font-variant: inherit; font-weight: inherit; line-height: inherit; margin: 0px; padding: 0px; vertical-align: baseline; white-space: inherit;&quot;&gt;CLUSTER REPLICATE &amp;lt;master-node-id&amp;gt;&lt;/code&gt;&lt;/pre&gt;
master-node-id is node id of node which you want as master.
&lt;/li&gt;
&lt;li&gt;Now you will see one master node and rest nodes are slaves&lt;/li&gt;
&lt;li&gt;Now allocate the slots to the master node with below command&lt;br /&gt;
&lt;pre&gt;FOR /L %i IN (0,1,16383) DO ( redis-cli.exe -p **6380** CLUSTER ADDSLOTS %i )
&lt;/pre&gt;
6380 is port of master node&lt;/li&gt;
&lt;/ol&gt;
&lt;div title=&quot;Setup Redis 3.2 server in cluster mode in Windows 7 64 bit&quot;&gt;
Now Redis 3.2 cluster server is ready!&lt;/div&gt;
&lt;div title=&quot;Setup Redis 3.2 server in cluster mode in Windows 7 64 bit&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;span style=&quot;background-color: white;&quot; title=&quot;Setup Redis 3.2 server in cluster mode in Windows 7 64 bit&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;background-color: white; color: blue; font-family: &amp;quot;trebuchet ms&amp;quot; , sans-serif;&quot; title=&quot;Setup Redis 3.2 server in cluster mode in Windows 7 64 bit&quot;&gt;You can also Download the following pre setup Redis 3.2 cluster based server:&lt;br /&gt;&lt;b&gt;&lt;a href=&quot;https://drive.google.com/open?id=1kzKPIe5_QSINpmGN7iqrW-s0VRlmVH8r&quot; target=&quot;_blank&quot;&gt;click here&lt;/a&gt;&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;color: red; font-size: large;&quot; title=&quot;Setup Redis 3.2 server in cluster mode in Windows 7 64 bit&quot;&gt;Help:
&lt;/span&gt;&lt;br /&gt;
&lt;ul style=&quot;text-align: left;&quot;&gt;&lt;span style=&quot;color: red; font-size: small;&quot; title=&quot;Setup Redis 3.2 server in cluster mode in Windows 7 64 bit&quot;&gt;
&lt;li&gt;To connect Redis node with host/port via redis-cli interface use below command:&lt;br /&gt;redis-cli -h hostname -p portnumber&lt;/li&gt;
&lt;/span&gt;&lt;/ul&gt;
&lt;span style=&quot;color: red; font-size: medium;&quot; title=&quot;Setup Redis 3.2 server in cluster mode in Windows 7 64 bit&quot;&gt;
&lt;/span&gt;&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://throwableobject.blogspot.com/feeds/1366738749711860093/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://throwableobject.blogspot.com/2018/06/setup-redis-32-server-in-cluster-mode.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/9048812660891698443/posts/default/1366738749711860093'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/9048812660891698443/posts/default/1366738749711860093'/><link rel='alternate' type='text/html' href='http://throwableobject.blogspot.com/2018/06/setup-redis-32-server-in-cluster-mode.html' title='Setup Redis 3.2 server in cluster mode in Windows 7 64 bit'/><author><name>test</name><uri>http://www.blogger.com/profile/06330700265841330179</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-9048812660891698443.post-7916349440904200642</id><published>2018-06-04T19:35:00.002+05:30</published><updated>2018-06-04T19:40:33.379+05:30</updated><category scheme="http://www.blogger.com/atom/ns#" term="64 bit"/><category scheme="http://www.blogger.com/atom/ns#" term="java"/><category scheme="http://www.blogger.com/atom/ns#" term="Jdk 1.8"/><category scheme="http://www.blogger.com/atom/ns#" term="Oracle"/><category scheme="http://www.blogger.com/atom/ns#" term="pre installed zip"/><title type='text'>Download Oracle 64 bit JDK 1.8 pre installed zip</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot; title=&quot;Download Oracle 64 bit JDK 1.8 pre installed zip&quot;&gt;
&lt;br /&gt;
Click below to download the Oracle JDK 1.8 pre installed zip 64 bit (No installation required)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;a alt=&quot;Download Oracle 64 bit JDK 1.8 pre installed zip&quot; href=&quot;https://drive.google.com/file/d/1iM2IQBIwTqN9SeZPDetxCFME5rYX2UiI/view?usp=sharing&quot; target=&quot;_blank&quot;&gt;Click here Oracle JDK 1.8&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;
after download, unzip the pack to a folder&lt;br /&gt;
&lt;br /&gt;
set JAVA_HOME and PATH environment variables&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://throwableobject.blogspot.com/feeds/7916349440904200642/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://throwableobject.blogspot.com/2018/06/download-oracle-64-bit-jdk-18-pre.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/9048812660891698443/posts/default/7916349440904200642'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/9048812660891698443/posts/default/7916349440904200642'/><link rel='alternate' type='text/html' href='http://throwableobject.blogspot.com/2018/06/download-oracle-64-bit-jdk-18-pre.html' title='Download Oracle 64 bit JDK 1.8 pre installed zip'/><author><name>test</name><uri>http://www.blogger.com/profile/06330700265841330179</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-9048812660891698443.post-8806090262834963612</id><published>2018-06-04T19:29:00.003+05:30</published><updated>2018-06-04T19:40:49.069+05:30</updated><category scheme="http://www.blogger.com/atom/ns#" term="64 bit"/><category scheme="http://www.blogger.com/atom/ns#" term="java"/><category scheme="http://www.blogger.com/atom/ns#" term="Jdk 1.7"/><category scheme="http://www.blogger.com/atom/ns#" term="Oracle"/><category scheme="http://www.blogger.com/atom/ns#" term="pre installed zip"/><title type='text'>Download Oracle 64 bit JDK 1.7 pre installed zip</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot; title=&quot;Download Oracle 64 bit JDK 1.8 pre installed zip&quot;&gt;
&lt;br /&gt;
Click below to download the Oracle JDK 1.7 pre installed zip 64 bit (No installation required)&lt;br /&gt;
&lt;br /&gt;
&lt;a alt=&quot;Download Oracle 64 bit JDK 1.8 pre installed zip&quot; href=&quot;https://drive.google.com/file/d/1XCCALDv9Hl84Xo4UNiI73UNVEjbVQupo/view?usp=sharing&quot; target=&quot;_blank&quot;&gt;Click here Oracle JDK 1.7&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;
after download, unzip the pack to a folder&lt;br /&gt;
&lt;br /&gt;
set JAVA_HOME and PATH environment variables&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://throwableobject.blogspot.com/feeds/8806090262834963612/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://throwableobject.blogspot.com/2018/06/download-oracle-64-bit-jdk-17-pre.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/9048812660891698443/posts/default/8806090262834963612'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/9048812660891698443/posts/default/8806090262834963612'/><link rel='alternate' type='text/html' href='http://throwableobject.blogspot.com/2018/06/download-oracle-64-bit-jdk-17-pre.html' title='Download Oracle 64 bit JDK 1.7 pre installed zip'/><author><name>test</name><uri>http://www.blogger.com/profile/06330700265841330179</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-9048812660891698443.post-8122750051329061041</id><published>2018-05-28T11:01:00.001+05:30</published><updated>2018-05-28T11:11:26.000+05:30</updated><category scheme="http://www.blogger.com/atom/ns#" term="Jdk"/><category scheme="http://www.blogger.com/atom/ns#" term="Oracle java"/><category scheme="http://www.blogger.com/atom/ns#" term="pre installed Java"/><title type='text'>Create Java Pre installed zip from Jdk executable</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;b&gt;&lt;br /&gt;&lt;/b&gt;
&lt;b&gt;Creating a pre installed JDK in Zip package, Follow these steps:
&lt;/b&gt;&lt;br /&gt;
&lt;ol style=&quot;text-align: left;&quot;&gt;
&lt;li&gt;Download Latest Jdk executable from &lt;a href=&quot;http://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html&quot; rel=&quot;&quot; target=&quot;_blank&quot;&gt;Oracle.com&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;extract all the files from&amp;nbsp;&lt;code style=&quot;background-color: #eff0f1; border: 0px; box-sizing: inherit; color: #242729; font-family: Consolas, Menlo, Monaco, &amp;quot;Lucida Console&amp;quot;, &amp;quot;Liberation Mono&amp;quot;, &amp;quot;DejaVu Sans Mono&amp;quot;, &amp;quot;Bitstream Vera Sans Mono&amp;quot;, &amp;quot;Courier New&amp;quot;, monospace, sans-serif; font-size: 13px; font-stretch: inherit; font-variant-east-asian: inherit; font-variant-numeric: inherit; line-height: inherit; margin: 0px; padding: 1px 5px; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;jdk-8u172-windows-x64.exe&lt;/code&gt;&lt;span style=&quot;background-color: white; color: #242729; font-family: &amp;quot;arial&amp;quot; , &amp;quot;helvetica neue&amp;quot; , &amp;quot;helvetica&amp;quot; , sans-serif; font-size: 15px;&quot;&gt;&amp;nbsp;into the directory( any destination dir)&lt;br /&gt;Eg: C:\JDK&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style=&quot;background-color: white;&quot;&gt;&lt;span style=&quot;color: #242729; font-family: &amp;quot;arial&amp;quot; , &amp;quot;helvetica neue&amp;quot; , &amp;quot;helvetica&amp;quot; , sans-serif;&quot;&gt;&lt;span style=&quot;font-size: 15px;&quot;&gt;Execute the following commands in&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;code style=&quot;background-color: #eff0f1; border: 0px; box-sizing: inherit; color: #242729; font-family: Consolas, Menlo, Monaco, &amp;quot;Lucida Console&amp;quot;, &amp;quot;Liberation Mono&amp;quot;, &amp;quot;DejaVu Sans Mono&amp;quot;, &amp;quot;Bitstream Vera Sans Mono&amp;quot;, &amp;quot;Courier New&amp;quot;, monospace, sans-serif; font-size: 13px; font-stretch: inherit; font-variant-east-asian: inherit; font-variant-numeric: inherit; line-height: inherit; margin: 0px; padding: 1px 5px; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;cmd.exe&lt;/code&gt;&lt;span style=&quot;color: #242729; font-family: &amp;quot;arial&amp;quot; , &amp;quot;helvetica neue&amp;quot; , &amp;quot;helvetica&amp;quot; , sans-serif;&quot;&gt;&lt;span style=&quot;font-size: 15px;&quot;&gt;:&lt;/span&gt;&lt;/span&gt;&lt;ul style=&quot;border: 0px; box-sizing: inherit; color: #242729; font-family: Arial, &amp;quot;Helvetica Neue&amp;quot;, Helvetica, sans-serif; font-size: 15px; font-stretch: inherit; font-variant-east-asian: inherit; font-variant-numeric: inherit; line-height: inherit; list-style: disc; margin: 0px 0px 0px 30px; padding: 0.5em 0px 0px; vertical-align: baseline;&quot;&gt;
&lt;li style=&quot;border: 0px; box-sizing: inherit; font-family: inherit; font-stretch: inherit; font-style: inherit; font-variant: inherit; font-weight: inherit; line-height: inherit; margin: 0px 0px 0.5em; padding: 0px; vertical-align: baseline; word-wrap: break-word;&quot;&gt;&lt;code style=&quot;background-color: #eff0f1; border: 0px; box-sizing: inherit; font-family: Consolas, Menlo, Monaco, &amp;quot;Lucida Console&amp;quot;, &amp;quot;Liberation Mono&amp;quot;, &amp;quot;DejaVu Sans Mono&amp;quot;, &amp;quot;Bitstream Vera Sans Mono&amp;quot;, &amp;quot;Courier New&amp;quot;, monospace, sans-serif; font-size: 13px; font-stretch: inherit; font-style: inherit; font-variant: inherit; font-weight: inherit; line-height: inherit; margin: 0px; padding: 1px 5px; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;cd C:\JDK\.rsrc\1033\JAVA_CAB10&lt;/code&gt;&lt;/li&gt;
&lt;li style=&quot;border: 0px; box-sizing: inherit; font-family: inherit; font-stretch: inherit; font-style: inherit; font-variant: inherit; font-weight: inherit; line-height: inherit; margin: 0px; padding: 0px; vertical-align: baseline; word-wrap: break-word;&quot;&gt;&lt;code style=&quot;background-color: #eff0f1; border: 0px; box-sizing: inherit; font-family: Consolas, Menlo, Monaco, &amp;quot;Lucida Console&amp;quot;, &amp;quot;Liberation Mono&amp;quot;, &amp;quot;DejaVu Sans Mono&amp;quot;, &amp;quot;Bitstream Vera Sans Mono&amp;quot;, &amp;quot;Courier New&amp;quot;, monospace, sans-serif; font-size: 13px; font-stretch: inherit; font-style: inherit; font-variant: inherit; font-weight: inherit; line-height: inherit; margin: 0px; padding: 1px 5px; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;extrac32 111&lt;/code&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/span&gt;&lt;/li&gt;
&lt;li style=&quot;border: 0px; box-sizing: inherit; font-family: inherit; font-size: 15px; font-stretch: inherit; font-style: inherit; font-variant: inherit; font-weight: inherit; line-height: inherit; margin: 0px 0px 0.5em; padding: 0px; vertical-align: baseline; word-wrap: break-word;&quot;&gt;&lt;span style=&quot;background-color: white;&quot;&gt;Unpack&amp;nbsp;&lt;code style=&quot;background-color: #eff0f1; border: 0px; box-sizing: inherit; font-family: Consolas, Menlo, Monaco, &amp;quot;Lucida Console&amp;quot;, &amp;quot;Liberation Mono&amp;quot;, &amp;quot;DejaVu Sans Mono&amp;quot;, &amp;quot;Bitstream Vera Sans Mono&amp;quot;, &amp;quot;Courier New&amp;quot;, monospace, sans-serif; font-size: 13px; font-stretch: inherit; font-style: inherit; font-variant: inherit; font-weight: inherit; line-height: inherit; margin: 0px; padding: 1px 5px; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;C:\JDK\.rsrc\1033\JAVA_CAB10\tools.zip&lt;/code&gt;&amp;nbsp;with 7-zip&lt;/span&gt;&lt;/li&gt;
&lt;li style=&quot;border: 0px; box-sizing: inherit; font-family: inherit; font-size: 15px; font-stretch: inherit; font-style: inherit; font-variant: inherit; font-weight: inherit; line-height: inherit; margin: 0px 0px 0.5em; padding: 0px; vertical-align: baseline; word-wrap: break-word;&quot;&gt;&lt;span style=&quot;background-color: white;&quot;&gt;Execute the following commands in&amp;nbsp;&lt;code style=&quot;background-color: #eff0f1; border: 0px; box-sizing: inherit; font-family: Consolas, Menlo, Monaco, &amp;quot;Lucida Console&amp;quot;, &amp;quot;Liberation Mono&amp;quot;, &amp;quot;DejaVu Sans Mono&amp;quot;, &amp;quot;Bitstream Vera Sans Mono&amp;quot;, &amp;quot;Courier New&amp;quot;, monospace, sans-serif; font-size: 13px; font-stretch: inherit; font-style: inherit; font-variant: inherit; font-weight: inherit; line-height: inherit; margin: 0px; padding: 1px 5px; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;cmd.exe&lt;/code&gt;:&lt;ul style=&quot;border: 0px; box-sizing: inherit; font-family: inherit; font-stretch: inherit; font-style: inherit; font-variant: inherit; font-weight: inherit; line-height: inherit; list-style: disc; margin: 0px 0px 0px 30px; padding: 0.5em 0px 0px; vertical-align: baseline;&quot;&gt;
&lt;li style=&quot;border: 0px; box-sizing: inherit; font-family: inherit; font-stretch: inherit; font-style: inherit; font-variant: inherit; font-weight: inherit; line-height: inherit; margin: 0px 0px 0.5em; padding: 0px; vertical-align: baseline; word-wrap: break-word;&quot;&gt;&lt;code style=&quot;background-color: #eff0f1; border: 0px; box-sizing: inherit; font-family: Consolas, Menlo, Monaco, &amp;quot;Lucida Console&amp;quot;, &amp;quot;Liberation Mono&amp;quot;, &amp;quot;DejaVu Sans Mono&amp;quot;, &amp;quot;Bitstream Vera Sans Mono&amp;quot;, &amp;quot;Courier New&amp;quot;, monospace, sans-serif; font-size: 13px; font-stretch: inherit; font-style: inherit; font-variant: inherit; font-weight: inherit; line-height: inherit; margin: 0px; padding: 1px 5px; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;cd C:\JDK\.rsrc\1033\JAVA_CAB10\tools\&lt;/code&gt;&lt;/li&gt;
&lt;li style=&quot;border: 0px; box-sizing: inherit; font-family: inherit; font-stretch: inherit; font-style: inherit; font-variant: inherit; font-weight: inherit; line-height: inherit; margin: 0px; padding: 0px; vertical-align: baseline; word-wrap: break-word;&quot;&gt;&lt;code style=&quot;background-color: #eff0f1; border: 0px; box-sizing: inherit; font-family: Consolas, Menlo, Monaco, &amp;quot;Lucida Console&amp;quot;, &amp;quot;Liberation Mono&amp;quot;, &amp;quot;DejaVu Sans Mono&amp;quot;, &amp;quot;Bitstream Vera Sans Mono&amp;quot;, &amp;quot;Courier New&amp;quot;, monospace, sans-serif; font-size: 13px; font-stretch: inherit; font-style: inherit; font-variant: inherit; font-weight: inherit; line-height: inherit; margin: 0px; padding: 1px 5px; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;for /r %x in (*.pack) do .\bin\unpack200 -r &quot;%x&quot; &quot;%~dx%~px%~nx.jar&quot;&lt;/code&gt;&amp;nbsp;(this will convert all&amp;nbsp;&lt;code style=&quot;background-color: #eff0f1; border: 0px; box-sizing: inherit; font-family: Consolas, Menlo, Monaco, &amp;quot;Lucida Console&amp;quot;, &amp;quot;Liberation Mono&amp;quot;, &amp;quot;DejaVu Sans Mono&amp;quot;, &amp;quot;Bitstream Vera Sans Mono&amp;quot;, &amp;quot;Courier New&amp;quot;, monospace, sans-serif; font-size: 13px; font-stretch: inherit; font-style: inherit; font-variant: inherit; font-weight: inherit; line-height: inherit; margin: 0px; padding: 1px 5px; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;.pack&lt;/code&gt;&amp;nbsp;files into&amp;nbsp;&lt;code style=&quot;background-color: #eff0f1; border: 0px; box-sizing: inherit; font-family: Consolas, Menlo, Monaco, &amp;quot;Lucida Console&amp;quot;, &amp;quot;Liberation Mono&amp;quot;, &amp;quot;DejaVu Sans Mono&amp;quot;, &amp;quot;Bitstream Vera Sans Mono&amp;quot;, &amp;quot;Courier New&amp;quot;, monospace, sans-serif; font-size: 13px; font-stretch: inherit; font-style: inherit; font-variant: inherit; font-weight: inherit; line-height: inherit; margin: 0px; padding: 1px 5px; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;.jar&lt;/code&gt;&amp;nbsp;files)&lt;/li&gt;
&lt;/ul&gt;
&lt;/span&gt;&lt;/li&gt;
&lt;li style=&quot;border: 0px; box-sizing: inherit; font-family: inherit; font-size: 15px; font-stretch: inherit; font-style: inherit; font-variant: inherit; font-weight: inherit; line-height: inherit; margin: 0px 0px 0.5em; padding: 0px; vertical-align: baseline; word-wrap: break-word;&quot;&gt;&lt;span style=&quot;background-color: white;&quot;&gt;Copy all contents of&amp;nbsp;&lt;code style=&quot;background-color: #eff0f1; border: 0px; box-sizing: inherit; font-family: Consolas, Menlo, Monaco, &amp;quot;Lucida Console&amp;quot;, &amp;quot;Liberation Mono&amp;quot;, &amp;quot;DejaVu Sans Mono&amp;quot;, &amp;quot;Bitstream Vera Sans Mono&amp;quot;, &amp;quot;Courier New&amp;quot;, monospace, sans-serif; font-size: 13px; font-stretch: inherit; font-style: inherit; font-variant: inherit; font-weight: inherit; line-height: inherit; margin: 0px; padding: 1px 5px; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;C:\JDK\.rsrc\1033\JAVA_CAB10\tools&lt;/code&gt;&amp;nbsp;where you want your JDK to be&lt;/span&gt;&lt;/li&gt;
&lt;/ol&gt;
&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://throwableobject.blogspot.com/feeds/8122750051329061041/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://throwableobject.blogspot.com/2018/05/create-java-pre-installed-zip-from-jdk.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/9048812660891698443/posts/default/8122750051329061041'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/9048812660891698443/posts/default/8122750051329061041'/><link rel='alternate' type='text/html' href='http://throwableobject.blogspot.com/2018/05/create-java-pre-installed-zip-from-jdk.html' title='Create Java Pre installed zip from Jdk executable'/><author><name>test</name><uri>http://www.blogger.com/profile/06330700265841330179</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-9048812660891698443.post-1739882984800933052</id><published>2016-07-07T11:26:00.002+05:30</published><updated>2016-07-07T16:27:17.167+05:30</updated><title type='text'>Connect Ldap using Java</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
LDAP (Lightweight Directory Access Protocol) is a software protocol for enabling anyone to locate organizations, individuals, and other resources such as files and devices in a network, whether on the public Internet or on a corporate intranet. LDAP is a &quot;lightweight&quot; (smaller amount of code) version of Directory Access Protocol (DAP), which is part of X.500, a standard for directory services in a network.
&lt;br /&gt;
&lt;div&gt;
&lt;table&gt;
&lt;tbody&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot;&gt;&lt;b&gt;Directory structure strings:&lt;/b&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;rdn&lt;/td&gt;&lt;td&gt;Relative Distinguished Name&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;dn&lt;/td&gt;&lt;td&gt;Distinguished Name&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;cn&lt;/td&gt;&lt;td&gt;Common Name&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;ou&lt;/td&gt;&lt;td&gt;Organizational Unit&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;dc&lt;/td&gt;&lt;td&gt;Domain Component&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;sn&lt;/td&gt;&lt;td&gt;SurName&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;table&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;As an example, the Entry look like was:
&lt;br /&gt;
&lt;pre&gt;&lt;b&gt;dn: cn=Joe Smith,ou=East,dc=MyDomain,dc=com&lt;/b&gt;
 cn: John Doe
 givenName: John
 sn: Doe
 telephoneNumber: +1 888 555 6789
 telephoneNumber: +1 888 555 1232
 mail: john@example.com
 manager: cn=Barbara Doe,dc=example,dc=com
 objectClass: inetOrgPerson
 objectClass: organizationalPerson
 objectClass: person
 objectClass: top
&lt;/pre&gt;
&lt;pre&gt;&lt;a name=&#39;more&#39;&gt;&lt;/a&gt;
&lt;/pre&gt;
&lt;/td&gt;&lt;td&gt;&lt;a alt=&quot;Throwable Object Connect ldap using java ldap binding structure&quot; href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiXWb8yvD2RnULL6HIJpOOOfv5Ss4SGP9ZSnfZtV260Lg_XG1cYwbcTY82fPednydp0ms0EsgjyfcPDrtEN2cceswe2SF7ww925n_ucYPwKfghqUNzFVm_u5tmNxaKcjSDOtTsdvk-btzu4/s1600/ldapStructure.jpg&quot; imageanchor=&quot;1&quot; style=&quot;clear: left; float: left; margin-bottom: 1em; margin-right: 1em;&quot; title=&quot;Throwable Object Connect ldap using java ldap binding structure&quot;&gt;&lt;img alt=&quot;Throwable Object Connect ldap using java ldap binding structure&quot; border=&quot;0&quot; height=&quot;152&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiXWb8yvD2RnULL6HIJpOOOfv5Ss4SGP9ZSnfZtV260Lg_XG1cYwbcTY82fPednydp0ms0EsgjyfcPDrtEN2cceswe2SF7ww925n_ucYPwKfghqUNzFVm_u5tmNxaKcjSDOtTsdvk-btzu4/s320/ldapStructure.jpg&quot; title=&quot;Throwable Object Connect ldap using java ldap binding structure&quot; width=&quot;320&quot; /&gt;&lt;/a&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;
&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
Above example, the Distinguished Name &quot;cn=Joe Smith,ou=East,dc=MyDomain,dc=com&quot; has four components. The first (lowest level) component of the Distinguished Name is the Relative Distinguished Name (RDN) of the object. In this case, the RDN is &quot;cn=Joe Smith&quot;. The RDN of an object is the name of the object in its container. The remainder of the components are the Distinguished Name of the container, which is the parent of the object. In this case, the object &quot;cn=Joe Smith&quot; is in the container whose Distinguished Name is &quot;ou=East,dc=MyDomain,dc=com&quot;. In this case, the parent container is an organizational unit. The parent of the &quot;ou=East&quot; organizational unit is the domain &quot;MyDomain.com&quot;. This domain has domain components &quot;dc=MyDomain&quot; and &quot;dc=com&quot;. The full DNS name of the domain is &quot;dc=MyDomain,dc=com&quot;.
&lt;br /&gt;
Container objects can be containers, organizational units, or domains. Container objects are objects that can &quot;contain&quot; other objects, such as user objects, group objects, and computer objects. Group objects are not containers. Groups can have members, but the members are not children of the group object.
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
Sample java program to connect ldap and search the directory:
&lt;br /&gt;
&lt;!-- HTML generated using hilite.me --&gt;&lt;br /&gt;
&lt;div style=&quot;background: #ffffff; border-width: 0.1em 0.1em 0.1em 0.4em; border: solid gray; overflow: auto; padding: 0.2em 0.6em; width: auto;&quot;&gt;
&lt;table&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;&lt;pre style=&quot;line-height: 125%; margin: 0;&quot;&gt; 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60&lt;/pre&gt;
&lt;/td&gt;&lt;td&gt;&lt;pre style=&quot;line-height: 125%; margin: 0;&quot;&gt;&lt;span style=&quot;color: #008800; font-weight: bold;&quot;&gt;import&lt;/span&gt; &lt;span style=&quot;color: #0e84b5; font-weight: bold;&quot;&gt;javax.naming.Context&lt;/span&gt;&lt;span style=&quot;color: #333333;&quot;&gt;;&lt;/span&gt;
&lt;span style=&quot;color: #008800; font-weight: bold;&quot;&gt;import&lt;/span&gt; &lt;span style=&quot;color: #0e84b5; font-weight: bold;&quot;&gt;javax.naming.directory.DirContext&lt;/span&gt;&lt;span style=&quot;color: #333333;&quot;&gt;;&lt;/span&gt;
&lt;span style=&quot;color: #008800; font-weight: bold;&quot;&gt;import&lt;/span&gt; &lt;span style=&quot;color: #0e84b5; font-weight: bold;&quot;&gt;javax.naming.directory.SearchResult&lt;/span&gt;&lt;span style=&quot;color: #333333;&quot;&gt;;&lt;/span&gt;
&lt;span style=&quot;color: #008800; font-weight: bold;&quot;&gt;import&lt;/span&gt; &lt;span style=&quot;color: #0e84b5; font-weight: bold;&quot;&gt;javax.naming.NamingEnumeration&lt;/span&gt;&lt;span style=&quot;color: #333333;&quot;&gt;;&lt;/span&gt;
&lt;span style=&quot;color: #008800; font-weight: bold;&quot;&gt;import&lt;/span&gt; &lt;span style=&quot;color: #0e84b5; font-weight: bold;&quot;&gt;javax.naming.directory.InitialDirContext&lt;/span&gt;&lt;span style=&quot;color: #333333;&quot;&gt;;&lt;/span&gt;
&lt;span style=&quot;color: #008800; font-weight: bold;&quot;&gt;import&lt;/span&gt; &lt;span style=&quot;color: #0e84b5; font-weight: bold;&quot;&gt;javax.naming.directory.Attributes&lt;/span&gt;&lt;span style=&quot;color: #333333;&quot;&gt;;&lt;/span&gt;
&lt;span style=&quot;color: #008800; font-weight: bold;&quot;&gt;import&lt;/span&gt; &lt;span style=&quot;color: #0e84b5; font-weight: bold;&quot;&gt;javax.naming.directory.BasicAttributes&lt;/span&gt;&lt;span style=&quot;color: #333333;&quot;&gt;;&lt;/span&gt;
&lt;span style=&quot;color: #008800; font-weight: bold;&quot;&gt;import&lt;/span&gt; &lt;span style=&quot;color: #0e84b5; font-weight: bold;&quot;&gt;javax.naming.directory.Attribute&lt;/span&gt;&lt;span style=&quot;color: #333333;&quot;&gt;;&lt;/span&gt;

&lt;span style=&quot;color: #008800; font-weight: bold;&quot;&gt;public&lt;/span&gt; &lt;span style=&quot;color: #008800; font-weight: bold;&quot;&gt;class&lt;/span&gt; &lt;span style=&quot;color: #bb0066; font-weight: bold;&quot;&gt;LdapTest&lt;/span&gt; 
&lt;span style=&quot;color: #333333;&quot;&gt;{&lt;/span&gt;
  &lt;span style=&quot;color: #008800; font-weight: bold;&quot;&gt;public&lt;/span&gt; &lt;span style=&quot;color: #008800; font-weight: bold;&quot;&gt;static&lt;/span&gt; &lt;span style=&quot;color: #333399; font-weight: bold;&quot;&gt;void&lt;/span&gt; &lt;span style=&quot;color: #0066bb; font-weight: bold;&quot;&gt;main&lt;/span&gt;&lt;span style=&quot;color: #333333;&quot;&gt;(&lt;/span&gt;String&lt;span style=&quot;color: #333333;&quot;&gt;[]&lt;/span&gt; args&lt;span style=&quot;color: #333333;&quot;&gt;)&lt;/span&gt;
  &lt;span style=&quot;color: #333333;&quot;&gt;{&lt;/span&gt;
    Hashtable&lt;span style=&quot;color: #333333;&quot;&gt;&amp;lt;&lt;/span&gt;String&lt;span style=&quot;color: #333333;&quot;&gt;,&lt;/span&gt; String&lt;span style=&quot;color: #333333;&quot;&gt;&amp;gt;&lt;/span&gt; env &lt;span style=&quot;color: #333333;&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: #008800; font-weight: bold;&quot;&gt;new&lt;/span&gt; Hashtable&lt;span style=&quot;color: #333333;&quot;&gt;&amp;lt;&lt;/span&gt;String&lt;span style=&quot;color: #333333;&quot;&gt;,&lt;/span&gt; String&lt;span style=&quot;color: #333333;&quot;&gt;&amp;gt;();&lt;/span&gt;
    env&lt;span style=&quot;color: #333333;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #0000cc;&quot;&gt;put&lt;/span&gt;&lt;span style=&quot;color: #333333;&quot;&gt;(&lt;/span&gt;Context&lt;span style=&quot;color: #333333;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #0000cc;&quot;&gt;INITIAL_CONTEXT_FACTORY&lt;/span&gt;&lt;span style=&quot;color: #333333;&quot;&gt;,&lt;/span&gt; &lt;span style=&quot;background-color: #fff0f0;&quot;&gt;&quot;com.sun.jndi.ldap.LdapCtxFactory&quot;&lt;/span&gt;&lt;span style=&quot;color: #333333;&quot;&gt;);&lt;/span&gt;
    env&lt;span style=&quot;color: #333333;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #0000cc;&quot;&gt;put&lt;/span&gt;&lt;span style=&quot;color: #333333;&quot;&gt;(&lt;/span&gt;Context&lt;span style=&quot;color: #333333;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #0000cc;&quot;&gt;PROVIDER_URL&lt;/span&gt;&lt;span style=&quot;color: #333333;&quot;&gt;,&lt;/span&gt; &lt;span style=&quot;background-color: #fff0f0;&quot;&gt;&quot;ldap://localhost:392&quot;&lt;/span&gt;&lt;span style=&quot;color: #333333;&quot;&gt;));&lt;/span&gt;
    env&lt;span style=&quot;color: #333333;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #0000cc;&quot;&gt;put&lt;/span&gt;&lt;span style=&quot;color: #333333;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;background-color: #fff0f0;&quot;&gt;&quot;com.sun.jndi.ldap.connect.pool&quot;&lt;/span&gt;&lt;span style=&quot;color: #333333;&quot;&gt;,&lt;/span&gt; &lt;span style=&quot;background-color: #fff0f0;&quot;&gt;&quot;true&quot;&lt;/span&gt;&lt;span style=&quot;color: #333333;&quot;&gt;);&lt;/span&gt;
    env&lt;span style=&quot;color: #333333;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #0000cc;&quot;&gt;put&lt;/span&gt;&lt;span style=&quot;color: #333333;&quot;&gt;(&lt;/span&gt;Context&lt;span style=&quot;color: #333333;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #0000cc;&quot;&gt;SECURITY_PRINCIPAL&lt;/span&gt;&lt;span style=&quot;color: #333333;&quot;&gt;,&lt;/span&gt; &lt;span style=&quot;background-color: #fff0f0;&quot;&gt;&quot;uid=admin,ou=system&quot;&lt;/span&gt;&lt;span style=&quot;color: #333333;&quot;&gt;);&lt;/span&gt;
    env&lt;span style=&quot;color: #333333;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #0000cc;&quot;&gt;put&lt;/span&gt;&lt;span style=&quot;color: #333333;&quot;&gt;(&lt;/span&gt;Context&lt;span style=&quot;color: #333333;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #0000cc;&quot;&gt;SECURITY_CREDENTIALS&lt;/span&gt;&lt;span style=&quot;color: #333333;&quot;&gt;,&lt;/span&gt; &lt;span style=&quot;background-color: #fff0f0;&quot;&gt;&quot;password&quot;&lt;/span&gt;&lt;span style=&quot;color: #333333;&quot;&gt;);&lt;/span&gt;
    env&lt;span style=&quot;color: #333333;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #0000cc;&quot;&gt;put&lt;/span&gt;&lt;span style=&quot;color: #333333;&quot;&gt;(&lt;/span&gt;Context&lt;span style=&quot;color: #333333;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #0000cc;&quot;&gt;SECURITY_AUTHENTICATION&lt;/span&gt;&lt;span style=&quot;color: #333333;&quot;&gt;,&lt;/span&gt; &lt;span style=&quot;background-color: #fff0f0;&quot;&gt;&quot;simple&quot;&lt;/span&gt;&lt;span style=&quot;color: #333333;&quot;&gt;);&lt;/span&gt;
    env&lt;span style=&quot;color: #333333;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #0000cc;&quot;&gt;put&lt;/span&gt;&lt;span style=&quot;color: #333333;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;background-color: #fff0f0;&quot;&gt;&quot;com.sun.jndi.ldap.read.timeout&quot;&lt;/span&gt;&lt;span style=&quot;color: #333333;&quot;&gt;,&lt;/span&gt; &lt;span style=&quot;background-color: #fff0f0;&quot;&gt;&quot;50000&quot;&lt;/span&gt;&lt;span style=&quot;color: #333333;&quot;&gt;);&lt;/span&gt;
    env&lt;span style=&quot;color: #333333;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #0000cc;&quot;&gt;put&lt;/span&gt;&lt;span style=&quot;color: #333333;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;background-color: #fff0f0;&quot;&gt;&quot;com.sun.jndi.ldap.connect.timeout&quot;&lt;/span&gt;&lt;span style=&quot;color: #333333;&quot;&gt;,&lt;/span&gt; &lt;span style=&quot;background-color: #fff0f0;&quot;&gt;&quot;50000&quot;&lt;/span&gt;&lt;span style=&quot;color: #333333;&quot;&gt;);&lt;/span&gt;

    &lt;span style=&quot;color: #008800; font-weight: bold;&quot;&gt;try&lt;/span&gt; 
    &lt;span style=&quot;color: #333333;&quot;&gt;{&lt;/span&gt;
      DirContext ctx &lt;span style=&quot;color: #333333;&quot;&gt;=&lt;/span&gt;  &lt;span style=&quot;color: #008800; font-weight: bold;&quot;&gt;new&lt;/span&gt; InitialDirContext&lt;span style=&quot;color: #333333;&quot;&gt;(&lt;/span&gt;env&lt;span style=&quot;color: #333333;&quot;&gt;);&lt;/span&gt;
      Attributes matchAttrs &lt;span style=&quot;color: #333333;&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: #008800; font-weight: bold;&quot;&gt;new&lt;/span&gt; BasicAttributes&lt;span style=&quot;color: #333333;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #008800; font-weight: bold;&quot;&gt;true&lt;/span&gt;&lt;span style=&quot;color: #333333;&quot;&gt;);&lt;/span&gt;
      matchAttrs&lt;span style=&quot;color: #333333;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #0000cc;&quot;&gt;put&lt;/span&gt;&lt;span style=&quot;color: #333333;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #008800; font-weight: bold;&quot;&gt;new&lt;/span&gt; BasicAttribute&lt;span style=&quot;color: #333333;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;background-color: #fff0f0;&quot;&gt;&quot;inputAttributeName&quot;&lt;/span&gt;&lt;span style=&quot;color: #333333;&quot;&gt;,&lt;/span&gt; &lt;span style=&quot;background-color: #fff0f0;&quot;&gt;&quot;inputAttributeValue&quot;&lt;/span&gt;&lt;span style=&quot;color: #333333;&quot;&gt;));&lt;/span&gt;      
      NamingEnumeration&lt;span style=&quot;color: #333333;&quot;&gt;&amp;lt;&lt;/span&gt;SearchResult&lt;span style=&quot;color: #333333;&quot;&gt;&amp;gt;&lt;/span&gt; answer &lt;span style=&quot;color: #333333;&quot;&gt;=&lt;/span&gt; ctx&lt;span style=&quot;color: #333333;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #0000cc;&quot;&gt;search&lt;/span&gt;&lt;span style=&quot;color: #333333;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;background-color: #fff0f0;&quot;&gt;&quot;baseDN&quot;&lt;/span&gt;&lt;span style=&quot;color: #333333;&quot;&gt;,&lt;/span&gt;matchAttrs&lt;span style=&quot;color: #333333;&quot;&gt;);&lt;/span&gt;
      &lt;span style=&quot;color: #008800; font-weight: bold;&quot;&gt;while&lt;/span&gt; &lt;span style=&quot;color: #333333;&quot;&gt;(&lt;/span&gt;answer&lt;span style=&quot;color: #333333;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #0000cc;&quot;&gt;hasMore&lt;/span&gt;&lt;span style=&quot;color: #333333;&quot;&gt;())&lt;/span&gt; 
      &lt;span style=&quot;color: #333333;&quot;&gt;{&lt;/span&gt;
        SearchResult sr &lt;span style=&quot;color: #333333;&quot;&gt;=&lt;/span&gt; answer&lt;span style=&quot;color: #333333;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #0000cc;&quot;&gt;next&lt;/span&gt;&lt;span style=&quot;color: #333333;&quot;&gt;();&lt;/span&gt;
        NamingEnumeration&lt;span style=&quot;color: #333333;&quot;&gt;&amp;lt;?&lt;/span&gt; &lt;span style=&quot;color: #008800; font-weight: bold;&quot;&gt;extends&lt;/span&gt; Attribute&lt;span style=&quot;color: #333333;&quot;&gt;&amp;gt;&lt;/span&gt; attributes &lt;span style=&quot;color: #333333;&quot;&gt;=&lt;/span&gt; sr&lt;span style=&quot;color: #333333;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #0000cc;&quot;&gt;getAttributes&lt;/span&gt;&lt;span style=&quot;color: #333333;&quot;&gt;().&lt;/span&gt;&lt;span style=&quot;color: #0000cc;&quot;&gt;getAll&lt;/span&gt;&lt;span style=&quot;color: #333333;&quot;&gt;();&lt;/span&gt;
        &lt;span style=&quot;color: #008800; font-weight: bold;&quot;&gt;while&lt;/span&gt; &lt;span style=&quot;color: #333333;&quot;&gt;(&lt;/span&gt;attributes&lt;span style=&quot;color: #333333;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #0000cc;&quot;&gt;hasMore&lt;/span&gt;&lt;span style=&quot;color: #333333;&quot;&gt;())&lt;/span&gt; 
        &lt;span style=&quot;color: #333333;&quot;&gt;{&lt;/span&gt;
          Attribute anAttribute &lt;span style=&quot;color: #333333;&quot;&gt;=&lt;/span&gt; attributes&lt;span style=&quot;color: #333333;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #0000cc;&quot;&gt;next&lt;/span&gt;&lt;span style=&quot;color: #333333;&quot;&gt;();&lt;/span&gt;
          String id &lt;span style=&quot;color: #333333;&quot;&gt;=&lt;/span&gt; anAttribute&lt;span style=&quot;color: #333333;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #0000cc;&quot;&gt;getID&lt;/span&gt;&lt;span style=&quot;color: #333333;&quot;&gt;();&lt;/span&gt;
          String value &lt;span style=&quot;color: #333333;&quot;&gt;=&lt;/span&gt; anAttribute&lt;span style=&quot;color: #333333;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #0000cc;&quot;&gt;get&lt;/span&gt;&lt;span style=&quot;color: #333333;&quot;&gt;().&lt;/span&gt;&lt;span style=&quot;color: #0000cc;&quot;&gt;toString&lt;/span&gt;&lt;span style=&quot;color: #333333;&quot;&gt;();&lt;/span&gt;
          System&lt;span style=&quot;color: #333333;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #0000cc;&quot;&gt;out&lt;/span&gt;&lt;span style=&quot;color: #333333;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #0000cc;&quot;&gt;println&lt;/span&gt;&lt;span style=&quot;color: #333333;&quot;&gt;(&lt;/span&gt;id&lt;span style=&quot;color: #333333;&quot;&gt;+&lt;/span&gt;&lt;span style=&quot;background-color: #fff0f0;&quot;&gt;&quot; &quot;&lt;/span&gt;&lt;span style=&quot;color: #333333;&quot;&gt;+&lt;/span&gt;value&lt;span style=&quot;color: #333333;&quot;&gt;);&lt;/span&gt;
        &lt;span style=&quot;color: #333333;&quot;&gt;}&lt;/span&gt;
        attributes&lt;span style=&quot;color: #333333;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #0000cc;&quot;&gt;close&lt;/span&gt;&lt;span style=&quot;color: #333333;&quot;&gt;();&lt;/span&gt;
      &lt;span style=&quot;color: #333333;&quot;&gt;}&lt;/span&gt;
      answer&lt;span style=&quot;color: #333333;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #0000cc;&quot;&gt;close&lt;/span&gt;&lt;span style=&quot;color: #333333;&quot;&gt;();&lt;/span&gt;
    &lt;span style=&quot;color: #333333;&quot;&gt;}&lt;/span&gt; &lt;span style=&quot;color: #008800; font-weight: bold;&quot;&gt;catch&lt;/span&gt; &lt;span style=&quot;color: #333333;&quot;&gt;(&lt;/span&gt;NamingException e&lt;span style=&quot;color: #333333;&quot;&gt;)&lt;/span&gt; &lt;span style=&quot;color: #333333;&quot;&gt;{&lt;/span&gt;
        e&lt;span style=&quot;color: #333333;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #0000cc;&quot;&gt;printStackTrace&lt;/span&gt;&lt;span style=&quot;color: #333333;&quot;&gt;();&lt;/span&gt;
    &lt;span style=&quot;color: #333333;&quot;&gt;}&lt;/span&gt; 
    &lt;span style=&quot;color: #008800; font-weight: bold;&quot;&gt;finally&lt;/span&gt; 
    &lt;span style=&quot;color: #333333;&quot;&gt;{&lt;/span&gt;
        &lt;span style=&quot;color: #008800; font-weight: bold;&quot;&gt;if&lt;/span&gt; &lt;span style=&quot;color: #333333;&quot;&gt;(&lt;/span&gt;ctx &lt;span style=&quot;color: #333333;&quot;&gt;!=&lt;/span&gt; &lt;span style=&quot;color: #008800; font-weight: bold;&quot;&gt;null&lt;/span&gt;&lt;span style=&quot;color: #333333;&quot;&gt;)&lt;/span&gt; 
        &lt;span style=&quot;color: #333333;&quot;&gt;{&lt;/span&gt;
          &lt;span style=&quot;color: #008800; font-weight: bold;&quot;&gt;try&lt;/span&gt; 
          &lt;span style=&quot;color: #333333;&quot;&gt;{&lt;/span&gt;
              ctx&lt;span style=&quot;color: #333333;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #0000cc;&quot;&gt;close&lt;/span&gt;&lt;span style=&quot;color: #333333;&quot;&gt;();&lt;/span&gt;
          &lt;span style=&quot;color: #333333;&quot;&gt;}&lt;/span&gt; &lt;span style=&quot;color: #008800; font-weight: bold;&quot;&gt;catch&lt;/span&gt; &lt;span style=&quot;color: #333333;&quot;&gt;(&lt;/span&gt;NamingException e&lt;span style=&quot;color: #333333;&quot;&gt;)&lt;/span&gt; &lt;span style=&quot;color: #333333;&quot;&gt;{&lt;/span&gt;
              e&lt;span style=&quot;color: #333333;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #0000cc;&quot;&gt;printStackTrace&lt;/span&gt;&lt;span style=&quot;color: #333333;&quot;&gt;();&lt;/span&gt;
          &lt;span style=&quot;color: #333333;&quot;&gt;}&lt;/span&gt;
        &lt;span style=&quot;color: #333333;&quot;&gt;}&lt;/span&gt;
    &lt;span style=&quot;color: #333333;&quot;&gt;}&lt;/span&gt;
  &lt;span style=&quot;color: #333333;&quot;&gt;}&lt;/span&gt;
&lt;span style=&quot;color: #333333;&quot;&gt;}&lt;/span&gt;
&lt;/pre&gt;
&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://throwableobject.blogspot.com/feeds/1739882984800933052/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://throwableobject.blogspot.com/2016/07/connect-ldap-using-java.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/9048812660891698443/posts/default/1739882984800933052'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/9048812660891698443/posts/default/1739882984800933052'/><link rel='alternate' type='text/html' href='http://throwableobject.blogspot.com/2016/07/connect-ldap-using-java.html' title='Connect Ldap using Java'/><author><name>test</name><uri>http://www.blogger.com/profile/06330700265841330179</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiXWb8yvD2RnULL6HIJpOOOfv5Ss4SGP9ZSnfZtV260Lg_XG1cYwbcTY82fPednydp0ms0EsgjyfcPDrtEN2cceswe2SF7ww925n_ucYPwKfghqUNzFVm_u5tmNxaKcjSDOtTsdvk-btzu4/s72-c/ldapStructure.jpg" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-9048812660891698443.post-8325555201917835609</id><published>2016-01-28T16:36:00.003+05:30</published><updated>2016-01-28T16:59:37.115+05:30</updated><title type='text'>Convert JKS into PEM using Keytool</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;Below are the steps to convert the JKS keystore file into CRT / PEM files(certs/keys) &lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;ol style=&quot;text-align: left;&quot;&gt;
&lt;li&gt;&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;Generate&amp;nbsp;PKCS12 file format with the Keystore jks file&lt;br /&gt;&lt;code&gt;&lt;b&gt;keytool -importkeystore -srckeystore &amp;lt;keystore.jks&amp;gt; -destkeystore &amp;lt;keystore.p12&amp;gt; -deststoretype PKCS12 -srcalias &amp;lt;aliasName&amp;gt; -deststorepass &amp;lt;password&amp;gt; -destkeypass &amp;lt;password&amp;gt;&lt;/b&gt;&lt;/code&gt;In above keystore.jks is input Keystore file&lt;br /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;keystore.p12 is the output PKCS12 file.&lt;br /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;aliasName was the entry name in keystore file.&lt;br /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;password is the password for the output file.&lt;br /&gt;Example:&lt;br /&gt;&lt;code&gt;&lt;b&gt;&amp;gt;keytool -importkeystore -srckeystore keystore.jks -destkeystore keystore.p12 -deststoretype PKCS12 -srcalias selfsigned -deststorepass password -destkeypass password&lt;/b&gt;&lt;br /&gt;Enter source keystore password:&lt;/code&gt;&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;Now convert the PKCS12 format into PEM format:&lt;/span&gt;&lt;/li&gt;
&lt;ol&gt;
&lt;li&gt;&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;Generate certificate in pem format without private keys:&lt;br /&gt;&lt;b&gt;&lt;code&gt;&amp;gt;openssl pkcs12 -in &amp;lt;keystore.p12&amp;gt; &amp;nbsp;-nokeys -out &amp;lt;cert.pem&amp;gt;&lt;/code&gt;&lt;/b&gt;&lt;br /&gt;in above keystore.p12 is the input file in PKCS12 format&lt;br /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;cert.pem is the output file in PEM format.&lt;br /&gt;example:&lt;br /&gt;&lt;code&gt;&lt;b&gt;&amp;gt;openssl pkcs12 -in keystore.p12 &amp;nbsp;-nokeys -out cert.pem&lt;/b&gt;&lt;br /&gt;Enter Import Password:&lt;br /&gt;MAC verified OK&lt;/code&gt;&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;Generate private key in pem format without certificate:&lt;br /&gt;&lt;code&gt;&lt;b&gt;&amp;gt;openssl pkcs12 -in keystore.p12 &amp;nbsp;-nodes -nocerts -out key.pem&lt;/b&gt;&lt;br /&gt;Enter Import Password:&lt;br /&gt;MAC verified OK&lt;/code&gt;&lt;/span&gt;&lt;/li&gt;
&lt;/ol&gt;
&lt;li&gt;&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;Additionally convert the keystore jks file into CRT format:&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;keytool -exportcert -file &amp;lt;keystore.crt&amp;gt; -keystore &amp;lt;keystore.jks&amp;gt; -alias &amp;lt;aliasName&amp;gt;&lt;br /&gt;in above keystore.jks is the input Keystore jks file&lt;br /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;aliasName is the entry name in the keystore file&lt;br /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;keystore.crt is the output CRT file.&lt;br /&gt;&lt;code&gt;&lt;b&gt;&amp;gt;keytool -exportcert -file keystore.crt -keystore keystore.jks -alias selfsigned&lt;/b&gt;&lt;br /&gt;Enter keystore password:&lt;br /&gt;Certificate stored in file &amp;lt;keystore.crt&amp;gt;&lt;/code&gt;&lt;/span&gt;&lt;/li&gt;
&lt;/ol&gt;
&lt;/div&gt;
&lt;ol&gt;
&lt;/ol&gt;
&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://throwableobject.blogspot.com/feeds/8325555201917835609/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://throwableobject.blogspot.com/2016/01/convert-jks-into-pem-using-keytool.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/9048812660891698443/posts/default/8325555201917835609'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/9048812660891698443/posts/default/8325555201917835609'/><link rel='alternate' type='text/html' href='http://throwableobject.blogspot.com/2016/01/convert-jks-into-pem-using-keytool.html' title='Convert JKS into PEM using Keytool'/><author><name>test</name><uri>http://www.blogger.com/profile/06330700265841330179</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-9048812660891698443.post-4128607900316100324</id><published>2015-12-11T11:03:00.001+05:30</published><updated>2015-12-11T12:10:06.726+05:30</updated><category scheme="http://www.blogger.com/atom/ns#" term="authentication"/><category scheme="http://www.blogger.com/atom/ns#" term="md5 password encoder"/><category scheme="http://www.blogger.com/atom/ns#" term="Spring security"/><category scheme="http://www.blogger.com/atom/ns#" term="web application"/><title type='text'>Spring Security with Md5 password encoder Authentication</title><content type='html'>&lt;div title=&quot;throwableobject Spring Security with Md5 password encoder Authentication&quot; dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;br /&gt;
&lt;div title=&quot;throwableobject Spring Security with Md5 password encoder Authentication&quot; style=&quot;text-align: center;&quot;&gt;
&lt;h1&gt;Spring Security to a web application with md5 password encoder&lt;/h1&gt;
&lt;/div&gt;
&lt;br /&gt;
&lt;ol style=&quot;font-weight: bold; text-align: left;&quot;&gt;
&lt;li style=&quot;font-weight: bold;&quot;&gt;Required Maven Libraries:&lt;/li&gt;
&lt;span title=&quot;throwableobject Spring Security with Md5 password encoder Authentication&quot; style=&quot;font-weight: normal&quot;&gt;
&lt;!-- HTML generated using hilite.me --&gt;&lt;div style=&quot;background: #f0f3f3; overflow:auto;width:auto;border:solid gray;border-width:.1em .1em .1em .4em;padding:.2em .6em;&quot;&gt;&lt;table&gt;&lt;tr&gt;&lt;td&gt;&lt;pre style=&quot;margin: 0; line-height: 125%&quot;&gt; 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24&lt;/pre&gt;&lt;/td&gt;&lt;td&gt;&lt;pre style=&quot;margin: 0; line-height: 125%&quot;&gt;&lt;span style=&quot;color: #330099; font-weight: bold&quot;&gt;&amp;lt;dependency&amp;gt;&lt;/span&gt;
 &lt;span style=&quot;color: #330099; font-weight: bold&quot;&gt;&amp;lt;groupId&amp;gt;&lt;/span&gt;org.springframework&lt;span style=&quot;color: #330099; font-weight: bold&quot;&gt;&amp;lt;/groupId&amp;gt;&lt;/span&gt;
 &lt;span style=&quot;color: #330099; font-weight: bold&quot;&gt;&amp;lt;artifactId&amp;gt;&lt;/span&gt;spring-core&lt;span style=&quot;color: #330099; font-weight: bold&quot;&gt;&amp;lt;/artifactId&amp;gt;&lt;/span&gt;
&lt;span style=&quot;color: #330099; font-weight: bold&quot;&gt;&amp;lt;/dependency&amp;gt;&lt;/span&gt;
&lt;span style=&quot;color: #330099; font-weight: bold&quot;&gt;&amp;lt;dependency&amp;gt;&lt;/span&gt;
 &lt;span style=&quot;color: #330099; font-weight: bold&quot;&gt;&amp;lt;groupId&amp;gt;&lt;/span&gt;org.springframework&lt;span style=&quot;color: #330099; font-weight: bold&quot;&gt;&amp;lt;/groupId&amp;gt;&lt;/span&gt;
 &lt;span style=&quot;color: #330099; font-weight: bold&quot;&gt;&amp;lt;artifactId&amp;gt;&lt;/span&gt;spring-beans&lt;span style=&quot;color: #330099; font-weight: bold&quot;&gt;&amp;lt;/artifactId&amp;gt;&lt;/span&gt;
&lt;span style=&quot;color: #330099; font-weight: bold&quot;&gt;&amp;lt;/dependency&amp;gt;&lt;/span&gt;
&lt;span style=&quot;color: #330099; font-weight: bold&quot;&gt;&amp;lt;dependency&amp;gt;&lt;/span&gt;
 &lt;span style=&quot;color: #330099; font-weight: bold&quot;&gt;&amp;lt;groupId&amp;gt;&lt;/span&gt;org.springframework&lt;span style=&quot;color: #330099; font-weight: bold&quot;&gt;&amp;lt;/groupId&amp;gt;&lt;/span&gt;
 &lt;span style=&quot;color: #330099; font-weight: bold&quot;&gt;&amp;lt;artifactId&amp;gt;&lt;/span&gt;spring-context&lt;span style=&quot;color: #330099; font-weight: bold&quot;&gt;&amp;lt;/artifactId&amp;gt;&lt;/span&gt;
&lt;span style=&quot;color: #330099; font-weight: bold&quot;&gt;&amp;lt;/dependency&amp;gt;&lt;/span&gt;
&lt;span style=&quot;color: #330099; font-weight: bold&quot;&gt;&amp;lt;dependency&amp;gt;&lt;/span&gt;
 &lt;span style=&quot;color: #330099; font-weight: bold&quot;&gt;&amp;lt;groupId&amp;gt;&lt;/span&gt;org.springframework&lt;span style=&quot;color: #330099; font-weight: bold&quot;&gt;&amp;lt;/groupId&amp;gt;&lt;/span&gt;
 &lt;span style=&quot;color: #330099; font-weight: bold&quot;&gt;&amp;lt;artifactId&amp;gt;&lt;/span&gt;spring-web&lt;span style=&quot;color: #330099; font-weight: bold&quot;&gt;&amp;lt;/artifactId&amp;gt;&lt;/span&gt;
&lt;span style=&quot;color: #330099; font-weight: bold&quot;&gt;&amp;lt;/dependency&amp;gt;&lt;/span&gt;
&lt;span style=&quot;color: #330099; font-weight: bold&quot;&gt;&amp;lt;dependency&amp;gt;&lt;/span&gt;
 &lt;span style=&quot;color: #330099; font-weight: bold&quot;&gt;&amp;lt;groupId&amp;gt;&lt;/span&gt;org.springframework.security&lt;span style=&quot;color: #330099; font-weight: bold&quot;&gt;&amp;lt;/groupId&amp;gt;&lt;/span&gt;
 &lt;span style=&quot;color: #330099; font-weight: bold&quot;&gt;&amp;lt;artifactId&amp;gt;&lt;/span&gt;spring-security-web&lt;span style=&quot;color: #330099; font-weight: bold&quot;&gt;&amp;lt;/artifactId&amp;gt;&lt;/span&gt;
&lt;span style=&quot;color: #330099; font-weight: bold&quot;&gt;&amp;lt;/dependency&amp;gt;&lt;/span&gt;
&lt;span style=&quot;color: #330099; font-weight: bold&quot;&gt;&amp;lt;dependency&amp;gt;&lt;/span&gt;
 &lt;span style=&quot;color: #330099; font-weight: bold&quot;&gt;&amp;lt;groupId&amp;gt;&lt;/span&gt;org.springframework.security&lt;span style=&quot;color: #330099; font-weight: bold&quot;&gt;&amp;lt;/groupId&amp;gt;&lt;/span&gt;
 &lt;span style=&quot;color: #330099; font-weight: bold&quot;&gt;&amp;lt;artifactId&amp;gt;&lt;/span&gt;spring-security-config&lt;span style=&quot;color: #330099; font-weight: bold&quot;&gt;&amp;lt;/artifactId&amp;gt;&lt;/span&gt;
&lt;span style=&quot;color: #330099; font-weight: bold&quot;&gt;&amp;lt;/dependency&amp;gt;&lt;/span&gt;
&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&lt;/div&gt;
&lt;/span&gt;
&lt;li style=&quot;font-weight: bold;&quot;&gt;Configuration files:&lt;/li&gt;
&lt;ol style=&quot;font-weight: bold;&quot; type=&quot;a&quot;&gt;
&lt;li style=&quot;font-weight: bold;&quot;&gt;MD5 Password Encoder script(md5encoder.sh)&lt;/li&gt;
&lt;span style=&quot;font-weight: normal;&quot;&gt;
&lt;!-- HTML generated using hilite.me --&gt;&lt;div style=&quot;background: #f0f3f3; overflow:auto;width:auto;border:solid gray;border-width:.1em .1em .1em .4em;padding:.2em .6em;&quot;&gt;&lt;table&gt;&lt;tr&gt;&lt;td&gt;&lt;pre style=&quot;margin: 0; line-height: 125%&quot;&gt;1
2
3
4
5
6
7&lt;/pre&gt;&lt;/td&gt;&lt;td&gt;&lt;pre style=&quot;margin: 0; line-height: 125%&quot;&gt;&lt;span style=&quot;color: #0099FF; font-style: italic&quot;&gt;#!/bin/bash&lt;/span&gt;
&lt;span title=&quot;throwableobject Spring Security with Md5 password encoder Authentication&quot; style=&quot;color: #0099FF; font-style: italic&quot;&gt;##########################################################################&lt;/span&gt;
&lt;span style=&quot;color: #0099FF; font-style: italic&quot;&gt;# Name  : MD5 Password Encoder for PRISM API &lt;/span&gt;
&lt;span style=&quot;color: #0099FF; font-style: italic&quot;&gt;##########################################################################&lt;/span&gt;
echo &lt;span style=&quot;color: #CC3300&quot;&gt;&amp;quot;Please enter password to be encoded:&amp;quot;&lt;/span&gt;
&lt;span style=&quot;color: #336666&quot;&gt;read&lt;/span&gt; md5pass
echo &lt;span style=&quot;color: #555555&quot;&gt;-&lt;/span&gt;n &lt;span style=&quot;color: #003333&quot;&gt;$md5pass&lt;/span&gt; &lt;span style=&quot;color: #555555&quot;&gt;|&lt;/span&gt; md5sum &lt;span style=&quot;color: #555555&quot;&gt;|&lt;/span&gt; awk &lt;span style=&quot;color: #CC3300&quot;&gt;&amp;#39;{print $1}&amp;#39;&lt;/span&gt;
&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&lt;/div&gt;
&lt;/span&gt;
&lt;li style=&quot;font-weight: bold;&quot;&gt;User Profiles(profiles.properties)&lt;/li&gt;
&lt;span title=&quot;throwableobject Spring Security with Md5 password encoder Authentication&quot; style=&quot;font-weight: normal;&quot;&gt;&lt;!-- HTML generated using hilite.me --&gt;&lt;div style=&quot;background: #f0f3f3; overflow:auto;width:auto;border:solid gray;border-width:.1em .1em .1em .4em;padding:.2em .6em;&quot;&gt;&lt;table&gt;&lt;tr&gt;&lt;td&gt;&lt;pre style=&quot;margin: 0; line-height: 125%&quot;&gt;1
2
3&lt;/pre&gt;&lt;/td&gt;&lt;td&gt;&lt;pre style=&quot;margin: 0; line-height: 125%&quot;&gt;&lt;span style=&quot;color: #0099FF; font-style: italic&quot;&gt;# Basic Authentication credentials in APP&lt;/span&gt;
&lt;span style=&quot;color: #0099FF; font-style: italic&quot;&gt;# Format  is &amp;lt;username&amp;gt; = &amp;lt;md5encodedpassword&amp;gt;,&amp;lt;userRole&amp;gt;,&amp;lt;isUserEnabled&amp;gt; &lt;/span&gt;
candy&lt;span style=&quot;color: #555555&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: #FF6600&quot;&gt;5&lt;/span&gt;f4dcc3b5aa765d61d8327deb882cf99,ROLE_USER,enabled
&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&lt;/div&gt;
&lt;/span&gt;
&lt;li style=&quot;font-weight: bold;&quot;&gt;Spring context xml(security-app-context.xml)&lt;/li&gt;
&lt;span style=&quot;font-weight: normal;&quot;&gt;&lt;!-- HTML generated using hilite.me --&gt;&lt;div style=&quot;background: #f0f3f3; overflow:auto;width:auto;border:solid gray;border-width:.1em .1em .1em .4em;padding:.2em .6em;&quot;&gt;&lt;table&gt;&lt;tr&gt;&lt;td&gt;&lt;pre style=&quot;margin: 0; line-height: 125%&quot;&gt; 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35&lt;/pre&gt;&lt;/td&gt;&lt;td&gt;&lt;pre style=&quot;margin: 0; line-height: 125%&quot;&gt;&lt;span style=&quot;color: #009999&quot;&gt;&amp;lt;?xml version=&amp;quot;1.0&amp;quot; encoding=&amp;quot;UTF-8&amp;quot;?&amp;gt;&lt;/span&gt;
&lt;span style=&quot;color: #330099; font-weight: bold&quot;&gt;&amp;lt;beans&lt;/span&gt; &lt;span style=&quot;color: #330099&quot;&gt;xmlns=&lt;/span&gt;&lt;span style=&quot;color: #CC3300&quot;&gt;&amp;quot;http://www.springframework.org/schema/beans&amp;quot;&lt;/span&gt;
 &lt;span style=&quot;color: #330099&quot;&gt;xmlns:xsi=&lt;/span&gt;&lt;span style=&quot;color: #CC3300&quot;&gt;&amp;quot;http://www.w3.org/2001/XMLSchema-instance&amp;quot;&lt;/span&gt; &lt;span style=&quot;color: #330099&quot;&gt;xmlns:security=&lt;/span&gt;&lt;span style=&quot;color: #CC3300&quot;&gt;&amp;quot;http://www.springframework.org/schema/security&amp;quot;&lt;/span&gt;
 &lt;span style=&quot;color: #330099&quot;&gt;xmlns:context=&lt;/span&gt;&lt;span style=&quot;color: #CC3300&quot;&gt;&amp;quot;http://www.springframework.org/schema/context&amp;quot;&lt;/span&gt;
 &lt;span style=&quot;color: #330099&quot;&gt;xsi:schemaLocation=&lt;/span&gt;&lt;span style=&quot;color: #CC3300&quot;&gt;&amp;quot;http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd&lt;/span&gt;
&lt;span style=&quot;color: #CC3300&quot;&gt;           http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.0.xsd&lt;/span&gt;
&lt;span style=&quot;color: #CC3300&quot;&gt;           http://www.springframework.org/schema/security&lt;/span&gt;
&lt;span style=&quot;color: #CC3300&quot;&gt;           http://www.springframework.org/schema/security/spring-security-3.1.xsd&amp;quot;&lt;/span&gt;&lt;span style=&quot;color: #330099; font-weight: bold&quot;&gt;&amp;gt;&lt;/span&gt;

 &lt;span style=&quot;color: #330099; font-weight: bold&quot;&gt;&amp;lt;security:http&lt;/span&gt; &lt;span style=&quot;color: #330099&quot;&gt;entry-point-ref=&lt;/span&gt;&lt;span style=&quot;color: #CC3300&quot;&gt;&amp;quot;authenticationEntryPoint&amp;quot;&lt;/span&gt;
  &lt;span style=&quot;color: #330099&quot;&gt;use-expressions=&lt;/span&gt;&lt;span style=&quot;color: #CC3300&quot;&gt;&amp;quot;true&amp;quot;&lt;/span&gt;&lt;span style=&quot;color: #330099; font-weight: bold&quot;&gt;&amp;gt;&lt;/span&gt;
  &lt;span style=&quot;color: #330099; font-weight: bold&quot;&gt;&amp;lt;security:intercept-url&lt;/span&gt; &lt;span style=&quot;color: #330099&quot;&gt;pattern=&lt;/span&gt;&lt;span style=&quot;color: #CC3300&quot;&gt;&amp;quot;/**&amp;quot;&lt;/span&gt;  &lt;span style=&quot;color: #330099&quot;&gt;access=&lt;/span&gt;&lt;span style=&quot;color: #CC3300&quot;&gt;&amp;quot;hasAnyRole ( &amp;#39;ROLE_USER&amp;#39;)&amp;quot;&lt;/span&gt; &lt;span style=&quot;color: #330099; font-weight: bold&quot;&gt;/&amp;gt;&lt;/span&gt;
   &lt;span style=&quot;color: #330099; font-weight: bold&quot;&gt;&amp;lt;security:logout&lt;/span&gt; &lt;span style=&quot;color: #330099&quot;&gt;invalidate-session=&lt;/span&gt;&lt;span style=&quot;color: #CC3300&quot;&gt;&amp;quot;true&amp;quot;&lt;/span&gt; &lt;span style=&quot;color: #330099&quot;&gt;delete-cookies=&lt;/span&gt;&lt;span style=&quot;color: #CC3300&quot;&gt;&amp;quot;JSESSIONID,SPRING_SECURITY_REMEMBER_ME_COOKIE&amp;quot;&lt;/span&gt; &lt;span style=&quot;color: #330099; font-weight: bold&quot;&gt;/&amp;gt;&lt;/span&gt;
  &lt;span style=&quot;color: #330099; font-weight: bold&quot;&gt;&amp;lt;security:custom-filter&lt;/span&gt; &lt;span style=&quot;color: #330099&quot;&gt;ref=&lt;/span&gt;&lt;span style=&quot;color: #CC3300&quot;&gt;&amp;quot;basicAuthenticationFilter&amp;quot;&lt;/span&gt; &lt;span style=&quot;color: #330099&quot;&gt;position=&lt;/span&gt;&lt;span style=&quot;color: #CC3300&quot;&gt;&amp;quot;BASIC_AUTH_FILTER&amp;quot;&lt;/span&gt; &lt;span style=&quot;color: #330099; font-weight: bold&quot;&gt;/&amp;gt;&lt;/span&gt;
 &lt;span style=&quot;color: #330099; font-weight: bold&quot;&gt;&amp;lt;/security:http&amp;gt;&lt;/span&gt;
 
 &lt;span style=&quot;color: #330099; font-weight: bold&quot;&gt;&amp;lt;bean&lt;/span&gt; &lt;span style=&quot;color: #330099&quot;&gt;id=&lt;/span&gt;&lt;span style=&quot;color: #CC3300&quot;&gt;&amp;quot;basicAuthenticationFilter&amp;quot;&lt;/span&gt;
  &lt;span style=&quot;color: #330099&quot;&gt;class=&lt;/span&gt;&lt;span style=&quot;color: #CC3300&quot;&gt;&amp;quot;org.springframework.security.web.authentication.www.BasicAuthenticationFilter&amp;quot;&lt;/span&gt;&lt;span style=&quot;color: #330099; font-weight: bold&quot;&gt;&amp;gt;&lt;/span&gt;
  &lt;span style=&quot;color: #330099; font-weight: bold&quot;&gt;&amp;lt;property&lt;/span&gt; &lt;span style=&quot;color: #330099&quot;&gt;name=&lt;/span&gt;&lt;span style=&quot;color: #CC3300&quot;&gt;&amp;quot;authenticationManager&amp;quot;&lt;/span&gt; &lt;span style=&quot;color: #330099&quot;&gt;ref=&lt;/span&gt;&lt;span style=&quot;color: #CC3300&quot;&gt;&amp;quot;authManager&amp;quot;&lt;/span&gt; &lt;span style=&quot;color: #330099; font-weight: bold&quot;&gt;/&amp;gt;&lt;/span&gt;
  &lt;span style=&quot;color: #330099; font-weight: bold&quot;&gt;&amp;lt;property&lt;/span&gt; &lt;span style=&quot;color: #330099&quot;&gt;name=&lt;/span&gt;&lt;span style=&quot;color: #CC3300&quot;&gt;&amp;quot;authenticationEntryPoint&amp;quot;&lt;/span&gt; &lt;span style=&quot;color: #330099&quot;&gt;ref=&lt;/span&gt;&lt;span style=&quot;color: #CC3300&quot;&gt;&amp;quot;authenticationEntryPoint&amp;quot;&lt;/span&gt; &lt;span style=&quot;color: #330099; font-weight: bold&quot;&gt;/&amp;gt;&lt;/span&gt;
 &lt;span style=&quot;color: #330099; font-weight: bold&quot;&gt;&amp;lt;/bean&amp;gt;&lt;/span&gt;
 &lt;span style=&quot;color: #330099; font-weight: bold&quot;&gt;&amp;lt;bean&lt;/span&gt; &lt;span style=&quot;color: #330099&quot;&gt;id=&lt;/span&gt;&lt;span style=&quot;color: #CC3300&quot;&gt;&amp;quot;authenticationEntryPoint&amp;quot;&lt;/span&gt;
  &lt;span style=&quot;color: #330099&quot;&gt;class=&lt;/span&gt;&lt;span style=&quot;color: #CC3300&quot;&gt;&amp;quot;org.springframework.security.web.authentication.www.BasicAuthenticationEntryPoint&amp;quot;&lt;/span&gt;&lt;span style=&quot;color: #330099; font-weight: bold&quot;&gt;&amp;gt;&lt;/span&gt;
  &lt;span style=&quot;color: #330099; font-weight: bold&quot;&gt;&amp;lt;property&lt;/span&gt; &lt;span style=&quot;color: #330099&quot;&gt;name=&lt;/span&gt;&lt;span style=&quot;color: #CC3300&quot;&gt;&amp;quot;realmName&amp;quot;&lt;/span&gt; &lt;span style=&quot;color: #330099&quot;&gt;value=&lt;/span&gt;&lt;span style=&quot;color: #CC3300&quot;&gt;&amp;quot;PRISM&amp;quot;&lt;/span&gt; &lt;span style=&quot;color: #330099; font-weight: bold&quot;&gt;/&amp;gt;&lt;/span&gt;
 &lt;span style=&quot;color: #330099; font-weight: bold&quot;&gt;&amp;lt;/bean&amp;gt;&lt;/span&gt;

 &lt;span style=&quot;color: #330099; font-weight: bold&quot;&gt;&amp;lt;bean&lt;/span&gt; &lt;span style=&quot;color: #330099&quot;&gt;id=&lt;/span&gt;&lt;span style=&quot;color: #CC3300&quot;&gt;&amp;quot;md5encoder&amp;quot;&lt;/span&gt; &lt;span style=&quot;color: #330099&quot;&gt;class=&lt;/span&gt;&lt;span style=&quot;color: #CC3300&quot;&gt;&amp;quot;org.springframework.security.authentication.encoding.Md5PasswordEncoder&amp;quot;&lt;/span&gt;&lt;span style=&quot;color: #330099; font-weight: bold&quot;&gt;&amp;gt;&lt;/span&gt;
 &lt;span style=&quot;color: #330099; font-weight: bold&quot;&gt;&amp;lt;/bean&amp;gt;&lt;/span&gt;
 &lt;span style=&quot;color: #330099; font-weight: bold&quot;&gt;&amp;lt;security:authentication-manager&lt;/span&gt; &lt;span style=&quot;color: #330099&quot;&gt;alias=&lt;/span&gt;&lt;span style=&quot;color: #CC3300&quot;&gt;&amp;quot;authManager&amp;quot;&lt;/span&gt;&lt;span style=&quot;color: #330099; font-weight: bold&quot;&gt;&amp;gt;&lt;/span&gt; 
  &lt;span style=&quot;color: #330099; font-weight: bold&quot;&gt;&amp;lt;security:authentication-provider&amp;gt;&lt;/span&gt;
      &lt;span style=&quot;color: #330099; font-weight: bold&quot;&gt;&amp;lt;security:password-encoder&lt;/span&gt; &lt;span style=&quot;color: #330099&quot;&gt;ref=&lt;/span&gt;&lt;span style=&quot;color: #CC3300&quot;&gt;&amp;quot;md5encoder&amp;quot;&lt;/span&gt; &lt;span style=&quot;color: #330099; font-weight: bold&quot;&gt;/&amp;gt;&lt;/span&gt;
   &lt;span style=&quot;color: #330099; font-weight: bold&quot;&gt;&amp;lt;security:user-service&lt;/span&gt; &lt;span style=&quot;color: #330099&quot;&gt;id=&lt;/span&gt;&lt;span style=&quot;color: #CC3300&quot;&gt;&amp;quot;userDetailsService&amp;quot;&lt;/span&gt; &lt;span style=&quot;color: #330099&quot;&gt;properties=&lt;/span&gt;&lt;span style=&quot;color: #CC3300&quot;&gt;&amp;quot;file:{path}/profiles.properties&amp;quot;&lt;/span&gt;&lt;span style=&quot;color: #330099; font-weight: bold&quot;&gt;/&amp;gt;&lt;/span&gt;
  &lt;span style=&quot;color: #330099; font-weight: bold&quot;&gt;&amp;lt;/security:authentication-provider&amp;gt;&lt;/span&gt;
 &lt;span style=&quot;color: #330099; font-weight: bold&quot;&gt;&amp;lt;/security:authentication-manager&amp;gt;&lt;/span&gt;
&lt;span style=&quot;color: #330099; font-weight: bold&quot;&gt;&amp;lt;/beans&amp;gt;&lt;/span&gt;
&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&lt;/div&gt;
&lt;/span&gt;
&lt;li style=&quot;font-weight: bold;&quot;&gt;Web application xml(web.xml)&lt;/li&gt;
&lt;span style=&quot;font-weight: normal;&quot;&gt;&lt;!-- HTML generated using hilite.me --&gt;&lt;div style=&quot;background: #f0f3f3; overflow:auto;width:auto;border:solid gray;border-width:.1em .1em .1em .4em;padding:.2em .6em;&quot;&gt;&lt;table&gt;&lt;tr&gt;&lt;td&gt;&lt;pre style=&quot;margin: 0; line-height: 125%&quot;&gt; 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14&lt;/pre&gt;&lt;/td&gt;&lt;td&gt;&lt;pre style=&quot;margin: 0; line-height: 125%&quot;&gt;&lt;span style=&quot;color: #330099; font-weight: bold&quot;&gt;&amp;lt;context-param&amp;gt;&lt;/span&gt;  
 &lt;span style=&quot;color: #330099; font-weight: bold&quot;&gt;&amp;lt;param-name&amp;gt;&lt;/span&gt;contextConfigLocation&lt;span style=&quot;color: #330099; font-weight: bold&quot;&gt;&amp;lt;/param-name&amp;gt;&lt;/span&gt;  
 &lt;span style=&quot;color: #330099; font-weight: bold&quot;&gt;&amp;lt;param-value&amp;gt;&lt;/span&gt;file:{path}/security-app-context.xml&lt;span style=&quot;color: #330099; font-weight: bold&quot;&gt;&amp;lt;/param-value&amp;gt;&lt;/span&gt;
&lt;span style=&quot;color: #330099; font-weight: bold&quot;&gt;&amp;lt;/context-param&amp;gt;&lt;/span&gt;
&lt;span style=&quot;color: #0099FF; font-style: italic&quot;&gt;&amp;lt;!-- security start --&amp;gt;&lt;/span&gt;
&lt;span style=&quot;color: #330099; font-weight: bold&quot;&gt;&amp;lt;filter&amp;gt;&lt;/span&gt;
 &lt;span style=&quot;color: #330099; font-weight: bold&quot;&gt;&amp;lt;filter-name&amp;gt;&lt;/span&gt;springSecurityFilterChain&lt;span style=&quot;color: #330099; font-weight: bold&quot;&gt;&amp;lt;/filter-name&amp;gt;&lt;/span&gt;
 &lt;span style=&quot;color: #330099; font-weight: bold&quot;&gt;&amp;lt;filter-class&amp;gt;&lt;/span&gt;org.springframework.web.filter.DelegatingFilterProxy&lt;span style=&quot;color: #330099; font-weight: bold&quot;&gt;&amp;lt;/filter-class&amp;gt;&lt;/span&gt;
&lt;span style=&quot;color: #330099; font-weight: bold&quot;&gt;&amp;lt;/filter&amp;gt;&lt;/span&gt;
&lt;span style=&quot;color: #330099; font-weight: bold&quot;&gt;&amp;lt;filter-mapping&amp;gt;&lt;/span&gt;
 &lt;span style=&quot;color: #330099; font-weight: bold&quot;&gt;&amp;lt;filter-name&amp;gt;&lt;/span&gt;springSecurityFilterChain&lt;span style=&quot;color: #330099; font-weight: bold&quot;&gt;&amp;lt;/filter-name&amp;gt;&lt;/span&gt;
 &lt;span style=&quot;color: #330099; font-weight: bold&quot;&gt;&amp;lt;url-pattern&amp;gt;&lt;/span&gt;/*&lt;span style=&quot;color: #330099; font-weight: bold&quot;&gt;&amp;lt;/url-pattern&amp;gt;&lt;/span&gt;
&lt;span style=&quot;color: #330099; font-weight: bold&quot;&gt;&amp;lt;/filter-mapping&amp;gt;&lt;/span&gt;
&lt;span style=&quot;color: #0099FF; font-style: italic&quot;&gt;&amp;lt;!-- security end --&amp;gt;&lt;/span&gt;
&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&lt;/div&gt;
&lt;/span&gt;
&lt;/ol&gt;
&lt;/ol&gt;
&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://throwableobject.blogspot.com/feeds/4128607900316100324/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://throwableobject.blogspot.com/2015/12/spring-security-with-md5-password.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/9048812660891698443/posts/default/4128607900316100324'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/9048812660891698443/posts/default/4128607900316100324'/><link rel='alternate' type='text/html' href='http://throwableobject.blogspot.com/2015/12/spring-security-with-md5-password.html' title='Spring Security with Md5 password encoder Authentication'/><author><name>test</name><uri>http://www.blogger.com/profile/06330700265841330179</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-9048812660891698443.post-7180943243310379727</id><published>2015-11-03T17:31:00.001+05:30</published><updated>2015-11-03T18:16:53.388+05:30</updated><category scheme="http://www.blogger.com/atom/ns#" term="crt"/><category scheme="http://www.blogger.com/atom/ns#" term="java"/><category scheme="http://www.blogger.com/atom/ns#" term="jks"/><category scheme="http://www.blogger.com/atom/ns#" term="Keystore"/><category scheme="http://www.blogger.com/atom/ns#" term="Keytool"/><title type='text'>Read Keystore jks file by using Java KeyTool</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;Below command to read the jks file and display the certificates it contains:&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: small;&quot;&gt;
&lt;span style=&quot;font-size: small;&quot;&gt;&lt;b&gt;&amp;gt;keytool -list -keystore keystore.jks&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-size: xx-small;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;Enter keystore password:&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-size: xx-small;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;Keystore type: JKS&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-size: xx-small;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;Keystore provider: SUN&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-size: xx-small;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;Your keystore contains 2 entries&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-size: xx-small;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;activation, Mar 13, 2013, trustedCertEntry,
Certificate fingerprint (SHA1): 85:4B:73:CE:00:86:D6:1B:FE:95:17:3D:BB:E6:BE:02:BB:78:A4:2F&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-size: xx-small;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;selfsigned, Mar 13, 2013, PrivateKeyEntry,
Certificate fingerprint (SHA1): C5:0A:C4:AB:DA:80:03:F7:59:C7:D9:02:C5:D7:9A:97:08:7B:83:A0&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;Above data says, it has 2 certificate entries,&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;first one is alias name is &quot;activation&quot;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;2nd one is alias name is &quot;selfsigned&quot;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;Now we can export the above two entries into Certificates in CRT files as below&amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;&lt;span style=&quot;font-size: x-small;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: small;&quot;&gt;&lt;b&gt;&amp;gt;keytool -exportcert -file keystore.crt -keystore keystore.jks -alias activation&lt;/b&gt;&lt;/span&gt;&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-size: xx-small;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;Enter keystore password:&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-size: xx-small;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;Certificate stored in file&amp;nbsp; &amp;lt;keystore.crt&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;


&lt;span style=&quot;font-size: small;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;&lt;span style=&quot;font-size: small;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;&lt;b&gt;&amp;gt;keytool -exportcert -file keystore1.crt -keystore keystore.jks -alias selfsigned&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-size: xx-small;&quot;&gt;&lt;keystore .crt=&quot;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;Enter keystore password:&amp;nbsp;&lt;/span&gt;&lt;/keystore&gt;&lt;/span&gt;&lt;br /&gt;
&lt;keystore .crt=&quot;&quot;&gt;&lt;span style=&quot;font-size: xx-small;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;Certificate stored in file &amp;lt;keystore1.crt&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;/keystore&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://throwableobject.blogspot.com/feeds/7180943243310379727/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://throwableobject.blogspot.com/2015/11/read-keystore-jks-file-by-using-java.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/9048812660891698443/posts/default/7180943243310379727'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/9048812660891698443/posts/default/7180943243310379727'/><link rel='alternate' type='text/html' href='http://throwableobject.blogspot.com/2015/11/read-keystore-jks-file-by-using-java.html' title='Read Keystore jks file by using Java KeyTool'/><author><name>test</name><uri>http://www.blogger.com/profile/06330700265841330179</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-9048812660891698443.post-6720649122129250218</id><published>2015-11-02T12:09:00.002+05:30</published><updated>2015-11-03T18:21:41.539+05:30</updated><category scheme="http://www.blogger.com/atom/ns#" term="CA"/><category scheme="http://www.blogger.com/atom/ns#" term="cer"/><category scheme="http://www.blogger.com/atom/ns#" term="certificate"/><category scheme="http://www.blogger.com/atom/ns#" term="Certificate signining request"/><category scheme="http://www.blogger.com/atom/ns#" term="crt"/><category scheme="http://www.blogger.com/atom/ns#" term="csr"/><category scheme="http://www.blogger.com/atom/ns#" term="generate crt"/><category scheme="http://www.blogger.com/atom/ns#" term="generate csr"/><category scheme="http://www.blogger.com/atom/ns#" term="generate P12"/><category scheme="http://www.blogger.com/atom/ns#" term="genrsa"/><category scheme="http://www.blogger.com/atom/ns#" term="Openssl"/><category scheme="http://www.blogger.com/atom/ns#" term="Pem"/><category scheme="http://www.blogger.com/atom/ns#" term="pkcs12"/><category scheme="http://www.blogger.com/atom/ns#" term="Public key cryptography standards"/><category scheme="http://www.blogger.com/atom/ns#" term="root CA"/><category scheme="http://www.blogger.com/atom/ns#" term="RSA"/><category scheme="http://www.blogger.com/atom/ns#" term="Sha2"/><category scheme="http://www.blogger.com/atom/ns#" term="sha256"/><category scheme="http://www.blogger.com/atom/ns#" term="ssl"/><category scheme="http://www.blogger.com/atom/ns#" term="x509"/><title type='text'>Certificates Manipulation with Open SSL</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;span style=&quot;font-size: small;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;&lt;b&gt;Download Open ssl binaries for windows here:&lt;/b&gt; &lt;a alt=&quot;Open SSL Windows&quot; href=&quot;http://slproweb.com/products/Win32OpenSSL.html&quot; target=&quot;_blank&quot;&gt;&lt;b&gt;Windows Openssl&lt;/b&gt;&lt;/a&gt;.&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;font-size: small;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;Before Going to certificates we will go through the some talks below:&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-size: small;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;
&lt;span style=&quot;font-size: small;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;To Generate Certificate we need Private key, this key will be generated by RSA algorithm&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-size: small;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;&lt;span style=&quot;background-color: white; color: black; display: inline ! important; float: none; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 30.06px; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: 1; word-spacing: 0px;&quot;&gt;RSA is a cryptosystem for private-key&lt;span class=&quot;Apple-converted-space&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;/span&gt;encryption&lt;span style=&quot;background-color: white; color: black; display: inline ! important; float: none; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 30.06px; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: 1; word-spacing: 0px;&quot;&gt;, and is widely used for securing sensitive data over internet.&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-size: small;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;&lt;span style=&quot;background-color: white; color: black; display: inline ! important; float: none; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 30.06px; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: 1; word-spacing: 0px;&quot;&gt;RSA stands for &lt;u&gt;R&lt;/u&gt;&lt;i&gt;ivest&lt;/i&gt;-&lt;u&gt;S&lt;/u&gt;&lt;i&gt;hamir&lt;/i&gt;-&lt;u&gt;A&lt;/u&gt;&lt;i&gt;dleman were the 3 persons last names who described the RSA algorithm.&lt;/i&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;font-size: small;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;&lt;span style=&quot;background-color: white; color: black; display: inline ! important; float: none; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 30.06px; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: 1; word-spacing: 0px;&quot;&gt;&lt;b&gt;.PEM&lt;/b&gt; Defined in RFC&#39;s 1421 through 1424, this is a container format that may include just the public certificate (such as with Apache installs, and CA certificate files /etc/ssl/certs), or may include an entire certificate chain including public key, private key, and root certificates. Confusingly, it may also encode a CSR (e.g. as used here) as the PKCS10 format can be translated into PEM. The name is from Privacy Enhanced Mail (PEM), a failed method for secure email but the container format it used lives on, and is a base64 translation of the x509 ASN.1 keys.&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-size: small;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;&lt;span style=&quot;background-color: white; color: black; display: inline ! important; float: none; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 30.06px; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: 1; word-spacing: 0px;&quot;&gt;&lt;i&gt;Normally it contains the chain of certificates.&lt;/i&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-size: small;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;&lt;span style=&quot;background-color: white; color: black; display: inline ! important; float: none; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 30.06px; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: 1; word-spacing: 0px;&quot;&gt;&lt;i&gt;&lt;b&gt;.key&lt;/b&gt; This is a PEM formatted file containing just the private-key of a specific certificate &lt;/i&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-size: small;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;&lt;span style=&quot;background-color: white; color: black; display: inline ! important; float: none; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 30.06px; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: 1; word-spacing: 0px;&quot;&gt;&lt;i&gt;&lt;b&gt;CSR&lt;/b&gt; is&amp;nbsp;&lt;/i&gt;&lt;/span&gt;&lt;span style=&quot;background-color: white; color: black; display: inline ! important; float: none; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 30.06px; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: 1; word-spacing: 0px;&quot;&gt;&lt;i&gt; Certificate Signing Request, basically this is the input file for generate Certificates(.CRT)&lt;/i&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-size: small;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;&lt;span style=&quot;background-color: white; color: black; display: inline ! important; float: none; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 30.06px; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: 1; word-spacing: 0px;&quot;&gt;&lt;i&gt;&lt;b&gt;CRT&lt;/b&gt; is Certificate, which content not fully encoded certificate, it was same like .crt .cert, .cer&lt;/i&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-size: small;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;&lt;span style=&quot;background-color: white; color: black; display: inline ! important; float: none; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 30.06px; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: 1; word-spacing: 0px;&quot;&gt;&lt;b&gt;.pkcs12 .pfx .p12&lt;/b&gt;&lt;i&gt; Originally defined by RSA in the &lt;a href=&quot;http://www.rsa.com/rsalabs/node.asp?id=2124&quot; rel=&quot;nofollow&quot; target=&quot;_blank&quot;&gt;&lt;b&gt;P&lt;/b&gt;ublic-&lt;b&gt;K&lt;/b&gt;ey &lt;b&gt;C&lt;/b&gt;ryptography &lt;b&gt;S&lt;/b&gt;tandards&lt;/a&gt;, the &lt;b&gt;&quot;12&quot;&lt;/b&gt; variant was enhanced by Microsoft. This is a passworded container format that contains both public and private certificate pairs. Unlike .pem files,&lt;b&gt; this container is fully encrypted.&lt;/b&gt; &lt;/i&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;font-size: small;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;&lt;span style=&quot;background-color: white; color: black; display: inline ! important; float: none; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 30.06px; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: 1; word-spacing: 0px;&quot;&gt;&lt;b&gt;Steps to Generate Certificate&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;ol style=&quot;text-align: left;&quot;&gt;
&lt;li&gt;
 &lt;span style=&quot;font-size: small;&quot;&gt;
  &lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;
   &lt;span style=&quot;background-color: white; color: black; display: inline ! important; float: none; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: 1; word-spacing: 0px;&quot;&gt;Generate a private key using RSA&lt;b&gt; &lt;br /&gt;&amp;gt;openssl genrsa -out root_ca.key 4096&lt;/b&gt;&lt;br /&gt;
   &lt;span style=&quot;font-size: x-small;&quot;&gt;
    Loading &#39;screen&#39; into random state - done&lt;br /&gt;Generating RSA private key, 4096 bit long modulus&lt;br /&gt;....................................................&lt;br /&gt;...................++&lt;br /&gt;e is 65537 (0x10001)&lt;b&gt;&lt;br /&gt;&lt;/b&gt;&lt;/span&gt;
    &lt;/span&gt;
  &lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-size: small;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;&lt;i&gt;If you want to password-protect this key, add option -des3.&lt;/i&gt;&lt;/span&gt;&lt;/span&gt;
&lt;/li&gt;
&lt;li&gt;
 &lt;span style=&quot;font-size: small;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;&lt;i&gt;Generate Root CA certificate by any one of following ways: &lt;/i&gt;&lt;/span&gt;&lt;/span&gt;
&lt;/li&gt;
&lt;ol&gt;
&lt;li&gt;&lt;span style=&quot;font-size: small;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;&lt;i&gt;&amp;nbsp;Generate new root CA Certificate(.crt) directly by above private key&lt;/i&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-size: small;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;&lt;i&gt;The &lt;b&gt;-x509&lt;/b&gt; option is used for a self-signed certificate. 1826 days gives us a cert valid for 5 years.&lt;br /&gt;&lt;b&gt;&amp;gt;openssl req -new -x509 -days 1826 -key root_ca.key -out root_ca.crt -sha256&lt;/b&gt;&lt;br /&gt;&lt;span style=&quot;font-size: x-small;&quot;&gt;Loading &#39;screen&#39; into random state - done&lt;br /&gt;You are about to be asked to enter information that will be incorporated&lt;br /&gt;into your certificate request.&lt;br /&gt;What you are about to enter is what is called a Distinguished Name or a DN.&lt;br /&gt;There are quite a few fields but you can leave some blank&lt;br /&gt;For some fields there will be a default value,&lt;br /&gt;If you enter &#39;.&#39;, the field will be left blank.&lt;br /&gt;-----&lt;br /&gt;Country Name (2 letter code) [AU]:IN&lt;br /&gt;State or Province Name (full name) [Some-State]:TAMILNADU&lt;br /&gt;Locality Name (eg, city) []:MADRAS&lt;br /&gt;Organization Name (eg, company) [Internet Widgits Pty Ltd]:HCL&lt;br /&gt;Organizational Unit Name (eg, section) []:BROSS&lt;br /&gt;Common Name (e.g. server FQDN or YOUR name) []:RAJA&lt;br /&gt;Email Address []:RAJA@ERICSSON.COM&lt;/span&gt;&lt;/i&gt;&lt;/span&gt;&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style=&quot;font-size: small;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;&lt;i&gt;Generate new root CA Certificate(.crt) using CSR(.csr)&lt;/i&gt;&lt;/span&gt;&lt;/span&gt;&lt;/li&gt;
&lt;ol&gt;
&lt;li&gt;&lt;span style=&quot;font-size: small;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;&lt;i&gt; Generate CSR&lt;br /&gt;&lt;b&gt;&amp;gt;openssl req -new -x509 -days 1826 -key root_ca.key -out root_ca.csr -sha256&lt;/b&gt;&lt;br /&gt;&lt;span style=&quot;font-size: x-small;&quot;&gt;Loading &#39;screen&#39; into random state - done&lt;br /&gt;You are about to be asked to enter information that will be incorporated&lt;br /&gt;into your certificate request.&lt;br /&gt;What you are about to enter is what is called a Distinguished Name or a DN.&lt;br /&gt;There are quite a few fields but you can leave some blank&lt;br /&gt;For some fields there will be a default value,&lt;br /&gt;If you enter &#39;.&#39;, the field will be left blank.&lt;br /&gt;-----&lt;br /&gt;Country Name (2 letter code) [AU]:IN&lt;br /&gt;State or Province Name (full name) [Some-State]:TAMILNADU&lt;br /&gt;Locality Name (eg, city) []:MADRAS&lt;br /&gt;Organization Name (eg, company) [Internet Widgits Pty Ltd]:ERICSSON&lt;br /&gt;Organizational Unit Name (eg, section) []:CSI&lt;br /&gt;Common Name (e.g. server FQDN or YOUR name) []:SAISUDHAKAR&lt;br /&gt;Email Address []:ABC@DEF.COM&lt;/span&gt;&lt;br /&gt;&amp;nbsp;&lt;/i&gt;&lt;/span&gt;&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style=&quot;font-size: small;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;&lt;i&gt;Generate CRT by input the CSR&lt;br /&gt;&lt;b&gt;&amp;gt;openssl x509 -days 3600 -in root_ca.csr -signkey root_ca.key -out root_csr_ca.crt&lt;/b&gt;&lt;br /&gt;&lt;span style=&quot;font-size: x-small;&quot;&gt;Loading &#39;screen&#39; into random state - done&lt;br /&gt;Getting Private key&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/i&gt;&lt;/span&gt;&lt;/span&gt;&lt;/li&gt;
&lt;/ol&gt;
&lt;/ol&gt;
&lt;li&gt;&lt;span style=&quot;font-size: small;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;&lt;i&gt;Create a Subordinate CA to used to under above Root CA&lt;/i&gt;&lt;/span&gt;&lt;/span&gt;&lt;/li&gt;
&lt;ol&gt;
&lt;li&gt;&lt;span style=&quot;font-size: small;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;&lt;i&gt;First Generate Key:&lt;b&gt;&lt;br /&gt;&amp;gt;openssl genrsa -out sub_ca.key 4096&lt;/b&gt;&lt;br /&gt;&lt;span style=&quot;font-size: x-small;&quot;&gt;..................................++&lt;br /&gt;..............................++&lt;br /&gt;e is 65537 (0x10001)&lt;/span&gt;&lt;/i&gt;&lt;/span&gt;&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style=&quot;font-size: small;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;&lt;i&gt;request a certificate for this subordinate CA:&lt;br /&gt;&lt;b&gt;&amp;gt;openssl req -new -key sub_ca.key -out sub_ca.csr&lt;/b&gt;&lt;/i&gt;&lt;span style=&quot;font-size: x-small;&quot;&gt;&lt;br /&gt;Loading &#39;screen&#39; into random state - done&lt;br /&gt;You are about to be asked to enter information that will be incorporated&lt;br /&gt;into your certificate request.&lt;br /&gt;What you are about to enter is what is called a Distinguished Name or a DN.&lt;br /&gt;There are quite a few fields but you can leave some blank&lt;br /&gt;For some fields there will be a default value,&lt;br /&gt;If you enter &#39;.&#39;, the field will be left blank.&lt;br /&gt;-----&lt;br /&gt;Country Name (2 letter code) [AU]:IN&lt;br /&gt;State or Province Name (full name) [Some-State]:TAMILNADU&lt;br /&gt;Locality Name (eg, city) []:MADRAS&lt;br /&gt;Organization Name (eg, company) [Internet Widgits Pty Ltd]:HCL&lt;br /&gt;Organizational Unit Name (eg, section) []:BROSS&lt;br /&gt;Common Name (e.g. server FQDN or YOUR name) []:JEAN&lt;br /&gt;Email Address []:JEAN@HCL.COM&lt;br /&gt;&lt;br /&gt;Please enter the following &#39;extra&#39; attributes&lt;br /&gt;to be sent with your certificate request&lt;br /&gt;A challenge password []:password&lt;br /&gt;An optional company name []:IBM&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style=&quot;font-size: small;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;&lt;span style=&quot;font-size: xsmall;&quot;&gt;&lt;span style=&quot;font-size: small;&quot;&gt;process the request for the subordinate CA certificate and get it signed by the root CA.&lt;br /&gt;&lt;b&gt;&amp;gt;openssl x509 -req -days 730 -in sub_ca.csr -CA root_ca.crt -CAkey root_ca.key -set_serial 01 -out sub_ca.crt&lt;/b&gt;&lt;br /&gt;&lt;span style=&quot;font-size: x-small;&quot;&gt;Loading &#39;screen&#39; into random state - done&lt;br /&gt;Signature ok&lt;br /&gt;subject=/C=IN/ST=TAMILNADU/L=MADRAS/O=HCL/OU=BROSS/CN=JEAN/emailAddress=JEAN@HCL.COM&lt;br /&gt;Getting CA Private Key&lt;br /&gt;   &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;The cert will be valid for 2 years (730 days) and I decided to choose my
 own serial number 01 for this cert (-set_serial 01). For the root CA, I
 let OpenSSL generate a random serial number.&lt;br /&gt;Like above we can create multiple sub ordinate CA under Root CA.&lt;/span&gt;&lt;/span&gt;&lt;/li&gt;
&lt;/ol&gt;
&lt;li&gt;&lt;span style=&quot;font-size: small;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;To package the keys and certs(root CA and all subordinate CA) in a &lt;a href=&quot;http://en.wikipedia.org/wiki/PKCS12&quot; target=&quot;_blank&quot;&gt;PKCS12&lt;/a&gt; file&lt;br /&gt;&lt;b&gt;&amp;gt;openssl pkcs12 -export -out sub_ca.p12 -inkey sub_ca.key -in sub_ca.crt -chain -CAfile root_ca.crt&lt;/b&gt;&lt;br /&gt;&lt;span style=&quot;font-size: x-small;&quot;&gt;Loading &#39;screen&#39; into random state - done&lt;br /&gt;Enter Export Password:&lt;br /&gt;Verifying - Enter Export Password:&lt;br /&gt;&lt;br /&gt;&lt;br /&gt; &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style=&quot;font-size: small;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;To view CSR contains&lt;br /&gt;
If it is self-signed(root) CSR&lt;br /&gt;
&lt;b&gt;&amp;gt;openssl x509 -text -noout -in root_ca.csr&lt;/b&gt;&lt;br /&gt;
 If it is not self-signed CA&lt;br /&gt;
&lt;b&gt;&amp;gt;openssl req -text -noout -in sub_ca.csr&lt;/b&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style=&quot;font-size: small;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;
To view CRT contains&lt;br /&gt;
&lt;b&gt;&amp;gt;openssl x509 -text -noout -in root_ca.crt&lt;/b&gt;&lt;br /&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/li&gt;
&lt;/ol&gt;
&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://throwableobject.blogspot.com/feeds/6720649122129250218/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://throwableobject.blogspot.com/2015/11/certificates-manipulation-with-open-ssl.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/9048812660891698443/posts/default/6720649122129250218'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/9048812660891698443/posts/default/6720649122129250218'/><link rel='alternate' type='text/html' href='http://throwableobject.blogspot.com/2015/11/certificates-manipulation-with-open-ssl.html' title='Certificates Manipulation with Open SSL'/><author><name>test</name><uri>http://www.blogger.com/profile/06330700265841330179</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-9048812660891698443.post-193495984801271336</id><published>2015-08-13T16:18:00.002+05:30</published><updated>2015-11-03T18:22:24.335+05:30</updated><category scheme="http://www.blogger.com/atom/ns#" term="java"/><category scheme="http://www.blogger.com/atom/ns#" term="merge objects"/><category scheme="http://www.blogger.com/atom/ns#" term="Reflection API"/><title type='text'>Merge Objects using Reflection API</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
Merging the two objects using Reflection API&lt;br /&gt;
&lt;br /&gt;
For example the class Animal has objects Tiger, Lion, following is show how to merge these objects using &lt;a href=&quot;https://docs.oracle.com/javase/tutorial/reflect&quot; rel=&quot;nofollow&quot; target=&quot;_blank&quot;&gt;Reflection API&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;!-- HTML generated using hilite.me --&gt;&lt;br /&gt;
&lt;div style=&quot;background: #ffffff; border-width: .1em .1em .1em .2em; border: solid gray; overflow: auto; padding: .2em .6em; width: auto;&quot;&gt;
&lt;table&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;&lt;pre style=&quot;line-height: 125%; margin: 0;&quot;&gt;1
2
3
4
5
6
7
8
9&lt;/pre&gt;
&lt;/td&gt;&lt;td&gt;&lt;pre style=&quot;line-height: 125%; margin: 0;&quot;&gt;&lt;span style=&quot;color: #008800; font-weight: bold;&quot;&gt;class&lt;/span&gt; &lt;span style=&quot;color: #bb0066; font-weight: bold;&quot;&gt;Animal&lt;/span&gt;
&lt;span style=&quot;color: #333333;&quot;&gt;{&lt;/span&gt;
&lt;span style=&quot;color: #008800; font-weight: bold;&quot;&gt;private&lt;/span&gt; name&lt;span style=&quot;color: #333333;&quot;&gt;;&lt;/span&gt;
&lt;span style=&quot;color: #008800; font-weight: bold;&quot;&gt;private&lt;/span&gt; age&lt;span style=&quot;color: #333333;&quot;&gt;;&lt;/span&gt;
&lt;span style=&quot;color: #008800; font-weight: bold;&quot;&gt;private&lt;/span&gt; weight&lt;span style=&quot;color: #333333;&quot;&gt;;&lt;/span&gt;

&lt;span style=&quot;color: #333333;&quot;&gt;..&lt;/span&gt;&lt;span style=&quot;color: #0000cc;&quot;&gt;setter&lt;/span&gt;&lt;span style=&quot;color: #333333;&quot;&gt;/&lt;/span&gt;getters

&lt;span style=&quot;color: #333333;&quot;&gt;}&lt;/span&gt;
&lt;/pre&gt;
&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;
&lt;/div&gt;
&lt;br /&gt;
&lt;br /&gt;
Main class&lt;br /&gt;
&lt;!-- HTML generated using hilite.me --&gt;&lt;br /&gt;
&lt;div style=&quot;background: #ffffff; border-width: .1em .1em .1em .2em; border: solid gray; overflow: auto; padding: .2em .6em; width: auto;&quot;&gt;
&lt;table&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;&lt;pre style=&quot;line-height: 125%; margin: 0;&quot;&gt; 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46&lt;/pre&gt;
&lt;/td&gt;&lt;td&gt;&lt;pre style=&quot;line-height: 125%; margin: 0;&quot;&gt;Class Main &lt;span style=&quot;color: #333333;&quot;&gt;{&lt;/span&gt;
&lt;span style=&quot;color: #008800; font-weight: bold;&quot;&gt;public&lt;/span&gt; &lt;span style=&quot;color: #008800; font-weight: bold;&quot;&gt;static&lt;/span&gt; &lt;span style=&quot;color: #333399; font-weight: bold;&quot;&gt;void&lt;/span&gt; &lt;span style=&quot;color: #0066bb; font-weight: bold;&quot;&gt;main&lt;/span&gt;&lt;span style=&quot;color: #333333;&quot;&gt;(&lt;/span&gt;String&lt;span style=&quot;color: #333333;&quot;&gt;[]&lt;/span&gt; args&lt;span style=&quot;color: #333333;&quot;&gt;)&lt;/span&gt;
&lt;span style=&quot;color: #333333;&quot;&gt;{&lt;/span&gt;
    Animal tiger &lt;span style=&quot;color: #333333;&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: #008800; font-weight: bold;&quot;&gt;new&lt;/span&gt; Animal&lt;span style=&quot;color: #333333;&quot;&gt;();&lt;/span&gt;
    tiger&lt;span style=&quot;color: #333333;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #0000cc;&quot;&gt;setName&lt;/span&gt;&lt;span style=&quot;color: #333333;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;background-color: #fff0f0;&quot;&gt;&quot;Tiger&quot;&lt;/span&gt;&lt;span style=&quot;color: #333333;&quot;&gt;);&lt;/span&gt;
    tiger&lt;span style=&quot;color: #333333;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #0000cc;&quot;&gt;setAge&lt;/span&gt;&lt;span style=&quot;color: #333333;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;background-color: #fff0f0;&quot;&gt;&quot;20&quot;&lt;/span&gt;&lt;span style=&quot;color: #333333;&quot;&gt;);&lt;/span&gt;
    tiger&lt;span style=&quot;color: #333333;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #0000cc;&quot;&gt;setWeight&lt;/span&gt;&lt;span style=&quot;color: #333333;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;background-color: #fff0f0;&quot;&gt;&quot;80&quot;&lt;/span&gt;&lt;span style=&quot;color: #333333;&quot;&gt;);&lt;/span&gt;
    Animal lion &lt;span style=&quot;color: #333333;&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: #008800; font-weight: bold;&quot;&gt;new&lt;/span&gt; Animal&lt;span style=&quot;color: #333333;&quot;&gt;();&lt;/span&gt;
    lion&lt;span style=&quot;color: #333333;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #0000cc;&quot;&gt;setName&lt;/span&gt;&lt;span style=&quot;color: #333333;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;background-color: #fff0f0;&quot;&gt;&quot;Lion&quot;&lt;/span&gt;&lt;span style=&quot;color: #333333;&quot;&gt;);&lt;/span&gt;
    lion&lt;span style=&quot;color: #333333;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #0000cc;&quot;&gt;setAge&lt;/span&gt;&lt;span style=&quot;color: #333333;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;background-color: #fff0f0;&quot;&gt;&quot;25&quot;&lt;/span&gt;&lt;span style=&quot;color: #333333;&quot;&gt;);&lt;/span&gt;
    lion&lt;span style=&quot;color: #333333;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #0000cc;&quot;&gt;setWeight&lt;/span&gt;&lt;span style=&quot;color: #333333;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;background-color: #fff0f0;&quot;&gt;&quot;120&quot;&lt;/span&gt;&lt;span style=&quot;color: #333333;&quot;&gt;);&lt;/span&gt;
  
    merge&lt;span style=&quot;color: #333333;&quot;&gt;(&lt;/span&gt;tiger&lt;span style=&quot;color: #333333;&quot;&gt;,&lt;/span&gt;lion&lt;span style=&quot;color: #333333;&quot;&gt;);&lt;/span&gt;
    
    sysout&lt;span style=&quot;color: #333333;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #0000cc;&quot;&gt;println&lt;/span&gt;&lt;span style=&quot;color: #333333;&quot;&gt;(&lt;/span&gt;tiger&lt;span style=&quot;color: #333333;&quot;&gt;);&lt;/span&gt;
&lt;span style=&quot;color: #333333;&quot;&gt;}&lt;/span&gt;

&lt;span style=&quot;color: #008800; font-weight: bold;&quot;&gt;public&lt;/span&gt; &lt;span style=&quot;color: #008800; font-weight: bold;&quot;&gt;static&lt;/span&gt; &lt;span style=&quot;color: #333399; font-weight: bold;&quot;&gt;void&lt;/span&gt; &lt;span style=&quot;color: #0066bb; font-weight: bold;&quot;&gt;merge&lt;/span&gt;&lt;span style=&quot;color: #333333;&quot;&gt;(&lt;/span&gt;Object obj&lt;span style=&quot;color: #333333;&quot;&gt;,&lt;/span&gt; Object update&lt;span style=&quot;color: #333333;&quot;&gt;)&lt;/span&gt; &lt;span style=&quot;color: #333333;&quot;&gt;{&lt;/span&gt;
       
        &lt;span style=&quot;color: #008800; font-weight: bold;&quot;&gt;if&lt;/span&gt; &lt;span style=&quot;color: #333333;&quot;&gt;(!&lt;/span&gt;obj&lt;span style=&quot;color: #333333;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #0000cc;&quot;&gt;getClass&lt;/span&gt;&lt;span style=&quot;color: #333333;&quot;&gt;().&lt;/span&gt;&lt;span style=&quot;color: #0000cc;&quot;&gt;isAssignableFrom&lt;/span&gt;&lt;span style=&quot;color: #333333;&quot;&gt;(&lt;/span&gt;update&lt;span style=&quot;color: #333333;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #0000cc;&quot;&gt;getClass&lt;/span&gt;&lt;span style=&quot;color: #333333;&quot;&gt;()))&lt;/span&gt; &lt;span style=&quot;color: #333333;&quot;&gt;{&lt;/span&gt;
            &lt;span style=&quot;color: #008800; font-weight: bold;&quot;&gt;return&lt;/span&gt;&lt;span style=&quot;color: #333333;&quot;&gt;;&lt;/span&gt;
        &lt;span style=&quot;color: #333333;&quot;&gt;}&lt;/span&gt;

        Method&lt;span style=&quot;color: #333333;&quot;&gt;[]&lt;/span&gt; methods &lt;span style=&quot;color: #333333;&quot;&gt;=&lt;/span&gt; obj&lt;span style=&quot;color: #333333;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #0000cc;&quot;&gt;getClass&lt;/span&gt;&lt;span style=&quot;color: #333333;&quot;&gt;().&lt;/span&gt;&lt;span style=&quot;color: #0000cc;&quot;&gt;getMethods&lt;/span&gt;&lt;span style=&quot;color: #333333;&quot;&gt;();&lt;/span&gt;

        &lt;span style=&quot;color: #008800; font-weight: bold;&quot;&gt;for&lt;/span&gt; &lt;span style=&quot;color: #333333;&quot;&gt;(&lt;/span&gt;Method fromMethod &lt;span style=&quot;color: #333333;&quot;&gt;:&lt;/span&gt; methods&lt;span style=&quot;color: #333333;&quot;&gt;)&lt;/span&gt; &lt;span style=&quot;color: #333333;&quot;&gt;{&lt;/span&gt;
            &lt;span style=&quot;color: #008800; font-weight: bold;&quot;&gt;if&lt;/span&gt; &lt;span style=&quot;color: #333333;&quot;&gt;(&lt;/span&gt;fromMethod&lt;span style=&quot;color: #333333;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #0000cc;&quot;&gt;getDeclaringClass&lt;/span&gt;&lt;span style=&quot;color: #333333;&quot;&gt;().&lt;/span&gt;&lt;span style=&quot;color: #0000cc;&quot;&gt;equals&lt;/span&gt;&lt;span style=&quot;color: #333333;&quot;&gt;(&lt;/span&gt;obj&lt;span style=&quot;color: #333333;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #0000cc;&quot;&gt;getClass&lt;/span&gt;&lt;span style=&quot;color: #333333;&quot;&gt;())&lt;/span&gt;
                    &lt;span style=&quot;color: #333333;&quot;&gt;&amp;amp;&amp;amp;&lt;/span&gt; fromMethod&lt;span style=&quot;color: #333333;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #0000cc;&quot;&gt;getName&lt;/span&gt;&lt;span style=&quot;color: #333333;&quot;&gt;().&lt;/span&gt;&lt;span style=&quot;color: #0000cc;&quot;&gt;startsWith&lt;/span&gt;&lt;span style=&quot;color: #333333;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;background-color: #fff0f0;&quot;&gt;&quot;get&quot;&lt;/span&gt;&lt;span style=&quot;color: #333333;&quot;&gt;))&lt;/span&gt; &lt;span style=&quot;color: #333333;&quot;&gt;{&lt;/span&gt;

                String fromName &lt;span style=&quot;color: #333333;&quot;&gt;=&lt;/span&gt; fromMethod&lt;span style=&quot;color: #333333;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #0000cc;&quot;&gt;getName&lt;/span&gt;&lt;span style=&quot;color: #333333;&quot;&gt;();&lt;/span&gt;
                String toName &lt;span style=&quot;color: #333333;&quot;&gt;=&lt;/span&gt; fromName&lt;span style=&quot;color: #333333;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #0000cc;&quot;&gt;replace&lt;/span&gt;&lt;span style=&quot;color: #333333;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;background-color: #fff0f0;&quot;&gt;&quot;get&quot;&lt;/span&gt;&lt;span style=&quot;color: #333333;&quot;&gt;,&lt;/span&gt; &lt;span style=&quot;background-color: #fff0f0;&quot;&gt;&quot;set&quot;&lt;/span&gt;&lt;span style=&quot;color: #333333;&quot;&gt;);&lt;/span&gt;

                &lt;span style=&quot;color: #008800; font-weight: bold;&quot;&gt;try&lt;/span&gt; &lt;span style=&quot;color: #333333;&quot;&gt;{&lt;/span&gt;
                    Method toMetod &lt;span style=&quot;color: #333333;&quot;&gt;=&lt;/span&gt; obj&lt;span style=&quot;color: #333333;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #0000cc;&quot;&gt;getClass&lt;/span&gt;&lt;span style=&quot;color: #333333;&quot;&gt;().&lt;/span&gt;&lt;span style=&quot;color: #0000cc;&quot;&gt;getMethod&lt;/span&gt;&lt;span style=&quot;color: #333333;&quot;&gt;(&lt;/span&gt;toName&lt;span style=&quot;color: #333333;&quot;&gt;,&lt;/span&gt;
                            fromMethod&lt;span style=&quot;color: #333333;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #0000cc;&quot;&gt;getReturnType&lt;/span&gt;&lt;span style=&quot;color: #333333;&quot;&gt;());&lt;/span&gt;
                    Object value &lt;span style=&quot;color: #333333;&quot;&gt;=&lt;/span&gt; fromMethod&lt;span style=&quot;color: #333333;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #0000cc;&quot;&gt;invoke&lt;/span&gt;&lt;span style=&quot;color: #333333;&quot;&gt;(&lt;/span&gt;update&lt;span style=&quot;color: #333333;&quot;&gt;,&lt;/span&gt; &lt;span style=&quot;color: #333333;&quot;&gt;(&lt;/span&gt;Object&lt;span style=&quot;color: #333333;&quot;&gt;[])&lt;/span&gt; &lt;span style=&quot;color: #008800; font-weight: bold;&quot;&gt;null&lt;/span&gt;&lt;span style=&quot;color: #333333;&quot;&gt;);&lt;/span&gt;
                    &lt;span style=&quot;color: #008800; font-weight: bold;&quot;&gt;if&lt;/span&gt; &lt;span style=&quot;color: #333333;&quot;&gt;(&lt;/span&gt;value &lt;span style=&quot;color: #333333;&quot;&gt;!=&lt;/span&gt; &lt;span style=&quot;color: #008800; font-weight: bold;&quot;&gt;null&lt;/span&gt;&lt;span style=&quot;color: #333333;&quot;&gt;)&lt;/span&gt; &lt;span style=&quot;color: #333333;&quot;&gt;{&lt;/span&gt;
                        toMetod&lt;span style=&quot;color: #333333;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #0000cc;&quot;&gt;invoke&lt;/span&gt;&lt;span style=&quot;color: #333333;&quot;&gt;(&lt;/span&gt;obj&lt;span style=&quot;color: #333333;&quot;&gt;,&lt;/span&gt; value&lt;span style=&quot;color: #333333;&quot;&gt;);&lt;/span&gt;
                    &lt;span style=&quot;color: #333333;&quot;&gt;}&lt;/span&gt;
                &lt;span style=&quot;color: #333333;&quot;&gt;}&lt;/span&gt; &lt;span style=&quot;color: #008800; font-weight: bold;&quot;&gt;catch&lt;/span&gt; &lt;span style=&quot;color: #333333;&quot;&gt;(&lt;/span&gt;Exception e&lt;span style=&quot;color: #333333;&quot;&gt;)&lt;/span&gt; &lt;span style=&quot;color: #333333;&quot;&gt;{&lt;/span&gt;
                    e&lt;span style=&quot;color: #333333;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #0000cc;&quot;&gt;printStackTrace&lt;/span&gt;&lt;span style=&quot;color: #333333;&quot;&gt;();&lt;/span&gt;
                &lt;span style=&quot;color: #333333;&quot;&gt;}&lt;/span&gt;
            &lt;span style=&quot;color: #333333;&quot;&gt;}&lt;/span&gt;
        &lt;span style=&quot;color: #333333;&quot;&gt;}&lt;/span&gt;
    &lt;span style=&quot;color: #333333;&quot;&gt;}&lt;/span&gt;
&lt;span style=&quot;color: #333333;&quot;&gt;}&lt;/span&gt;
&lt;/pre&gt;
&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;
&lt;/div&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;&lt;span style=&quot;color: blue;&quot;&gt;Output&lt;/span&gt;:&lt;br /&gt;
[Lion, 25, 120]&lt;/b&gt;
&lt;br /&gt;
Tiger objects properties were overriden by Lion object properties.
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://throwableobject.blogspot.com/feeds/193495984801271336/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://throwableobject.blogspot.com/2015/08/merge-objects-using-reflection-api.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/9048812660891698443/posts/default/193495984801271336'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/9048812660891698443/posts/default/193495984801271336'/><link rel='alternate' type='text/html' href='http://throwableobject.blogspot.com/2015/08/merge-objects-using-reflection-api.html' title='Merge Objects using Reflection API'/><author><name>test</name><uri>http://www.blogger.com/profile/06330700265841330179</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-9048812660891698443.post-3704996519086778360</id><published>2015-06-30T15:49:00.001+05:30</published><updated>2015-06-30T16:35:29.200+05:30</updated><category scheme="http://www.blogger.com/atom/ns#" term="Clustering JMS"/><category scheme="http://www.blogger.com/atom/ns#" term="HornetQueue"/><category scheme="http://www.blogger.com/atom/ns#" term="Jboss"/><category scheme="http://www.blogger.com/atom/ns#" term="JMS"/><title type='text'>Post Json message to JMS Queue of Hornet Queue on JBoss</title><content type='html'>
Here we do Posting the Json string contained JMS text message into a JMS HornetQ on Jboss server.
&lt;br/&gt;
Here we are using Clustered based JMS setup on Jboss.
&lt;br/&gt;
&lt;br/&gt;
Test data contains the below json texts in *.json files.&lt;br/&gt;
For example &lt;i&gt;&lt;b&gt;TC1.json&lt;/b&gt;&lt;/i&gt; file contains below texts:&lt;br/&gt;
&lt;!-- HTML generated using hilite.me --&gt;&lt;div style=&quot;background: #ffffff; overflow:auto;width:auto;border:solid gray;border-width:.0em .0em .0em .0em;padding:.2em .6em;&quot;&gt;&lt;table&gt;&lt;tr&gt;&lt;td&gt;&lt;pre style=&quot;margin: 0; line-height: 125%&quot;&gt;1
2
3
4
5&lt;/pre&gt;&lt;/td&gt;&lt;td&gt;&lt;pre style=&quot;margin: 0; line-height: 125%&quot;&gt;{
   &lt;span style=&quot;font-weight: bold&quot;&gt;&amp;quot;ID&amp;quot;&lt;/span&gt;:&lt;span style=&quot;font-style: italic&quot;&gt;&amp;quot;clkeidkerk948fjfmfkk49k&amp;quot;&lt;/span&gt;,
   &lt;span style=&quot;font-weight: bold&quot;&gt;&amp;quot;name&amp;quot;&lt;/span&gt;:&lt;span style=&quot;font-style: italic&quot;&gt;&amp;quot;Purushottam&amp;quot;&lt;/span&gt;,
   &lt;span style=&quot;font-weight: bold&quot;&gt;&amp;quot;value&amp;quot;&lt;/span&gt;:&lt;span style=&quot;font-style: italic&quot;&gt;&amp;quot;20000010&amp;quot;&lt;/span&gt;
}
&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&lt;/div&gt;



&lt;br/&gt;&lt;br/&gt;
Below are the steps:
&lt;br/&gt;
&lt;!-- HTML generated using hilite.me --&gt;&lt;div style=&quot;background: #ffffff; overflow:auto;width:auto;border:solid gray;border-width:.0em .0em .0em .0em;padding:.2em .6em;&quot;&gt;&lt;table&gt;&lt;tr&gt;&lt;td&gt;&lt;pre style=&quot;margin: 0; line-height: 125%&quot;&gt; 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36&lt;/pre&gt;&lt;/td&gt;&lt;td&gt;&lt;pre style=&quot;margin: 0; line-height: 125%&quot;&gt;&lt;span style=&quot;color: #000080; font-weight: bold&quot;&gt;import&lt;/span&gt; java.io.File;
&lt;span style=&quot;color: #000080; font-weight: bold&quot;&gt;import&lt;/span&gt; java.io.IOException;
&lt;span style=&quot;color: #000080; font-weight: bold&quot;&gt;import&lt;/span&gt; java.util.Iterator;

&lt;span style=&quot;color: #000080; font-weight: bold&quot;&gt;import&lt;/span&gt; javax.jms.JMSException;
&lt;span style=&quot;color: #000080; font-weight: bold&quot;&gt;import&lt;/span&gt; javax.jms.Queue;
&lt;span style=&quot;color: #000080; font-weight: bold&quot;&gt;import&lt;/span&gt; javax.jms.QueueConnection;
&lt;span style=&quot;color: #000080; font-weight: bold&quot;&gt;import&lt;/span&gt; javax.jms.QueueSession;
&lt;span style=&quot;color: #000080; font-weight: bold&quot;&gt;import&lt;/span&gt; javax.jms.Session;
&lt;span style=&quot;color: #000080; font-weight: bold&quot;&gt;import&lt;/span&gt; javax.jms.TextMessage;

&lt;span style=&quot;color: #000080; font-weight: bold&quot;&gt;import&lt;/span&gt; org.apache.commons.io.FileUtils;
&lt;span style=&quot;color: #000080; font-weight: bold&quot;&gt;import&lt;/span&gt; org.hornetq.api.core.DiscoveryGroupConfiguration;
&lt;span style=&quot;color: #000080; font-weight: bold&quot;&gt;import&lt;/span&gt; org.hornetq.api.core.UDPBroadcastGroupConfiguration;
&lt;span style=&quot;color: #000080; font-weight: bold&quot;&gt;import&lt;/span&gt; org.hornetq.api.jms.HornetQJMSClient;
&lt;span style=&quot;color: #000080; font-weight: bold&quot;&gt;import&lt;/span&gt; org.hornetq.api.jms.JMSFactoryType;
&lt;span style=&quot;color: #000080; font-weight: bold&quot;&gt;import&lt;/span&gt; org.hornetq.jms.client.HornetQConnectionFactory;

&lt;span style=&quot;color: #000080; font-weight: bold&quot;&gt;public&lt;/span&gt; &lt;span style=&quot;color: #000080; font-weight: bold&quot;&gt;class&lt;/span&gt; PostQueue {


    &lt;span style=&quot;color: #000080; font-weight: bold&quot;&gt;public&lt;/span&gt; &lt;span style=&quot;color: #000080; font-weight: bold&quot;&gt;static&lt;/span&gt; QueueConnection connection = &lt;span style=&quot;color: #000080; font-weight: bold&quot;&gt;null&lt;/span&gt;;

    &lt;span style=&quot;color: #000080; font-weight: bold&quot;&gt;public&lt;/span&gt; PostQueue() {
    }

    &lt;span style=&quot;color: #000080; font-weight: bold&quot;&gt;private&lt;/span&gt; &lt;span style=&quot;color: #000080; font-weight: bold&quot;&gt;void&lt;/span&gt; initJMSLister() {
 
 &lt;span style=&quot;color: #000080; font-weight: bold&quot;&gt;try&lt;/span&gt; {
     String discoveryGroupName = &lt;span style=&quot;color: #0000FF&quot;&gt;&amp;quot;dg-group1&amp;quot;&lt;/span&gt;;
     String groupAddress = &lt;span style=&quot;color: #0000FF&quot;&gt;&amp;quot;231.7.7.7&amp;quot;&lt;/span&gt;;
     &lt;span style=&quot;color: #000080; font-weight: bold&quot;&gt;int&lt;/span&gt; groupPort = &lt;span style=&quot;color: #0000FF&quot;&gt;9876&lt;/span&gt;;
     &lt;span style=&quot;color: #000080; font-weight: bold&quot;&gt;int&lt;/span&gt; localPort = -&lt;span style=&quot;color: #0000FF&quot;&gt;1&lt;/span&gt;;
     String localBindAddress = &lt;span style=&quot;color: #0000FF&quot;&gt;&amp;quot;142.133.174.76&amp;quot;&lt;/span&gt;;
     &lt;span style=&quot;color: #000080; font-weight: bold&quot;&gt;long&lt;/span&gt; refreshWaitTimeout = &lt;span style=&quot;color: #0000FF&quot;&gt;1000&lt;/span&gt;;
     &lt;span style=&quot;color: #000080; font-weight: bold&quot;&gt;long&lt;/span&gt; initialWaitTimeout = &lt;span style=&quot;color: #0000FF&quot;&gt;5000&lt;/span&gt;;
&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&lt;/div&gt;

above is the starting the code .

&lt;br/&gt;&lt;br/&gt;
Step2:
&lt;br/&gt;
&lt;!-- HTML generated using hilite.me --&gt;&lt;div style=&quot;background: #ffffff; overflow:auto;width:auto;border:solid gray;border-width:.0em .0em .0em .0em;padding:.2em .6em;&quot;&gt;&lt;table&gt;&lt;tr&gt;&lt;td&gt;&lt;pre style=&quot;margin: 0; line-height: 125%&quot;&gt; 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29&lt;/pre&gt;&lt;/td&gt;&lt;td&gt;&lt;pre style=&quot;margin: 0; line-height: 125%&quot;&gt;     UDPBroadcastGroupConfiguration udpConfig = &lt;span style=&quot;color: #000080; font-weight: bold&quot;&gt;new&lt;/span&gt; UDPBroadcastGroupConfiguration(groupAddress, groupPort, localBindAddress, localPort);
     System.&lt;span style=&quot;color: #FF0000&quot;&gt;out&lt;/span&gt;.&lt;span style=&quot;color: #FF0000&quot;&gt;println&lt;/span&gt;(&lt;span style=&quot;color: #0000FF&quot;&gt;&amp;quot;udpConfig=\n&amp;quot;&lt;/span&gt; + udpConfig);
     DiscoveryGroupConfiguration groupConfiguration = &lt;span style=&quot;color: #000080; font-weight: bold&quot;&gt;new&lt;/span&gt; DiscoveryGroupConfiguration(discoveryGroupName, refreshWaitTimeout, initialWaitTimeout,udpConfig);
  System.&lt;span style=&quot;color: #FF0000&quot;&gt;out&lt;/span&gt;.&lt;span style=&quot;color: #FF0000&quot;&gt;println&lt;/span&gt;(&lt;span style=&quot;color: #0000FF&quot;&gt;&amp;quot;groupConfiguration=\n&amp;quot;&lt;/span&gt; + groupConfiguration);
     HornetQConnectionFactory jmsConnectionFactory = HornetQJMSClient.&lt;span style=&quot;color: #FF0000&quot;&gt;createConnectionFactoryWithHA&lt;/span&gt;(groupConfiguration,JMSFactoryType.&lt;span style=&quot;color: #FF0000&quot;&gt;CF&lt;/span&gt;);
  System.&lt;span style=&quot;color: #FF0000&quot;&gt;out&lt;/span&gt;.&lt;span style=&quot;color: #FF0000&quot;&gt;println&lt;/span&gt;(&lt;span style=&quot;color: #0000FF&quot;&gt;&amp;quot;jmsConnectionFactory=\n&amp;quot;&lt;/span&gt; + jmsConnectionFactory);
  
     String queueName = &lt;span style=&quot;color: #0000FF&quot;&gt;&amp;quot;QueueName1&amp;quot;&lt;/span&gt;;
     &lt;span style=&quot;color: #000080; font-weight: bold&quot;&gt;final&lt;/span&gt; Queue queue = HornetQJMSClient.&lt;span style=&quot;color: #FF0000&quot;&gt;createQueue&lt;/span&gt;(queueName);
     connection = jmsConnectionFactory.&lt;span style=&quot;color: #FF0000&quot;&gt;createQueueConnection&lt;/span&gt;(&lt;span style=&quot;color: #0000FF&quot;&gt;&amp;quot;testuser&amp;quot;&lt;/span&gt;, &lt;span style=&quot;color: #0000FF&quot;&gt;&amp;quot;testuser@1&amp;quot;&lt;/span&gt;);
  System.&lt;span style=&quot;color: #FF0000&quot;&gt;out&lt;/span&gt;.&lt;span style=&quot;color: #FF0000&quot;&gt;println&lt;/span&gt;(&lt;span style=&quot;color: #0000FF&quot;&gt;&amp;quot;connection=\n&amp;quot;&lt;/span&gt; + connection);
     &lt;span style=&quot;color: #000080; font-weight: bold&quot;&gt;final&lt;/span&gt; QueueSession session = connection.&lt;span style=&quot;color: #FF0000&quot;&gt;createQueueSession&lt;/span&gt;(&lt;span style=&quot;color: #000080; font-weight: bold&quot;&gt;false&lt;/span&gt;,Session.&lt;span style=&quot;color: #FF0000&quot;&gt;AUTO_ACKNOWLEDGE&lt;/span&gt;);
     QueueReceiver receiver = session.&lt;span style=&quot;color: #FF0000&quot;&gt;createReceiver&lt;/span&gt;(queue);
     receiver.&lt;span style=&quot;color: #FF0000&quot;&gt;setMessageListener&lt;/span&gt;(&lt;span style=&quot;color: #000080; font-weight: bold&quot;&gt;new&lt;/span&gt; MessageListener() {
          @Override
          &lt;span style=&quot;color: #000080; font-weight: bold&quot;&gt;public&lt;/span&gt; &lt;span style=&quot;color: #000080; font-weight: bold&quot;&gt;void&lt;/span&gt; onMessage(Message message) {
            
            System.&lt;span style=&quot;color: #FF0000&quot;&gt;out&lt;/span&gt;.&lt;span style=&quot;color: #FF0000&quot;&gt;println&lt;/span&gt;(&lt;span style=&quot;color: #0000FF&quot;&gt;&amp;quot;Message received.&amp;quot;&lt;/span&gt;);
            TextMessage eventMessage = (TextMessage) message;
            String jsonEventMessage = &lt;span style=&quot;color: #000080; font-weight: bold&quot;&gt;null&lt;/span&gt;;
            &lt;span style=&quot;color: #000080; font-weight: bold&quot;&gt;try&lt;/span&gt; {
              jsonEventMessage = eventMessage.&lt;span style=&quot;color: #FF0000&quot;&gt;getText&lt;/span&gt;();
              
              System.&lt;span style=&quot;color: #FF0000&quot;&gt;out&lt;/span&gt;.&lt;span style=&quot;color: #FF0000&quot;&gt;println&lt;/span&gt;(&lt;span style=&quot;color: #0000FF&quot;&gt;&amp;quot;Message Id: &amp;quot;&lt;/span&gt;+jsonEventMessage);
            }&lt;span style=&quot;color: #000080; font-weight: bold&quot;&gt;catch&lt;/span&gt;(Exception e){e.&lt;span style=&quot;color: #FF0000&quot;&gt;printStackTrace&lt;/span&gt;();}
            
          }
        });
     connection.&lt;span style=&quot;color: #FF0000&quot;&gt;start&lt;/span&gt;();
&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&lt;/div&gt;


&lt;br/&gt;&lt;br/&gt;
Step3: This part will explained in 3 sections as shown below:
&lt;br/&gt;
Listener part:
&lt;br/&gt;
&lt;!-- HTML generated using hilite.me --&gt;&lt;div style=&quot;background: #ffffff; overflow:auto;width:auto;border:solid gray;border-width:.0em .0em .0em .0em;padding:.2em .6em;&quot;&gt;&lt;table&gt;&lt;tr&gt;&lt;td&gt;&lt;pre style=&quot;margin: 0; line-height: 125%&quot;&gt; 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26&lt;/pre&gt;&lt;/td&gt;&lt;td&gt;&lt;pre style=&quot;margin: 0; line-height: 125%&quot;&gt;     System.&lt;span style=&quot;color: #FF0000&quot;&gt;out&lt;/span&gt;.&lt;span style=&quot;color: #FF0000&quot;&gt;println&lt;/span&gt;(&lt;span style=&quot;color: #0000FF&quot;&gt;&amp;quot; Event Queue Listerner Started&amp;quot;&lt;/span&gt;);
     &lt;span style=&quot;color: #000080; font-weight: bold&quot;&gt;new&lt;/span&gt; Thread() {
  &lt;span style=&quot;color: #000080; font-weight: bold&quot;&gt;public&lt;/span&gt; &lt;span style=&quot;color: #000080; font-weight: bold&quot;&gt;void&lt;/span&gt; run() {
      System.&lt;span style=&quot;color: #FF0000&quot;&gt;out&lt;/span&gt;.&lt;span style=&quot;color: #FF0000&quot;&gt;println&lt;/span&gt;(&lt;span style=&quot;color: #0000FF&quot;&gt;&amp;quot; Event Queue Sender Started&amp;quot;&lt;/span&gt;);
      &lt;span style=&quot;color: #000080; font-weight: bold&quot;&gt;try&lt;/span&gt; {
      javax.&lt;span style=&quot;color: #FF0000&quot;&gt;jms&lt;/span&gt;.&lt;span style=&quot;color: #FF0000&quot;&gt;QueueSender&lt;/span&gt; sender1 = session.&lt;span style=&quot;color: #FF0000&quot;&gt;createSender&lt;/span&gt;(queue);
   
            String[] ext = {&lt;span style=&quot;color: #0000FF&quot;&gt;&amp;quot;json&amp;quot;&lt;/span&gt;};
            Iterator&amp;lt;File&amp;gt; it = FileUtils.&lt;span style=&quot;color: #FF0000&quot;&gt;iterateFiles&lt;/span&gt;(&lt;span style=&quot;color: #000080; font-weight: bold&quot;&gt;new&lt;/span&gt; File(&lt;span style=&quot;color: #0000FF&quot;&gt;&amp;quot;/opt/jboss/testjms/testdata&amp;quot;&lt;/span&gt;), ext, &lt;span style=&quot;color: #000080; font-weight: bold&quot;&gt;true&lt;/span&gt;);
            &lt;span style=&quot;color: #000080; font-weight: bold&quot;&gt;while&lt;/span&gt;(it.&lt;span style=&quot;color: #FF0000&quot;&gt;hasNext&lt;/span&gt;()){
              File test = (File)it.&lt;span style=&quot;color: #FF0000&quot;&gt;next&lt;/span&gt;();
              String tmp = FileUtils.&lt;span style=&quot;color: #FF0000&quot;&gt;readFileToString&lt;/span&gt;(test, &lt;span style=&quot;color: #0000FF&quot;&gt;&amp;quot;UTF-8&amp;quot;&lt;/span&gt;);
              System.&lt;span style=&quot;color: #FF0000&quot;&gt;out&lt;/span&gt;.&lt;span style=&quot;color: #FF0000&quot;&gt;println&lt;/span&gt;(test.&lt;span style=&quot;color: #FF0000&quot;&gt;getName&lt;/span&gt;()+&lt;span style=&quot;color: #0000FF&quot;&gt;&amp;quot;\n&amp;quot;&lt;/span&gt;+tmp);
              
              TextMessage tm = session.&lt;span style=&quot;color: #FF0000&quot;&gt;createTextMessage&lt;/span&gt;(tmp);
              sender1.&lt;span style=&quot;color: #FF0000&quot;&gt;send&lt;/span&gt;(tm);
              
              System.&lt;span style=&quot;color: #FF0000&quot;&gt;out&lt;/span&gt;.&lt;span style=&quot;color: #FF0000&quot;&gt;println&lt;/span&gt;(&lt;span style=&quot;color: #0000FF&quot;&gt;&amp;quot;msg. &amp;quot;&lt;/span&gt;+test.&lt;span style=&quot;color: #FF0000&quot;&gt;getName&lt;/span&gt;() + &lt;span style=&quot;color: #0000FF&quot;&gt;&amp;quot; sent.&amp;quot;&lt;/span&gt;);
              Thread.&lt;span style=&quot;color: #FF0000&quot;&gt;sleep&lt;/span&gt;(&lt;span style=&quot;color: #0000FF&quot;&gt;1000&lt;/span&gt;);
            }
          } &lt;span style=&quot;color: #000080; font-weight: bold&quot;&gt;catch&lt;/span&gt; (Exception e1) {
            e1.&lt;span style=&quot;color: #FF0000&quot;&gt;printStackTrace&lt;/span&gt;();
          }
  }

     }.&lt;span style=&quot;color: #FF0000&quot;&gt;start&lt;/span&gt;();
&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&lt;/div&gt;

&lt;br/&gt;&lt;br/&gt;
Shutdown hook for JMS connection:
&lt;br/&gt;
&lt;!-- HTML generated using hilite.me --&gt;&lt;div style=&quot;background: #ffffff; overflow:auto;width:auto;border:solid gray;border-width:.0em .0em .0em .0em;padding:.2em .6em;&quot;&gt;&lt;table&gt;&lt;tr&gt;&lt;td&gt;&lt;pre style=&quot;margin: 0; line-height: 125%&quot;&gt; 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17&lt;/pre&gt;&lt;/td&gt;&lt;td&gt;&lt;pre style=&quot;margin: 0; line-height: 125%&quot;&gt;     Runtime.&lt;span style=&quot;color: #FF0000&quot;&gt;getRuntime&lt;/span&gt;().&lt;span style=&quot;color: #FF0000&quot;&gt;addShutdownHook&lt;/span&gt;(&lt;span style=&quot;color: #000080; font-weight: bold&quot;&gt;new&lt;/span&gt; Thread() {
      @Override
      &lt;span style=&quot;color: #000080; font-weight: bold&quot;&gt;public&lt;/span&gt; &lt;span style=&quot;color: #000080; font-weight: bold&quot;&gt;void&lt;/span&gt; run() {   
   &lt;span style=&quot;color: #000080; font-weight: bold&quot;&gt;if&lt;/span&gt;(connection!=&lt;span style=&quot;color: #000080; font-weight: bold&quot;&gt;null&lt;/span&gt;)
    &lt;span style=&quot;color: #000080; font-weight: bold&quot;&gt;try&lt;/span&gt; {
        connection.&lt;span style=&quot;color: #FF0000&quot;&gt;close&lt;/span&gt;();
        System.&lt;span style=&quot;color: #FF0000&quot;&gt;out&lt;/span&gt;.&lt;span style=&quot;color: #FF0000&quot;&gt;println&lt;/span&gt;(&lt;span style=&quot;color: #0000FF&quot;&gt;&amp;quot;connection closed&amp;quot;&lt;/span&gt;);
    } &lt;span style=&quot;color: #000080; font-weight: bold&quot;&gt;catch&lt;/span&gt; (JMSException e) {
        e.&lt;span style=&quot;color: #FF0000&quot;&gt;printStackTrace&lt;/span&gt;();
    }
      }
     });

 } &lt;span style=&quot;color: #000080; font-weight: bold&quot;&gt;catch&lt;/span&gt; (Exception ee) {
     ee.&lt;span style=&quot;color: #FF0000&quot;&gt;printStackTrace&lt;/span&gt;();
 }
    }
&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&lt;/div&gt;
&lt;br/&gt;&lt;br/&gt;
Main method:
&lt;br/&gt;
&lt;!-- HTML generated using hilite.me --&gt;&lt;div style=&quot;background: #ffffff; overflow:auto;width:auto;border:solid gray;border-width:.0em .0em .0em .0em;padding:.2em .6em;&quot;&gt;&lt;table&gt;&lt;tr&gt;&lt;td&gt;&lt;pre style=&quot;margin: 0; line-height: 125%&quot;&gt; 1
 2
 3
 4
 5
 6
 7
 8
 9
10&lt;/pre&gt;&lt;/td&gt;&lt;td&gt;&lt;pre style=&quot;margin: 0; line-height: 125%&quot;&gt;&lt;span style=&quot;color: #000080; font-weight: bold&quot;&gt;public&lt;/span&gt; &lt;span style=&quot;color: #000080; font-weight: bold&quot;&gt;static&lt;/span&gt; &lt;span style=&quot;color: #000080; font-weight: bold&quot;&gt;void&lt;/span&gt; main(String[] args) {

 &lt;span style=&quot;color: #000080; font-weight: bold&quot;&gt;try&lt;/span&gt; {
     PostQueue ab = &lt;span style=&quot;color: #000080; font-weight: bold&quot;&gt;new&lt;/span&gt; PostQueue();
     ab.&lt;span style=&quot;color: #FF0000&quot;&gt;initJMSLister&lt;/span&gt;();
 } &lt;span style=&quot;color: #000080; font-weight: bold&quot;&gt;catch&lt;/span&gt; (Exception ex) {
     ex.&lt;span style=&quot;color: #FF0000&quot;&gt;printStackTrace&lt;/span&gt;();
 }
    }
}
&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&lt;/div&gt;


&lt;br/&gt;</content><link rel='replies' type='application/atom+xml' href='http://throwableobject.blogspot.com/feeds/3704996519086778360/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://throwableobject.blogspot.com/2015/06/post-json-message-to-jms-queue-of.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/9048812660891698443/posts/default/3704996519086778360'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/9048812660891698443/posts/default/3704996519086778360'/><link rel='alternate' type='text/html' href='http://throwableobject.blogspot.com/2015/06/post-json-message-to-jms-queue-of.html' title='Post Json message to JMS Queue of Hornet Queue on JBoss'/><author><name>test</name><uri>http://www.blogger.com/profile/06330700265841330179</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-9048812660891698443.post-804448982919881560</id><published>2015-06-16T16:59:00.003+05:30</published><updated>2015-06-16T17:11:59.522+05:30</updated><category scheme="http://www.blogger.com/atom/ns#" term="clustering"/><category scheme="http://www.blogger.com/atom/ns#" term="JMS"/><category scheme="http://www.blogger.com/atom/ns#" term="Maven"/><category scheme="http://www.blogger.com/atom/ns#" term="Spring"/><title type='text'>Spring JMS Complete Series</title><content type='html'>
Part 1

Step1 : Build a Maven WebApp Project
Step 2: Add the below dependencies:
&lt;!-- HTML generated using hilite.me --&gt;&lt;div style=&quot;background: #ffffff; overflow:auto;width:auto;border:solid gray;border-width:.1em .1em .1em .8em;padding:.2em .6em;&quot;&gt;&lt;table&gt;&lt;tr&gt;&lt;td&gt;&lt;pre style=&quot;margin: 0; line-height: 125%&quot;&gt; 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19&lt;/pre&gt;&lt;/td&gt;&lt;td&gt;&lt;pre style=&quot;margin: 0; line-height: 125%&quot;&gt;&lt;span style=&quot;color: #1e90ff; font-weight: bold&quot;&gt;&amp;lt;dependency&amp;gt;&lt;/span&gt;
     &lt;span style=&quot;color: #1e90ff; font-weight: bold&quot;&gt;&amp;lt;groupId&amp;gt;&lt;/span&gt;org.springframework&lt;span style=&quot;color: #1e90ff; font-weight: bold&quot;&gt;&amp;lt;/groupId&amp;gt;&lt;/span&gt;
 &lt;span style=&quot;color: #1e90ff; font-weight: bold&quot;&gt;&amp;lt;artifactId&amp;gt;&lt;/span&gt;spring-core&lt;span style=&quot;color: #1e90ff; font-weight: bold&quot;&gt;&amp;lt;/artifactId&amp;gt;&lt;/span&gt;
&lt;span style=&quot;color: #1e90ff; font-weight: bold&quot;&gt;&amp;lt;/dependency&amp;gt;&lt;/span&gt;

&lt;span style=&quot;color: #1e90ff; font-weight: bold&quot;&gt;&amp;lt;dependency&amp;gt;&lt;/span&gt;
 &lt;span style=&quot;color: #1e90ff; font-weight: bold&quot;&gt;&amp;lt;groupId&amp;gt;&lt;/span&gt;org.springframework&lt;span style=&quot;color: #1e90ff; font-weight: bold&quot;&gt;&amp;lt;/groupId&amp;gt;&lt;/span&gt;
 &lt;span style=&quot;color: #1e90ff; font-weight: bold&quot;&gt;&amp;lt;artifactId&amp;gt;&lt;/span&gt;spring-beans&lt;span style=&quot;color: #1e90ff; font-weight: bold&quot;&gt;&amp;lt;/artifactId&amp;gt;&lt;/span&gt;
&lt;span style=&quot;color: #1e90ff; font-weight: bold&quot;&gt;&amp;lt;/dependency&amp;gt;&lt;/span&gt;

&lt;span style=&quot;color: #1e90ff; font-weight: bold&quot;&gt;&amp;lt;dependency&amp;gt;&lt;/span&gt;
 &lt;span style=&quot;color: #1e90ff; font-weight: bold&quot;&gt;&amp;lt;groupId&amp;gt;&lt;/span&gt;org.springframework&lt;span style=&quot;color: #1e90ff; font-weight: bold&quot;&gt;&amp;lt;/groupId&amp;gt;&lt;/span&gt;
 &lt;span style=&quot;color: #1e90ff; font-weight: bold&quot;&gt;&amp;lt;artifactId&amp;gt;&lt;/span&gt;spring-context&lt;span style=&quot;color: #1e90ff; font-weight: bold&quot;&gt;&amp;lt;/artifactId&amp;gt;&lt;/span&gt;
&lt;span style=&quot;color: #1e90ff; font-weight: bold&quot;&gt;&amp;lt;/dependency&amp;gt;&lt;/span&gt;

&lt;span style=&quot;color: #1e90ff; font-weight: bold&quot;&gt;&amp;lt;dependency&amp;gt;&lt;/span&gt;
 &lt;span style=&quot;color: #1e90ff; font-weight: bold&quot;&gt;&amp;lt;groupId&amp;gt;&lt;/span&gt;org.springframework&lt;span style=&quot;color: #1e90ff; font-weight: bold&quot;&gt;&amp;lt;/groupId&amp;gt;&lt;/span&gt;
 &lt;span style=&quot;color: #1e90ff; font-weight: bold&quot;&gt;&amp;lt;artifactId&amp;gt;&lt;/span&gt;spring-web&lt;span style=&quot;color: #1e90ff; font-weight: bold&quot;&gt;&amp;lt;/artifactId&amp;gt;&lt;/span&gt;
&lt;span style=&quot;color: #1e90ff; font-weight: bold&quot;&gt;&amp;lt;/dependency&amp;gt;&lt;/span&gt;
&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&lt;/div&gt;

</content><link rel='replies' type='application/atom+xml' href='http://throwableobject.blogspot.com/feeds/804448982919881560/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://throwableobject.blogspot.com/2015/06/spring-jms-complete-series.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/9048812660891698443/posts/default/804448982919881560'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/9048812660891698443/posts/default/804448982919881560'/><link rel='alternate' type='text/html' href='http://throwableobject.blogspot.com/2015/06/spring-jms-complete-series.html' title='Spring JMS Complete Series'/><author><name>test</name><uri>http://www.blogger.com/profile/06330700265841330179</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-9048812660891698443.post-2798712022829859698</id><published>2015-06-03T13:12:00.002+05:30</published><updated>2015-06-03T14:20:10.829+05:30</updated><category scheme="http://www.blogger.com/atom/ns#" term="Serializable class"/><category scheme="http://www.blogger.com/atom/ns#" term="XSD schema"/><title type='text'>Generate Serializable classes from XSD schema</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
Below is the code snippet to generate the serializable classes from Xsd schema xml:
&lt;br /&gt;

&lt;div&gt;Part 1: this section is normal to xsd file.
&lt;!-- HTML generated using hilite.me --&gt;&lt;div style=&quot;background: #ffffff; overflow:auto;width:auto;border:solid gray;border-width:.1em .1em .1em .4em;padding:.2em .6em;&quot;&gt;&lt;table&gt;&lt;tr&gt;&lt;td&gt;&lt;pre style=&quot;margin: 0; line-height: 125%&quot;&gt;1
2
3&lt;/pre&gt;&lt;/td&gt;&lt;td&gt;&lt;pre style=&quot;margin: 0; line-height: 125%&quot;&gt;&lt;span style=&quot;color: #008080&quot;&gt;&amp;lt;?xml version=&amp;quot;1.0&amp;quot; encoding=&amp;quot;utf-8&amp;quot;?&amp;gt;&lt;/span&gt;
&lt;span style=&quot;color: #000080; font-weight: bold&quot;&gt;&amp;lt;xsd:schema&lt;/span&gt; &lt;span style=&quot;color: #FF0000&quot;&gt;targetNamespace=&lt;/span&gt;&lt;span style=&quot;color: #0000FF&quot;&gt;&amp;quot;http://www.apertio.com/webservice/TmoUsEIRSoap/v1&amp;quot;&lt;/span&gt;
    &lt;span style=&quot;color: #FF0000&quot;&gt;xmlns:typens=&lt;/span&gt;&lt;span style=&quot;color: #0000FF&quot;&gt;&amp;quot;http://www.apertio.com/webservice/TmoUsEIRSoap/v1&amp;quot;&lt;/span&gt;
&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&lt;/div&gt;

&lt;/div&gt;

&lt;div&gt;Part 2: Below section is the required attributes/values to generate the serializable classes for xsd.
&lt;!-- HTML generated using hilite.me --&gt;&lt;div style=&quot;background: #ffffff; overflow:auto;width:auto;border:solid gray;border-width:.1em .1em .1em .4em;padding:.2em .6em;&quot;&gt;&lt;table&gt;&lt;tr&gt;&lt;td&gt;&lt;pre style=&quot;margin: 0; line-height: 125%&quot;&gt;4
5
6
7&lt;/pre&gt;&lt;/td&gt;&lt;td&gt;&lt;pre style=&quot;margin: 0; line-height: 125%&quot;&gt;xmlns:jaxb=&amp;quot;http://java.sun.com/xml/ns/jaxb&amp;quot;
    xmlns:xjc=&amp;quot;http://java.sun.com/xml/ns/jaxb/xjc&amp;quot;
    jaxb:extensionBindingPrefixes=&amp;quot;xjc&amp;quot;
    jaxb:version=&amp;quot;1.0&amp;quot; &amp;gt;
&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&lt;/div&gt;

&lt;/div&gt;
&lt;div&gt;Part 3:Below section is the required xml tags to generate the serializable classes for xsd.
&lt;!-- HTML generated using hilite.me --&gt;&lt;div style=&quot;background: #ffffff; overflow:auto;width:auto;border:solid gray;border-width:.1em .1em .1em .4em;padding:.2em .6em;&quot;&gt;&lt;table&gt;&lt;tr&gt;&lt;td&gt;&lt;pre style=&quot;margin: 0; line-height: 125%&quot;&gt;8
9
10
11
12
13
14&lt;/pre&gt;&lt;/td&gt;&lt;td&gt;&lt;pre style=&quot;margin: 0; line-height: 125%&quot;&gt;
&lt;span style=&quot;color: #000080; font-weight: bold&quot;&gt;&amp;lt;xsd:annotation&amp;gt;&lt;/span&gt;
   &lt;span style=&quot;color: #000080; font-weight: bold&quot;&gt;&amp;lt;xsd:appinfo&amp;gt;&lt;/span&gt;
      &lt;span style=&quot;color: #000080; font-weight: bold&quot;&gt;&amp;lt;jaxb:globalBindings&lt;/span&gt; &lt;span style=&quot;color: #FF0000&quot;&gt;generateIsSetMethod=&lt;/span&gt;&lt;span style=&quot;color: #0000FF&quot;&gt;&amp;quot;false&amp;quot;&lt;/span&gt;&lt;span style=&quot;color: #000080; font-weight: bold&quot;&gt;&amp;gt;&lt;/span&gt;
         &lt;span style=&quot;color: #000080; font-weight: bold&quot;&gt;&amp;lt;xjc:serializable&lt;/span&gt; &lt;span style=&quot;color: #FF0000&quot;&gt;uid=&lt;/span&gt;&lt;span style=&quot;color: #0000FF&quot;&gt;&amp;quot;1&amp;quot;&lt;/span&gt;&lt;span style=&quot;color: #000080; font-weight: bold&quot;&gt;/&amp;gt;&lt;/span&gt;
      &lt;span style=&quot;color: #000080; font-weight: bold&quot;&gt;&amp;lt;/jaxb:globalBindings&amp;gt;&lt;/span&gt;
   &lt;span style=&quot;color: #000080; font-weight: bold&quot;&gt;&amp;lt;/xsd:appinfo&amp;gt;&lt;/span&gt;
&lt;span style=&quot;color: #000080; font-weight: bold&quot;&gt;&amp;lt;/xsd:annotation&amp;gt;&lt;/span&gt;
&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&lt;/div&gt;


&lt;/div&gt;
&lt;div&gt;Part 4: Finally this section is normal to xsd file which contains the xsd elements.
&lt;!-- HTML generated using hilite.me --&gt;&lt;div style=&quot;background: #ffffff; overflow:auto;width:auto;border:solid gray;border-width:.1em .1em .1em .4em;padding:.2em .6em;&quot;&gt;&lt;table&gt;&lt;tr&gt;&lt;td&gt;&lt;pre style=&quot;margin: 0; line-height: 125%&quot;&gt;15
16
17
18
19
20
21
22
23
24
25&lt;/pre&gt;&lt;/td&gt;&lt;td&gt;&lt;pre style=&quot;margin: 0; line-height: 125%&quot;&gt;&lt;span style=&quot;color: #000080; font-weight: bold&quot;&gt;&amp;lt;xsd:element&lt;/span&gt; &lt;span style=&quot;color: #FF0000&quot;&gt;name=&lt;/span&gt;&lt;span style=&quot;color: #0000FF&quot;&gt;&amp;quot;QueryReq&amp;quot;&lt;/span&gt;&lt;span style=&quot;color: #000080; font-weight: bold&quot;&gt;&amp;gt;&lt;/span&gt;
        &lt;span style=&quot;color: #000080; font-weight: bold&quot;&gt;&amp;lt;xsd:complexType&amp;gt;&lt;/span&gt;
          &lt;span style=&quot;color: #000080; font-weight: bold&quot;&gt;&amp;lt;xsd:sequence&amp;gt;&lt;/span&gt;
            &lt;span style=&quot;color: #000080; font-weight: bold&quot;&gt;&amp;lt;xsd:element&lt;/span&gt; &lt;span style=&quot;color: #FF0000&quot;&gt;type=&lt;/span&gt;&lt;span style=&quot;color: #0000FF&quot;&gt;&amp;quot;xsd:integer&amp;quot;&lt;/span&gt; &lt;span style=&quot;color: #FF0000&quot;&gt;minOccurs=&lt;/span&gt;&lt;span style=&quot;color: #0000FF&quot;&gt;&amp;quot;1&amp;quot;&lt;/span&gt; &lt;span style=&quot;color: #FF0000&quot;&gt;maxOccurs=&lt;/span&gt;&lt;span style=&quot;color: #0000FF&quot;&gt;&amp;quot;1&amp;quot;&lt;/span&gt; &lt;span style=&quot;color: #FF0000&quot;&gt;name=&lt;/span&gt;&lt;span style=&quot;color: #0000FF&quot;&gt;&amp;quot;tranId&amp;quot;&lt;/span&gt; &lt;span style=&quot;color: #000080; font-weight: bold&quot;&gt;/&amp;gt;&lt;/span&gt;
            &lt;span style=&quot;color: #000080; font-weight: bold&quot;&gt;&amp;lt;xsd:element&lt;/span&gt; &lt;span style=&quot;color: #FF0000&quot;&gt;type=&lt;/span&gt;&lt;span style=&quot;color: #0000FF&quot;&gt;&amp;quot;xsd:integer&amp;quot;&lt;/span&gt; &lt;span style=&quot;color: #FF0000&quot;&gt;minOccurs=&lt;/span&gt;&lt;span style=&quot;color: #0000FF&quot;&gt;&amp;quot;1&amp;quot;&lt;/span&gt; &lt;span style=&quot;color: #FF0000&quot;&gt;maxOccurs=&lt;/span&gt;&lt;span style=&quot;color: #0000FF&quot;&gt;&amp;quot;1&amp;quot;&lt;/span&gt; &lt;span style=&quot;color: #FF0000&quot;&gt;name=&lt;/span&gt;&lt;span style=&quot;color: #0000FF&quot;&gt;&amp;quot;reqId&amp;quot;&lt;/span&gt; &lt;span style=&quot;color: #000080; font-weight: bold&quot;&gt;/&amp;gt;&lt;/span&gt;
            &lt;span style=&quot;color: #000080; font-weight: bold&quot;&gt;&amp;lt;xsd:element&lt;/span&gt; &lt;span style=&quot;color: #FF0000&quot;&gt;type=&lt;/span&gt;&lt;span style=&quot;color: #0000FF&quot;&gt;&amp;quot;xsd:integer&amp;quot;&lt;/span&gt; &lt;span style=&quot;color: #FF0000&quot;&gt;minOccurs=&lt;/span&gt;&lt;span style=&quot;color: #0000FF&quot;&gt;&amp;quot;0&amp;quot;&lt;/span&gt; &lt;span style=&quot;color: #FF0000&quot;&gt;maxOccurs=&lt;/span&gt;&lt;span style=&quot;color: #0000FF&quot;&gt;&amp;quot;1&amp;quot;&lt;/span&gt; &lt;span style=&quot;color: #FF0000&quot;&gt;name=&lt;/span&gt;&lt;span style=&quot;color: #0000FF&quot;&gt;&amp;quot;version&amp;quot;&lt;/span&gt; &lt;span style=&quot;color: #000080; font-weight: bold&quot;&gt;/&amp;gt;&lt;/span&gt;
            &lt;span style=&quot;color: #000080; font-weight: bold&quot;&gt;&amp;lt;xsd:element&lt;/span&gt; &lt;span style=&quot;color: #FF0000&quot;&gt;type=&lt;/span&gt;&lt;span style=&quot;color: #0000FF&quot;&gt;&amp;quot;xsd:string&amp;quot;&lt;/span&gt; &lt;span style=&quot;color: #FF0000&quot;&gt;minOccurs=&lt;/span&gt;&lt;span style=&quot;color: #0000FF&quot;&gt;&amp;quot;0&amp;quot;&lt;/span&gt; &lt;span style=&quot;color: #FF0000&quot;&gt;maxOccurs=&lt;/span&gt;&lt;span style=&quot;color: #0000FF&quot;&gt;&amp;quot;1&amp;quot;&lt;/span&gt; &lt;span style=&quot;color: #FF0000&quot;&gt;name=&lt;/span&gt;&lt;span style=&quot;color: #0000FF&quot;&gt;&amp;quot;capability&amp;quot;&lt;/span&gt; &lt;span style=&quot;color: #000080; font-weight: bold&quot;&gt;/&amp;gt;&lt;/span&gt;
          &lt;span style=&quot;color: #000080; font-weight: bold&quot;&gt;&amp;lt;/xsd:sequence&amp;gt;&lt;/span&gt;
        &lt;span style=&quot;color: #000080; font-weight: bold&quot;&gt;&amp;lt;/xsd:complexType&amp;gt;&lt;/span&gt;
      &lt;span style=&quot;color: #000080; font-weight: bold&quot;&gt;&amp;lt;/xsd:element&amp;gt;&lt;/span&gt;
    &lt;span style=&quot;color: #000080; font-weight: bold&quot;&gt;&amp;lt;/xsd:schema&amp;gt;&lt;/span&gt;
&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&lt;/div&gt;

&lt;/div&gt;
&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://throwableobject.blogspot.com/feeds/2798712022829859698/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://throwableobject.blogspot.com/2015/06/generate-serializableclasses-from-xsd.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/9048812660891698443/posts/default/2798712022829859698'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/9048812660891698443/posts/default/2798712022829859698'/><link rel='alternate' type='text/html' href='http://throwableobject.blogspot.com/2015/06/generate-serializableclasses-from-xsd.html' title='Generate Serializable classes from XSD schema'/><author><name>test</name><uri>http://www.blogger.com/profile/06330700265841330179</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-9048812660891698443.post-5185995837871841431</id><published>2011-01-23T23:44:00.001+05:30</published><updated>2015-05-14T14:38:59.282+05:30</updated><category scheme="http://www.blogger.com/atom/ns#" term="Ajax"/><title type='text'>Ajax Implementation</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;div style=&quot;text-align: left;&quot; title=&quot;throwable object Ajax Implementation&quot;&gt;
&lt;b&gt;Ajax&lt;/b&gt; (&lt;i&gt;shorthand for Asynchronous JavaScript and XML&lt;/i&gt;) is a group of interrelated web development methods used on the client-side to create interactive web applications. With Ajax, web applications can retrieve data from the server asynchronously in the background without interfering with the display and behavior of the existing page. Data is usually retrieved using the XMLHttpRequest object. Despite the name, the use of XML is not needed, and the requests need not be asynchronous.&lt;br /&gt;
&lt;br /&gt;
Implementation:&lt;br /&gt;
&lt;b&gt;Step 1 Jsp part : wrote the following code in JSP where Ajax calls made&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;script src=&quot;https://gist.github.com/apurushottamind/343d03009952c0808aec.js&quot;&gt;&lt;/script&gt;

&lt;br /&gt;
&lt;div class=&quot;MsoNormal&quot; title=&quot;throwable object Ajax Implementation&quot;&gt;
&lt;span lang=&quot;EN-US&quot; style=&quot;font-family: &amp;quot;Courier New&amp;quot;; font-size: 9pt;&quot;&gt;above was in &amp;lt;script&amp;gt;&amp;lt;/script&amp;gt; only.&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; title=&quot;throwable object Ajax Implementation&quot;&gt;
&lt;span lang=&quot;EN-US&quot; style=&quot;font-family: &amp;quot;Courier New&amp;quot;; font-size: 9pt;&quot;&gt;in the body section&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; title=&quot;throwable object Ajax Implementation&quot;&gt;
&lt;span lang=&quot;EN-US&quot; style=&quot;font-family: &amp;quot;Courier New&amp;quot;; font-size: 9pt;&quot;&gt;&amp;lt;input type=&quot;text&quot; onblur=&quot;getXXX(this)&quot; name=&quot;&lt;u&gt;&lt;i&gt;&lt;span style=&quot;color: #783f04;&quot;&gt;pname&lt;/span&gt;&lt;/i&gt;&lt;/u&gt;&quot;/&amp;gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; title=&quot;throwable object Ajax Implementation&quot;&gt;
&lt;script src=&quot;https://gist.github.com/apurushottamind/426b7cf174c48c357b90.js&quot;&gt;&lt;/script&gt;
&lt;/div&gt;
&lt;br /&gt;
&lt;b&gt;Step 2: Java Part&lt;/b&gt;:&lt;br /&gt;
&lt;br /&gt;
&lt;div class=&quot;MsoNormal&quot; title=&quot;throwable object Ajax Implementation&quot;&gt;
&lt;b&gt;&lt;u&gt;&lt;span lang=&quot;EN-US&quot; style=&quot;font-family: &amp;quot;Courier New&amp;quot;; font-size: 9pt;&quot;&gt;xxxAction.java&lt;/span&gt;&lt;/u&gt;&lt;/b&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; title=&quot;throwable object Ajax Implementation&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; title=&quot;throwable object Ajax Implementation&quot;&gt;
&lt;script src=&quot;https://gist.github.com/apurushottamind/24006ce4be87d4f77dd2.js&quot;&gt;&lt;/script&gt;
&lt;/div&gt;
&amp;nbsp;..,,,,,&lt;br /&gt;
And forward mapping to NULL.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://throwableobject.blogspot.com/feeds/5185995837871841431/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://throwableobject.blogspot.com/2011/01/ajax-implementation.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/9048812660891698443/posts/default/5185995837871841431'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/9048812660891698443/posts/default/5185995837871841431'/><link rel='alternate' type='text/html' href='http://throwableobject.blogspot.com/2011/01/ajax-implementation.html' title='Ajax Implementation'/><author><name>Unknown</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-9048812660891698443.post-3548274370735890254</id><published>2011-01-10T23:24:00.000+05:30</published><updated>2011-01-10T23:24:09.498+05:30</updated><category scheme="http://www.blogger.com/atom/ns#" term="Collections"/><category scheme="http://www.blogger.com/atom/ns#" term="Sorting Objects"/><title type='text'>Sorting the objects using collections</title><content type='html'>&lt;div title=&quot;Throwable Object Real Expert Sorting the objects using Collections&quot;&gt;&lt;b&gt;We can implement using two following ways:&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;Way 1: &lt;/b&gt;&lt;br /&gt;
&lt;b&gt;&lt;i&gt;Step 1:&lt;/i&gt;&lt;/b&gt;&lt;br /&gt;
the object which supposed to sort in collection needs to be implements Comparable interface&lt;br /&gt;
For Ex: Object TestPOJO needs to be sort so that class looks like below:&lt;br /&gt;
&lt;br /&gt;
&lt;a name=&#39;more&#39;&gt;&lt;/a&gt;&lt;br /&gt;
public class TestPOJO implements Comparable&lt;br /&gt;
{&lt;br /&gt;
int id;&lt;br /&gt;
String code;&lt;br /&gt;
TestPOJO(int a, String b){&lt;br /&gt;
this.id=a;&lt;br /&gt;
this.code=b;&lt;br /&gt;
}&lt;br /&gt;
………..&lt;br /&gt;
Getters/setters…&lt;br /&gt;
}&lt;br /&gt;
&lt;i&gt;&lt;b&gt;Step 2:&lt;/b&gt;&lt;/i&gt; below this for Ascending order&lt;br /&gt;
Override the compareTo method&lt;br /&gt;
public int compareTo(Object obj)&lt;br /&gt;
{&lt;br /&gt;
int retVal = 0;&lt;br /&gt;
TestPOJO testPojo1 = (TestPOJO)obj;&lt;br /&gt;
if(testPojo1!=null )&lt;br /&gt;
{&lt;br /&gt;
if((testPojo1!= null) &amp;amp;&amp;amp; (this.getCode() != null))&lt;br /&gt;
{&lt;br /&gt;
retVal = this.getCode().compareTo(testPojo1.getCode());&lt;br /&gt;
}&lt;br /&gt;
}&lt;br /&gt;
return retVal;&lt;br /&gt;
}&lt;br /&gt;
&lt;i&gt;&lt;b&gt;Step 3:&lt;/b&gt;&lt;/i&gt;&lt;br /&gt;
The Main Class where you are sorting the list of objects:&lt;br /&gt;
List testPOJOList = new ArrayList();&lt;br /&gt;
TestPOJO obj1 = new TestPOJO(1,”SBI”);&lt;br /&gt;
TestPOJO obj2 = new TestPOJO(1,”ABN AMRO”);&lt;br /&gt;
TestPOJO obj3 = new TestPOJO(1,”ANB”);&lt;br /&gt;
TestPOJO obj4 = new TestPOJO(1,”KVB”);&lt;br /&gt;
TestPOJO obj5 = new TestPOJO(1,”SYN”);&lt;br /&gt;
TestPOJO obj6 = new TestPOJO(1,”SCB”);&lt;br /&gt;
&lt;br /&gt;
testPOJOList.add(obj1);&lt;br /&gt;
testPOJOList.add(obj2);&lt;br /&gt;
testPOJOList.add(obj3);&lt;br /&gt;
testPOJOList.add(obj4);&lt;br /&gt;
testPOJOList.add(obj5);&lt;br /&gt;
testPOJOList.add(obj6);&lt;br /&gt;
&lt;br /&gt;
if((testPOJOList!= null) &amp;amp;&amp;amp; (testPOJOList.size() &amp;gt; 0))&lt;br /&gt;
{        &lt;br /&gt;
Collections.sort(testPOJOList);&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;Way2:&lt;/b&gt;&lt;br /&gt;
Using anonymous class&lt;br /&gt;
For this way of implementation as in above step1, step 2: not required here.&lt;br /&gt;
&lt;br /&gt;
For Ex: Object TestPOJO needs to be sort so that class looks like below:&lt;br /&gt;
No need to implement comparable interface here.&lt;br /&gt;
public class TestPOJO &lt;br /&gt;
{&lt;br /&gt;
int id;&lt;br /&gt;
String code;&lt;br /&gt;
TestPOJO(int a, String b){&lt;br /&gt;
this.id=a;&lt;br /&gt;
this.code=b;&lt;br /&gt;
}&lt;br /&gt;
………..&lt;br /&gt;
Getters/setters…&lt;br /&gt;
}&lt;br /&gt;
Here we need to pass the Comparator object to the Collections.sort method and override the compare(obj,obj) method like below:&lt;br /&gt;
Collections.sort(testPOJOList, new Comparator() &lt;br /&gt;
{&lt;br /&gt;
public int compare(Object o1, Object o2) &lt;br /&gt;
{&lt;br /&gt;
TestPOJO test1 = (TestPOJO) o1;&lt;br /&gt;
TestPOJO test2 = (TestPOJO) o2;&lt;br /&gt;
&lt;br /&gt;
String d1 = (String) test1.getCode(); /////// line A&lt;br /&gt;
String d2 = (String) test2.getCode;   /////// line B&lt;br /&gt;
return d1.compareTo(d2);        ///////////// line C&lt;br /&gt;
}&lt;br /&gt;
}&lt;br /&gt;
);&lt;br /&gt;
In above way also we can use the first way:&lt;br /&gt;
Just replace the line A, Line B, Line c with below line&lt;br /&gt;
return test1.compareTo(test2);&lt;br /&gt;
And TestPOJO class should be implements Comparable interface and must override the compareTo(object) method.&lt;br /&gt;
&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://throwableobject.blogspot.com/feeds/3548274370735890254/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://throwableobject.blogspot.com/2011/01/sorting-objects-using-collections.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/9048812660891698443/posts/default/3548274370735890254'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/9048812660891698443/posts/default/3548274370735890254'/><link rel='alternate' type='text/html' href='http://throwableobject.blogspot.com/2011/01/sorting-objects-using-collections.html' title='Sorting the objects using collections'/><author><name>Unknown</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-9048812660891698443.post-594135964879407358</id><published>2010-12-21T23:44:00.002+05:30</published><updated>2010-12-21T23:45:49.357+05:30</updated><category scheme="http://www.blogger.com/atom/ns#" term="Production Issues"/><title type='text'>Production Issue search enhancement</title><content type='html'>&lt;div style=&quot;text-align: justify;&quot; title=&quot;Throwable Object Production Issue search enhancement&quot;&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot; title=&quot;Throwable Object Production Issue search enhancement&quot;&gt;&lt;b&gt;Issue history:&lt;/b&gt;&amp;nbsp;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot; title=&quot;Throwable Object Production Issue search enhancement&quot;&gt;added username to all custom search api’s queries. We must ignore username from search results.&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot; title=&quot;Throwable Object Production Issue search enhancement&quot;&gt;Changes done on common file’s method which all custom search api’s being used.&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot; title=&quot;Throwable Object Production Issue search enhancement&quot;&gt;&lt;b&gt;Issue raised: &lt;/b&gt;some custom search api’s missed out with out adding username.&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot; title=&quot;Throwable Object Production Issue search enhancement&quot;&gt;&lt;b&gt;Impact: &lt;/b&gt;required values also missed from search results of the custom search apis which doesn’t have username.&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot; title=&quot;Throwable Object Production Issue search enhancement&quot;&gt;&lt;b&gt;Severity:&lt;/b&gt; High&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot; title=&quot;Throwable Object Production Issue search enhancement&quot;&gt;&lt;b&gt;Priority:&lt;/b&gt; Top&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot; title=&quot;Throwable Object Production Issue search enhancement&quot;&gt;&lt;br /&gt;
&lt;a name=&#39;more&#39;&gt;&lt;/a&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot; title=&quot;Throwable Object Production Issue search enhancement&quot;&gt;&lt;b&gt;Solution Approach:&lt;/b&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot; title=&quot;Throwable Object Production Issue search enhancement&quot;&gt;While adding username to query keep alias name to the username.&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot; title=&quot;Throwable Object Production Issue search enhancement&quot;&gt;SELECT ‘LOGGED_USERNAME’ PROD_USER, …..FROM … WHERE….&amp;nbsp;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot; title=&quot;Throwable Object Production Issue search enhancement&quot;&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot; title=&quot;Throwable Object Production Issue search enhancement&quot;&gt;Changes were required in common file.While ignoring the username from the results checking the username included or not [resultSetMetaData.getColumName(i) ==’PROD_USER_ID’]. If not included keep the old code which populating search result. If included customize the search by ignoring username from the results.&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot; title=&quot;Throwable Object Production Issue search enhancement&quot;&gt;&lt;br /&gt;
&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://throwableobject.blogspot.com/feeds/594135964879407358/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://throwableobject.blogspot.com/2010/12/production-issue-search-enhancement.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/9048812660891698443/posts/default/594135964879407358'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/9048812660891698443/posts/default/594135964879407358'/><link rel='alternate' type='text/html' href='http://throwableobject.blogspot.com/2010/12/production-issue-search-enhancement.html' title='Production Issue search enhancement'/><author><name>Unknown</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-9048812660891698443.post-2212908354908807968</id><published>2010-12-21T23:37:00.000+05:30</published><updated>2010-12-21T23:46:33.296+05:30</updated><category scheme="http://www.blogger.com/atom/ns#" term="Oc4j"/><title type='text'>Getting OC4J Admin Console to work in OC4J 9 0 4</title><content type='html'>&lt;div style=&quot;text-align: justify;&quot; title=&quot;Throwable Object Getting OC4J Admin Console to work in OC4J 9 0 4 &quot;&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot; title=&quot;Throwable Object Getting OC4J Admin Console to work in OC4J 9 0 4 &quot;&gt;What you say? There&#39;s no management console with OC4J 9.0.4 standalone. Well yes, officially you are 100% correct. There is no supported management console for the 9.0.4 release.&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot; title=&quot;Throwable Object Getting OC4J Admin Console to work in OC4J 9 0 4 &quot;&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot; title=&quot;Throwable Object Getting OC4J Admin Console to work in OC4J 9 0 4 &quot;&gt;But ....&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot; title=&quot;Throwable Object Getting OC4J Admin Console to work in OC4J 9 0 4 &quot;&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot; title=&quot;Throwable Object Getting OC4J Admin Console to work in OC4J 9 0 4 &quot;&gt;With a little bit of configuration, you can get the prototype admin console we&#39;ve been using to test out a few things on the server side, up and running for OC4J 9.0.4 standalone. It&#39;s basically the same thing as the OC4J Admin Console that&#39;s configured out of the box in the OC4J 10.0.3 Developer Preview we have available now on OTN.&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot; title=&quot;Throwable Object Getting OC4J Admin Console to work in OC4J 9 0 4 &quot;&gt;&lt;/div&gt;&lt;a name=&#39;more&#39;&gt;&lt;/a&gt;Just to make it clear -- this is completely unsupported -- there&#39;s a chance that it may do something strange to your configuration which you may need to recover from.&lt;br /&gt;
&lt;div style=&quot;text-align: justify;&quot; title=&quot;Throwable Object Getting OC4J Admin Console to work in OC4J 9 0 4 &quot;&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot; title=&quot;Throwable Object Getting OC4J Admin Console to work in OC4J 9 0 4 &quot;&gt;But for those of you who want to do deployments, web application binding, configurations of datasources and user provisioning, it gives you a simple browser based interface to work with.&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot; title=&quot;Throwable Object Getting OC4J Admin Console to work in OC4J 9 0 4 &quot;&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot; title=&quot;Throwable Object Getting OC4J Admin Console to work in OC4J 9 0 4 &quot;&gt;To get it running do the following:&lt;/div&gt;&lt;div&gt;&lt;b&gt;1. Edit j2ee/home/config/application.xml and add the following lines:&lt;/b&gt;&lt;br /&gt;
&amp;lt;web-module id=&quot;admin_web&quot; path=&quot;../../home/applications/admin_web.war&quot;/&amp;gt;&lt;br /&gt;
&amp;lt;ejb-module id=&quot;admin_ejb&quot; path=&quot;../../home/applications/admin_ejb.jar&quot;/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This adds the OC4J Admin Console apps to the default application.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;2. Edit j2ee/home/config/http-web-site.xml and add the following line:&lt;/b&gt;&lt;br /&gt;
&amp;lt;web-app application=&quot;default&quot; name=&quot;admin_web&quot; root=&quot;/adminoc4j&quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
This binds the web module to the root path of /adminoc4j.&lt;br /&gt;
&lt;br /&gt;
When you save these files, OC4J should detect the config file changes and auto-deploy the admin* applications.&lt;br /&gt;
&lt;br /&gt;
Once the deployment has completed, you should be able to access the OC4J Admin Console using a URL of the form&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;a alt=&quot;Throwable Object Getting OC4J Admin Console to work in OC4J 9 0 4 &quot; href=&quot;http://localhost:8888/adminoc4j&quot;&gt;http://localhost:8888/adminoc4j&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;
The server side foundation layed by this work in the OC4J 9.0.4 release went on to become the JSR77/88 and JMX functional areas in the OC4J 10.0.3 release. &lt;br /&gt;
&lt;br /&gt;
Enter the user Credentials(from j2ee/home/config/jazn-data.xml) and click OK.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;jazn-data&amp;gt;&lt;br /&gt;
&amp;lt;!-- JAZN Realm Data --&amp;gt;&lt;br /&gt;
&amp;lt;jazn-realm&amp;gt;&lt;br /&gt;
&amp;lt;realm&amp;gt;&lt;br /&gt;
&amp;lt;name&amp;gt;jazn.com&amp;lt;/name&amp;gt;&lt;br /&gt;
&amp;lt;users&amp;gt;&lt;br /&gt;
&amp;lt;user&amp;gt;&lt;br /&gt;
&amp;lt;name&amp;gt;anonymous&amp;lt;/name&amp;gt;&lt;br /&gt;
&amp;lt;description&amp;gt;The default guest/anonymous user&amp;lt;/description&amp;gt;&lt;br /&gt;
&amp;lt;/user&amp;gt;&lt;br /&gt;
&amp;lt;user&amp;gt;&lt;br /&gt;
&amp;lt;name&amp;gt;admin&amp;lt;/name&amp;gt;&lt;br /&gt;
&amp;lt;display-name&amp;gt;OC4J Administrator&amp;lt;/display-name&amp;gt;&lt;br /&gt;
&amp;lt;description&amp;gt;OC4J Administrator&amp;lt;/description&amp;gt;&lt;br /&gt;
&amp;lt;credentials&amp;gt;!password&amp;lt;/credentials&amp;gt;&lt;br /&gt;
&amp;lt;/user&amp;gt;&lt;br /&gt;
&amp;lt;/users&amp;gt;&lt;br /&gt;
&amp;lt;roles&amp;gt;&lt;br /&gt;
&amp;lt;role&amp;gt;&lt;br /&gt;
&amp;lt;name&amp;gt;administrators&amp;lt;/name&amp;gt;&lt;br /&gt;
&amp;lt;display-name&amp;gt;Realm Admin Role&amp;lt;/display-name&amp;gt;&lt;br /&gt;
&amp;lt;description&amp;gt;Administrative role for this realm.&amp;lt;/description&amp;gt;&lt;br /&gt;
&amp;lt;members&amp;gt;&lt;br /&gt;
&amp;lt;member&amp;gt;&lt;br /&gt;
&amp;lt;type&amp;gt;user&amp;lt;/type&amp;gt;&lt;br /&gt;
&amp;lt;name&amp;gt;admin&amp;lt;/name&amp;gt;&lt;br /&gt;
&amp;lt;/member&amp;gt;&lt;br /&gt;
&amp;lt;/role&amp;gt;&lt;br /&gt;
&amp;lt;/roles&amp;gt;&lt;br /&gt;
&amp;lt;/realm&amp;gt;&lt;br /&gt;
&amp;lt;/jazn-realm&amp;gt;&lt;br /&gt;
&amp;lt;/jazn-data&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://throwableobject.blogspot.com/feeds/2212908354908807968/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://throwableobject.blogspot.com/2010/12/getting-oc4j-admin-console-to-work-in.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/9048812660891698443/posts/default/2212908354908807968'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/9048812660891698443/posts/default/2212908354908807968'/><link rel='alternate' type='text/html' href='http://throwableobject.blogspot.com/2010/12/getting-oc4j-admin-console-to-work-in.html' title='Getting OC4J Admin Console to work in OC4J 9 0 4'/><author><name>Unknown</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-9048812660891698443.post-3920291185590499985</id><published>2010-12-21T23:11:00.001+05:30</published><updated>2010-12-21T23:16:58.839+05:30</updated><category scheme="http://www.blogger.com/atom/ns#" term="Collections"/><title type='text'>Sorting the the List of Objects using Collections</title><content type='html'>&lt;div style=&quot;text-align: justify;&quot; title=&quot;throwable object Sorting the the List of Objects using Collections&quot;&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot; title=&quot;throwable object Sorting the the List of Objects using Collections&quot;&gt;A List l may be sorted as follows.&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot; title=&quot;throwable object Sorting the the List of Objects using Collections&quot;&gt;Collections.sort(l);&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot; title=&quot;throwable object Sorting the the List of Objects using Collections&quot;&gt;If the List consists of String elements, it will be sorted into alphabetical order. If it consists of Date elements, it will be sorted into chronological order. How does this happen? String and Date both implement the Comparable interface. Comparable implementations provide a natural ordering for a class, which allows objects of that class to be sorted automatically. &lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot; title=&quot;throwable object Sorting the the List of Objects using Collections&quot;&gt;&lt;b&gt;&lt;a name=&#39;more&#39;&gt;&lt;/a&gt;Way 1: &lt;/b&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot; title=&quot;throwable object Sorting the the List of Objects using Collections&quot;&gt;&lt;b&gt;&lt;i&gt;Step 1:&lt;/i&gt;&lt;/b&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot; title=&quot;throwable object Sorting the the List of Objects using Collections&quot;&gt;the object which supposed to sort in collection needs to be implements Comparable interface&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot; title=&quot;throwable object Sorting the the List of Objects using Collections&quot;&gt;For Ex: Object TestPOJO needs to be sort so that class looks like below:&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot; title=&quot;throwable object Sorting the the List of Objects using Collections&quot;&gt;&lt;pre&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;public class TestPOJO implements Comparable
{
 int id;
 String code;
 TestPOJO(int a, String b){
this.id=a;
this.code=b;
}
 ………..
 Getters/setters…
}&lt;/span&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot; title=&quot;throwable object Sorting the the List of Objects using Collections&quot;&gt;&lt;i&gt;&lt;b&gt;Step 2:&lt;/b&gt;&lt;/i&gt; below this for Ascending order&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot; title=&quot;throwable object Sorting the the List of Objects using Collections&quot;&gt;Override the compareTo method&lt;/div&gt;&lt;div style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace; text-align: justify;&quot; title=&quot;throwable object Sorting the the List of Objects using Collections&quot;&gt;&lt;pre&gt;public int compareTo(Object obj)
{
    int retVal = 0;
    TestPOJO testPojo1 = (TestPOJO)obj;
    if(testPojo1!=null )
    {
      if((testPojo1!= null) &amp;amp;&amp;amp; (this.getCode() != null))
      {
         retVal = this.getCode().compareTo(testPojo1.getCode());
      }
    }
    return retVal;
 }
&lt;/pre&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot; title=&quot;throwable object Sorting the the List of Objects using Collections&quot;&gt;&lt;i&gt;&lt;b&gt;Step 3:&lt;/b&gt;&lt;/i&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot; title=&quot;throwable object Sorting the the List of Objects using Collections&quot;&gt;The Main Class where you are sorting the list of objects:&lt;/div&gt;&lt;div style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace; text-align: justify;&quot; title=&quot;throwable object Sorting the the List of Objects using Collections&quot;&gt;&lt;pre&gt;List testPOJOList = new ArrayList();
TestPOJO obj1 = new TestPOJO(1,”SBI”);
TestPOJO obj2 = new TestPOJO(1,”ABN AMRO”);
TestPOJO obj3 = new TestPOJO(1,”ANB”);
TestPOJO obj4 = new TestPOJO(1,”KVB”);
TestPOJO obj5 = new TestPOJO(1,”SYN”);
TestPOJO obj6 = new TestPOJO(1,”SCB”);

testPOJOList.add(obj1);
testPOJOList.add(obj2);
testPOJOList.add(obj3);
testPOJOList.add(obj4);
testPOJOList.add(obj5);
testPOJOList.add(obj6);

if((testPOJOList!= null) &amp;amp;&amp;amp; (testPOJOList.size() &amp;gt; 0))
{        
    Collections.sort(testPOJOList);
}
&lt;/pre&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot; title=&quot;throwable object Sorting the the List of Objects using Collections&quot;&gt;&lt;br /&gt;
&lt;b&gt;Way2:&lt;/b&gt;&lt;br /&gt;
&lt;b&gt;&lt;i&gt;Using anonymous inner-class&lt;/i&gt;&lt;/b&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot; title=&quot;throwable object Sorting the the List of Objects using Collections&quot;&gt;For this way of implementation as in above step1, step 2: not required here.&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot; title=&quot;throwable object Sorting the the List of Objects using Collections&quot;&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot; title=&quot;throwable object Sorting the the List of Objects using Collections&quot;&gt;&lt;b&gt;For Ex:&lt;/b&gt; Object TestPOJO needs to be sort so that class looks like below:&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot; title=&quot;throwable object Sorting the the List of Objects using Collections&quot;&gt;No need to implement comparable interface here.&lt;/div&gt;&lt;div style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace; text-align: justify;&quot; title=&quot;throwable object Sorting the the List of Objects using Collections&quot;&gt;&lt;pre&gt;public class TestPOJO 
{
int id;
String code;
TestPOJO(int a, String b){
this.id=a;
this.code=b;
}
………..
Getters/setters…
}&lt;/pre&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot; title=&quot;throwable object Sorting the the List of Objects using Collections&quot;&gt;Here we need to pass the Comparator object to the Collections.sort method and override the compare(obj,obj) method like below:&lt;/div&gt;&lt;div style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace; text-align: justify;&quot; title=&quot;throwable object Sorting the the List of Objects using Collections&quot;&gt;&lt;pre&gt;Collections.sort(testPOJOList, new Comparator() 
{
public int compare(Object o1, Object o2) 
{
TestPOJO test1 = (TestPOJO) o1;
TestPOJO test2 = (TestPOJO) o2;

String d1 = (String) test1.getCode(); /////// line A
String d2 = (String) test2.getCode;   /////// line B
return d1.compareTo(d2);        ///////////// line C
}
}
);&lt;/pre&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot; title=&quot;throwable object Sorting the the List of Objects using Collections&quot;&gt;&lt;b&gt;&lt;i&gt;In above way also we can use the first way:&lt;/i&gt;&lt;/b&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot; title=&quot;throwable object Sorting the the List of Objects using Collections&quot;&gt;Just replace the line A, Line B, Line c with below line&lt;/div&gt;&lt;div style=&quot;background-color: white; color: blue; text-align: justify;&quot;&gt;return test1.compareTo(test2);&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot; title=&quot;throwable object Sorting the the List of Objects using Collections&quot;&gt;And TestPOJO class should be implements Comparable interface and must override the compareTo(object) method.&lt;br /&gt;
&lt;br /&gt;
The &lt;code&gt;compare&lt;/code&gt; method compares its two arguments, returning a negative integer, 0, or a positive integer depending on whether the  first argument is less than, equal to, or greater than the second.  If  either of the arguments has an inappropriate type for the &lt;code&gt;Comparator&lt;/code&gt;, the &lt;code&gt;compare&lt;/code&gt; method throws a &lt;code&gt;ClassCastException&lt;/code&gt;.&lt;br /&gt;
&lt;br /&gt;
If you try to sort a list, the elements of which do not implement &lt;code&gt;Comparable&lt;/code&gt;, &lt;code&gt;Collections.sort(list)&lt;/code&gt; will throw a &lt;a class=&quot;APILink&quot; href=&quot;http://download.oracle.com/javase/7/docs/api/java/lang/ClassCastException.html&quot; target=&quot;_blank&quot;&gt;&lt;code&gt;ClassCastException&lt;/code&gt;&lt;/a&gt;. Similarly, &lt;code&gt;Collections.sort(list, comparator)&lt;/code&gt; will throw a &lt;code&gt;ClassCastException&lt;/code&gt; if you try to sort a list whose elements cannot be compared to one another using the &lt;code&gt;comparator&lt;/code&gt;.  Elements that can be compared to one another are called &lt;i&gt;mutually comparable&lt;/i&gt;.  Although elements of different types may be mutually comparable, none of the classes listed here permit interclass comparison. &lt;br /&gt;
This is all you really need to know about the &lt;code&gt;Comparable&lt;/code&gt; interface if you just want to sort lists of comparable elements or to create sorted collections of them. The next section will be of interest to you if you want to implement your own &lt;code&gt;Comparable&lt;/code&gt; type.  &lt;br /&gt;
&lt;br /&gt;
&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://throwableobject.blogspot.com/feeds/3920291185590499985/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://throwableobject.blogspot.com/2010/12/sorting-the-list-of-objects-using.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/9048812660891698443/posts/default/3920291185590499985'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/9048812660891698443/posts/default/3920291185590499985'/><link rel='alternate' type='text/html' href='http://throwableobject.blogspot.com/2010/12/sorting-the-list-of-objects-using.html' title='Sorting the the List of Objects using Collections'/><author><name>Unknown</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-9048812660891698443.post-3842578448954974111</id><published>2010-12-21T02:10:00.003+05:30</published><updated>2010-12-21T23:20:45.529+05:30</updated><category scheme="http://www.blogger.com/atom/ns#" term="IO Streams"/><title type='text'>How to redirect the IO Streams</title><content type='html'>&lt;div style=&quot;text-align: justify;&quot; title=&quot;Throwable object How to redirect the IO Streams&quot;&gt;In Java IO streams are flows of data you can either read from, or write to. Streams are typically connected to a data source, or data destination, like a file, network connection etc.&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot; title=&quot;Throwable object How to redirect the IO Streams&quot;&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot; title=&quot;Throwable object How to redirect the IO Streams&quot;&gt;A stream has no concept of an index of the read or written data, like an array does. Nor can you typically move forth and back in a stream, like you can in an array, or in a file using RandomAccessFile. A stream is just a continuous flow of data. &lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot; title=&quot;Throwable object How to redirect the IO Streams&quot;&gt;&lt;br /&gt;
&lt;/div&gt;&lt;a name=&#39;more&#39;&gt;&lt;/a&gt;&lt;div style=&quot;text-align: justify;&quot; title=&quot;Throwable object How to redirect the IO Streams&quot;&gt;In Java IO streams are typically byte based. This means that you can either read bytes from, or write bytes to a stream. If you need to read / write characters (like Latin1 or UNICODE characters), you should use a Reader or Writer.&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;b&gt;OutputStream&lt;/b&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot; title=&quot;Throwable object How to redirect the IO Streams&quot;&gt;The class java.io.OutputStream is the base class of all Java IO output streams. If you are writing a component that needs to write output to a stream, try to make sure that component depends on an OutputStream and not one of its subclasses. &lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot; title=&quot;Throwable object How to redirect the IO Streams&quot;&gt;System.out is a static variable of the System class that holds a reference to a PrintStream used to channel output to the host system&#39;s console. System.err is also a PrintStream and System.in is an InputStream. When the Java runtime system starts up it automatically hooks-up these object references to the host system&#39;s output, error and input streams.&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot; title=&quot;Throwable object How to redirect the IO Streams&quot;&gt;The PrintStream and InputStream types used to interface with the host system are not subclasses of the System class, they are a subclasses of the java.io.OutputStream and InputStream hierarchy. Notably the PrintStream class never throws IOException, though you can use the checkError() method to discover any problems.&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot; title=&quot;Throwable object How to redirect the IO Streams&quot;&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot; title=&quot;Throwable object How to redirect the IO Streams&quot;&gt;The common technique of making print calls with System.out.println() gives the impression that println() may be a method of the System class but it is not, it is a method of the PrintStream class.&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;b&gt;To Disable the System.out.println writes in console while in production environments:&lt;/b&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot; title=&quot;Throwable object How to redirect the IO Streams&quot;&gt;&lt;img alt=&quot;throwable object How to redirect the IO Streams&quot; src=&quot;http://i1125.photobucket.com/albums/l587/prismvibgyor/cod1.png&quot; title=&quot;throwableobject How to redirect the IO Streams&quot; /&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot; title=&quot;Throwable object How to redirect the IO Streams&quot;&gt;&lt;b&gt;the following will disable the error/exception prints in console:&lt;/b&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot; title=&quot;Throwable object How to redirect the IO Streams&quot;&gt;&lt;img alt=&quot;throwable object How to redirect the IO Streams&quot; src=&quot;http://i1125.photobucket.com/albums/l587/prismvibgyor/cod2.png&quot; title=&quot;throwable object How to redirect the IO Streams&quot; /&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot; title=&quot;Throwable object How to redirect the IO Streams&quot;&gt;&lt;b&gt;To Enable the System.out.println writes in console while in development environments:&lt;/b&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot; title=&quot;Throwable object How to redirect the IO Streams&quot;&gt;&lt;img alt=&quot;throwable object How to redirect the IO Streams&quot; src=&quot;http://i1125.photobucket.com/albums/l587/prismvibgyor/cod3.png&quot; title=&quot;throwable object How to redirect the IO Streams&quot; /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://throwableobject.blogspot.com/feeds/3842578448954974111/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://throwableobject.blogspot.com/2010/12/how-to-redirect-io-streams.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/9048812660891698443/posts/default/3842578448954974111'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/9048812660891698443/posts/default/3842578448954974111'/><link rel='alternate' type='text/html' href='http://throwableobject.blogspot.com/2010/12/how-to-redirect-io-streams.html' title='How to redirect the IO Streams'/><author><name>Unknown</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry></feed>