跳至主要内容

博文

Book Review: Arquillian Testing Guide

Today I have received my hard copy of the book, Arquillian Testing Guide. Comparing to the resource I had got at the end of last year, much content are improved. Arquillian is a modern Java EE testing framework, based the well-known JUnit or TestNG, brought by JBoss.org. In fact, currently Arquillian is beyond Java EE, and not only for Java EE application and Java EE container, such as it also supports Android application test and can run test in Android system(or Android simulator) . Most of my Arquillian experience is based on Java EE. If you have some experience of JUnit experience before, and eager to find a testing solution for your Java EE application and want to run the test case in container automatically, this book is for you. With Arquillian, you are free from preparing the test fixture before you write real tests. You can write tests in the nature way, such as using @Inject, @Resource etc in your test case directly as the way in yo...

Click4nb Update for NetBeans 7.3

I just updated the click4nb and rebuilt the source code against NetBeans IDE 7.3. No new features added. Follow the installation guide to install it into your IDE. Installation Read this wiki page to start your first Click application. Getting Started with Apache Click and NetBeans IDE Enjoy!

Getting Started with Apache Click and NetBeans IDE

Note: this post is from my project wiki pages, please read https://github.com/hantsy/click4nb/wiki/Getting-Started-with-Apache-Click-and-NetBeans-IDE for the newest version. If you have some suggestion or find some errors, please file an issue. Thanks. After moved from Google Code, I have cleaned the codes and just released a new version of click4nb , which was tested against the stable NetBeans IDE 7.2. Installation Following the steps in Installation wiki page to install click4nb into your NetBeans IDE. Create a web project with Apache Click Support Create a Web Application in NetBeans is very easy, follow the following steps to create one for yourself. Click the New Project button or click "File/New Project" menu from main menu in NetBeans IDE. In the popup New Project dialog, select Java Web in the Categories list, and Web Application in the "Projects", click Next button. In the Name and Location dialog, input the project related info, such...

Generate reports with Seam 3 Reports and Apache Velocity

Seam 3 provides a collection of standard CDI extensions. Seam3 report module bridges CDI and several report engines, such as JasperReports Pentaho XDocReport Basic Configuration Assume you have already created a Maven based Java EE 6 application. If not, you can create one using JBoss Forge. Add Seam 3 reports related dependencies into your pom.xml . <dependency> <groupId>org.jboss.seam.reports</groupId> <artifactId>seam-reports-api</artifactId> <version>${seam-reports-version}</version> </dependency> <!-- If you are using Jasper Reports, add the following dependency --> <dependency> <groupId>org.jboss.seam.reports</groupId> <artifactId>seam-reports-jasper</artifactId> <version>${seam-reports-version}</version> </dependency> Generally, in order to generate a JasperReports based report in a Seam 3/Java EE6 project, y...

Send email with Seam 3 Mail and JMS

Seam 3 Mail module provides simple API to use Java Mail API to send email message. Basic Configuration Assume you have already created a Maven based Java EE 6 application. Add seam mail dependency to your pom.xml file. <dependency> <groupId>org.jboss.seam.mail</groupId> <artifactId>seam-mail-api</artifactId> <scope>compile</scope> </dependency> <dependency> <groupId>org.jboss.seam.mail</groupId> <artifactId>seam-mail</artifactId> <scope>compile</scope> </dependency> Add basic mail configuration in your META-INF/seam-beans.xml . <mail:MailConfig serverHost="smtp.gmail.com" serverPort="587" auth="true" enableTls="true" username="<your gmail account>" password="<your password>"> <ee:modifies /> </mail:MailConfig> In your Java codes, inject ...

Click4nb 1.1.1 is available now

Click4 nb 1.1.1 is available for downloading now. I have uploaded the file to Google Code and NetBeans Plugin center. Get it and try. This release does not provide more new features but an improvement for Page class hyperlink support( Issue 1 ). Currently, click4 nb works well on NetBeans 6.8. I will move my development envoriment ot NetBeans 6.9 for the next version. In the next version, I will try my best to implement the following features. 1. Add click 2.2 support ( Cllick team has just release the first RC of Click 2.2), update the libary to Click 2.2 and improve the Content Assistance for 2.2. 2. Intergrate Cayenne Modeler into NetBeans IDE , add a action to open Cayenne file directly in NetBeans IDE . 3. Configuration for Cayenne ORM framework and Click intergration . Feel free to submit your feedback by email( hantsy@tom.com ) or leave message on this blog, you can also report your bug in the issue tracker.

Click Plugin for NetBeans 1.1 is avai...

Click Plugin for NetBeans 1.1 is available now Due to the shutdown of Kenai.com, I decided to move this project to Google Code. You can access from the new host page. http://code.google.com/p/click4nb/ Some features are provided in 1.1: 1. Click library update to 2.1 release. 2. You can customize a Click library, and create web project using your click library. see bug: NBX-1 3. CssImport and JsImport hyperlink support. see NBX-2 4. If more than one templates are mapped to one page class, it will popup a panel for you to select which file to open. You can download it from NetBeans Plugin portal or Google Code .

Click for NetBeans plugin 1.0 is avai...

Click for NetBeans plugin 1.0 is available now. I am very pleased to announce that the first version of Click for netBeans plugin is available now. You can get it from the Kenai.com or NetBeans plugin portal. Click i s a simple, but effective and component based web framework, it hosts on the Apache as a incubator project. This plugin bring basic Click support for NetBeans IDE. It includes the following features: 1、 Project creation wizard . 2、 Click Page creation wizard (the interface cloned clickide). 3、Provide basic error checks , hyperlink , code templates , code completion , refacotoring in click.xml file. 4、Also provide hyperlink , code templates , code completion in menu component configuration file. 5、Switch between Page Template, Page Class , Page properties quickly。 This project is open source under GPL, it hosts on kenai.com. Homepage: http://kenai.com/projects/nbx User Forum: http://kenai.com/projects/nbx/forums/user-forum Mail List: http://kenai.com/projects/nbx/lists Bu...

NetBeans Struts2 plugin updates

NetBeans Struts 2 plugin updates NetBeans Struts 2 plugin ( http://nbstruts2support.dev.java.net )is not updated for a long time. I checkout the source code and made some modification to the latest NetBeans IDE 6.7. 1.Update Struts library to the latest stable version 2.1.6 2.Update to the latest web framework API。 3.Redesigned configuration panel and provide more flexible configuration options 4.Other modification to Struts 2.1. Download here : https://dl.getdropbox.com/u/201666/nbstruts2.tar.bz2 Struts 2.1 provides next generation Filter to process request , and also provides a new optional Servlet . If you like choose Struts Servlet to process request , you can check "Servlet"  radio box in the "Reuqest processed by" section in the "Main" tab. This will generate some code like the following.    <servlet>         <servlet-name>struts2servlet</servlet-name>         <servlet-class...

Another NetBeans plugin updated - RichFaces

This a small personal update for  RichFaces plugin for NetBeans ( http://nbrichfacessupport.dev.java.net ) . Modification includes: 1. Update richfaces to 3.3.1.GA. 2. Add skin selector to the configuration panel. Then it will generate the following code in web.xml .     <context-param>         <param-name>javax.faces.STATE_SAVING_METHOD</param-name>         <param-value>server</param-value>     </context-param>     <context-param>         <param-name>org.richfaces.SKIN</param-name>         <param-value>japanCherry</param-value>     </context-param>     <context-param>         <param-name>org.richfaces.CONTROL_SKINNING</param-name>   ...

I updated two NetBeans plugins

The first one is the Wicket 1.4 support for NetBeans ( http://nbwicketsupport.dev.java.net ). I checked out nbwicketsupport ( http://nbwicketsupport.dev.java.net ) of branch nb_67. And made a slight modification on it for the Wicket 1.4 release version. 1. update wicket libaray to 1.4 release . 2. make wicket framework detect works. 3. update example (Login, Pizaa) application (Using filter instead of servlet, remove jasypt lib dependency ) Some problem I encountered. 1. In a maven web project , add Wicket support causes NetBeans dead. Kill and restart NetBeans, I found it configured correctly. 2. I tried to add some code to disable Wicket configuration and display the configured information on the Framework panel ( in the Project properties) after adding it to the Web project( Struts support use this style). But I do not how to get the "HomePage" from project ( code about it is commented). The second is the Stripes plugin (http://code.google.com/p/stripes4netbeans/). Small ...

Maven support in NetBeans 6.7 m2 ...en

NetBeans has released the second milestone product some days ago. There are many articles on PlanetNetBeans( http://www.planetnetbeans.org ) which were talking about the newest features NetBeans 6.7 will bring. Maven support is a highlight feature of them. Many peoples have praised the Maven support in NetBeans 6.7. I am a maven fan, but after I tried it, I was disappointed. Maven support is an incomplete work now. As described on NetBeans wiki, it supports JEE and Java Web project creation now. I found this functionality is only a short-circuit of the normal "Maven Project". In the second step of the wizard, it only provide a extra Java EE version option. In my idea, it must support: target server selection, project relation (parent Maven module and child Maven module) settings and web framework configuration. For "Web project", ideally, in the project definition panel , it must provide a "Add to existed Enterprise Application" option to add current ma...

Hack JBoss JDocbook Maven Plugin

I've used Docbook to organize my technical document for some years. But I prefered using my custom ant-based publish tools than other tools due to the poor Chinese font support. I've just shared my house-use docbook publish tool on google code ( http://code.google.com/p/hantsy-labs/ ) some days ago. Then I created a group on javaeye.com(one of the biggest java community in China) to discuss docbook usage. Jeff Yu noticed my post on javaeye forum and suggested me to use JBoss JDocbook maven plugin( http://www.jboss.org/maven-jdocbook-plugin ), and complained it is lack of Chinese support at the same time. Given my docbook experience , if you want to use Apache FOP to render PDF and dream beautiful Chinese font support , you must customsize the FOP config file. When I checked out the JDocbook source code and read the core code about pdf render, I found it have no way to use customized FOP config file. I decided to resovle the problem , add serval lines of code , I made a patch ...

A new registeration problem occured...

NetBeans 6.5 patch 2 is available now. As the release note declared , the previous JBoss 5 registration problem is fixed in this patch. This means You can add a JBoss Application Server in Services Windows directly , as you add other app server. 1. Start NetBeans 6.5 , and open the Services Windows. 2.Right click the "Server" node , select Add Server in context menu. Unfortunately, I got a NullPointerException. I try to do this in another way . Open Server manager from Tools->Servers menu , click add Server button and then encounter the same problem. This is a bug reported in NetBeans bugzilla , as report #123180 . It is awfully boring. Update: From the www.planetnetbeans.org , a blog entry named " NetBeans, JDK Update 12 and Server Registrati " reports the same problem. The reason is that NetBeans 6.5 runs on the newest JDK 6 update 12. I've just updated it to update 12. Downgrade jdk to update 11 or wait for the ...

Registering JBoss 5 GA in NetBeans 6.5 under Fedora 10

JBoss 5 is GA for some days, but NetBeans 6.5 dose not support JBoss 5.0.0 GA. I use google and find the solution to fix the problem. Follow this blog entry, Registering JBoss 5.0 in NetBeans 6.5. Simple copy several jars from JBoss common lib directory to the instance lib directroy. Enter the JBoss home directory and enter common/lib directory. [hantsy@localhost jboss-5.0.0.GA]cd common/lib [hantsy@localhost lib]cp jboss-javaee.jar jboss.jar jbosssx.jar jmx-adaptor-plugin.jar jnpserver.jar log4j.jar ../../server/default/lib/ It is simple. Now you can add JBoss 5 to the Server node in NetBeans Services Windows. But I encountered another problem under Fedora 10. When I start JBoss 5 from NetBeans Service panel. It failed with the following error message. The transaction service port is used by another application. [hantsy@localhost ~]$ sudo netstat -apl|grep 4713 [sudo] password for hantsy: tcp 0 0 *:4713 *:* LISTEN 24723...

My wishlist in future NetBeans.

NetBeans 7.0 is only a improved version , it will not bring many new features to us. May be the version should be 6.6 or 6.5.1. 1. Clean Code . Many codes in NetBeans are too old. Why not clear them and start at a new point. Sun and the NetBeans team are too care about the API compatibility. I think as a major version upgrade , like 6.5 to 7.0 , it can begin at a new point. Provide a more clear API strategy to keep the API compatibility , I think it is good to the module developer. For example , the minor version upgrade, like 6.0 to 6.1, only make the API more stable and usable and mark the unused API to deprecated but do not remove them. Thus all modules agianst 6.0 can work well on all 6.x version. When a major upgrade, like 6.5 to 7.0, remove the old code marked with Deprecated annotations in last version. Add the new usable API to the main trunk. Ajust the base infrastructure to make it more powerful. 2. Improve UI operation . I would like using the Swing (metal) UI when I...

Fedora 9,糟糕的体验(1)-安装

Fedora 9 经过短暂的延期时,终于发布了。 这次Fedora 9 带来了很很多的特性,吸引Fedora 粉丝眼球。 具体情况,你可以从 Fedora 9的发行说明 中进行了解。 喜欢尝鲜的朋友可以会迫不及待的安装试用,而我的安装经历不是那么愉快。 Fedora 常见的两种安装方法,光盘直接安装和Live CD 进行安装。 1.光盘安装 要体验的ext4等,安装时内核启动时加上参数linux ext4,具体细节请查阅官方网站上的安装手册。 我一般都用reiserfs。 我添加了 linux reiserfs selinux=0。 selinux=0,表示禁用selinux的使用。 如果在现有系统上进行安装,可以选择升级和全新安装。 一般最好选择全新安装,以前的Fedora 升级经验告诉我,它并不能做Redhat 企业版本那样无缝升级。 导致升级后问题会很多。 我一般都是选择全新安装,这样才能真正体验到新版本带来的特性。 安装之前,首先要进行现有硬盘数据进行保护,以免安装过程重要数据丢失。 主要是 /etc /opt /home 几个目录。 如果/opt,/home是单独分区,安装时可以选择将它们挂到新系相应的目录上,但要注意的是,千万不要对其进行格式化。 也可以先不挂载任何分区,安装完之后,再修改/etc/fstab,将它挂上去。 2.Live CD 安装 我首先使用过的Live CD是 Knoppix ,后来这种方式在 Ubuntu 中发扬光大。Fedora 提供Live CD 是最近两版本的事。 Live CD可以提供在先不安装的情况下,试用linux。 我现在还没有试用Fedora Linux 提供的Live CD ,不知道与Ubuntu 的方式有什么差别。但是Ubuntu的Live CD 安装方式在我机器上体验不是很好。 3.使用Preupgrade进行升级 除用光盘安装与升级外,Fedora 9 声称提供另外一种新的特性进行升级,称为 PreUpgrade 。 Preupgrade声称提供系统的无缝升级,目前支持F7,F8-》F9的升级。 在Fedora 8 下必须使用0.9.3-3版本才能看到看到Fedora 9,现在已包含Fedora 8官方安装源中,直接用yum安装即可。 从命令行中启动preupgrade,如图...

NetBeans 6.1 发布了

在短暂的延期后,NetBeans 6.1 终于发布了。 一起来关注一下NetBeans 6.1的一些激动人心的特性。 首先 NetBeans 6.1 在性能上有大幅提升,启动明显比以前快很多,编辑器的响应速度也大幅度提升,Navigator的解析速度也明显加快。 这在老外的博客上作了详尽的描述,请参考这里P erformance improvements in NetBeans 6.1 。 另外,6.1也为企业级开发提供了便利,现在流行的应用框架Spring, Hibernate, Struts都已经得到NetBeans 官方支持。Spring在下载包中已经内置了。Hibernate只要点击几下,从PluginPortal中安装即可。 经过重新设计,NetBeans 6.1提供了近乎完美的JavaScript支持。这为开发Web 2.0程序作好了准备,这里提供了一个 Javascirpt的开发演示 的教程。 在Web Service 支持也得到了增强,支持了Apache aisx,直接集成了SoupUI的调试工具,正式支持Rest风格的WebService开发。 语言方面加入了PHP(现在处于开发阶段,这个目标是在下一个版本正式提供),现在下载站点已经提供了一个开发版本(Early Access),你可以 http://www.netbeans.org 下载一个完整的PHP开发环境。 数据库方面直接集成了MySQL,这可能是Sun收购MySQL之后,产品集成上的首个体现吧。 NetBeans 的下一个版本是6.5 ,计划年底提供,请参考NetBeans 的 Roadmap 。 一个主要是的目标是提供PHP开发环境,另外会完全重新设计数据库的支持。这是值得期待的。另外也提到要提供Javascript的debug功能。 具体细节,请参考NetBeans wiki内容,请参考 http://wiki.netbeans.org/NetBeans65 。

重新开张了

不知道这次是不是真的不再需要代理了。 前一段时间看到消息,说blogger.com的访问限制取消了。不知道是不是真,这几天访问下来,几乎没有什么问题。 以前访问blogger.com都是需要代理的,以至我申请了好长时间,也没有写过什么实质性的内容。 其实喜欢blogger.com不是因为别的,只是因为它出于Google,沿袭了Google产品的风格,简洁实用。Blogger.com作为国际上较有影响力的博客空间,知名度也不一样,在这里,多少会多一些人气。 我现在在考虑,是不是真该搬到这儿了。以前曾经有这样的想法,想把blog从chinaunix.net上搬过来。后来由于blogger.com访问受限的缘故,还是放弃了。 我是希望这一次不要让我再后悔。