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: com.sun.enterprise.security.auth.login.common.LoginException: Login failed: Failed file 
login for admin@example.com.
SEVERE: javax.servlet.ServletException: Exception thrown while attempting to authenticate for user: admin@example.com
at org.apache.catalina.connector.Request.login(Request.java:1969)
at org.apache.catalina.connector.Request.login(Request.java:1900)
at org.apache.catalina.connector.RequestFacade.login(RequestFacade.java:1146)
at com.forest.web.UserController.login(UserController.java:63)
at com.forest.web.UserController$Proxy$_$$_WeldClientProxy.login(UserController$Proxy$_$$_WeldClientProxy.java)
at sun.reflect.GeneratedMethodAccessor253.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:601)
at com.sun.el.parser.AstValue.invoke(AstValue.java:254)
at com.sun.el.MethodExpressionImpl.invoke(MethodExpressionImpl.java:302)
at org.jboss.weld.util.el.ForwardingMethodExpression.invoke(ForwardingMethodExpression.java:39)
at org.jboss.weld.el.WeldMethodExpression.invoke(WeldMethodExpression.java:50)
....
....

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.
http://docs.oracle.com/javaee/6/tutorial/doc/glnqp.html#glxaq

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

Spring Framework

Spring Framework

Spring Framework, an open source application framework and an Inversion of Control container, is one of the most popular application development framework for enterprise Java. Originally designed by Rod Johnson to address some of the limitations of the J2EE components, Spring offers a modular programming approach for building enterprise applications on top of the Java EE platform.

Read More