Saturday May 19, 2012

JEEConf 2012 Trip Report




600+ participants, 3 days, 4 concurrent tracks, 28 sessions, 3 workshops, 30+ speakers - a quick summary of JEEConf 2012.

This is second year of the conference and they've grown >50% from last year. This is the only major Java conference in Ukraine and there is a huge demand for Java speakers in this region. Even though the conference started with a focus on enterprise Java but has diversified into broader Java ecosystem covering Play, Gradle, Hazelcast, Scala, Hadoop, Cassandra, and other topics.

I gave a talk on Java EE 7: Developing for the Cloud to about 400+ developers. I used the newly refreshed slide deck with tons of code samples from different technologies such as JAX-RS 2.0, JPA 2.1, and Bean Validation 1.1. The slide deck is available.




I had the opportunity to spend some time with Yakov Fain, a Java Champion, who gave two day-long workshops on Java EE 6 and JavaScript. I also spent some time with Ruslan, CEO of Jelastic and thanked them for their continued support of GlassFish. The local JUG is not active but I learned about Club of Anonymous Developers where geeks meet couple of times a month to talk about different technologies. If you live in the local region, then consider joining this group and learn/share your experience.

Thank you Nikolai and Alexsey for taking the lead on running a Java conference in Ukraine. I hope to be back next year!

Here are some pictures captured from the trip ...












I also managed to run in the streets of Ukraine:



And now the complete photo album


Next and last stop in this trip, Java Developer Day, Johannesburg ...

Friday May 18, 2012

Geecon 2012 Trip Report


What moved the Java world in Poland ? About 600 participants, 60+ sessions, 45+ speakers, and 3 days at Geecon!

This was my first time at the conference and they kept me busy :-) I've delivered the self-paced Java EE 6 hands-on lab multiple times all around the world, but this is the first time where I used the content to demonstrate the simplicity and ease-of-use of the platform in a code-driven session. The 2 hrs were entertaining with constant interaction from about 50+ attendees. The lab material can be downloaded from here anyway.

Then right after I gave a talk on Java EE 7: Developing for the Cloud. This talk gave an introduction to the upcoming Java EE 7 platform to about 50 attendees. And I refreshed the slide deck with tons of code samples from different technologies such as JAX-RS 2.0, JPA 2.1, and Bean Validation 1.1 that have released their early drafts so far. The slide deck is available.


Pete Muir also helped me provide a more thorough insight into Contexts & Dependency Injection 1.1.

The talk on JAX-RS 2.0 had about 100+ attendees where I gave an introduction to JAX-RS, explained the motivation behind upcoming features, and showed code samples of how the API is evolving. The slide deck is available here.


And finally the last talk shared our experience of building a PaaS platform using GlassFish, the slides are available.


This talk explained the internals of GlassFish and how Orachestration Engine, Service Provisioning Engine, IaaS Management Service, and Cloud Elasticity Manager work together to provide a Java EE 7-based PaaS environment.

Overall, the movie theater-style seating worked well and the technical crew knew their job very well. The volunteers were very prompt in showing the time remaining which was helpful. Everybody in the conference team gave a very welcome feeling which certainly wants me to go back there again next year (provided they accept my submissions ;-) Thank you AdamD (Poznan JUG leader and conference organizer), AdamP, Adrian, Marcin, Lukasz, and everybody else for a great show!

The speakers' dinner was in the old part of the town and I enjoyed sharing stories with Gavin King, Pete Muir, Stephane Eperdaud, Anton Arhipov, Joonas Lehtinen, and many others.

Here are some pictures captured from the trip ...












And the complete album


Next stop JEEConf ...

Tuesday May 15, 2012

JSON-P: Java API for JSON Processing (TOTD #178)


JSR 353 is Java API for JSON Processing (JSON-P) and will define an API to process (e.g. parse, generate, transform, and query) JSON. This JSR will be delivered as part of Java EE 7. The API will allow to produce and consume JSON in a streaming fashion (StAX equivalent in XML world) and build a Java object model for JSON (DOM equivalent in XML world). Note, binding JSON to Java objects and vice versa is not part of the scope of this JSR.

json-processing-spec.java.net is where all the specification work is happening and jsonp.java.net is the project for the  Reference Implementation. Its still early days but this Tip Of The Day (TOTD) will explain how to get started. The workspace can be checked out as

git clone git://java.net/jsonp~git
Cloning into jsonp~git...
remote: Counting objects: 313, done.
remote: Compressing objects: 100% (218/218), done.
remote: Total 313 (delta 110), reused 0 (delta 0)
Receiving objects: 100% (313/313), 64.13 KiB, done.
Resolving deltas: 100% (110/110), done.

Building the workspace require JAVA_HOME to be set (/Library/Java/JavaVirtualMachines/1.7.0.jdk/Contents/Home or /System/Library/Frameworks/JavaVM.framework/Versions/1.6/Home). Once set, the workspace can be built as
mvn install
[INFO] Scanning for projects...
[INFO] ------------------------------------------------------------------------
[INFO] Reactor Build Order:
[INFO]
[INFO] RI for JSON-P JSR
[INFO] Java API for Processing JSON (JSON-P)
[INFO] jsonp-tests
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building RI for JSON-P JSR 1.0-SNAPSHOT
[INFO] ------------------------------------------------------------------------

. . .

Tests run: 22, Failures: 0, Errors: 0, Skipped: 0

[INFO]
[INFO] --- maven-jar-plugin:2.3.1:jar (default-jar) @ jsonp-tests ---
[WARNING] JAR will be empty - no content was marked for inclusion!
[INFO] Building jar: /Users/arungup/code/workspaces/jsonp~git/tests/target/jsonp-tests-1.0-SNAPSHOT.jar
[INFO]
[INFO] --- maven-install-plugin:2.3.1:install (default-install) @ jsonp-tests ---
[INFO] Installing /Users/arungup/code/workspaces/jsonp~git/tests/target/jsonp-tests-1.0-SNAPSHOT.jar to /Users/arungup/.m2/repository/org/glassfish/jsonp-tests/1.0-SNAPSHOT/jsonp-tests-1.0-SNAPSHOT.jar
[INFO] Installing /Users/arungup/code/workspaces/jsonp~git/tests/pom.xml to /Users/arungup/.m2/repository/org/glassfish/jsonp-tests/1.0-SNAPSHOT/jsonp-tests-1.0-SNAPSHOT.pom
[INFO] ------------------------------------------------------------------------
[INFO] Reactor Summary:
[INFO]
[INFO] RI for JSON-P JSR ................................. SUCCESS [0.528s]
[INFO] Java API for Processing JSON (JSON-P) ............. SUCCESS [12.214s]
[INFO] jsonp-tests ....................................... SUCCESS [1.695s]
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------

The API .jar file is in api/target/jsonp-ri-1.0-SNAPSHOT.jar and javadocs are in api/target/jsonp-ri-1.0-SNAPSHOT-javadoc.jar. There are several tests in the tests directory that shows the API usage. The RI JARs are not pushed to a public maven repo yet but are installed in the local repo with the above command. These can be included in your "pom.xml" with the following coordinates:

<dependency>
<groupId>javax.json</groupId>
<artifactId>jsonp-ri</artifactId>
<version>1.0-SNAPSHOT</version>
</dependency>

The key APIs are
  • DOM-based APIs (javax.json package)
    • JsonBuilder - Builds a JSON object or JSON array
    • JsonReader - Reads a JSON object or array from the stream
    • JsonWriter - Writes a JSON object or array to the stream
  • Streaming APIs (javax.json.stream package)
    • JsonGenerator - Streaming JSON generator
    • JsonParser - Allows forward, read-only access to JSON

Here is an sample usage of JsonBuilder:
JsonObject value = new JsonBuilder()
   .beginObject()
     .add("firstName", "John")
     .add("lastName", "Smith")
     .add("age", 25)
        .beginObject("address")
           .add("streetAddress", "21 2nd Street")
           .add("city", "New York")
           .add("state", "NY")
           .add("postalCode", "10021")
        .endObject()
        .beginArray("phoneNumber")
           .beginObject()
              .add("type", "home")
              .add("number", "212 555-1234")
           .endObject()
           .beginObject()
              .add("type", "home")
              .add("number", "646 555-4567")
           .endObject()
        .endArray()
   .endObject()
.build();

Here is a sample usage of JsonReader:

String json = "...";
JsonReader reader = new JsonReader(new StringReader(json));
JsonValue value = reader.readObject();
reader.close();

A sample usage of JsonWriter:

JsonWriter jsonWriter = new JsonWriter(new FileWriter(...));
JsonObject jsonObject = new JsonBuilder()
.beginObject()
. . .
.endObject()
.build()
; jsonWriter.writeObject(jsonObject); jsonWriter.close();
Here is a sample usage of JsonGenerator:

JsonGenerator generator = new JsonGenerator(new FileWriter(...));
generator
.beginObject()
. . .
.beginArray()
. . .
.endArray()
.endObject()
.build();
generator.close();

And finally a sample usage of JsonParser:
String json = "...";
JsonParser parser = new JsonParser(new StringReader(json));
Iterator<Event> it = reader.iterator();
Event event = it.next();
The event  can be of the following types:
  • START_OBJECT
  • END_OBJECT
  • START_ARRAY
  • END_ARRAY
  • KEY_NAME
  • VALUE_STRING
  • VALUE_NUMBER
  • VALUE_FALSE
  • VALUE_TRUE
  • VALUE_NULL
Here are some references to track the progress and provide feedback:
This JSR will be delivered as part of Java EE 7. Here are some other early work that has been explained:

Have fun!

Monday May 14, 2012

Java Day, Istanbul, May 2012 Trip Report




About 120+ 150 attendees at Java Day, Istanbul learned about Java EE 6/7 earlier today. The Java track had about 100 110 attendees during most of the day. I gave 4 sessions:
  • Developing Modern and Lightweight Java EE 6 Applications using WebLogic 12c (keynote to all the attendees)
  • What's coming in Java EE 7
  • Java EE 6 Hands-on Lab using NetBeans/WebLogic
  • RESTful Web services using JAX-RS

The attendees were generally quiet but the hands-on session had some interesting conversations around Java EE 6 usage. TOTD #177 showcase the WebLogic Maven plugin usage TOTD #176 shows how to run Conference Planner application on WebLogic 12c. I also had the opportunity to meet the Istanbul JUG leader and local GTUG leader. Show your passion about Java by participating at the local JUG, all the more better to volunteer as a speaker :-)

The slides presented are available below.






The self-paced instructions for Java EE 6 hands-on lab using NetBeans and WebLogic is available here.

Some pictures from the event and around the city ...














Here are a couple of more pictures from the local events team:





And the complete album:


Next stop Geecon, Poland ...

Friday May 11, 2012

wls-maven-plugin: WebLogic 12c Maven Plugin Usage (TOTD #177)


Oracle WebLogic Server 12c provides full Java EE 6 platform support. The screencast #39 shows how to build a complete application using NetBeans. The self-paced hands-on lab provides detailed instructions on the same as well. The Maven support in WebLogic 12c is much more improved. Steve Button and Markus Eisele wrote detailed blogs on how/what/why of Maven support in WebLogic. This Tip Of The Day (TOTD) will provide a quick overview of how to get started with using the maven plugin for deploying a Java EE 6 web application.

  1. Download and install WebLogic 12c using the zip installer as explained in TOTD #174.
  2. The Maven plugin can be installed using "$MW_HOME/wlserver/server/lib/wls-maven-plugin.jar". Change the directory to "$MW_HOME/wlserver/server/lib" and give the following commands:
    mvn install
    mvn install:install-file –Dfile=wls-maven-plugin.jar -DpomFile=pom.xml
  3. The maven plugin usage can be seen by giving the following command:
    mvn com.oracle.weblogic:wls-maven-plugin:help
    Or add the following to "~/.m2/settings.xml":
    <pluginGroups>     
    <pluginGroup>com.oracle.weblogic</pluginGroup>
    </pluginGroups>
    And then give the following command:
    mvn wls:help
    to see the output as:
    [INFO] Scanning for projects...
    [INFO]
    [INFO] ------------------------------------------------------------------------
    [INFO] Building wls-maven-sample 1.0-SNAPSHOT
    [INFO] ------------------------------------------------------------------------
    [INFO]
    [INFO] --- wls-maven-plugin:12.1.1.0:help (default-cli) @ wls-maven-sample ---
    [INFO]
    WebLogic Server Maven Plugin
    The following goals are supported by wls-maven-plugin:

    appc:
    The appc compiler generates and compiles the classes needed to deploy
    EJBs and JSPs to WebLogic Server. It also validates the deployment
    descriptors for compliance with the current specifications at both the
    individual module level and the application level.

    deploy:
    To deploy a weblogic server application (supports all formats WAR,JAR
    etc..)

    create-domain:
    Create a domain for WebLogic Server using the default domain template.
    For more complex domain creation use the WLST goal.

    help:
    Provides a list of all the goals supported by the wls-maven-plugin

    install:
    Install WebLogic Server

    list-apps:
    Lists the deployment names for applications and stand-alone modules
    deployed distributed, or installed to the domain

    redeploy:
    Redeploys a running application or part of a running application

    start-app:
    Starts an application deployed on weblogic server.

    start-server:
    Start WebLogic Server

    stop-app:
    Stops an application

    stop-server:
    Stop Weblogic Server

    undeploy:
    Undeploys the application from weblogic server. Stops the deployment unit
    and removes staged files from target servers

    update-app:
    Updates an application's deployment plan by redistributing the plan files
    and reconfiguring the application based on the new plan contents.

    wlst:
    WLST wrapper for Maven


    For detailed help on a goal, use -Dgoal=<goal-name> -Ddetail=true options.
    [INFO] ------------------------------------------------------------------------
    [INFO] BUILD SUCCESS
    [INFO] ------------------------------------------------------------------------
    [INFO] Total time: 0.794s
    [INFO] Finished at: Thu May 03 06:38:23 IST 2012
    [INFO] Final Memory: 8M/125M
    [INFO] ------------------------------------------------------------------------
    More details about each goal can be found using the following command:
    mvn wls:help -Dgoal=<GOAL> -Ddetail=true
    For example:
    mvn wls:help -Dgoal=install -Ddetail=true
    [INFO] Scanning for projects...
    [INFO]
    [INFO] ------------------------------------------------------------------------
    [INFO] Building Maven Stub Project (No POM) 1
    [INFO] ------------------------------------------------------------------------
    [INFO]
    [INFO] --- wls-maven-plugin:12.1.1.0:help (default-cli) @ standalone-pom ---
    [INFO]
    WebLogic Server Maven Plugin
    The following goals are supported by wls-maven-plugin:

    install:
    Install WebLogic Server

    Available Parameters:

    installCommand:
    The command to use to install the product when using an
    'executable' installer. The following macros are supported -
    @INSTALLER_FILE@ - the path to the installer file, @JAVA_HOME@ -
    path to the java home. eg: @JAVA_HOME@ -Xms512m -Xmx1024m -jar
    @INSTALLER_FILE@ one two

    artifactLocation:
    The address of the artifact. This can be one of the following -
    1) A ':' separated maven coordinates of the form (groupId:artifac-
    tId:packaging:classifier:version) 2) A file on the local system
    (/home/prash/myapps/helloworld.war)3) A remote http url
    (http://foo/a/b.zip)

    middlewareHome:
    The home directory for Oracle WebLogic Server or Fusion
    Middleware installation. Required unless WLS was installed in the
    default location selected by the WLS Maven Plugin's install goal.

    domainHome:
    Location of WLS domain

    localRepository:
    The absolute path of a local maven repository.

    artifactFactory:
    The artifactFactory is used to locate an artifact with a
    groupId:artifactId:artifactName:version in the remote Repository
    as provided by the remoteRepsitories parameter.

    artifactResolver:
    Artifactresolver resolves the artifact from the remote
    repository. Downloads an updated version of the artifact if
    present in the remote repo.



    [INFO] ------------------------------------------------------------------------
    [INFO] BUILD SUCCESS
    [INFO] ------------------------------------------------------------------------
    [INFO] Total time: 0.889s
    [INFO] Finished at: Wed May 02 17:35:46 PDT 2012
    [INFO] Final Memory: 6M/89M
    [INFO] ------------------------------------------------------------------------

  4. Build a Java EE 6 application
    1. Create a Java EE 6 Maven web application as:
      mvn archetype:generate
      -DarchetypeGroupId=org.codehaus.mojo.archetypes
      -DarchetypeArtifactId=webapp-javaee6 -DgroupId=example
      -DartifactId=wls-maven-sample -DarchetypeVersion=1.5
      -DinteractiveMode=false
    2. Add a trivial servlet to the sample project by following the screencast #39. The complete source code for the project can be downloaded here.
  5. Add the following code fragment to the generated "pom.xml":
    <plugin>                
    <groupId>com.oracle.weblogic</groupId>
    <artifactId>wls-maven-plugin</artifactId>
    <version>12.1.1.0</version>
    </plugin>
  6. Try some Maven commands in the "wls-maven-sample" directory
    1. The server can be started as:

      mvn wls:start-server
      -DmiddlewareHome=/Users/arungup/tools/weblogic/12c
      -DdomainHome=/Users/arungup/tools/weblogic/mydomain

      [INFO] Scanning for projects...
      [INFO]
      [INFO] ------------------------------------------------------------------------
      [INFO] Building wls-maven-sample 1.0-SNAPSHOT
      [INFO] ------------------------------------------------------------------------
      [INFO]
      [INFO] --- wls-maven-plugin:12.1.1.0:start-server (default-cli) @ wls-maven-sample ---
      [INFO] ++====================================================================++
      [INFO] ++ wls-maven-plugin: start-server ++
      [INFO] ++====================================================================++
      .[INFO] Starting server in domain: /Users/arungup/tools/weblogic/mydomain
      [INFO] Check stdout file for details: /Users/arungup/tools/weblogic/mydomain/server-922019421247284651.out
      [INFO] Process being executed, waiting for completion.
      ................
      [INFO] Server started successful
      [INFO] ------------------------------------------------------------------------
      [INFO] BUILD SUCCESS
      [INFO] ------------------------------------------------------------------------
      [INFO] Total time: 16.919s
      [INFO] Finished at: Wed May 02 18:06:22 PDT 2012
      [INFO] Final Memory: 5M/88M
      [INFO] ------------------------------------------------------------------------
    2. Build and deploy the application as:

      mvn wls:deploy
      -DmiddlewareHome=/Users/arungup/tools/weblogic/12c
      -DdomainHome=/Users/arungup/tools/weblogic/mydomain
      -Duser=admin
      -Dpassword=admin007
      -Dsource=/Users/arungup/code/samples/weblogic/wls-maven-sample/target/wls-maven-sample-1.0-SNAPSHOT.war

      [INFO] Scanning for projects...
      [INFO]
      [INFO] ------------------------------------------------------------------------
      [INFO] Building wls-maven-sample 1.0-SNAPSHOT
      [INFO] ------------------------------------------------------------------------
      [INFO]
      [INFO] --- wls-maven-plugin:12.1.1.0:deploy (default-cli) @ wls-maven-sample ---
      [INFO] ++====================================================================++
      [INFO] ++ wls-maven-plugin: deploy ++
      [INFO] ++====================================================================++
      weblogic.Deployer invoked with options: -noexit -user admin -deploy -source /Users/arungup/code/samples/weblogic/wls-maven-sample/target/wls-maven-sample-1.0-SNAPSHOT.war
      <May 3, 2012 8:24:17 AM IST> <Info> <J2EE Deployment SPI> <BEA-260121> <Initiating deploy operation for application, wls-maven-sample-1.0-SNAPSHOT [archive: /Users/arungup/code/samples/weblogic/wls-maven-sample/target/wls-maven-sample-1.0-SNAPSHOT.war], to configured targets.>
      Task 0 initiated: [Deployer:149026]deploy application wls-maven-sample-1.0-SNAPSHOT on myserver.
      Task 0 completed: [Deployer:149026]deploy application wls-maven-sample-1.0-SNAPSHOT on myserver.
      Target state: deploy completed on Server myserver

      [INFO] ------------------------------------------------------------------------
      [INFO] BUILD SUCCESS
      [INFO] ------------------------------------------------------------------------
      [INFO] Total time: 7.745s
      [INFO] Finished at: Thu May 03 08:24:18 IST 2012
      [INFO] Final Memory: 11M/130M
      [INFO] ------------------------------------------------------------------------
    3. The application is accessible at localhost:7001/wls-maven-sample-1.0-SNAPSHOT/TestServlet.
    4. Stop the server as:

      mvn wls:stop-server
      -DmiddlewareHome=/Users/arungup/tools/weblogic/12c
      -DdomainHome=/Users/arungup/tools/weblogic/mydomain
      -Duser=admin
      -Dpassword=admin007

      [INFO] Scanning for projects...
      [INFO]
      [INFO] ------------------------------------------------------------------------
      [INFO] Building wls-maven-sample 1.0-SNAPSHOT
      [INFO] ------------------------------------------------------------------------
      [INFO]
      [INFO] --- wls-maven-plugin:12.1.1.0:stop-server (default-cli) @ wls-maven-sample ---
      [INFO] ++====================================================================++
      [INFO] ++ wls-maven-plugin: stop-server ++
      [INFO] ++====================================================================++
      [INFO] Stop server in domain: /Users/arungup/tools/weblogic/mydomain
      [INFO] Process being executed, waiting for completion.
      [INFO] [exec] Stopping Weblogic Server...
      [INFO] [exec]
      [INFO] [exec] Initializing WebLogic Scripting Tool (WLST) ...
      [INFO] [exec]
      [INFO] [exec] Welcome to WebLogic Server Administration Scripting Shell
      [INFO] [exec]
      [INFO] [exec] Type help() for help on available commands
      [INFO] [exec]
      [INFO] [exec] Connecting to t3://localhost:7001 with userid admin ...
      [INFO] [exec] Successfully connected to Admin Server 'myserver' that belongs to domain 'mydomain'.
      [INFO] [exec]
      [INFO] [exec] Warning: An insecure protocol was used to connect to the
      [INFO] [exec] server. To ensure on-the-wire security, the SSL port or
      [INFO] [exec] Admin port should be used instead.
      [INFO] [exec]
      [INFO] [exec] Shutting down the server myserver with force=false while connected to myserver ...
      [INFO] [exec] WLST lost connection to the WebLogic Server that you were
      [INFO] [exec] connected to, this may happen if the server was shutdown or
      [INFO] [exec] partitioned. You will have to re-connect to the server once the
      [INFO] [exec] server is available.
      [INFO] [exec] Disconnected from weblogic server: myserver
      [INFO] [exec] Disconnected from weblogic server:
      [INFO] [exec]
      [INFO] [exec]
      [INFO] [exec] Exiting WebLogic Scripting Tool.
      [INFO] [exec]
      [INFO] [exec] Done
      [INFO] [exec] Stopping Derby Server...
      [INFO] ------------------------------------------------------------------------
      [INFO] BUILD SUCCESS
      [INFO] ------------------------------------------------------------------------
      [INFO] Total time: 10.847s
      [INFO] Finished at: Thu May 03 06:37:48 IST 2012
      [INFO] Final Memory: 9M/125M
      [INFO] ------------------------------------------------------------------------

Simple, quick, and easy!

Are you building Java EE 6 applications on WebLogic ? With Maven ? Now you can fully integrate the WebLogic lifecycle with your "pom.xml".

The WebLogic Application Development Guide provide detailed documentation on the maven plugin.


Wednesday May 09, 2012

OTN Developer Days in Turkey and Johannesburg, Geecon in Poland, JEEConf in Ukraine


Several Java EE sessions around the world over next few days ...


Where: Ceylan Intercontinental Istanbul, Turkey
When: May 14, 9am
Sessions: Several Java EE 6/7 sessions
Agenda, Register



Where: Poznan, Poland
When: May 16-18
Sessions:
    Java EE 6 = Less Code + More Power (May 16, 9am)
    Java EE 7: Developing for the Cloud (May 16, 11:10am)
    JAX-RS 2.0: RESTful Java on Steroids (May 18, 11:20am)
    PaaSing a Java EE 6 Application (May 18, 2:30pm)



Where: International Exhibition Center, Kiev, Ukraine
When: May 19, 10am
Session: Java EE 7: Developing for the Cloud
Register



When: May 21
Where: The Forum, Johannesburg, South Africa
Session: Several
Agenda, Register


Where will I see or run with you ?

Sunday May 06, 2012

JavaOne and Oracle Develop India 2012 Trip Report


JavaOne and Oracle Develop India 2012 concluded earlier this week. About 2000 attendees for JavaOne makes it the biggest Java developer conference in South Asia. The conference showed Oracle's continued commitment to move Java forward and demonstrated progress on different fronts.

Several attendees told me that they liked Java EE related sessions and how it demonstrated how the platform is making progress. The automatic service provisioning feature was particularly well appreciated. The complete instructions to download the Conference Planner sample showing some PaaS capabilities of the platform is available at glassfish.org/javaone2011. And the video that explains the PaaSing a Java EE application is shown below.



I had several speaking engagements at the conference including Technical Keynote, Meet The Experts, 2 Hands-on Labs, and 2 Technical Sessions.

I helped mentor a hands-on lab that explained how to Develop/Deploy/Monitor a Java EE 6 Application in a GlassFish Cluster. The room was packed with 120 attendees and several folks made good progress by following the instructions in the document. The complete self-paced lab instructions can be downloaded here and the source code here. The lab explains how to create a 2-instance cluster, front-end the cluster with a load balancer, verify that session replication works, and then monitor the application using JavaScript.




The session on GlassFish REST Administration Backend explained the internals of how GlassFish exposes a RESTful API for administration, monitoring, and management. But other than learning internals, the emphasis was more on how to build a large-scale RESTful application. The tips and tricks part of the presentation shared the lessons learned during our exercise of publishing this API. The slides are available:


Do you know the RESTful management API is at localhost:4848/management/domain and the monitoring API is localhost:4848/monitoring/domain. And did you know that you can append ".xml" or ".json" to the RESTful URIs and the data is displayed in the requested format ?

The evening concluded with a dinner with several JUG leaders and Java Champions from all around the world. There was Kevin Nilson from the Silicon Valley JUG, Vinicius and Yara Senger from the SouJava, Stephen Chin from the Java FX User Group, Raj Mahendra from the JUG Chennai, Kayal from JDuchess Chennai, Murali Vallath from AIOUG and several other luminaries. However its still surprisingly shocking that in a country of 1.2 billion+ people, there are only 4 active JUGs - Pune, Bangalore, Chennai, and Nagpur. And then Hyderabad JUG was created at JavaOne India. I plan to write a detailed blog on what it takes to start a JUG any where and hopefully that will motivate some individuals to start more JUGs around the world. Anyway, here are some pictures from the dinner:








Day 2 for me started with Meet The Experts session with Dalibor Topic, Terrence Barr, Michael Heinrichs, and Markus Hirt. The 9am session started low on attendance but the 250+ capacity room was packed within 15 minutes. And the questions ranged from merged JVMs, comparison between HTML5 and JavaFX, NoSQL support in Java EE, JavaFX on mobile, features in JDK 8/9/10, Project Avatar, and all over the Java landscape. The engaged audience kept asking questions all the way to the end.

Then I delivered a session on WebLogic 12c: Developer Deep Dive at Oracle Develop. This session gave an overview of some of the new features that are available in Oracle WebLogic Server 12c such as zip installer (TOTD #174), simplified programming model with Java EE 6, new Maven goals, and extensive IDE support. The slides are available.



A comprehensive Java EE 6 application was explained with a code walk-through and deployed on WebLogic server using NetBeans. TOTD #176 explains how you can deploy this application on WebLogic as well. There are several blogs that explain new Maven support in WebLogic and I've already prepared a blog draft (to be published soon) explaining the same using the TOTD format. There were some cases of Websphere -> WebLogic migration and that is always welcome!

The final session of the day for me was the Java EE 6 Application Development using NetBeans and WebLogic hands-on lab at Oracle Develop. This self-paced guided the attendees to build a complete end-to-end application using different Java EE 6 technologies such as JavaServer Faces 2, Enterprise JavaBeans 3.1, Java Persistence API 2, and Contexts & Dependency Injection. The self-paced lab instructions are available here. I was told that with about 75 attendees this was the most heavily attended lab of Oracle Develop.

The evening concluded with the GlassFish & Friends Party. We've conducted this party at the premier JavaOne event for the past 5 years and this is the first time we've taken it to a regional event. There were about 110+ JavaOne attendees who were present at the party and had some great conversations. Several folks told me that they enjoyed the party and are already looking forward to it next year. The Nagpur JUG had the biggest presence at the party and they are a charged up bunch of folks. I really wish other cities have similar amount of passion and energy as well. Here are some pictures from the party:










On a personal side, the fitness center of Novotel Hotel is pretty good and this allowed me to continue following the Spartacus Workout. A visit to Hyderabad must include a trip to Paradise Biryani and so managed to sneak in that after the GlassFish party. The OTN welcome party was a good way to decompress at the end of Day 1 and got the attendees dancing to the latest bollywood flicks by Vasundhara Das. Here are some pictures from the dance party:






Here are some more pictures captured from the event:












And now the complete album:



Many thanks to the Novotel Hotel and HICC staff, competent technical crew, events team running around for logistics, attendees, local and international speakers, and everybody else. A good conference is a blend of all of these together and JavaOne India certainly had a good mix.

For me, the next stops are Turkey, Poland, Ukraine, Johannesburg ...

Wednesday May 02, 2012

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.
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
« May 2012 »
SunMonTueWedThuFriSat
  
1
3
4
5
7
8
10
12
13
16
17
20
21
22
23
24
25
26
27
28
29
30
31
  
       
Today