Skip to main content

Posts

Showing posts with the label Java

HTML5 support in JSF 2.2 with Bean Validation 1.1 (JavaEE 7)

In this post i will show the HTML5 Support given by JSF 2.2, Which is part of Java EE 7 Spec. Also how to integrate the Bean Validation 1.1 feature with help of CDI (Contexts and Dependency Injection) 1.1 spec. Before going the HTML5 support, my earlier posts on JSF, i used @ManagedBean annotation, because its part of Managed Bean Specification (Java EE 6). Another Reason i used Tomcat as a primary container, if i used Managed Bean Spec then its part of Mojjara implementation, so no need to add more CDI specific (Jboss Weld lib) lib to class-path. But from Java EE 7 on-wards, JCP community expand the CDI capabilities and make CDI as important spec in Java EE 7 and Managed Bean spec is deprecated in favor of CDI . so they recommend to use CDI wherever its possible. so our future all post to target the CDI. next post i will show how add the CDI capability to tomcat container.

Tomcat Clustering Series Part 5 : NginX as Load Balancer

Hi this is my fifth part of the  Tomcat Clustering Series . In this post we are going to discuss how to replace Apache httpd load balancer to Nginx as a load balancer.  [Check the video below for better understanding] Hi i finished Tomcat Clustering Series . In these series we have 2 big setups needed for Tomcat Clustering Setup and configure the Load Balancer Configure the Session Replication in Tomcat. In first setup, we configure the Load Balancer using Apache httpd web server. Its open source and widely used. Second setup is session replication in Tomcat through modify/add <cluster> tag in server.xml file. These tomcat instance may run on single machine or different machine. In our Tomcat Clustering Series , the big part is configure the Load balancer (Apache httpd web server). Because there are lots of steps are involved Install the Apache httpd web server from either source or repo Compile and install the mod_jk connector Create the workers.pr

Tomcat Clustering Series Part 4 : Session Replication using Backup Manager

Hi this is my fourth part of the  Tomcat Clustering Series . In this post we are going to discuss the how to setup session replication using Backup Manager in tomcat clustering environment. Session replication makes High availability and full fail-over capability to our clustering environment. [Check the video below for better understanding] Its continuation of the last post (session replication using Delta Manager) . In delta manager each tomcat instance need to replicate the session information to all other tomcat instances. Its take more time and replication if our cluster size is increased. so there is alternative manager is there. Its Backup Manager. Backup Manager is replicate the copy of session data to exactly one other tomcat instances. This big difference between both managers. here which tomcat creates that is primary copy of the session. and another tomcat whose hold the replicate session is backup copy . If any one of the tomcat is down. back up tomcat serve the ses

Tomcat Clustering Series Part 3 : Session Replication

Hi this is my third part of the  Tomcat Clustering Series . In this post we are going to discuss the how to setup session replication in tomcat clustering environment. Session replication makes High availability and full fail-over capability to our clustering environment. [Check the video below for better understanding] In my previous post we discussed about setup simple load balancer and how to make session affinity concepts. How to setup Session Replication in tomcat    before going to session replication we need to understand 2 important concepts Multicast Session Manager in Tomcat Multicast       Multicast is To transmit a single message to a select group of recipients. here multicast used by tomcat cluster to identify the instances those part of cluster.  There is 2 types of cluster Static Tomcat Cluster Dynamic Tomcat Cluster In static cluster there is no need multicast, because each tomcat we statically defined/configured the other instances. Bu

Tomcat Clustering Series Part 2 : Session Affinity Load Balancer

Hi this second part of the  Tomcat Clustering Series . In my first part we discuss about how to setup simple load balancer. and we seen how load balancer distribute the request to tomcat instance in round robin fashion. [Check the video below for better understanding] In this post we discuss about what is the problem is occur in simple load balancer when we introduce sessions in our web application. and we will see how to resolve this issue. Its continuation of my first part of this series. so kindly go read my first part then continue here. How Session works in Servlet/Tomcat?        Before going into problem, let see the session management in Tomcat . If any if the page/servlet create the session then Tomcat create the Session Object and attached into group of session (HashMap kind structure) and that session can identify using session-id, its just random number generated through any one of the hash algorithm. then respond to client with cookie header field. That cookie

Tomcat Clustering Series Part 1 : Simple Load Balancer

I am going to start new series of posts about Tomcat clustering . In this first post we will see what is problem in normal deployment in only single machine, what is clustering and why is necessary and how to setup the simple load balancer with Apache httpd web server + Tomcat server cluster. [Check the video for better understanding] Why need Clustering? (Tomcat Clustering)            In normal production servers are running in single machine. If that's machine may be failed due to crashed or hardware defects or OutOfMemory exception then  our site can't access by anybody. so how to solve this problem? . to add more tomcat machine to collectively (group/cluster) run as a production server. (oppose of single machine). Each tomcat has deployed the same web application. so any tomcat can process the client request. If one tomcat is failed, then other tomcat in the cluster to proceeds the request. Here one big problem is arrive. each tomcat instances are running in de

Integrate Charts in Jasper Reports +JSF 2.0

In this post we will walk through how to integrate Charts (JFreeChart) into Jasper Report framework. JasperReports is the world's most popular open source reporting engine. It is entirely written in Java and it is able to use data coming from any kind of data source and produce pixel-perfect documents that can be viewed, printed or exported in a variety of document formats including HTML, PDF, Xlsx, Docx, Pptx, Odf Check my  Introduction to Jasper Reports and  Sub-report with jasper Report posts. 2-ways to Integrate the Charts/Graphs into Jasper Reports Use JFreeChart API inside Jasper Report to generate the Charts while generating reports Use any 3rd party Java Libraries to create the chart and stored in In-memory Image object (or) stored in file. then pass the Image/file to Jasper Report. then embed the Image into Report. (check here ) In this post we going to use 1st option. In Jasper Report use JFreeChart Components to make charts. In my next post we will see the

Beware of SQLInjection in Java Application

Hi In this post we will discuss what is SQL Injection attack. and how its may affect ur any  web application its use the backend database. Here i concentrate on java web application. Open Web Application Security Project(OWAP) listed that SQL Injection is the top vulnerability attack for web application. Hacker's they Inject the SQL code in web request to the web application and take the control of backend database, even that backend database is not directly connected to internet. And we will see how to solve and prevent the SQL Injection in java Web Application. For this purpose we need 1 tools. these tool are completely open source. SQL Map - SqlMap is an open source penetration testing tool that automates the process of detecting and exploiting SQL Injection. we can get it from here . SQLInjection       SQL injection is the technique to extract the database information through web application. Scenario: we have one database server [MySQL] and web application ser