Michael Yuan

“Science is a wonderful thing if one does not have to earn one’s living at it” — Albert Einstein

February 26th, 2008

A Mobile Companion for SXSW 2008

If you are among the 6000+ technologists / entrepreneurs / designers attending this year’s SXSW conference (or are just interested in following what’s going on in the conference), check this out: The SXSW 2008 Mobile Companion (http://webclip2go.com/sxsw08) is a free mobile web application that lets you access everything about the South by Southwest conference right there on your mobile phone. Try it in a web-based iphone simulator (Safari and Firefox only). It works on iphone, Blackberry, Palm, Windows Mobile, Nokia, and just about any smartphone out there. The way it works is that it takes live content about the conferences from all over the web, and make the content suitable for display on small mobile phone browsers. Through the companion, you can check:

* Panel / presentation schedules by day
* Session abstracts
* Film / music performance schedules by day
* Official and unofficial conference news, blogs and wikis
* Blogs of conference speakers (full posts w/ comments)
* SXSW parties!
* Austin local news
* Music and film listings by venue in the Austin area
* and much more …

All you need is to load the following URL in your mobile phone browser. Or, if you do not want to type the URL, simply text the word sxsw08 to phone number 41411 to get a link returned in an SMS message (the SMS works in the US only!).

http://webclip2go.com/sxsw08 (Try web-based iphone simulator in your Safari or Firefox browser)

Picture 41.pngScreenshot0114.jpg

Why did I create it? Well, as a veteran technology conference speaker / attendee, I can tell you that conference WIFI is flaky at best in most big conferences. In fact, WIFI was the #1 problem in SXSW 2007. It is quite frustrating to take out your 8 lbs laptop just to find out that the WIFI is down or has no coverage in the Hall. Well, with the mobile companion, you can check out just about anything about the conference / speakers in real time on your phone. I personally would use it a lot. And I encourage you to try it out if you have an iphone / blackberry or other connected device. I plan to do the same for most other conferences I attend this year as well. :)

The technology behind the SXSW Mobile Companion is WebClip2Go. The goal was to let people clip live content from any existing web site / blog, so that those content can be viewed from mobile phones. It has become a hit among my friends — especially those with iphones, since the web content loads much faster and requires simpler navigation in WebClip2Go, compared with directly loading the original web site in iphone. Much still needs to be done to make WebClip2Go ready for the general Internet audience (e.g., we need a Firefox plugin that lets people “clip” web content via drag and drop). In any case, I will blog about WebClip2Go in a separate blog entry later this week. Stay tuned!

BTW, for my Seam readers, it might be comforting to know that the application is built on top of JBoss Seam technology.

February 15th, 2008

Seam conversations made easy

One of the most interesting concepts in Seam is “conversation” — it allows your web application to have separate internal states for each browser tab, or for each logical multi-page web operation. Conversations can even be nested to manage multi-level wizards. Conversations let you break away from the monolithic session-based web application state management. However, while the concept is easy to grasp, conversations are not as widely understood as sessions. Many web developers are intimidated by the powerful conversation management APIs in Seam.

Well, no more! Jacob Orshalick just released three draft chapters from our 2nd edition of the JBoss Seam book. Those chapters provide very good explanations on conversations should be used in Seam applications. Thanks Jacob! Go check them out!

February 4th, 2008

2.5 Sessions Accepted in JavaOne 2008

Cool! Out of 4 sessions I submitted to JavaOne 2008, 2.5 are accepted! Given that JavaOne accepts less than 5% of all session proposals, this sounds like pretty good success rate. :) So, what exactly will I talk about in JavaOne?

First off, I will be giving a technical session on Building Interactive Mobile Messaging Applications. I will discuss how to build a SMS service like the Google SMS on a Java EE server. I think the information presented in the session will be useful for a large number of developers — for instance, for web application developers, it is often nice to have a “send to phone” button on your pages to send small pieces of information (e.g., alerts / reminders / links) to the user’s mobile phone. In the session, you will also learn how to make your application respond to requests from SMS (e.g., the user sends in a SMS to reschedule an appointment etc.). The session covers technologies used in such a solution, common design patterns / pitfalls, and third party players involved.

I will also run a BoF session on JBoss Seam: The Deep Integration Framework for Web Applications. I will try to dispel the notion that Seam is somehow a mere “web framework”. Yes, Seam is used in many web applications, but you can just use PHP or Ruby for a simple web site. The real value of Seam is to bring real Java enterprise infrastructure (e.g., business process engine, rules engine, asynchronous messaging infrastructure, advanced transaction services, scheduling service etc.) to the web application. That saves you from hard coding business workflow or rolling your own middleware frameworks in the web application. Come to the session and join the discussion!

Finally, they accepted my proposal on Developing Compelling Mobile Web Applications as a backup session — that is the 0.5 session here. :) This session covers mobile browser detection, multi-template based web site design, and special UI tricks for the iphone. From what I was told, there is a pretty good chance for backup sessions to be presented in the conference since some session presenters drop out at last minute for various reasons. We will see.

Hope to see y’all in JavaOne again this year!

November 13th, 2007

Seam book examples updated to Seam 2.0.0.GA

As a service to my readers, I have updated all examples in my JBoss Seam book to Seam 2.0.0.GA.

Go download the zip file here

The example applications are fully tested against JBoss AS 4.2.0 GA.

NOTE: To build the examples, you now need to download and unzip Seam 2.0.0.GA first, and then set the build.properties file to point to the Seam installation directory.

November 7th, 2007

Running Seam on non-JBoss Application Servers

UPDATE: Several people commented that Seam works just fine with the TopLink JPA provider. I stand corrected. Thanks guys.

Here is what I posted to TSS today …

First, we try very hard to make Seam as generic as possible — so it would not require JBoss AS to run. The proof of this effort is that Seam runs on plain Tomcat (using RESOURCE_LOCAL transactions). So, in theory, it should run on all application servers out there. However, since all Seam developers use JBoss AS on a daily basis (we happen to believe that JBoss AS is the best AS out there :) ), it is natural that Seam is tested most extensively on JBoss AS. Also, as an open source project, we do not have access to commercial WLS, WAS, ORA licenses, and do not have access to their support. So, our testing on those servers is not very comprehensive. I have personally installed the trial versions of those servers multiple times since they expire all the time. It is extremely time consuming …

So, the testing on commercial app servers is not very good at this moment. If you encounter issues with non-JBoss servers, raising them on the Seam forum is your best bet. Now here is a breakdown of what works and what not (to the best of my knowledge).

* Tomcat 5.5 and 6: Seam applications work out of the box on those servers if you use the RESOURCE_LOCAL transaction (see examples/jpa). You can use EJB3 features if you install JBoss Embeddable on top of Tomcat.

* Glassfish: Glassfish v2 is known to work with Seam (see examples/jee5 for an example). But we strongly recommend you use Hibernate as the JPA provider — not the default TopLink.

* Oracle: Oracle 10 is known to work with Seam (see examples/jee5 and examples/jpa). Again, choose Hibernate as the JPA provider.

* WebLogic: WebLogic 9.2 and 10 can be made to work with JPA + JTA transaction (see examples/jpa). However, EJB3 on WLS 10 does not yet work. There is a reflection error from the EJB proxy the last time I checked.

* WebSphere: I think the examples/jpa can work against WAS 6.1.0.9. You do need to tweak stuff a lot to make JSF 1.2 and Facelets work on that server. We have not tried WebSphere EJB3. However, anything beyond a simple CRUD app might have problems on WAS. One of the reasons is that the IBM JVM5 has a bug that complains about unknown annotations (the correct way is to ignore unknown annotations as the Sun JVM does). Unless IBM fixes this, you will have problems running Seam on WAS.

So, that’s it. If any of you can help us testing this stuff, please let us know! :)

October 24th, 2007

Slides for Seam talk at the New England JUG

I gave a 2-hour talk on JBoss Seam in the New England Java User’s Group last Thursday. Although the talk was at the same night as a crucial game for Red Sox, it still managed to attract 250+ people — making it one of largest JUG meetings I have ever attended! I had a great time there, and learned first hand about how Java developers in the Boston area are using JBoss Seam to solve real world problems. For those who are interested, the presentation itself can be found here:

Slides for the JBoss Seam presentation in NEJUG, Oct 18th 2007

I enjoyed a “re-union” with my Red Hat colleagues in the Boston area: Shelly McGowan, Chantal Yang, Bill Burke, Kurt Stam, and Rajesh Rajasekaran. Thank you guys for making the meeting a success! In addition, I’d also like to thank Mark Johnson (the president of the NEJUG), Heather Fox (publicist at Prentice Hall), and Shaun Connolly (my sponsor at Red Hat) for organizing everything!

Finally, a couple of references to things I mentioned in the meeting:

October 9th, 2007

JBoss Seam project setup with Maven — Part 2: EAR deployment

In a previous post, I discussed how to setup a Maven project for your Seam WAR application. However, most Seam developers are probably working on applications with EJB3 components to fully take advantage of the service infrastructure of the JBoss AS container. So, to complete this series, I setup a maven project for Seam EAR deployment. The project structure is as follows. The ejb module builds the JAR for EJB3 components; the war project build the web application; and the ear module builds the EAR application with necessary library JARs.

CODE:
  1. .
  2.  |-- pom.xml
  3.  |
  4.  |-- ear
  5.  |   `-- pom.xml
  6.  |
  7.  |-- ejb
  8.  |   |-- pom.xml
  9.  |   |-- src
  10.  |       `-- main
  11.  |           |-- java
  12.  |           |    `-- com
  13.  |           |         `-- example
  14.  |           |               `-- ejb
  15.  |           |                    |-- MyEnterpriseBeanImpl.java
  16.  |           |                    `-- MyEnterpriseBean.java
  17.  |            `-- resources
  18.  |                |-- seam.properties
  19.  |                 `--  ejb-jar.xml
  20.  |
  21.  |-- war
  22.       |-- pom.xml
  23.        `-- src
  24.             `-- main
  25.                  |-- java
  26.                  |   `-- com
  27.                  |       `-- example
  28.                  |             `-- SampleAction.java (and other Java source files)
  29.                  |-- resources
  30.                  |   |-- META-INF
  31.                  |   |   `-- persistence.xml
  32.                  |   |-- messages.properties
  33.                  |   `-- seam.properties
  34.                  `-- webapp
  35.                      |-- WEB-INF
  36.                      |    | -- components.xml
  37.                      |    | -- pages.xml
  38.                      |    | -- face-config.xml
  39.                      |     `-- web.xml
  40.                      `-- hello.xhtml (and other web content, CSS, templates, and images)

The main pom.xml file defines the shared libraries required by all modules. It optionally uses the Seam parent POM to set the version numbers for the dependency JARs. Here is how it might look like:

XML:
  1. <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
  2.  
  3.   <repositories>
  4.     <repository>
  5.       <id>jboss-snapshot</id>
  6.       <name>The JBoss maven repo</name>
  7.       <url>http://snapshots.jboss.org/maven2</url>
  8.     </repository>
  9.   </repositories>
  10.   <parent>
  11.     <groupId>org.jboss.seam</groupId>
  12.     <artifactId>root</artifactId>
  13.     <version>2.0.0-SNAPSHOT</version>
  14.   </parent>
  15.  
  16.   <modelVersion>4.0.0</modelVersion>
  17.   <groupId>mystuff</groupId>
  18.   <artifactId>mystuff</artifactId>
  19.   <packaging>pom</packaging>
  20.   <version>1.0</version>
  21.   <name>mystuff</name>
  22.   <url>http://maven.apache.org</url>
  23.  
  24.   <dependencies>
  25.  
  26.     <dependency>
  27.       <groupId>log4j</groupId>
  28.       <artifactId>log4j</artifactId>
  29.       <scope>provided</scope>
  30.     </dependency>
  31.  
  32.     <dependency>
  33.       <groupId>junit</groupId>
  34.       <artifactId>junit</artifactId>
  35.       <scope>test</scope>
  36.     </dependency>
  37.  
  38.   </dependencies>
  39.  
  40.   <modules>
  41.     <module>ejb</module>
  42.     <module>war</module>
  43.     <module>ear</module>
  44.   </modules>
  45.  
  46.   <build>
  47.     <plugins>
  48.       <plugin>
  49.         <groupId>org.apache.maven.plugins</groupId>
  50.         <artifactId>maven-compiler-plugin</artifactId>
  51.         <configuration>
  52.           <source>1.5</source>
  53.           <target>1.5</target>
  54.         </configuration>
  55.       </plugin>
  56.     </plugins>
  57.   </build>
  58. </project>

The ejb/pom.xml file defines the dependencies for the EJB3 module. Everything here is in the provided scope -- unless testing-specific libraries, which are in the test scope.

XML:
  1. <project>
  2.  
  3.   <parent>
  4.     <artifactId>mystuff</artifactId>
  5.     <groupId>mystuff</groupId>
  6.     <version>1.0</version>
  7.   </parent>
  8.  
  9.   <modelVersion>4.0.0</modelVersion>
  10.   <groupId>mystuff</groupId>
  11.   <artifactId>ejb</artifactId>
  12.   <name>mystuff - ejb</name>
  13.   <version>1.0</version>
  14.   <url>http://maven.apache.org</url>
  15.  
  16.   <build>
  17.     <finalName>ejb</finalName>
  18.   </build>
  19.  
  20.   <dependencies>
  21.  
  22.     <dependency>
  23.       <groupId>org.hibernate</groupId>
  24.       <artifactId>hibernate</artifactId>
  25.       <scope>provided</scope>
  26.     </dependency>   
  27.  
  28.     <dependency>
  29.       <groupId>org.hibernate</groupId>
  30.       <artifactId>hibernate-entitymanager</artifactId>
  31.       <scope>provided</scope>
  32.     </dependency>
  33.  
  34.     <dependency>
  35.       <groupId>org.hibernate</groupId>
  36.       <artifactId>hibernate-annotations</artifactId>
  37.       <scope>provided</scope>
  38.     </dependency>
  39.  
  40.     <dependency>
  41.       <groupId>org.hibernate</groupId>
  42.       <artifactId>hibernate-validator</artifactId>
  43.       <scope>provided</scope>
  44.     </dependency>
  45.  
  46.     <dependency>
  47.       <groupId>org.jboss.seam</groupId>
  48.       <artifactId>jboss-seam</artifactId>
  49.       <scope>provided</scope>
  50.     </dependency>
  51.  
  52.     <dependency>
  53.       <groupId>javax.ejb</groupId>
  54.       <artifactId>ejb-api</artifactId>
  55.       <scope>provided</scope>
  56.     </dependency>
  57.  
  58.     <dependency>
  59.       <groupId>hsqldb</groupId>
  60.       <artifactId>hsqldb</artifactId>
  61.       <version>1.7.2</version>
  62.       <scope>test</scope>
  63.     </dependency>
  64.  
  65.   </dependencies>
  66.  
  67. </project>

The war/pom.xml file defines the dependencies for the WAR module. It depends on the ejb module.

XML:
  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <project>
  3.   <parent>
  4.     <artifactId>mystuff</artifactId>
  5.     <groupId>mystuff</groupId>
  6.     <version>1.0</version>
  7.   </parent>
  8.   <modelVersion>4.0.0</modelVersion>
  9.  
  10.   <groupId>mystuff</groupId>
  11.   <artifactId>war</artifactId>
  12.   <name>mystuff - web</name>
  13.   <version>1.0</version>
  14.   <packaging>war</packaging>
  15.   <url>http://maven.apache.org</url>
  16.  
  17.   <build>
  18.     <finalName>war</finalName>
  19.   </build>
  20.  
  21.   <dependencies>
  22.  
  23.     <dependency>
  24.       <groupId>mystuff</groupId>
  25.       <artifactId>ejb</artifactId>
  26.       <version>1.0</version>
  27.       <scope>provided</scope>
  28.       <type>ejb</type>
  29.     </dependency>
  30.  
  31.    <!-- The following 4 dependencies are included in the WEB-INF/lib of the war -->
  32.  
  33.     <dependency>
  34.       <groupId>org.jboss.seam</groupId>
  35.       <artifactId>jboss-seam-ui</artifactId>
  36.     </dependency>
  37.  
  38.     <dependency>
  39.       <groupId>org.jboss.seam</groupId>
  40.       <artifactId>jboss-seam-debug</artifactId>
  41.     </dependency>
  42.  
  43.     <dependency>
  44.       <groupId>com.sun.facelets</groupId>
  45.       <artifactId>jsf-facelets</artifactId>
  46.     </dependency>
  47.  
  48.     <dependency