JAVA

You are currently browsing the archive for the JAVA category.

This time I want to introduce a book I just read from the Internet. It is free of charge to download and the contents are mainly focused on questions that we will face during an interview.

The author has eight years of JAVA experience, even he was graduated as a Mechanical Engineer. He has experience on different fields of JAVA, from JavaSE to JavaEE to other related technologies that companies usually want, from concept, theory to the programming language. It benefits not only to the job seekers, but also the interviewers.

Most questions are composed of Q&A style, divided into parts of different topics, with an index for you to locate several subsets of the questions. You can also take it as a quiz on your JAVA knowledges, e.g. before you go for certification. I didn’t actually start reading it, but there are already many reviews on the book.

Page about the book:

http://stores.lulu.com/java-success

Share and Enjoy: These icons link to social bookmarking sites where readers can share and discover new web pages.
  • Digg
  • Sphinn
  • del.icio.us
  • Facebook
  • Mixx
  • Google
  • Live
  • Technorati
  • YahooMyWeb

I am invited to participate in the Java Certification Day on 21 June in Hong Kong. The talk mainly introduces some new technologies in the Java World, but I think they are not quite useful.

The first talk I attended is “Java Programming with no Java *code*”. The name is so attracting but the content is rubbish. It just introduces how Netbeans creates a BPEL project. It is not really about JAVA programming, it’s a construction of SOA projects.

The second talk is about non-intrusive monitoring using JMX. Other than the introduction of two softwares, JConsole and JFluid, I don’t think the talk is worth attending. And the last talk is on “High Performance Java Technology in a Multi-core World”, it did state how hardward can help to improve the performance of Java applications, but that’s not my knowledge field. That’s why I leave earlier (actually it overruns a lot).

After that, I went outside and proceeded to the promotional counter. After discussion with an Education Manager, I am much clear about my certification path. Personally, I want to take the SCEA exam as a long-term objective. Before that, I will take SCWCD and SCBCD which I did set as objective this year. Thus, I bought two discounted exam coupons and two corresponding ePractice exams. Totally, it costs me HKD2000. The price is acceptable and I hope this is worth and get me to a good career in the next job.

Share and Enjoy: These icons link to social bookmarking sites where readers can share and discover new web pages.
  • Digg
  • Sphinn
  • del.icio.us
  • Facebook
  • Mixx
  • Google
  • Live
  • Technorati
  • YahooMyWeb

Since learning about AJAX from Shan Shin’s JavaPassion course last year, I have tried several AJAX Frameworks in testing environment and have already made use part of them in production application. These frameworks always lead me to dead end. Most of them are not mature enough, and each of them do have something better and worser.

Here, I would like to make a comparison between several frameworks that I’m really interested in, and probably make use of them in the coming projects. (You know? There are probably more than 100 frameworks available, both commercial and open-source. I guess no one will have time to investigate one by one) Let me first list them out.

Dojo
This is the first framework that I learnt and made use of. It is developed by a group of web application developer, and most of them are well equipped with web technology skills like Javascript, DOM, etc.

YUI (Yahoo! User Interface)
Shan Shin’s course didn’t mention about this framework at the time being. The reason that I know about this comes from Dojo. Many people complains Dojo is slow in terms of performance, and I know some of them switched to YUI due to this reason.

GWT (Google Web Toolkit)
Yet another framework that is developed by big IT company, but this one is not an open-source framework. It provides API and guidelines to help you developing applications.

ZK
Sourceforge.net #1 AJAX Project. I have noticed this framework long time ago, saying that creating AJAX applications without Javascript. This will also be covered in Sang Shing’s course in the coming few months.

In the next part, I will be continuing on the topic by providing table of information.

Share and Enjoy: These icons link to social bookmarking sites where readers can share and discover new web pages.
  • Digg
  • Sphinn
  • del.icio.us
  • Facebook
  • Mixx
  • Google
  • Live
  • Technorati
  • YahooMyWeb

Just found a book introduction from TheServerSide.com

This book explains the concept of JPA, with some useful knowledge on the persistence standard, JPA Annotations, Entity Manager and JPA Query Language (also known as EJB-QL), etc. There are examples, and a simple Maven 2 application with MySQL Database, and Hibernate as the persistence provider will be build after reading through the book. I hope this will be useful for my development using JPA.

Post on TheServerSide
JPA101 Chapter
Author: Chris Maki’s Blog
http://jroller.com/page/cmaki

Share and Enjoy: These icons link to social bookmarking sites where readers can share and discover new web pages.
  • Digg
  • Sphinn
  • del.icio.us
  • Facebook
  • Mixx
  • Google
  • Live
  • Technorati
  • YahooMyWeb

One of the major change for this 2.4 version of web.xml is the ordering of tags. As the use of XML Schema provides the flexibility on the ordering of tags, you can put the tag in any ordering as you like.

Besides this, one another change is the use of tag library. Starting from 2.4, we have to surround all <taglib> with a new tag <jsp-config>, as required by the mechanism of XML Schema, like the following:

<web-app xmlns=”http://java.sun.com/xml/ns/j2ee”
xmlns:xsi=”http://www.w3.org/2001/XMLSchema-instance”
xsi:schemaLocation=”http://java.sun.com/xml/ns/j2ee
http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd”
version=”2.4″>

<description>StrutsTest</description>

<jsp-config>

<taglib>
<taglib-uri>http://jakarta.apache.org/tomcat/debug-taglib</taglib-uri>
<taglib-location>/WEB-INF/jsp/debug-taglib.tld</taglib-location>
</taglib>

</jsp-config>

</web-app>

Share and Enjoy: These icons link to social bookmarking sites where readers can share and discover new web pages.
  • Digg
  • Sphinn
  • del.icio.us
  • Facebook
  • Mixx
  • Google
  • Live
  • Technorati
  • YahooMyWeb

Learning EJB-QL

Seems that there is still not much resource on Java Persistence, which is included in EJB3. If I want to learn more about EJB-QL, the only way is to look at the resources of EJB2.1. The articles may not be updated, but most of the contents still apply.

However, I found one EJB-QL that is in the spec. seems not supported by most of the vendors, which is OFFSET and LIMIT. I found some articles on people asking Sun about the issue, but no one answers. Then I do a search on Google, and only found Resin which supports it.

These keywords are used together to limit the number of entity instances returned in a list, especially useful for entity storing up to ten thousand records. Your memory size must be a main issue by then. Actually, it is just similar to the ROWNUM functions provided by Oracle, but don’t know why so few vendors implement such a useful function.

Share and Enjoy: These icons link to social bookmarking sites where readers can share and discover new web pages.
  • Digg
  • Sphinn
  • del.icio.us
  • Facebook
  • Mixx
  • Google
  • Live
  • Technorati
  • YahooMyWeb

When I am thinking using autoReconnect will resolve the disconnection problem, a new error comes to me.

java.net.SocketException
MESSAGE: Software caused connection abort: recv failed

This error appears in occasional case, but also after a long hours of idle. I used Java Persistence to connect mysql. Today morning, when I was back to office. My application seems fine when doing the querying functionalities. However, when I used persist() and merge() operations which updated the DB, this error occurred.

Someone said this also the same problem as previous, which MySQL disconnects the connections after idle for 8 hours, but I am amazing that the error only throw for updating operations. Is it mechanism for Java Persistence, since it can store part of DB details in memory, so it didn’t actually query the database?

Reference:
http://forums.mysql.com/read.php?39,55337,95721#msg-95721

Share and Enjoy: These icons link to social bookmarking sites where readers can share and discover new web pages.
  • Digg
  • Sphinn
  • del.icio.us
  • Facebook
  • Mixx
  • Google
  • Live
  • Technorati
  • YahooMyWeb

These days, this exception always occur in my new developing application using persistence, especially on the morning when I came back to office. At the beginning, I think it may be due to the use of Java Persistence. However, when I do a search on Google, at the top of the list, I got this post:

http://www.yannicafe.info/wp/2006/11/25/53.html

This post describes the case in detail. It is due to the mechanism of MySQL, where this DB will disconnect all the active connections after 8 hours if there is no activity. After that, if your application try to work on some activities, the above exception is caused.

Normally, the exception should be caught in the application, and direct to a reconnect logic. However, the persistence provider (Oracle TopLink) that I am using does not provide auto reconnect function. So, I need to change the connection URL to the following:

jdbc:mysql://localhost:3306/test?autoReconnect=true

This allow the application to auto reconnect in case MySQL disconnects all the connections. Nevertheless, the bad thing is that  this is not recommended by MySQL community and this parameter may even be removed from future versions of MySQL.

Reference:
http://forums.java.net/jive/thread.jspa?messageID=189962

Share and Enjoy: These icons link to social bookmarking sites where readers can share and discover new web pages.
  • Digg
  • Sphinn
  • del.icio.us
  • Facebook
  • Mixx
  • Google
  • Live
  • Technorati
  • YahooMyWeb

Struts Validation

Today, I’m learning about the Validation Framework incorporated in Struts.

After setting and running the application using validation, I got a weired NullPointerExceptionn. After surfing the Q&A on the Internet, I got this.

“Wrong package name”

The package for importing the new Action Form should be

org.apache.struts.validator.DynaValidatorForm

not

org.apache.struts.action.DynaValidatorForm

so Take Care!!

Reference:

http://wiki.wsmoak.net/cgi-bin/wiki.pl?Struts/DynaValidatorFormError

Share and Enjoy: These icons link to social bookmarking sites where readers can share and discover new web pages.
  • Digg
  • Sphinn
  • del.icio.us
  • Facebook
  • Mixx
  • Google
  • Live
  • Technorati
  • YahooMyWeb

As JPA is providing the interface to connect your Java application to the database, it is supposed to be just an interface doing so. In the other words, you have freedom in managing your database, by changing the DB-specific parameters and tuning the database.

In MySQL, as most people should know, there provides a choice of storage engine on each table. By using JPA, you can let the persistence provider to generate the table for you. It is easy and let the persistence provider determine the suitable configuration for you, both on table and on each field.

The default storage engine for table is InnoDB, as it supports transaction, row-locking and foreign keys where are needed by JPA. However, if you have a table that needs performance rather than data accuracy, you can manually change the storage engine to MyISAM before or after the persistence provider’s decision.

You can stop the persistence provider from generating the table, which you build your own table first, and just simply mapped all the things to the Entity.

Share and Enjoy: These icons link to social bookmarking sites where readers can share and discover new web pages.
  • Digg
  • Sphinn
  • del.icio.us
  • Facebook
  • Mixx
  • Google
  • Live
  • Technorati
  • YahooMyWeb

« Older entries

 

September 2008
S M T W T F S
« May    
 123456
78910111213
14151617181920
21222324252627
282930  

Categories