Showing posts with label java. Show all posts
Showing posts with label java. Show all posts

Saturday, June 12, 2010

Attending Singapore Google Technology Group Meetup

 

Today I attended this Singapore Google Technology User Group Meeting. It's my first time to attend such a Google meetings. Some of previous meet ups had always fallen on the wrong days -- on the day that I have something else to do. Today I am glad to be able to make it, attended the meeting, and Wesley Chun, was the speaker. He presented 2 sessions, one about Python and the other one about Google App Engine.

This guy's a hardcore Python guy, wrote the Core Python series of book, and was a presenter in the PyCon Asia Pacific 2010, Singapore -- an event that has been held last 3 days. Awesome in depth knowledge, vast industrial experiences, and keep the talk flows fluent.

The rest about the meeting can be found here: http://www.sg-gtug.org/2010/05/sg-gtug-special-tutorial-session-june.html

Monday, March 1, 2010

Apache Beehive Moved into Apache Attic

Our long time friend, Apache Beehive framework, which was  from BEA WebLogic Workshop Framework donated to Apache Software Foundation has reached its end of life. Personally I have encountered this framework a few times when dealing with production application developed using BEA WebLogic Workshop Framework 8.1.x (the BEA's proprietary IDE), and also the development that we did using BEA WebLogic Workshop Framework 9.2 (the Eclipse based IDE).

The framework consisted of NetUI, Control and Web Service Metadata.

The Beehive NetUI is a framework built on top of Struts 1.x (I think it was 1.1, but not from 1.3.x for sure). I remembered when using  the BEA WebLogic Workshop IDE, we can configure the page flow using diagrams. It was quite a mess after a while, when you have a lot of page flows though.

The Beehive Controls framework was a superb innovation that time. It simplifies a lot of things (taking into account that at those time it took a lot of extra jobs when you want to configure EJB 2.1 invocation yourself). I believe was based on EJBGen, and predates the Java annotations. The major setbacks with Controls frameworks were that it make it difficult for developers to decouple the application from the BEA WebLogic Workshop Framework, and even more difficult to decouple with the WebLogic Workshop IDE! The IDE did a lot of magic behind the scene (at least for WebLogic 8.1.x), such as generating Ant build files that uses weblogic.jar classes.

Most of the contribution from BEA Systems Inc had been absorbed into the Java Annotations. Well, I think the Beehive Control framework served its duty at its time, yet now it became less and less compelling to use for the reason that it's been obsolete. With almost every comparable framework providing the similar ease of use without having to couple with some jars; who wants to use this "maintenance mode" framework for new developments.

The Beehive WSM (web service metadata), has also served its duty during its time, as new web service standards and frameworks have rolled out one by one. It's been obsolete just as many other web service frameworks. it's cousin, the XMLBeans framework (http://xmlbeans.apache.org) seems to survive much longer. It has just released version 2.5.0 last December 14th, 2009. I personally enjoy using this component framework, generating Java classes and XML mapping. Though we have some other frameworks like Jibx, I personally feel that this XMLBeans is more sophisticated.

Commiters of the project eventually voted to close the Apache Beehive project (http://beehive.apache.org) due to lack of activity. It is moved to Apache Attic (http://attic.apache.org) - such an affectionate name :D

The project was lacking activities, and I agree that it should be shelved into the attic. I believe legacy applications that uses this component should not have any problems because the component is still there, the source code is still there, and more or less it is stable enough.

Recommendations for replacement components are shown in the page, Spring Web Flow/Struts 2 to replace Beehive NetUI, Spring Framework Core to replace Beehive Controls, and Axis2 to replace Beehive WSM.

Good bye, old friend!

Thursday, June 25, 2009

Float and Byte Array Conversion

One of my friends raised this question: How to convert sequence of bytes into float in Java?

He/she bumped into this problem when porting C application to Java which parses UDP packets. Sounds like Java is lacking the flexibility of C whereby it could simply copy the memory block content to a pointer of any types (including struct).

While in C/C++ it is legal to do this:
[sourcecode lang="c"]
#include

char cbuf[] = { 0, 0, 96, 64 }; /* representing single precision floating point 3.5f */

int main(int argc, char **argv) {
int i;
for(i = 0; i < 4; i++) {
printf("cbuf[%d] = %d\n", i, cbuf[i]);
}

float *fp = (float *) cbuf;
printf("*fp = %3.3f\n\n", *fp);
}
[/sourcecode]

Which prints the result:
[sourcecode lang="shell"]
cbuf[0]=0
cbuf[1]=0
cbuf[2]=96
cbuf[3]=64
res = 3.500

[/sourcecode]

You just can't do that in Java (plus you won't be getting mystifying errors due to memory stomping as well).
NOTE: because we are using C language, result might be different from platform to platform, due to Little Endian/Big Endian issue.

In order to achieve the conversion in Java, you have to parse the byte array (equivalent to char[] in above C example code).

I constructed a Java utility class named FloatByteArrayUtil:

[sourcecode lang="java"]
public class FloatByteArrayUtil {
private static final int MASK = 0xff;

/**
* convert byte array (of size 4) to float
* @param test
* @return
*/
public static float byteArrayToFloat(byte test[]) {
int bits = 0;
int i = 0;
for (int shifter = 3; shifter >= 0; shifter--) {
bits |= ((int) test[i] & MASK) << (shifter * 8);
i++;
}

return Float.intBitsToFloat(bits);
}

/**
* convert float to byte array (of size 4)
* @param f
* @return
*/
public static byte[] floatToByteArray(float f) {
int i = Float.floatToRawIntBits(f);
return intToByteArray(i);
}

/**
* convert int to byte array (of size 4)
* @param param
* @return
*/
public static byte[] intToByteArray(int param) {
byte[] result = new byte[4];
for (int i = 0; i < 4; i++) {
int offset = (result.length - 1 - i) * 8;
result[i] = (byte) ((param >>> offset) & MASK);
}
return result;
}

/**
* convert byte array to String.
* @param byteArray
* @return
*/
public static String byteArrayToString(byte[] byteArray) {
StringBuilder sb = new StringBuilder("[");
if(byteArray == null) {
throw new IllegalArgumentException("byteArray must not be null");
}
int arrayLen = byteArray.length;
for(int i = 0; i < arrayLen; i++) {
sb.append(byteArray[i]);
if(i == arrayLen - 1) {
sb.append("]");
} else{
sb.append(", ");
}
}
return sb.toString();
}
}

[/sourcecode]

One good thing about Java is, we don't have the Big Endian/Little Endian issue.

This is the sample code that shows how this utility works.

[sourcecode lang="java"]

public class SampleConversion {
public static void main(String args[]) {
float source = (float) Math.exp(1);
System.out.println("source=" + source);
byte[] second = FloatByteArrayUtil.floatToByteArray(source);
System.out.println("temporary byte array=" + FloatByteArrayUtil.byteArrayToString(second));
float third = FloatByteArrayUtil.byteArrayToFloat(second);
System.out.println("result=" + third);
}
}
[/sourcecode]

Which prints:
[sourcecode lang="shell"]
source=2.7182817
temporary byte array=[64, 45, -8, 84]
result=2.7182817
[/sourcecode]

Of course you also need to take consideration of the Little Endian/Big Endian issue when parsing the bytes passed from non-Java platform, or from native binaries (I think JNI supports the conversion seamlessly).

Thursday, June 18, 2009

I run my Tomcat, instead I get this "ORACLE DATABASE 10g EXPRESS..." message

You try to run  Apache Tomcat, but instead you  get this message "ORACLE DATABASE 10g EXPRESS EDITION LICENSE AGREEMENT".
This simply means
If you bump into this problem, you have an Oracle 10g Express Edition (OracleXE 10g) installation sitting on the same port as your Tomcat default port (TCP/IP port 8080). As the TCP/IP protocol doesn't allow you to have more than one process listening to the same port (except when you use the advanced channel/selector), then when you start Tomcat, it will fail. You might not be aware that your Tomcat has failed to start, until you get into that message mentioned above.

There are 2 cures to this symptoms, the first cure  is to let Oracle XE take the port, and we move the tomcat installation to another port. The second cure is to set the Oracle XE to use another port.

To achieve the first one, you need to modify your $CATALINA_HOME/conf/server.xml file. Find the portion of the file that contains this snippet (assuming you are using the standard Tomcat installation):

[sourcecode lang="xml"]
connectionTimeout="20000"
redirectPort="8443" />
[/sourcecode]

Change the port 8080 to something else, e.g. 8484.

[sourcecode lang="xml"]
connectionTimeout="20000"
redirectPort="8443" />
[/sourcecode]

By now you should be able to run you application.
Don't forget that you have to run it from port 8484. So if the application you deploy is someapp.war the URL that you aim should be http://localhost:8484/someapp/ instead of http://localhost:8080/someapp/

Ok, now if you want to take the second cure, go to your Oracle XE 10g console using sqlplus. Replace mypassword with that your SYS user password (as specified during the installation process). Note that the number 2, 3, 4 at the left side is generated by the sqlplus tools prompt (you don't need to type them in).

[sourcecode lang="sql"]
C:\> sqlplus sys/mypassword@xe as sysdba
SQL*Plus: Release 10.2.0.1.0 - Production on Thu Jun 18 17:53:47 2009
Copyright (c) 1982, 2005, Oracle. All rights reserved.

Connected to:
Oracle Database 10g Express Edition Release 10.2.0.1.0 - Production

SQL> begin
2 dbms_xdb.sethttpport('8484');
3 end;
4 /
[/sourcecode]

Oracle XE should reply:

[sourcecode lang="sql"]
PL/SQL procedure successfully completed.
[/sourcecode]

After that check to ensure that the configuration has been changed properly:

[sourcecode lang="sql"]
SQL> select dbms_xdb.gethttpport as "HTTP-Port is " from dual;
[/sourcecode]

You should get a message like this:

[sourcecode lang="sql"]
HTTP-Port is
------------
8484
[/sourcecode]

Exit from sqlplus by typing "exit" at the prompt.

If everything as expected, now you can start the Tomcat server and use the port 8080 for Tomcat. To access the Oracle XE 10g database web console, access through http://localhost:8484/apex

HTTP Error 404 on Your Java Web App?

Somebody in the JUG-ID mailing list was asking where does this HTTP Error 404 comes from? He has successfully run the application before, but now get this error when hitting the page.

For me, I would run through these diagnostic process:

  1. Because the browser returned error HTTP status 404, means that the application server is there serving the HTTP request; make sure that the application server serving there is the Tomcat/JBoss/WebLogic/WebSphere that you intended to get the data from; typical mistakes would be that you are trying to get the data from your application server, ended up that you hit an Oracle XE web console running on the same port, or you are hitting something else other than what you intended to.

  2. Check whether your application has been deployed. The error could come because your application actually has not been deployed to the application server. Use Tomcat Manager for Apache Tomcat, use WebLogic console, or Glassfish console, or whatever console your application server provides.

  3. Check whether there are some failure in the deployment process. This time you or your IDE deployed the application, yet there are some failure that causes the deployment to stop. It is typical for example, on finding error on your Spring context configuration or your Hibernate context configuration, your application will cease to deploy. It is also common when you have something wrong in your web.xml file, the application server will refuse to deploy. Check what error you get from your console and application server's log.

  4. And if you find out that the application has been successfully deployed, check whether the URL is actually available: check whether your web application uses filter (check the web.xml file), and check whether the JSP file exists (if it hits the JSP file directly), or check whether the action request is configured property (in action based MVC framework such as Struts1.x, WebWork, Struts2, Spring MVC, etc).


Better luck next time.

Monday, March 23, 2009

Get 'This project needs to migrate WTP metadata' error on Eclipse/Maven 2

Today I took a look of old source code base which I had not maintain for such a long time. It is a mock object of a web service. I wrote an XML-RPC client for a vendor specific API, and I need a mock servlet to test the code.
Today I decided to mavenize the project, as now I believe that's the best way to maintain my source code base. Because the servlet is a web application, I create the maven source try.

Oh ya, by the way I'm using these:
Eclipse 3.4 (Ganymede)
Apache Maven 2.0.9
Eclipse IAM == Maven Integration for Eclipse plugin == Q4E plugin (still prefer to call it Q4E)

After creating the source tree base I created the Eclipse configuration file using the Maven's Eclipse plugin.
I just need to invoke this maven task:

[sourcecode lang="shell"]
mvn eclipse:eclipse
[/sourcecode]

Then I opened the project in Eclipse. I found my project caught a chicken pox (a part of the project got the red rashes - errors). I tried to rebuild, and got this message:

 This project needs to migrate WTP metadata


I knew I missed something, but it's been 2 months since last time I configured Maven 2 web application, and I have totally forgotten the exact steps to do it.

Later I realised that I need to specify the WTP version, so here's the solution:

1) Clean up the project file, run the Maven 2 Eclipse plugin clean task

[sourcecode lang="shell"]
mvn eclipse:clean
[/sourcecode]

2) Create the Eclipse configuration, now specifying the WTP version

[sourcecode lang="shell"]
mvn eclipse:eclipse -Dwtpversion=2.0
[/sourcecode]

3) Open the Maven 2 project in Eclipse IDE, refresh the project so that changes made on the file system is reflected in the Eclipse project as well

4) Remove the library references that contains M2_REPO

Because I'm using Q4E plugin and seemed that the Maven 2 Eclipse plugin was configured for use with other plugin (Mevenide or m2clipse), they specified the M2_REPO variable and repository which you don't need when using Q4E.

Just right click on the project, select Properties - Build Path, remove the libraries that contains M2_REPO.

4) Right click on the Project, select - Maven 2 - Use Maven Dependency Management

If it's already checked, then what you need to do is to uncheck it. After that refresh the project, and then check it again.

Wednesday, March 18, 2009

Hudson Build Stuck on the Build Queue

These few days we have had problem with our Hudson server. The build seems to be stuck in the build queue, there are some executors (I setup 2 executors) available though. I suspected that there are some thread starvation going on or lacking of worker thread in the application server?
We used Apache Tomcat 6.0 to run the Hudson server. We also run artifactory for local maven2 repository on the same application server.
These few days the problem could be temporarily fixed by restarting the application server. I did it several times, but seems this problem is a chronic problem that keeps recurring every 10-20 builds.

This morning I figured out something new, Hudson seems to complain that the executor was frozen (showing that both executors status is "Offline"). Then I take a look, I discovered that there is a configuration for the executor when you click on the [Build executor status] positioned on the bottom of the left menu.
From here I can see the problem clearly:
Hudson displays the name of the executor nodes (as it supports build on multiple nodes), the response time for each node, free swap space and free disk space and some other stuff.
On my machine Hudson showed a warning that the disk space is low (less than 1GB). So this is the reason why Hudson froze the executors. It prevents itself to bring down the machine buy hogging the disk space.

Then I try to find a solution for this problem. I know that on our Windows server Hudson is running as Default User on the user's home. So, there is high probability to fix this problem by moving Hudson to other user of moving this user's space to location other than C: drive.

The simplest working solution to this problem turned to be:

  • specifying Hudson home (other than the default $USER_HOME/.hudson) on the Apache Tomcat service configuration

  • specifying Artifactory home (other than the default $USER_HOME/.artifactory) on the Apache Tomcat service configuration

  • copy the content of $USER_HOME/.hudson to a new hudson home

  • copy the content of $USER_HOME/.artifactory to a new artifactory home

  • restart Apache Tomcat service

Tuesday, March 17, 2009

Cannot install WebLogic Connector on Eclipse 3.4 Ganymede...

Today I tried to install Eclipse Connector for WebLogic 10.3.

The connector component is a software component that responsible for deploy/undeploy/get status/configure the application server from within Eclipse.

I used the old way: 

1) Right click on the Servers view, New - Server

2) Click "Download additional server adapters".

Eclipse will do traverse several sites to get the connectors for application servers, such as  to http://www.webtide.com/eclipse for Jetty connetor, etc. Then Eclipse would display list of servers (Geronimo, Jetty Generic Server Adaptor, Oracle WebLogic Server Tools, WASCE, etc.). 

3) I chose the "Oracle WebLogic Server Tools" (v1.1.0.200903091141).

4) Click the Next button

5) Choose "Accept" radio button, then click "Finish" button

Eclipse displayed: "Support for Oracle WebLogic Server Tools will now be downloaded and installed. You will be prompted to restart once the installation is complete."

6) Click "OK"

Then nothing happened. Looks like Eclipse tried to display something error dialog, but it disappeared very fast.

I have been using the previous version of WebLogic Server 10.3 Tech Preview before on Eclipse 3.3 (Europa), and it worked fine with the online server connectors/adaptors download. But for now my Eclipse 3.4 Ganymede it has problem (at least on my laptop). That time WebLogic Server was still with BEA Systems, prior to the acquisition by Oracle Corp.

I try to find it on the Net if other people also have the same problem.
Then I found out that I need this software component:
Oracle Enterprise Pack for Eclipse 1.0

You need to update from this update site for Eclipse 3.4 (Ganymede) as follows:

1) On the menu, choose: Help - Software Updates...

2) Select Available Software tab, click "Add Site" button

3) Enter this url: "http://download.oracle.com/otn_software/oepe/ganymede"

For previous version of Eclipse 3.3 (Europa) from this site:
http://download.oracle.com/otn_software/oepe/europa

4) When done adding site, check the box to the left of "Oracle Enterprise Pack for Eclipse Update Site"

5) Click "Install" button

Eclipse will display which components will be installed. 

6) Select all components, then click "Next"

7) Accept the term/license

8) Click "Finish" button

9) When finished, restart Eclipse, here are the details:

After the installation it will display a dialog box asking you to participate in User Experience something program.

After that I got a warning that if I run Eclipse under JDK 6 I need to enable option in -Dsun.java.classloader.enableArraySyntax=true something in your eclipse.ini file. The installer would do it for you and ask you whether you want to restart? LOL.

Nah, now I got the WebLogic connector on my Eclipse.

Tuesday, October 21, 2008

The Long Awaited JDK 6 Update 10 has been released

Here is the link where you could download the latest JDK.

http://java.sun.com/javase/downloads/index.jsp

I have heard about this long awaited release, JDK6u10 since the time I attended the Sun Developers' Day 2008, on June this year. Joey Shen presented what's new in this version.

Though the version name seems to be only minor update to the JDK 6, actually this version contains a whole bunch of improvement.

The most notable one explained by Joey Shen is the modular approach in downloading JRE. Now the JRE could be downloaded very fast, the initial will only be download only small piece of jar. Later other components will be downloaded on demand.

Why jump straight away from update 7 to update 10?

I believe these features weren't released as JDK 7 because JDK 7 has been released to the community as OpenJDK in which Sun Microsystems doesn't have the direct control over the release. There were some long discussion on what features should be in, not mentioning also when to release. Inherent problem with community driven release of such SDK is the delay caused by strong disagreement among the community.

So I guess that Sun just put a certain number for the next version, which turned out to be update 10 while we were in the update 5 or 6 just to be safe and give some lead time to complete the job. As there are lots of full timers and experienced employees working on the version Sun Microsystems could be better drive the release of update 10.  Eventually they finished long before update 8 being used, thus the number jumps from update 7 to update 10!

Tuesday, September 23, 2008

On Migration Problem from WebLogic 8.1 to 10.0

Somebody posted a question on an old entry of my blog, asking about the problem they have when migrating from WebLogic 8.1 to WebLogic 10.0. I pasted the question that was asked so that everyone could easily referred to it.
In order to be able to answer to your question I need more specific things:



  • What kind of WebLogic project are you using (is it a WebLogic Workflow Project or plain J2EE application), it will help me to identify what kind of 'compiling' is going on

  • If what BEA support asserted is correct (it was merely caused by the Sun JDK bug with zip file), you have an option to migrate to use the JRockIt! virtual machine instead; you have an option to set your JVM to JRockIt! when you are setting your domain



In the past, WebLogic Server is known only to work on certain version of Sun JDK which usually is not the latest one (may contain bugs that has already been fixed in the later version). I found out that the later version of WebLogic Server such as 10.x seems to be more compatible with the Sun JDK; means I have successfully run WebLogic Server on  the  latest version of JDK 1.6.0 which was not the case with 8.1 and 9.2 version.

On the later version such as 10.x, BEA (now Oracle) suggested to use JRockIt! JVM even for development. Previously BEA suggested to use Sun JDK for development and only use JRockIt! on production.

Using Sun JVM  you will experience java.lang.OutOfMemory caused by PermGenSpace is full (this is a normal and expected behavior), but you will have much faster deployment cycle (JRockIt! needs to precompile to native binaries for every things that are deployed, while Sun JVM only compiles to native part that is used often).

I guess that your problem happens while you are compiling EJB using the WebLogic Workshop IDE?



Anonymous said...

Hi,
I am trying to get information about Weblogic 10.0. 
So far, we have had a 
very hard time trying to migrate from Weblogic 8.1 to Weblogic 10.0. 
Do you know of anybody with experience on doing this migration? What type of problems did they found and how they got resolved?


We keep having OutOfMemory Exceptions when compiling EJBs...and servers not even start. We migrated from 8.1 all applications using Weblogic's domain upgrade utility. The configuration is preserved, and the applications are deployed, but when it tries to start, it is not able to do it. If it starts then it keeps finding OutOfMemory exceptions.

I am told from BEA support that this is caused by SUN JDK bug with zip files... What are my options?

 



 

 

 

Thursday, September 18, 2008

Reiterate JavaFX Again

Today our servers being physically transported to the new office site. Initially I planned to fix things before leaving to Bangkok, but the moving coincide with my planned date. 
So today I spend my half day in the morning exploring JavaFx again.

I went back to my NetBeans 6.1 installation which is a bit dusty because I haven't touched it for a such long time.

I followed the JavaFX Clock application step by step and it works as advertised. For a Java developer the learning curve for JavaFX is not steep. Even considering the vast number of open source Java libraries lying around, it is an advantage!

I still am able to use the whole java.lang.* while using the javafx.application.* packages.

Before using the NetBeans version, I followed the Chuk Mun Lee's tutorial on the recent Sun Developers' Network 2008, which was using JavaFXPad. JavaFXPad is ok, only the code formatting and cut-and-paste feature is pretty much limiting. NetBeans has much better support as an IDE, you could even start to develop your JavaFX application.

Learn Java from Scratch

Yesterday I talked with a freshman from one of the local (Singapore) private university. Now he starts learning Java language. The curriculum required him to learn Java very fast with the small amount of introductory material. It translate to he has to do considerable amount of individual unsupervised work.
It good though that the university requires him to learn the Java language the hard way. Use text editor only and command line.

Next after they learn Object Oriented Application Development, they will be allowed to use sophisticated commercial development tools, such as IntelliJ IDEA which is available at his campus.

I still believe and support the idea that a better fundamental will be shaped when students learn Java the hard way, that is start from the command line compiler and the command line JVM invocation.

Wednesday, September 3, 2008

ItsNat: Java based Comet framework

Java based framework that supports Comet out of the box are out there right now. At least we have 3 now: Dojo, IceFaces, and now ItsNat!


It is dual licensed, GNU Affero GPL v3 or commercial license for closed source project.

This framework has it's own client/server both at the browser. The server communicate with the Java server, and the server communicates with the client side.

Wednesday, July 30, 2008

Java User Group Singapore Meeting Up

This is the photo of the last Java User Group Meeting Up at Singapore. The event was around February 18th, 2008.
The host is Ivan Petrov, which provided us with nice place and facilities, even a very nice food. What a great hospitality he had shown to us.
Ben Alex, Principal Software Engineer (3rd from the right), spoke on the to-be-released-soon version of Spring Security (formerly known as AcegiSecurity).
Ben showed us how much easier it is to use the SpringSecurity framework in your JEE web application.
Posted by Picasa

Thursday, July 17, 2008

Apache Tomcat 6.0 Cannot Undeploy Correctly

This 3 months I have been using Tomcat 6.0 for deployment, and one thing that I don't like is that the application server needs to be restarted most of the time when deploying. I remember that this is not the case with my previous development. I thought it was because the Tomcat 6.0. Later I found out that the problem is with the struts-core-1.3.9.jar library.

Several attempts have been made to use the antiJARLocking and antiResourceLocking features of Tomcat. All ends up in futility.

The struts-core-1.3.9.jar (as well as version 1.3.5, 1.3.8) as setup by maven 2 dependency, depends on the Apache commons-digester-1.8.jar. This version (1.8) of the commons-digester library has this bug specific to Windows environment.

There are some workarounds that is possible:

  • Upgrade to higher version of Struts (in the case of my current work, we are moving to struts2 which known not to have this problem)

  • Override the maven 2 dependency, and inject a new dependency to higher version of commons-digester library


First option is obvious, the next will be a bit tricky.
I will show you how to do it later...

Tuesday, July 15, 2008

Sun Developers Day 2008 at Singapore


Today I attended the Sun Developers' Day. My office is not in the habit of sending people to such events, so I have to be a proactive person, take a one day leave to attend this event.
"Sun Developer Day 2008 brings together visionaries, leading experts and developers to seize the next wave of technical innovation through Open Source".

Trends that were presented are in the topics of JavaFX, MySQL, OpenSolaris.

This is my first time attending Sun Developers' Day. There were Sun Developers' Day events in Jakarta, but I didn't manage to have time to attend one of them. 

Some thing that interest me are: JavaFX, VirtualBox, new OpenSolaris eye candy, MySQL tuning, and Solaris DTrace, JDK 6 update 10, Grails.


Matt Thompson, manager of the Sun Technology Evangelist group,  gave an opening message. 

Among the speakers were:

Chuk-Munn Lee, Senior Developer Consultant and Technology Evangelist for Technology Outreach at Sun Microsystems in Singapore.

Joey Shen (Zhuo-Li, Chinese), Technology Evangelist for Sun Microsystems based in Beijing, China.

Peter Karlsson, Solaris Technology Evangelist for Sun Microsystems. 

Raghavan Srinivas, CTO of Technology Evangelism at Sun Microsystems.


This even also intertwinned with JavaJive competition final between universities from Singapore, Malaysia, and Thailand. Previously local competitions have been held in their respective countries. The final presentation brought was won by team from Thailand.



Thursday, July 10, 2008

Liferay 5.0.1 with Tomcat bundle

Why did I choose the Tomcat bundle?

First, unarguably Tomcat is the most popular application server in the planet.
One of the SpringSource guys told me that based on survey, around 80% of the Spring framework
deployment are in Tomcat. There are lots of application currently in production that uses
Tomcat.

Second, that is what the Liferay 4.4 documentation suggest for the development.
(Sadly enough, currently there is no Liferay 5.0.1 documentation...)

Become a bit different from the manual, I choose PostgreSQL 8.2 as my development database instead of MySQL as suggested by Liferay manual. pgAdminIII 1.6.3 feels handy right here.

What you need to do with PostgreSQL is:

Copy the JDBC driver from PostgreSQL installation to the Tomcat library folder.
In my machine I copied from [C:\Program Files\PostgreSQL\8.2\jdbc\postgresql-8.2-506.jdbc4.jar]
to my [d:\opt\liferay-portal-tomcat-5.5-5.0.1\shared\lib] folder.

I edit the d:\opt\liferay-portal-tomcat-5.5-5.0.1\conf\Catalina\localhost\ROOT.xml
Comment out the tag for MySQL, uncomment and adapt the PostgreSQL section.
For my machine, it was setup like this. You might need to adapt to your own database setting.

<resource
name="jdbc/LiferayPool"
auth="Container"
type="javax.sql.DataSource"
driverClassName="org.postgresql.Driver"
url="jdbc:postgresql://localhost:5432/lportal"
username="lportal_client"
password="liferay"
maxActive="20"
/>

Remember that some default configuration of PostgreSQL installation disabled the TCP/IP access
to database. You need to enable that, and also you might need to grant permission to where the
TCP/IP client located (in this case your Tomcat application server).

As suggested by the manual, Liferay will do the magic when you change the database, provided
sufficient rights to access the new database. Of course the magic takes some time to perform.

Access the web browser on the url [http://localhost:8080/]. It will display this screen:

Login using:
user: test@liferay.com
pass: test
Click on the [Sign in] button.

The sample page will show you a form asking you to agree/disagree with the Terms and Conditions.

If you get this far that means that you have succeeded setting up a fresh Liferay installation with the database for development.
Good job!

Thursday, November 15, 2007

WebLogic 10.3 Tech Preview

BEA has released a tech preview version of its flagship product, WebLogic Server, the most advanced JEE application server. The new application server has features that make many other envy, as it is able to do the hot deployment of classes.
Experience using the Eclipse Europa Fall using BEA Connector for WebLogic 10.3 shows a very significant increase in time to deploy changes in the Java classes.
One of our project adapted this environment which makes development pretty much faster and enjoyable.
More time for beers and fewer time waiting to deploy...

Monday, October 22, 2007

Back To AWT!

Last 2 weeks has been my time revisiting the Java AWT. I was assigned to create a chart graphics which is not supported by existing open source projects. The graphics required to be overlapping with left and right side showing different scales on the Y-axis. I took a look on an open source project that do similar graphics, and finally come into decision to create the graphics itself in Java AWT, and later display it through servlet streaming the image.
Last time I dealt with this stuff was long time ago, first time I learnt Java 1.1. The assignment was to create a GUI application for Reverse Polish Notation (RPN) calculator. RPN is a stack machine, where all operations takes place in the stack. RPN itself was widely used in the first generation programmable calculator (with the first and notable player: Hewlett-Packard!). The assignment was displaying 8 rows of stacked line seven-segment-digits that contain numbers stored in the stack machine.
This is a real fun though, it remains me the time of BASICA when drawing in the screen requires us to compute the coordinate, transforming it, etc. Now of course the AWT has bunch of more satisfying features such as Graphics2D (which wasn't there during Java 1.1 reign).
This is a real banana!

Tuesday, October 16, 2007

Java2D for Custom Report Graphics Display

This last 4 days I was forced to learn the Java2D. Java2D is a powerful library, but it was only introduced in Java 1.2. The last time I learn about graphics in Java, was the time when I took the OOP Course, back to 1997? Mr. Stef taught us OOP using Java 1.1. AWT has just changed the infrastructure to message based to reduce complexity. We implemented a graphical Reverse Polish Notation calculator with 8 rows representing the contents of the stack (the first electronic calculator was using this kind of stack based Reverse Polish Notation).

Now I have to browse through it again, because the requirements asked for a type of graphics which I believe currently not supported in any reporting engine. It needs an overlapped view of two graphics. One with the legend on the left, and the other on the right. I have tried to use JFreeChart, but eventually found out that this kind of graphics is not commonly used. I have to build the graphics from scratch, except for the encoder that converts the BufferedImage objects into a PNG or GIF files.

It's interesting to see how JFreeChart is doing it down the hood. Last time when I touched this library it was still 0.9.x and not so stable. Now the library has grown up so much, and the page display flashy pictures.