Skip to main content

Posts

Prevent hot deployments memory leaks in Tomcat

Since we are mostly using Tomcat as App Container, it's making tough environment when deploying a patch or existing application without restarting tomcat server (Hot deployments) due to reaching the PermGen size due to memory leaks. Hence most of the cases we have to increase PermGen size more than required to deployed applications and it's wasting of memory in the system.  There is a solution for them to release PermGen size and let it clean by GC in JVM at hot deployment. Step 01: Include below dependency to pom.xml <dependency>               <groupId>se.jiderhamn.classloa der-leak-prevention</groupId>         <artifactId>classloader-leak-p revention-servlet</artifactId>   <version>2.2.0</version> </dependency> Step 02: Add listener to web.xml <listener>   <listener-class>se.jiderhamn.c lassloader.leak.prevention.Cla ssLoaderL...
Recent posts

Jboss 5.1.0_GA, Maven, Mysql, EJB3, JSF2 sample

I thought to write this because of no completed sample found with using above technologies. Environment JDK 1.6 Jboss-5.1.0.GA JSF2 Maven 3 EJB3 Note : Please copy the mysql connector jar to Jboss lib e.x. I copied mysql-connector-java-5.1.29.jar to jboss-5.1.0.GA/server/default/lib Clone the sample from github here git clone https://github.com/malithmeee/library.git Build the entire project and copy the library.ear to Jboss server. Try to access the web page using http://localhost:8080/library.web/home.jsf Note : Database needed to be created, and change properties in relevant files.

EJB3 Stateless Maven example with Jboss Application server

Step 1 : Download jboss 5.1 application server from below (Which supporting for JDK 1.6) http://jbossas.jboss.org/downloads Extract and start the Jboss server. Step 2 : Create sample maven project as below <?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0"          xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"          xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">     <modelVersion>4.0.0</modelVersion>     <groupId>ejb</groupId>     <artifactId>ejb-stateless</artifactId>     <version>1.0-SNAPSHOT</version>     <dependencies>         <dependency>             <gro...

Sample Web service and client creation using WSDL with Maven and JAX-WS

How to generate client via WSDL file By executing following command on linux bash command line, cloud be obtain the service port classes > wsimport -keep -verbose http://compA.com/ws/HelloService.wsdl -b binding.xml OR > wsimport -keep -verbose /home/malith/HelloService.wsdl -b binding.xml Note : The binding xml is need to avoid generating JAXB element contents ------ How to create web service By above code generation, we can obtain Interface class which contains the service bridge. We could be wright sample web service by implementing the interface by additionally adding teh @WebService annotation Create the sun-javaws.xml in WEB-INF folder to define web service mappings E.g. @WebService(name = "Hello_", targetNamespace = "http://www.examples.com/wsdl/HelloService.wsdl") public class HelloWebService implements HelloPortType {     /**      * @param firstName      * @return returns java.lang.String ...

Create clone of git project from existing code without do new clone

In this article, I will guide you how to create a clone of a existing project by using the already cloned code set which available in another computer. When you going to clone the project from remote repository, it's need to download the project form the remote. Trouble start if the project got more capacity and slow internet connections or temporary disconnection to clone new one. Step 01.  Go to the project location of code existing place by console. (I'm using linux terminal) Step 02. Execute following command at the project place. git archive --format zip --output /full/path/to/myproject.zip master Project code has exported to the myproject.zip, but not included the .git folder. Take both myproject.zip file and .git folder to another computer or another place of your computer Step 3. Extract the zip and copy the .git folder into it. Step 4. Go inside to the project and take git pull (If internet connection available). Now it's working as a newly clone...

Simple jQuery multiple file uploading manager

In following segment refers how to create dynamically add multiple files uploading fields in forms.  Copy and paste following code segment into html file. Then open it in a browser and try out the demo. (I have used the on-line reference for the jquery-1.10.1.min.js , else download it from http://jquery.com/download/ ) <html> <script src="http://code.jquery.com/jquery-1.10.1.min.js">     /**      * Above is for on-line reference for jQuery.      * If above is not worked, please download the jquery-1.10.1.min.js from here. http://jquery.com/download/      *      */ </script> <script type="text/javascript" xmlns="http://www.w3.org/1999/html">     $(document).ready(function () {         var counter = 2;         $("#addButton").click(function () {      ...

Struts2 Data Grid with Maven

In this document refers how to use Struts2 jQuery grid for view data set.  This is the project structure using maven of my example. (IDE Intellj Idea 12 ) Step 01. Start Struts2 project with maven builder. pom.xml : Need to add struts2 jquery plugin, grid plugin and json pluing as dependencies. <?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"          xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">     <modelVersion>4.0.0</modelVersion>     <groupId>com.struts2.gridExample</groupId>     <artifactId>Struts2GridExample</artifactId>     <packaging>war</packaging>     <version>1.0</version>     <name>...