This article demonstrates the use of Appfuse to develop the open source J2EE application using latest state of art technologies like JSF, Spring MVC, Tapestry 5, Struts 2 and Web Services ,Hibernate etc using databases like MySQL, Oracle, PostgresSQL etc using Maven.
J2EE application has lot of pieces into it including leading Front end technologies like JSF, Spring MVC, Struts2, Tapestry5 ,O/R framework like Hibernate, iBatis etc. It also includes boilerplate code to connect database like MySQL, Oracle ,PostgresSQL etc and configure with O/R framework like Hibernate and create a build file to deploy it to the web server or application server like Jetty, Tomcat , Glassfish ,Weblogic and Websphere. Also it needs build file and continuous integration and build script like Maven. This article demonstate the use of AppFuse architecture to integrate all these application to generate the project skeleton so that we can work on top of it without concerning about how every piece fits with one another.
Also it manages the multiple versions of java archive (JAR) files using POM architecture of Maven.
I assume the person who are reading this article can install JDK,MqSQL and Maven own their own. If not please visit their site to get the latest version of those software and get it up and running. Here are the links for downloading them.
Maven is the main tool we are using for the project stub skeleton generation so I want to make sure you have the correct version. Please issue the command as shown in picture below and make sure you have it up and running. Also I recommend you set MAVEN_HOME environment variable so that you can run this command from anywhere.
Also make sure you have latest JDK installed in your machine. I recommend that you set JAVA_HOME environment variable and import it in PATH so that you can run from anywhere.
After this you need to use AppFuse to set project architecture. Please visit this AppFuse link to choose the technologies you want and create the project archetype which are nothing but your project name and package structure you want. Also you can choose Struts Spring as your web layer for this demo purpose I am choosing JSF. Please see the diagram below.
Please go to the folder where you want your code to be generated. Then copy these generated commands open terminal in that folder and paste it there. For my demo the archetype will look like this:
mvn archetype:generate -B -DarchetypeGroupId=org.appfuse.archetypes -DarchetypeArtifactId=appfuse-basic-jsf-archetype -DarchetypeVersion=2.1.0 -DgroupId=codeissue.appfuse.demo -DartifactId=webservice -DarchetypeRepository=http://oss.sonatype.org/content/repositories/appfuse
After running this command you will see web service folder created and successful build in the command line as shown below.
Now in order to deploy this application you need to issue opens this file and provide MySQL database connection information like username password and the database name.
This is how my default file looks like before making the changes which are last 13 lines from the generated pom.xml file. The only information I changed here are my database password, database port and the database name that I am going to use which is straight forward change.
After this step we are done let’s start our web server Jetty and see our application in action.
Please issue this command in after going inside the web service directory that was generated where pom.xml file resides.
This diagram says that Jetty was started successfully on port 8080.
Please use username/password admin/admin to login to this page http://localhost:8080/login
Now you are at the point where you have fully fledged deployed successfully and running. It just took me 5 minutes since I have MySQL, JDK and Maven already up and running. Installing those and get it up and running should take you less than 15 minutes.
This article demonstrates how you can integrate different open source J2EE compliant web applications using AppFuse in very short interval of time. Please free to send me your comments through this website or my personal email email@example.com . I would love to hear your comments and suggestions regarding this article.