Running Maven project within Eclipse on Tomcat

Running Maven project within Eclipse on Tomcat

Here is the simplest way of running a web application that uses Maven as the build tool, from within Eclipse.

This tutorial is based on the following software’s :

1. Java 1.6
2. Eclipse Juno (4.2) JEE Version
3. Maven 2 Eclipse Plugin ( Read this blog to know how to configure M2E Plugin )
4. Maven 3.0.3
5. Simple Hello World web application that uses Struts 2. You can download a simple Hello World app build using Maven from GitHub: Struts Hello World App

Assuming that Eclipse is pointed to a new work space and you have installed and configured M2E plugin correctly, here is what you need to do to import the Maven project and then run it on Tomcat:

Read More

Eclipse and M2E Plugin

Eclipse and M2E Plugin

If you are a Java developer and use the Eclipse JEE version as your primary IDE and your project is using Maven, you would have to install the Maven 2 Eclipse (M2E) plugin into Eclipse in order to integrate Eclipse with the Maven install on your machine.

This post will show you to install and configure the M2E plugin.

M2E can be installed via the Help -> Install New Software within Eclipse.

The update site url for the M2E plugin :

Once you have installed the M2E plugin and restarted Eclipse, ensure you configure the following, for Eclipse to be integrated with Maven correctly:

Read More

JEE6 : Dukes Forest Tutorial : Part 3

Once MySql database was setup and appropriate jdbc-connection-pool information was set-up (Refer to Part 2), I did run into a JAAS exception. When I started the application, it would start up fine, but when i tried to log in, using any of the users setup, it would show me the following stack-trace:

WARNING: WEB9102: Web Login Failed: Login failed: Failed file 
login for [email protected]
SEVERE: javax.servlet.ServletException: Exception thrown while attempting to authenticate for user: [email protected]
at org.apache.catalina.connector.Request.login(
at org.apache.catalina.connector.Request.login(
at org.apache.catalina.connector.RequestFacade.login(
at com.forest.web.UserController.login(
at com.forest.web.UserController$Proxy$_$$_WeldClientProxy.login(UserController$Proxy$_$$
at sun.reflect.GeneratedMethodAccessor253.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(
at java.lang.reflect.Method.invoke(
at com.sun.el.parser.AstValue.invoke(
at com.sun.el.MethodExpressionImpl.invoke(
at org.jboss.weld.util.el.ForwardingMethodExpression.invoke(
at org.jboss.weld.el.WeldMethodExpression.invoke(

Debugging this issue, I found that I had not created a Security Realm in the glassfish domain. Oracles’ documentation for this tutorial is excellent and found the following link that tells you exactly how to set up the security realm.

You could create the Security Realm via the glassfish admin application. But creating the realm using Ant as explained in the above link is the easiest way of doing it.

Read More

JEE6 : Dukes Forest Tutorial : Part 2

Out of the box, Dukes Forest tutorial is setup to use Java Derby as the database.

In order to use a different database, other than Derby, you will have to modify the jdbc-connection-pool setup in the glassfish-resources.xml file, which can be found under dukes-forest/dukes-store/setup folder.

You can find two different glassfist-resource.xml files, which have appropriate jdbc-connection-pool configurations for Derby & MySql databases, in the following location on GitHub:

You can replace the original glassish-resources.xml file with the contents of either of these two xml files and you would have switched from Derby to MySql or vice-versa.

The original code base does provide a dukes-forest-model.mwb (found under dukes-forest/entities/sql folder), which can be opened in MySQL Workbench and can be forward engineered to create an appropriate schema. I did create the initial DB via this method, but when i started the app, it did not work due to a DB related issue, which I had to resolve by adding a specific column to one particular table in the entire schema. Sorry, I have forgotten which table that was, but once that was fixed, i was able to run the full application without any issues.

Here is the dukes-forest-model.mwb and a sql script to create the entire forest schema, with test data, in a MySql database:

You should now be able to setup the DB using the SQL script, instead of the dukes-forest-model.mwb file and that should work without any issues. Do let me know if you run into any issues while running this script or the app.

Read More

How to get started with Git and GitHub

As you probably already know, Git is a distributed source control system created by Linus Torvalds. Yes, the same guy who gave us Linux operating system. There are lots of resources that explain very well what Git is and how to get started on it. So I will writing about that, but will provide you with a list resources that I have found so far, at the end of this post.

Read More