Saturday, February 5, 2011

JEE6 Tutorial for a Distributed Enterprise Application incorporating EJB 3.1, JPA 2.0, JSF 2.0, Servlet 3.0 and JAX-RS on Oracle GlassFish Server 3.1

20110209: This tutorial has widened in scope and is being developed at the following URL.
http://wiki.eclipse.org/EclipseLink/Examples/Distributed

    This tutorial describes the analysis, design, implementation and deployment of a distributed JEE6 application that makes use of the EJB 3.1, JPA 2.0, JSF 2.0, Servlet 3.0 and JAX-RS API implemented as part of the Oracle GlassFish Server 3.1 distribution.  The Java IDE used for this tutorial is the tightly integrated SUN NetBeans 7.0 release that will be in beta until April 2011.

Technology Summary:
    Normally we do not decide on what APIs will be in use before we analyse the requirements.  However, here is the list of technologies we are using - as we finalize the implementation.

Problem:
    The Collatz conjecture or (3n + 1) problem is currently not proved.  There have been attempts at verifying collatz up to 2^61 - however, massive amounts of scalar processing power is required to do this because the problem is non-linear and therefore must be brute force simulated even with optimizations.

    The algorithm is as follows for the set of positive integers to infinity.
  • odd numbers are transformed by 3n + 1
  • even numbers are divided by 2
    If you think in base 2, we see that for odd numbers we shift bits to the left, add the number to the result and set bit 0.   For even numbers we shift bits to the right.  We therefore have a simplified algorithm as follows.
  • odd: next binary = number << 1 + number + 1
  • even: next binary = number >> 1

    Observation 1: the maximum value remains at or around 2x the number of bits in the start number - at least so far in my own simulations up to 640 billion. 

    We stop iteration and record the max path and max value when the sequence enters the 4-2-1 loop after the first 1 is reached.  This sequence must be simulated for all positive integers up to the limit of the software being used.  Fortunately, in Java (and .NET3) we can use BigInteger which supports unlimited length integers - as we would quickly overflow using a 64 bit long as soon as we started iterating numbers over 32 bits.

    Observation 2: I have determined - via a week of simulation distributed among 16 different machines in parallel  - that we will need native computation. 

Requirements:

Analysis:

Use Cases:

Design:

Data Model:
    The following UML class diagram details the data model for the business objects.  We will be using JPA entities and mappedsuperclass artifacts.
Figure 1-1: UML Class Diagram - Data Model


Implementation:

Deployment:

References:


/ Michael O'Brien 20110205

Wednesday, February 2, 2011

JSF 2.0 on JEE6 GlassFish 3.1 (PrimeFaces) and JEE6 WebLogic 12c

Oracle WebLogic Server 12c is an excellent full featured Java EE 6 compliant application server suitable for development and production.  In this tutorial I will details how to get a Java EE application running on WebLogic 12c using JSF 2.0, JPA 2.0 (using the EclipseLink 2.5 provider) on top of any database like Derby 10.8.

Install OEPE for WebLogic 12c
Deploy JSF shared library
Create EAR, EJB, Model and Web Eclipse projects


Configuration:
Add JSF facet and capabilities


add to weblogic.xml
    <wls:library-ref>
        <wls:library-name>jsf</wls:library-name>
        <wls:specification-version>2.0</wls:specification-version>
        <wls:exact-match>true</wls:exact-match>
    </wls:library-ref>


Upgraded the default EclipseLink 2.3.2 provider to the latest EclipseLink 2.5 to take advantage of the new features in 2.5 that don't require container changes - like JPA-RS in http://wiki.eclipse.org/EclipseLink/Development/2.4.0/JPA-RS/REST-API.


change from EclipseLink 2.3.2
[EL Info]: 2013-04-07 18:59:12.282--ServerSession(14413904)--Thread(Thread[[ACTIVE] ExecuteThread: '0' for queue: 'weblogic.kernel.Default (self-tuning)',5,Pooled Threads])--EclipseLink, version: Eclipse Persistence Services - 2.3.2.v20111125-r10461

by modifying the library jar in the modules directory.
in your $Weblogic\wls12110\modules dir
ignore org.eclipse.persistence_2.0.0.0_2-3.jar
but overwrite
javax.persistence_2.0.0.0_2-0.jar
with
eclipselink.jar
from
http://www.eclipse.org/eclipselink/downloads/milestones.php

After restarting Eclipse OEPE and Weblogic 12c we see the latest version of EclipseLink

[EL Info]: 2013-04-07 19:09:23.109--ServerSession(18669924)--Thread(Thread[[ACTIVE] ExecuteThread: '9' for queue: 'weblogic.kernel.Default (self-tuning)',5,Pooled Threads])--EclipseLink, version: Eclipse Persistence Services - 2.5.0.v20130403-740364a
[EL Info]: 2013-04-07 19:09:23.109--ServerSession(18669924)--Thread(Thread[[ACTIVE] ExecuteThread: '9' for queue: 'weblogic.kernel.Default (self-tuning)',5,Pooled Threads])--Server: 12.1.1.0


Enabling JSF 2.0 on WebLogic 10.3.5.0

<14-Jan-2014 3:25:43 o'clock PM EST> <Notice> <WebLogicServer> <BEA-000360> <Server started in RUNNING mode>
14-Jan-2014 3:26:04 PM com.sun.faces.config.ConfigureListener contextInitialized
INFO: Initializing Sun's JavaServer Faces implementation (1.2_03-b04-FCS) for context '/console'
14-Jan-2014 3:26:05 PM com.sun.faces.config.ConfigureListener contextInitialized
INFO: Completed initializing Sun's JavaServer Faces implementation (1.2_03-b04-FCS) for context '/console'

after deploying a JSF 2.0 war
14-Jan-2014 3:40:12 PM com.sun.faces.config.ConfigureListener contextInitialized
INFO: Initializing Mojarra 2.0.4 (FCS b05) for context '/WeblogicWeb'
<14-Jan-2014 3:40:14 o'clock PM EST> <Notice> <WebLogicServer> <BEA-000360> <Server started in RUNNING mode>
14-Jan-2014 3:40:15 PM com.sun.faces.config.ConfigureListener contextInitialized
INFO: Initializing Mojarra 2.0.4 (FCS b05) for context '/console'
14-Jan-2014 3:40:15 PM com.sun.faces.config.ConfigureListener contextInitialized
INFO: Completed initializing Mojarra (2.0.4 (FCS b05)) for context '/console'

Upgrading a WebLogic 10.3.5 cluster to 12.1.2 - WebLogic 12c

This section details issues surrounding an upgrade of WebLogic 10.3.5 past 10.3.6 and 12.1.1 to 12.1.2.

References

http://docs.oracle.com/middleware/1212/wls/WLDCW/intro.htm
http://docs.oracle.com/middleware/1212/wls/WLSRN/issues.htm#BCFHBHDD
http://docs.oracle.com/middleware/1212/wls/WLUPG/compat.htm
http://docs.oracle.com/middleware/1212/wls/WLUPG/upgrade_dom.htm#WLUPG388




Tuesday, February 1, 2011

JEE6 : Java Enterprise Edition 6 changes

JEE6 has been released.  Here are some of the highlights of the new version of the API.


1) JPA (Java Persistence API) 2.0 (JSR-317)
CDI (Contexts and Dependency Injection) (JSR 299)
- including Servlet 3.0 where
- web.xml is optional but still overrides the new annotations like @WebServlet
- new init() method annotations (existing on other components) - @PostConstruct and
- new WebProfile deployment model
2) DI (Dependency Injection) for Java (JSR 330)
3) Bean Validation (JSR 303)
4) JAX-RS (RESTful Web Services) (JSR 311)
5) JSF (Java Server Faces) 2.0 (JSR 314)
6) EJB (Enterprise Java Beans) 3.1 (JSR 318) and EJB Lite




Oracle GlassFish 3.1

Oracle WebLogic 10.3.4.0
- See procedure on enabling container managed JPA 2.0 applications on WebLogic 10.3.4.0
http://wiki.eclipse.org/EclipseLink/Development/JPA_2.0/weblogic

Total Pageviews

Followers