Java EE 6 Sample Application on WebLogic 12c: Conference Planner (TOTD #176)


Oracle WebLogic 12c provide a Java EE 6 Full Platform compliant application server. During the launch event last year, a Java EE 6 application was shown that demonstrated all the features of Java EE 6. This application allows conference organizers to publish details about their conference such as tracks, sessions, and speakers. It also allows attendees to register for the conference and prepare their schedule. The application is built as a typical 3-tier Java EE 6 application using JavaServer Faces (with PrimeFaces widgets) for the front-end, Enterprise JavaBeans for the middle tier business logic, and Java Persistence API for connectivity with the database.

This Tip Of The Day (TOTD) shows how to deploy the application on WebLogic 12c.
  1. Check out the application from svn.java.net/svn/glassfish~svn/branches/arun/ConferencePlanner/trunk/ or download the source bundle.
  2. Download and install Apache Derby. If you are using JDK7 then it comes bundled with Derby and installed in directory (/Library/Java/JavaVirtualMachines/1.7.0.jdk/Contents/Home/db). Any other database can be used as well but the instructions will differ accordingly.
    1. Create "derby.properties" file in the main directory of and specify the following content:

      #
      derby.user.sa=sa

      This creates a user "sa" with the password "sa".
    2. Start the database by invoking the "bin/startNetworkServer" script.
    3. Copy "derbyclient.jar" to "mydomain/lib" directory and restart the server by using "mydomain/startWeblogic.sh" script.
    4. Create and populate the database by invoking the interactive SQL scripting tool "bin/ij". Specify the location of the SQL from the application as shown.
      ./ij
      ij version 10.8
      ij> driver 'org.apache.derby.jdbc.ClientDriver';
      ij> connect 'jdbc:derby://localhost:1527/cp;ServerName=localhost;databaseName=cp;user=sa;password=sa;create=true';
      ij> run '/Users/arungup/code/workspaces/arun/ConferencePlanner/trunk/src/main/sql/javaone-sf-2011.sql';
      ij> . . .
      1 row inserted/updated/deleted
      ij> exit;
  3. Download, unzip, and configure WebLogic 12c as described in TOTD #174. Here is my simple script that performs all the steps required:
    mkdir 12c
    cd 12c
    export CLASSPATH=/Users/arungup/tools/db-derby-10.8.2.2-bin/lib/derbyclient.jar
    unzip ~/Downloads/wls1211_dev.zip export JAVA_HOME=/System/Library/Frameworks/JavaVM.framework/Versions/1.6/Home ./configure.sh . $MW_HOME/wlserver/server/bin/setWLSEnv.sh cd .. mkdir mydomain cd mydomain $JAVA_HOME/bin/java $JAVA_OPTIONS -Xmx1024m -XX:MaxPermSize=256m weblogic.Server

    Notice, here we are explicitly including "derbyclient.jar" in the  CLASSPATH. This will ensure that Derby database's JDBC driver is available to WebLogic Administration Console which was not able to pick up JAR files from "mydomain/lib" directory otherwise.
  4. Access WebLogic Admin Console at localhost:7001/console, the login/password used in TOTD #174 is admin/admin007.
  5. Create a JDBC data source
    1. Click on "Data Sources" as shown.


    2. Click on "New" and select "Generic Data Source" as shown.

    3. Specify the values as shown.



      The JDBC resource name is "jdbc/cp" and the database is "Derby".
    4. Change the "Database Driver" to "Derby's Driver (Type 4) Versions: Any" and click on "Next". Make sure to not choose Type 4 XA driver which is the default.
    5. Take the defaults and select "Next".
    6. Specify the connection properties as shown.



      And click on "Next".
    7. Click on "Test Configuration" to make sure that every thing is configured correctly. Make sure to see the message "Connection test succeeded.". Verify the defaults and click on "Next".
    8. Select the target "myserver" as shown



      and click on "Finish".
  6. Deploy the application
    1. In the localhost:7001/console, click on "Home" (at the top center) and then "Deployments".


    2. Click on "Install".
    3. Specify the location of the WAR file as shown



      Make sure to pick the WAR file by selecting the radio button and click on "Next".
    4. Take the defaults and click on "Next".
    5. Take the defaults again and click on "Next". Notice that "myserver" is chosen as the target of deployment.
    6. Click on "Finish". After the application is deployed the console shows the following snapshot:


  7. Access the application at localhost:7001/ConferencePlanner to see the output as:



Feel free to browse through the source code!

Download WebLogic and play with it! Screencast #39 explains how to build a more comprehensive Java EE 6 application using NetBeans and WebLogic.
Comments:

Hi,

Nice tutorial. Tell me one thing how I can get the WAR file.

Posted by Vidyadhar on May 20, 2012 at 12:48 AM PDT #

"mvn package" in the source bundle will build the WAR file.

Arun

Posted by Arun Gupta on May 21, 2012 at 09:39 AM PDT #

Do you have same tutorial on Java EE 7

Posted by guest on July 12, 2013 at 07:48 PM PDT #

Yes, Java EE 7 tutorial is available at:

http://docs.oracle.com/javaee/7/tutorial/doc/home.htm

Posted by Arun Gupta on July 17, 2013 at 05:19 AM PDT #

Post a Comment:
Comments are closed for this entry.
About

profile image
Arun Gupta is a technology enthusiast, a passionate runner, author, and a community guy who works for Oracle Corp.


Java EE 7 Samples

Stay Connected

Search

Archives
« April 2014
SunMonTueWedThuFriSat
  
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
   
       
Today