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 [email protected]
SEVERE: javax.servlet.ServletException: Exception thrown while attempting to authenticate for user: [email protected]
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

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:

https://github.com/AnilkumarGT/JEE6/tree/master/dukes-forest/dukes-store/setup

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:
https://github.com/AnilkumarGT/JEE6/tree/master/dukes-forest/DB_Scripts

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

Design Mindset

Design Mindset

As any experienced technologist will tell you, moving from being a module lead role, focused on implementing a given design or designing and implementing a module of a large system, to a technical lead or solution architect role, being responsible for the design of an entire system is quite a challenge. One needs breadth of various design aspects to along with the depth of technical knowledge in order to tackle bigger challenges.

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

JEE Architecture

JEE Architecture

This course gives a broad overview of the JEE Components, with emphasis on ‘What’ and ‘Why’ behind each of the component(s), rather than ‘How’ to build that component. It discusses various architectures that are feasible using the JEE components, the role of open source frameworks and illustrates a few commonly used JEE specific architecture and architectures with open source software.

This course will talk various Transaction Management models that exists and how to choose and design an application with an appropriate Transaction Management Model.

1. Role played by Web Server, Application Servers
2. JEE Components Overview : Servlet, JSP’s, JDBC, EJB’s, JMS, JMX, JAX-WS, JAX-RS, JSF, JPA
3. Open Source Frameworks and their role in JEE Architectures
4. Case Studies : Architectures using pure JEE Components and architectures using JEE components with Open Source Frameworks
5. Transaction Management Model
6. Transaction Management using EJB’s and Spring AOP
1 Day Instructor Led Training Session (ILT)
1. Should have about 3-5 years of development experience and should have worked on mid to large enterprise applications.
2. Should have a good level of knowledge in web / enterprise application design
3. Should be aware of the capabilities of web servers / application servers
4. Should have had good development exposure to JEE Components

Contact us to know more

Read More