<?xml version='1.0' encoding='UTF-8'?><?xml-stylesheet href="http://www.blogger.com/styles/atom.css" type="text/css"?><feed xmlns='http://www.w3.org/2005/Atom' xmlns:openSearch='http://a9.com/-/spec/opensearchrss/1.0/' xmlns:georss='http://www.georss.org/georss' xmlns:gd='http://schemas.google.com/g/2005' xmlns:thr='http://purl.org/syndication/thread/1.0'><id>tag:blogger.com,1999:blog-7373694028643264060</id><updated>2012-02-16T15:36:07.781-08:00</updated><category term='memcached'/><category term='social network software'/><category term='hibernate'/><category term='java tip collection'/><category term='java cache'/><category term='terracotta'/><category term='cache'/><category term='second level cache'/><category term='cache provider'/><title type='text'>Create a site with 10s millions users</title><subtitle type='html'>The diary to record the process to drive the site from 0 users to 10s millions users.</subtitle><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://hankliblog.blogspot.com/feeds/posts/default'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7373694028643264060/posts/default?max-results=100'/><link rel='alternate' type='text/html' href='http://hankliblog.blogspot.com/'/><link rel='hub' href='http://pubsubhubbub.appspot.com/'/><author><name>Hank Li</name><uri>http://www.blogger.com/profile/01921353182145348702</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><generator version='7.00' uri='http://www.blogger.com'>Blogger</generator><openSearch:totalResults>18</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>100</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-7373694028643264060.post-6179093793492239655</id><published>2010-03-14T23:25:00.000-07:00</published><updated>2010-03-14T23:32:14.931-07:00</updated><title type='text'>local.telenav.com has been launched</title><content type='html'>the site &lt;a href="http://local.telenav.com"&gt;http://local.telenav.com&lt;/a&gt; has been launched. It provides quickly search based on user's location.&lt;br /&gt;&lt;br /&gt;It has 0 users since nobody knows it yet. but the target is to grow the site bigger than the yelp.com, Google local and Yahoo Local.&lt;br /&gt;&lt;br /&gt;Stay with me about the process. give me the suggestion too.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7373694028643264060-6179093793492239655?l=hankliblog.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://hankliblog.blogspot.com/feeds/6179093793492239655/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=7373694028643264060&amp;postID=6179093793492239655' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7373694028643264060/posts/default/6179093793492239655'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7373694028643264060/posts/default/6179093793492239655'/><link rel='alternate' type='text/html' href='http://hankliblog.blogspot.com/2010/03/localtelenavcom-has-been-launched.html' title='local.telenav.com has been launched'/><author><name>Hank Li</name><uri>http://www.blogger.com/profile/01921353182145348702</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7373694028643264060.post-6079300454316681248</id><published>2008-04-20T22:25:00.000-07:00</published><updated>2008-04-20T22:27:46.430-07:00</updated><title type='text'>Software Configuration Management Tools</title><content type='html'>copied from http://www.software-configuration.com/software_configuration_tools.html&lt;br /&gt;&lt;br /&gt;Software Configuration Management Tools&lt;br /&gt;configuration managment system Posted by Rob Castellow&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;So now is the fun part.  You get to pick which tools you will be using to make your development process as smooth as possible.  I will attempt to give my experiences with a select few tools that I have seen be useful in a software configuration management environment.  If you, the reader, know of other tools that you feel should really be mentioned, please feel free to send suggestions to my email address in the contact section.&lt;br /&gt;        First, let's address each area that you will need at some point of the software design life cycle...&lt;br /&gt;&lt;br /&gt;Version Control Tools&lt;br /&gt;Subversion (http://subversion.tigris.org) - This is quickly becoming the open source industry standard for version control.  Subversion provides numerous features and also there is  an enormous amount of support for development tools (Eclipse, NetBeans, etc)  Subversion was developed by many of the original CVS developers and was designed to address all the things wrong with CVS.&lt;br /&gt;&lt;br /&gt;Git (http://git.or.cz/) - A non-traditional SCM tool but efficient and distributed version control system.  This project was originally created to manage version controlling LINUX kernels.  The main push on Git is to handle large projects more efficiently.&lt;br /&gt;&lt;br /&gt;Clearcase (http://www-306.ibm.com/software/awdtools/clearcase/) - Did I say that I was cheap?  Yes, I did, but I would like to mention Clearcase anyway.   First, understand the cost of Clearcase is more than what appears on your invoice.  The real cost to maintain Clearcase is in maintaining a local server, and then if multi-site is needed, just multiply that cost by the number of remote locations.  Other than the enormous costs, if I had to pay for a version control tool I would select Clearcase for its overall functionality.&lt;br /&gt;Multi Site replicators&lt;br /&gt;WANDisco (http://www.wandisco.com) - I have not personally used this product, but I know that WANDisco is the leader in providing multi site solutions for Subversion, JIRA, and CVS.&lt;br /&gt;Defect and Enhancement Tracking&lt;br /&gt;JIRA (http://www.atlassian.com/software/jira/) - JIRA is a customizable bug and issue tracker.  JIRA provides custom workflows, web service interfaces and much more.  I have used JIRA and it is extremely intuitive.  JIRA is not free, but it is extremely cheap compared to other tools.  &lt;br /&gt;&lt;br /&gt;TRAC (http://trac.edgewall.org) - I use TRAC on all my home projects, and it is extremely simple and flexible.  TRAC has an interface to Subversion and also has an integrated wiki.  TRAC also reads wiki markup in the commit comments of Subversion.  TRAC is also open source.&lt;br /&gt;&lt;br /&gt;Bugzilla (http://www.bugzilla.org) - Bugzilla is an old standby for many developers.  I would suggest though that there are many better tools out there these days.  However, if you just want  the old classic, Bugzilla is still actively maintained.  Bugzilla is open source.&lt;br /&gt;&lt;br /&gt;Scarab (http://scarab.tigris.org) - Scarab is an open source tool to track issues.  Scarab is a Java based implementation over MySQL.  Scarab is highly configurable, and will also import/export data from other defect tracking tools.&lt;br /&gt;&lt;br /&gt;Mantis (http://www.mantisbt.org) - Mantis is a popular open source web based issue tracker.  Easily installed and configurable.&lt;br /&gt;&lt;br /&gt;Requirement Tools&lt;br /&gt;OSRMT (http://sourceforge.net/projects/osrmt) - Open Source Requirements Management Tool manages features, requirements, design, implementation, and testing.  &lt;br /&gt;&lt;br /&gt;Iterative Build Tools&lt;br /&gt;Cruise Control - CruiseControl was for many years on the forefront of continuous build integration.  CruiseControl has been a favorite by many.  There are many options to the CruiseControl tool, which can all be configured in its xml configuration file.&lt;br /&gt;&lt;br /&gt;Hudson - A newer but powerful continuous integration build tool.  I am using this tool on a project now, and enjoy Hudson's many options, nice interface, and good communication options.  &lt;br /&gt;&lt;br /&gt;Environment Management Tools&lt;br /&gt;SourceForge - (http://sourceforge.net) - The world's largest open source development web site.  This environment allows any open source project to host itself for free on the site.  SourceForge also enables developers to communicate efficiently, track defects, and provides version control.&lt;br /&gt;&lt;br /&gt;Build Tools&lt;br /&gt;Ant (http://ant.apache.org) - Ant is a Java XML based build tool that has many built in libraries to automate builds and deploys.  Most development environments have plugins to Ant, and Ant enjoys widespread support.&lt;br /&gt;&lt;br /&gt;Maven (http://maven.apache.org) - Maven is another Java XML based build tool with many built in libraries.  Maven differs in a few aspects from Ant.  First Maven is object oriented.  A developer will create a POM file to build code and that file will be inherited on all subprojects.  If you are trying to decide whether to use Maven or Ant, I would recommend that if you have a basic  J2EE app that does not deviate from good design patterns, then Maven is great.  If you really need to create creative design patterns, I would recommend Ant.&lt;br /&gt;&lt;br /&gt;Make (http://www.gnu.org/software/make) - You may be designing C++ apps and using Make.  If so, I dropped the link, but chances are this is tattooed on your forearm by now.&lt;br /&gt;&lt;br /&gt;Other Utilities worth Mentioning&lt;br /&gt;KOSMOS - (http://labs.jboss.com/kosmos) - This product is so useful, if you are using JIRA, Subversion, CruiseControl, or SourceForge.  If you are into high level understandings of where the code is at at any given moment, this tool provides a dashboard to several version control and defect tracking tools.  This tool is a JBoss portlet, so you will need a JBoss application server to run this app.  That's OK though.  It's all free!&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7373694028643264060-6079300454316681248?l=hankliblog.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://hankliblog.blogspot.com/feeds/6079300454316681248/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=7373694028643264060&amp;postID=6079300454316681248' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7373694028643264060/posts/default/6079300454316681248'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7373694028643264060/posts/default/6079300454316681248'/><link rel='alternate' type='text/html' href='http://hankliblog.blogspot.com/2008/04/software-configuration-management-tools.html' title='Software Configuration Management Tools'/><author><name>Hank Li</name><uri>http://www.blogger.com/profile/01921353182145348702</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7373694028643264060.post-2464229817097528120</id><published>2008-04-19T13:56:00.000-07:00</published><updated>2008-04-19T14:01:36.453-07:00</updated><title type='text'>maven, defininitly not a relacement for ant</title><content type='html'>Ant has many problems, but maven is definitely not the replacement for ant.&lt;br /&gt;&lt;br /&gt;One key concept for the next generation build tool is that it should be much easier to use. Obviously, maven goes to the wrong direction.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;The following is copied from http://fishbowl.pastiche.org/2007/12/20/maven_broken_by_design&lt;br /&gt;for my reference to write presentation to prevent the moving from ant to maven.&lt;br /&gt;&lt;br /&gt;Responsiveness&lt;br /&gt;&lt;br /&gt;We have a joke around the office, when a new hire is setting up their development environment for the first time. “Now we go to lunch while Maven downloads the Internet.”&lt;br /&gt;&lt;br /&gt;Software should be responsive. When you tell it to do something it should do it. Take a pristine Maven installation and tell it to build a Java application — i.e. perform its most obvious, primary function — and Maven will first say “Wait a moment, I have to download three dozen different components before I can even start doing what you asked me to do.”&lt;br /&gt;&lt;br /&gt;“Ah”, you say. “That’s how maven works. It’s a modular system, you’re just using it to build a Java app.”&lt;br /&gt;&lt;br /&gt;To which I reply: “Then don’t give me a spoon and tell me to use it to cut steak.”&lt;br /&gt;&lt;br /&gt;The fact that all these components are downloaded separately and in serial mean the overhead of not including them is far greater than if they’d put them all (even plus a bunch more you might not need) in the core installation. Worse, though, this happens not when you’re installing maven, but when you’re trying to use it to do something else.&lt;br /&gt;&lt;br /&gt;This process doesn’t stop at installation. Far too often you’ll run maven and it will gleefully traipse off through various repositories doing its own internal housecleaning before actually performing the build. It’s like walking up to a shop assistant and asking him to help you find a book, only to watch him dust shelves for fifteen minutes first.&lt;br /&gt;&lt;br /&gt;Reliability&lt;br /&gt;&lt;br /&gt;Consider two pieces of software. One uses maven (and 1–n artifact repositories) to manage its dependencies, the other keeps all its dependencies in source-control. How many potential points of failure are involved in checking out and building each product?&lt;br /&gt;&lt;br /&gt;Repeatability&lt;br /&gt;&lt;br /&gt;Builds must be repeatable. If you check out a particular version of your code and build it with particular versions of your tools, you should get a product that is binary-identical each time. (Modulo things like compiled-in build dates, obviously)&lt;br /&gt;&lt;br /&gt;Maven seems to try as hard as it can to prevent this. Files go missing from public Maven repositories and suddenly a whole swathe of historical versions of open source projects can’t be built without hacking. ibiblio reorganises its directory layout and chaos ensues. Imagine what happens in ten years time when maven has been superceded by some new tool, public maven repository maintenance is an afterthought, and you desperately need to patch some legacy Java app?&lt;br /&gt;&lt;br /&gt;For well-resourced projects, the solution is to maintain your own repository and ensure all your dependencies will be available from it, for all time, but even that won’t help you if you suddenly need the compile-time dependencies of a project you previously only used as a binary.&lt;br /&gt;&lt;br /&gt;(A number of responses to this blog post have assumed that all my problems could be solved by a locally maintained repository, and/or a repository proxy. We have both. They help to some extent, but they in no way solve the problem completely. All they are is a band-aid over the fundamental issue, and once again, additional potential points of failure.)&lt;br /&gt;&lt;br /&gt;Most open-source projects just assume their dependencies will continue to exist in “the cloud” for eternity.&lt;br /&gt;&lt;br /&gt;Plugins are the worst culprit. Since the core of maven exists solely to download an Internet’s-worth of plugins to do the heavy lifting, and maven has a nasty habit of upgrading those plugins without any user-prompting whatsoever, builds can be crippled by some well-meaning committer “fixing” some piece of functionality. I’m told this has been fixed recently (or will be fixed soon) but versions should not be a moving target. v. 2.0.1 of your build tool should be v. 2.0.1 of your build tool. Forever.&lt;br /&gt;&lt;br /&gt;Case Study: Dependency Management&lt;br /&gt;&lt;br /&gt;One of the big strengths of Maven 2 is supposed to be the way it manages dependencies, including transitive dependencies. So if jar A requires jar B which requires jar C, Maven will sort all this out for you.&lt;br /&gt;&lt;br /&gt;Tracking down dependencies and sorting out their transitive relationships is a tricky task, but it’s a tricky task you only ever have to do when you modify your dependencies. Maven, on the other hand, wants to do this job every time you build, which adds a huge responsiveness overhead, as the “pom” definition files of each dependency must be retrieved and analysed alongside their jars.&lt;br /&gt;&lt;br /&gt;Dependencies may live in a number of different repositories, and these repositories are out of the control of the user, especially in the case of maven-built open-source projects that almost universally rely on the public ibiblio, apache and Codehaus repositories. This impacts both reliability, as all these repositories must be available, and repeatability, as changes to the repositories may have catastrophic effects on the build.&lt;br /&gt;&lt;br /&gt;Reliability problems also creep in because maven, forced to do dependency resolution in each build, must hide a lot of what it’s doing from view lest it overwhelm the user even more. Conflicting transitive dependencies are resolved implicity, and you have to make a concerted effort (with clumsy tools) to manually find out what was going on.&lt;br /&gt;&lt;br /&gt;Paradoxically, by trying to make dependency management easy, maven makes it incredibly hard. It becomes dangerously easy for a project to accumulate dependency cruft —— at best unnecessary, at worst conflicting —— and excruciatingly painful to remove them.&lt;br /&gt;&lt;br /&gt;Conclusion&lt;br /&gt;&lt;br /&gt;Maven 2 performs a difficult task, and there are a lot of moving parts — plugins, proxies, repositories — between typing mvn install on the command-line and getting a working system. But there has to be something fundamentally wrong with any tool that, whenever I use it, seems to have at least a 50% chance of completely fucking up my day&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7373694028643264060-2464229817097528120?l=hankliblog.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://hankliblog.blogspot.com/feeds/2464229817097528120/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=7373694028643264060&amp;postID=2464229817097528120' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7373694028643264060/posts/default/2464229817097528120'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7373694028643264060/posts/default/2464229817097528120'/><link rel='alternate' type='text/html' href='http://hankliblog.blogspot.com/2008/04/amven-defininitly-not-relacement-for.html' title='maven, defininitly not a relacement for ant'/><author><name>Hank Li</name><uri>http://www.blogger.com/profile/01921353182145348702</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7373694028643264060.post-531680937839302680</id><published>2008-03-30T01:49:00.000-07:00</published><updated>2008-03-30T12:11:41.512-07:00</updated><title type='text'>mvn + tomcat for hot deployment</title><content type='html'>Also, one very powerful feature of Maven that I am messing around with right now is filtering and profile "mashups". Lets say, I want LRD (local rapid development ;-) on my workstation using Tomcat. Usually I would use the Jetty plugin because it is the ultimate for Maven LRD, but the majority of the time and to match what is in production, developers use Tomcat at a minimum. Here is a quick tip for creating a shared distributable app using the aforementioned.&lt;br /&gt;&lt;br /&gt;In a existing Maven app, create the following structure:&lt;br /&gt;&lt;br /&gt;src&lt;br /&gt;|-main&lt;br /&gt;   |-filters&lt;br /&gt;      |-tomcat.properties&lt;br /&gt;   |-resources&lt;br /&gt;      |-context.xml&lt;br /&gt;&lt;br /&gt;In your pom.xml we have something like&lt;br /&gt;:&lt;br /&gt;&lt;br /&gt;  &lt;profile&gt;&lt;br /&gt;  &lt;id&gt;tomcat&lt;/id&gt;&lt;br /&gt;  &lt;activation&gt;&lt;br /&gt;     &lt;activebydefault&gt;false&lt;/activebydefault&gt;&lt;br /&gt;&lt;br /&gt;  &lt;/activation&gt;&lt;br /&gt;  &lt;br /&gt;  &lt;build&gt;&lt;br /&gt;&lt;br /&gt;     &lt;filters&gt;&lt;br /&gt;        &lt;filter&gt;src/main/filters/tomcat.properties&lt;/filter&gt;&lt;br /&gt;&lt;br /&gt;     &lt;/filters&gt;&lt;br /&gt;&lt;br /&gt;     &lt;resources&gt;&lt;br /&gt;        &lt;resource&gt;&lt;br /&gt;           &lt;directory&gt;${basedir}/src/main/resources&lt;/directory&gt;&lt;br /&gt;&lt;br /&gt;           &lt;filtering&gt;true&lt;/filtering&gt;&lt;br /&gt;           &lt;targetpath&gt;../${build.finalName}/META-INF&lt;/targetpath&gt;&lt;br /&gt;           &lt;includes&gt;&lt;br /&gt;              &lt;include&gt;context.xml&lt;/include&gt;&lt;br /&gt;&lt;br /&gt;           &lt;/includes&gt;&lt;br /&gt;        &lt;/resource&gt;&lt;br /&gt;     &lt;/resources&gt;&lt;br /&gt;&lt;br /&gt;in tomcat.properties&lt;br /&gt;&lt;br /&gt;context.docBase=${basedir}/target/${project.build.finalName}&lt;br /&gt;context.path=/${project.build.finalName}&lt;br /&gt;&lt;br /&gt;and in context.xml&lt;br /&gt;&lt;br /&gt;&lt;context path="${context.path}" docbase="${context.docBase}" reloadable="true"&gt;&lt;br /&gt;&lt;br /&gt;Once you have all of this in place (along with a good cargo config found in this post) you will be on your way to a enjoyable, easy development setup.&lt;br /&gt;&lt;br /&gt;So now, all you have to do to hot deploy your maven app to a running instance of Tomcat is type the following: mvn install -Ptomcat&lt;br /&gt;This will compile and deploy your changes quickly. You can also set your IDE to copy jsp/xhtml files over using a keyboard shortcut mapping (easy to do with Idea) so for UI changes you don't have to hot deploy every time.&lt;br /&gt;This example just scratches the surface of what mixing profiles with filtering can do. You could have a filtering/profile mechanism for every possible scenario.&lt;/context&gt;&lt;/build&gt;&lt;/profile&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7373694028643264060-531680937839302680?l=hankliblog.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://hankliblog.blogspot.com/feeds/531680937839302680/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=7373694028643264060&amp;postID=531680937839302680' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7373694028643264060/posts/default/531680937839302680'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7373694028643264060/posts/default/531680937839302680'/><link rel='alternate' type='text/html' href='http://hankliblog.blogspot.com/2008/03/mvn-tomcat-for-hot-deployment.html' title='mvn + tomcat for hot deployment'/><author><name>Hank Li</name><uri>http://www.blogger.com/profile/01921353182145348702</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7373694028643264060.post-3237180044504804170</id><published>2008-03-27T09:58:00.000-07:00</published><updated>2008-03-27T09:59:06.925-07:00</updated><title type='text'>open source e-commerce software</title><content type='html'>--------------&lt;br /&gt;osCommerce Online Merchant is an Open Source online shop e-commerce solution that is available for free under the GNU General Public License.  (PHP)&lt;br /&gt;--------------------------------&lt;br /&gt;Apache: http://ofbiz.apache.org/feature-list.html&lt;br /&gt;&lt;br /&gt;-----------------------------&lt;br /&gt;http://www.magentocommerce.com/features&lt;br /&gt;--------&lt;br /&gt;php sites:&lt;br /&gt;&lt;br /&gt;osCommerce ,  ZenCart,  phpShop,  myMarket&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7373694028643264060-3237180044504804170?l=hankliblog.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://hankliblog.blogspot.com/feeds/3237180044504804170/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=7373694028643264060&amp;postID=3237180044504804170' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7373694028643264060/posts/default/3237180044504804170'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7373694028643264060/posts/default/3237180044504804170'/><link rel='alternate' type='text/html' href='http://hankliblog.blogspot.com/2008/03/open-source-e-commerce-software.html' title='open source e-commerce software'/><author><name>Hank Li</name><uri>http://www.blogger.com/profile/01921353182145348702</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7373694028643264060.post-6889904451510231369</id><published>2008-03-22T21:43:00.000-07:00</published><updated>2008-03-22T22:00:13.252-07:00</updated><title type='text'>how to get sequence from mysql in cluster env</title><content type='html'>If you have a cluster of application servers running and you would like to get a unique id across the cluster, the best way is to get the id from Database. Oracle has the sequence function, but MySQL does not have the function.&lt;br /&gt;&lt;br /&gt;Here are several ways to work around the issue in MySQL.&lt;br /&gt;&lt;br /&gt;&lt;b&gt;Retrieving &lt;code class="literal"&gt;AUTO_INCREMENT&lt;/code&gt; column values using               &lt;code class="literal"&gt;Statement.getGeneratedKeys()&lt;/code&gt;&lt;/b&gt; &lt;pre class="programlisting"&gt;   Statement stmt = null;&lt;br /&gt;  ResultSet rs = null;&lt;br /&gt;&lt;br /&gt;  try {&lt;br /&gt;&lt;br /&gt;   //&lt;br /&gt;   // Create a Statement instance that we can use for&lt;br /&gt;   // 'normal' result sets assuming you have a&lt;br /&gt;   // Connection 'conn' to a MySQL database already&lt;br /&gt;   // available&lt;br /&gt;&lt;br /&gt;   stmt = conn.createStatement(java.sql.ResultSet.TYPE_FORWARD_ONLY,&lt;br /&gt;                               java.sql.ResultSet.CONCUR_UPDATABLE);&lt;br /&gt;&lt;br /&gt;   //&lt;br /&gt;   // Issue the DDL queries for the table for this example&lt;br /&gt;   //&lt;br /&gt;&lt;br /&gt;   stmt.executeUpdate("DROP TABLE IF EXISTS autoIncTutorial");&lt;br /&gt;   stmt.executeUpdate(&lt;br /&gt;           "CREATE TABLE autoIncTutorial ("&lt;br /&gt;           + "priKey INT NOT NULL AUTO_INCREMENT, "&lt;br /&gt;           + "dataField VARCHAR(64), PRIMARY KEY (priKey))");&lt;br /&gt;&lt;br /&gt;   //&lt;br /&gt;   // Insert one row that will generate an AUTO INCREMENT&lt;br /&gt;   // key in the 'priKey' field&lt;br /&gt;   //&lt;br /&gt;&lt;br /&gt;   stmt.executeUpdate(&lt;br /&gt;           "INSERT INTO autoIncTutorial (dataField) "&lt;br /&gt;           + "values ('Can I Get the Auto Increment Field?')",&lt;br /&gt;           Statement.RETURN_GENERATED_KEYS);&lt;br /&gt;&lt;br /&gt;   //&lt;br /&gt;   // Example of using Statement.getGeneratedKeys()&lt;br /&gt;   // to retrieve the value of an auto-increment&lt;br /&gt;   // value&lt;br /&gt;   //&lt;br /&gt;&lt;br /&gt;   int autoIncKeyFromApi = -1;&lt;br /&gt;&lt;br /&gt;   rs = stmt.getGeneratedKeys();&lt;br /&gt;&lt;br /&gt;   if (rs.next()) {&lt;br /&gt;       autoIncKeyFromApi = rs.getInt(1);&lt;br /&gt;   } else {&lt;br /&gt;&lt;br /&gt;       // throw an exception from here&lt;br /&gt;   }&lt;br /&gt;&lt;br /&gt;   rs.close();&lt;br /&gt;&lt;br /&gt;   rs = null;&lt;br /&gt;&lt;br /&gt;   System.out.println("Key returned from getGeneratedKeys():"&lt;br /&gt;       + autoIncKeyFromApi);&lt;br /&gt;} finally {&lt;br /&gt;&lt;br /&gt;   if (rs != null) {&lt;br /&gt;       try {&lt;br /&gt;           rs.close();&lt;br /&gt;       } catch (SQLException ex) {&lt;br /&gt;           // ignore&lt;br /&gt;       }&lt;br /&gt;   }&lt;br /&gt;&lt;br /&gt;   if (stmt != null) {&lt;br /&gt;       try {&lt;br /&gt;           stmt.close();&lt;br /&gt;       } catch (SQLException ex) {&lt;br /&gt;           // ignore&lt;br /&gt;       }&lt;br /&gt;   }&lt;br /&gt;&lt;br /&gt;&lt;b&gt;Retrieving &lt;code class="literal"&gt;AUTO_INCREMENT&lt;/code&gt; column values using&lt;br /&gt;             &lt;code class="literal"&gt;SELECT LAST_INSERT_ID()&lt;/code&gt;&lt;/b&gt;&lt;br /&gt;  Statement stmt = null;&lt;br /&gt;  ResultSet rs = null;&lt;br /&gt;&lt;br /&gt;  try {&lt;br /&gt;&lt;br /&gt;   //&lt;br /&gt;   // Create a Statement instance that we can use for&lt;br /&gt;   // 'normal' result sets.&lt;br /&gt;&lt;br /&gt;   stmt = conn.createStatement();&lt;br /&gt;&lt;br /&gt;   //&lt;br /&gt;   // Issue the DDL queries for the table for this example&lt;br /&gt;   //&lt;br /&gt;&lt;br /&gt;   stmt.executeUpdate("DROP TABLE IF EXISTS autoIncTutorial");&lt;br /&gt;   stmt.executeUpdate(&lt;br /&gt;           "CREATE TABLE autoIncTutorial ("&lt;br /&gt;           + "priKey INT NOT NULL AUTO_INCREMENT, "&lt;br /&gt;           + "dataField VARCHAR(64), PRIMARY KEY (priKey))");&lt;br /&gt;&lt;br /&gt;   //&lt;br /&gt;   // Insert one row that will generate an AUTO INCREMENT&lt;br /&gt;   // key in the 'priKey' field&lt;br /&gt;   //&lt;br /&gt;&lt;br /&gt;   stmt.executeUpdate(&lt;br /&gt;           "INSERT INTO autoIncTutorial (dataField) "&lt;br /&gt;           + "values ('Can I Get the Auto Increment Field?')");&lt;br /&gt;&lt;br /&gt;   //&lt;br /&gt;   // Use the MySQL LAST_INSERT_ID()&lt;br /&gt;   // function to do the same thing as getGeneratedKeys()&lt;br /&gt;   //&lt;br /&gt;&lt;br /&gt;   int autoIncKeyFromFunc = -1;&lt;br /&gt;   rs = stmt.executeQuery("SELECT LAST_INSERT_ID()");&lt;br /&gt;&lt;br /&gt;   if (rs.next()) {&lt;br /&gt;       autoIncKeyFromFunc = rs.getInt(1);&lt;br /&gt;   } else {&lt;br /&gt;       // throw an exception from here&lt;br /&gt;   }&lt;br /&gt;&lt;br /&gt;   rs.close();&lt;br /&gt;&lt;br /&gt;   System.out.println("Key returned from " +&lt;br /&gt;                      "'SELECT LAST_INSERT_ID()': " +&lt;br /&gt;                      autoIncKeyFromFunc);&lt;br /&gt;&lt;br /&gt;} finally {&lt;br /&gt;&lt;br /&gt;   if (rs != null) {&lt;br /&gt;       try {&lt;br /&gt;           rs.close();&lt;br /&gt;       } catch (SQLException ex) {&lt;br /&gt;           // ignore&lt;br /&gt;       }&lt;br /&gt;   }&lt;br /&gt;&lt;br /&gt;   if (stmt != null) {&lt;br /&gt;       try {&lt;br /&gt;           stmt.close();&lt;br /&gt;       } catch (SQLException ex) {&lt;br /&gt;           // ignore&lt;br /&gt;       }&lt;br /&gt;   }&lt;br /&gt;}&lt;br /&gt; &lt;br /&gt;}&lt;br /&gt;&lt;/pre&gt;What happes if you need multiple sequences in your app. The you may create sequence talbe several columns.&lt;br /&gt;&lt;br /&gt;update sequence set id1=&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7373694028643264060-6889904451510231369?l=hankliblog.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://hankliblog.blogspot.com/feeds/6889904451510231369/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=7373694028643264060&amp;postID=6889904451510231369' title='3 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7373694028643264060/posts/default/6889904451510231369'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7373694028643264060/posts/default/6889904451510231369'/><link rel='alternate' type='text/html' href='http://hankliblog.blogspot.com/2008/03/how-to-get-sequence-from-mysql-in.html' title='how to get sequence from mysql in cluster env'/><author><name>Hank Li</name><uri>http://www.blogger.com/profile/01921353182145348702</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>3</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7373694028643264060.post-4327361373673638508</id><published>2008-03-20T23:53:00.001-07:00</published><updated>2008-03-20T23:53:38.155-07:00</updated><title type='text'>opensource social network software</title><content type='html'>" Pligg is an open source content management system available for download at no cost"&lt;br /&gt;&lt;br /&gt;"Drupal.org is the official website of Drupal, an open source content management platform."&lt;br /&gt;&lt;br /&gt;"NewsCloud is an open source media platform which you can use to launch your own grassroots media Web site. Or, you can get involved in the development of the NewsCloud platform"&lt;br /&gt;&lt;br /&gt;"AROUNDMe is a GNU package. We use the General Public License (GPL) for our software meaning that you can copy our software, redistribute it, explore, change or modify the code."&lt;br /&gt;&lt;br /&gt;"Dolphin Smart Community Builder is a universal, free, open source software that allows you to build any kind of online community."&lt;br /&gt;&lt;br /&gt;"Even though PHPizabi is distributed unencrypted, it DOES NOT fall under any GPL license (Open Source does not necessarily mean OSD/GPL)."&lt;br /&gt;&lt;br /&gt;"Elgg is an open source social networking platform developed for LAMP (Linux, Apache, MySQL, PHP) which encompasses weblogging, file storage, RSS aggregation, personal profiles, FOAF functionality and more."&lt;br /&gt;&lt;br /&gt;"The software that powers Mugshot is 100% open source, including the client and the server."&lt;br /&gt;&lt;br /&gt;" Web-based social bookmarking system. Allows multiple users to store, share and tag their favourite links online. License: GNU General Public License (GPL) "&lt;br /&gt;&lt;br /&gt;"GetBoo just turned to open-source, under the GPL license at the end of April. I don't have any expectations, but I am confident it will add to my experience!"&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;-------------------     &lt;br /&gt;&lt;br /&gt;Dolphin&lt;br /&gt;&lt;br /&gt;Dolphin, from Boonex, is a popular free community-building application that is being used for a number of dating sites. Many modifications have been developed, however many of them are only available for a fee. There is also a cost associated with removing the company’s links from your site.&lt;br /&gt;&lt;br /&gt;PHPizabi&lt;br /&gt;&lt;br /&gt;PHPizabi is another social networking script that charges a fee to remove their branding. They are rapidly approaching 100,000 downloads of their software, and have a few impressive-looking demo sites listed on their website.&lt;br /&gt;&lt;br /&gt;Elgg&lt;br /&gt;&lt;br /&gt;Elgg was developed with the educational industry in mind, but can be customized for any use. Many universities throughout the world have adapted the social software to fit their needs.&lt;br /&gt;&lt;br /&gt;Mugshot&lt;br /&gt;&lt;br /&gt;Developed by Red Hat, Mugshot allows you to post what you are reading and listening too, and share it with you friends. Mugshot is a little different, as both the client and server code are open source and available for download.&lt;br /&gt;&lt;br /&gt;AroundMe&lt;br /&gt;&lt;br /&gt;AroundMe is an open source social networking app that supports OpenID. They are based in Sweden. We haven’t seen many sites running on the platform.&lt;br /&gt;&lt;br /&gt;---------------------&lt;br /&gt;Top 40 Free Downloadable Open Source Social Networking Software&lt;br /&gt;Vivalogo Resources&lt;br /&gt;&lt;br /&gt;This is Vivalogo's list of best free, downloadable, open source social networking software (kinda hard to say all these words :) ).&lt;br /&gt;Unlike some other lists you may find on the net, this one contains only really downloadable and functional software.&lt;br /&gt;Note: listed in no particular order.&lt;br /&gt;spree&lt;br /&gt;&lt;br /&gt;spree is an expert search engine where users ask questions to find other participating users, who are knowledgeable in that area and willing to help.&lt;br /&gt;iSocial&lt;br /&gt;&lt;br /&gt;iSocial is a free social networking CMS software that allows you to create your own Friendster and Orkut like sites. Use bookmarks, dating and create groups with just one mouse click.&lt;br /&gt;Mahara&lt;br /&gt;&lt;br /&gt;Mahara is fully featured electronic portfolio, weblog, resume builder, and social networking system for connecting users and creating online communities.&lt;br /&gt;Yogurt&lt;br /&gt;&lt;br /&gt;This is a Social Network module for xoops CMS. You have seen Facebook, Orkut, Myspace , try Yogurt for Xoops!&lt;br /&gt;VMukti&lt;br /&gt;&lt;br /&gt;VMukti is a Unified Social Collaborative conferencing engine. Allows access through personalized, mashable web-interface. Core features:- Video conferencing, Audio conferencing, IP Telephony, Desktop sharing, Chat, Whiteboard, Presentation &amp;amp; More.&lt;br /&gt;The PeopleAggregator&lt;br /&gt;&lt;br /&gt;The PeopleAggregator is a next-generation social networking system that goes beyond the idea of social networks as mating games, and attempts to use open standards, network inter-connectivity and massive flexibility.&lt;br /&gt;Appleseed&lt;br /&gt;&lt;br /&gt;Appleseed is (augmented) social networking software, ie Friendster, only distributed. Sites running Appleseed will interoperate, and form the 'Appleseed Social Network.' Development is focused on privacy and security, as well as ease of configuration.&lt;br /&gt;Mugshot Project&lt;br /&gt;&lt;br /&gt;The Mugshot site lets you track what your friends are doing online across a variety of popular web sites ? music, photos, blog posts, and more.&lt;br /&gt;GetBoo&lt;br /&gt;&lt;br /&gt;Web 2.0 bookmarking system, both social (with tags) and private (with folders). Import and export your bookmarks from Firefox, IE, Mozilla, Netscape. Admin management section, translations, groups, bookmarklets, Firefox extension, RSS feeds, and more!&lt;br /&gt;Akarru&lt;br /&gt;&lt;br /&gt;Akarru is a social bookmarking engine, is used to build social bookmarkings sites, like www.blogmemes.com. Users posts links and promote links to front page using voting system.&lt;br /&gt;Scuttle&lt;br /&gt;&lt;br /&gt;Web-based social bookmarking system. Allows multiple users to store, share and tag their favourite links online.&lt;br /&gt;SemanticScuttle&lt;br /&gt;&lt;br /&gt;SemanticScuttle is a social bookmarking tool (based on Scuttle) experimenting new features as hierarchical tags, collaborative descriptions or OpenID authentification.&lt;br /&gt;AROUNDMe&lt;br /&gt;&lt;br /&gt;Create collaborative social websites (like Ning, Myspace, Yahoo or Google groups). Each group can create a multiple web pages. They get a drop in guestbook, blog, forum and wiki. Each group is fully customizable using xHTML, CSS, Javascript and PHP.&lt;br /&gt;Clonesumating&lt;br /&gt;&lt;br /&gt;Clonesumating is the open source version of the code that runs CONSUMATING.COM. It features many state of the art social networking functions including user profiles, user tagging, matching and discovery based on quirky tag combinations, group activities such as weekly photo contests and blog questions, an event calendar, RSS feeds for everything, etc. It is written primarily in mod_perl.&lt;br /&gt;BeWelcome Rox&lt;br /&gt;&lt;br /&gt;Get to know the global village and other cultures, share your place. BW Rox is the platform driving www.bewelcome.org and other social networks, aiming to bring people together in real life. Organize your travel or stay abroad, travelblog, meetings, ...&lt;br /&gt;ICEcore&lt;br /&gt;&lt;br /&gt;ICEcore open team collaboration software uses social networking to unify team workspaces w/ real-time web conferencing. Collaboration for knowledge networking, program management, communities-of-practice, telework, ...&lt;br /&gt;Memephage&lt;br /&gt;&lt;br /&gt;Memephage is an automated web log (blog). It passively gathers and summarizes links from various places. Currently: IRC, social MUDs, e-mail, and web browsers. Uses the POE multitasking and networking framework for Perl.&lt;br /&gt;InteractOLE&lt;br /&gt;&lt;br /&gt;A platform for the delivery and support of online learning. It differs from many other elearning platforms in that its aim is to concentrate on the social/interactive aspects of teaching and learning rather than the delivery of content to students.&lt;br /&gt;Elgg&lt;br /&gt;&lt;br /&gt;Elgg is an open source social networking platform developed for LAMP (Linux, Apache, MySQL, PHP) which encompasses weblogging, file storage, RSS aggregation, personal profiles, FOAF functionality and more.&lt;br /&gt;CommunityNews&lt;br /&gt;&lt;br /&gt;CommunityNews uses social bookmarking and bayesian techinques to provide periodic postings to blogs. Users can vote for or against RSS sources ti increase the chances that the source is used again. Spam filtering (bayesian) is provided by spam bayes.&lt;br /&gt;OpenPNE&lt;br /&gt;&lt;br /&gt;OpenPNE is a Social Networking Service Engine written in PHP. It has many features(friend control,friend invitation,diary,blog feeds,message box,etc).&lt;br /&gt;MonkeyChow&lt;br /&gt;&lt;br /&gt;Feed Aggregator Reader (branched from FeedOnFeeds) with Social Bookmarks (del.icio.us, Blogger, Newsvine, Technorati, mailto), Article Starring, Feed Tagging, OPML, Article Search, Reblogging and Refeeding, Aging, and Edit feed attributes.&lt;br /&gt;NewsCloud&lt;br /&gt;&lt;br /&gt;NewsCloud is an open source media platform for citizen journalism and the social news network hosted at NewsCloud.com.&lt;br /&gt;Feed Me Links&lt;br /&gt;&lt;br /&gt;Feed Me Links stores your bookmarks online so you can get to them anywhere. Import your favorites and share your links with friends. Add tags to organize your links. Discover new things.&lt;br /&gt;WorldSpace&lt;br /&gt;&lt;br /&gt;WorldSpace is a user-extensible shared virtual environment, aimed at being a next-generation social networking system.&lt;br /&gt;Social Networking POC&lt;br /&gt;&lt;br /&gt;A networking site on the lines of Orkut.Right now we plan to build it on Jboss seam and use a Java content management system like apache Jackrabbit as the backend. It would be more of a POC than an actual commercial app.&lt;br /&gt;Zoints&lt;br /&gt;&lt;br /&gt;Zoints is intimately aware that online communities are the most important aspect of the internet. Our free software solutions are designed to help solve the three major problems forum owners face: Member acquisition, Member retention and Profitability.&lt;br /&gt;earth-life-simulation&lt;br /&gt;&lt;br /&gt;A simulation of the world, there will be a global map representation and players can choose a country or civilization and develop it's social, political and military existence.&lt;br /&gt;PHPizabi&lt;br /&gt;&lt;br /&gt;PHPizabi is one of the most powerful social networking platforms on the planet. With literally thousands of websites powered by PHPizabi including everything from simple friends sites to the most complex networking super sites out there.&lt;br /&gt;Ozcode&lt;br /&gt;&lt;br /&gt;Ozcode is the source code behind Ozmozr.com, a microformat-aware RSS aggregator, social networking, resource sharing, identity aggregation and presentation site.&lt;br /&gt;TallStreet&lt;br /&gt;&lt;br /&gt;TallStreet.com is a new search engine concept where users make investments, with fictional money, in their favourite websites and the rankings are determined entirely by the users.&lt;br /&gt;Jamss&lt;br /&gt;&lt;br /&gt;Jamss is a social news site based off of Digg.com. Jamss allows for peer submission and review of web articles and can be adapted to fit a variety of themes. Jamss runs on PHP/MySQL.&lt;br /&gt;Dolphin&lt;br /&gt;&lt;br /&gt;Dolphin is open-source and free, although there is a cost associated with removing the company?s links from your site.&lt;br /&gt;Ospo&lt;br /&gt;&lt;br /&gt;Ospo is an opensource social portal project. It use standard function (add, remove friends, top10), forums integration, music module (artists directory with albums, songs), shoutcast integration, blog (add, delete, modify, view) and so on.&lt;br /&gt;AstroSPACES&lt;br /&gt;&lt;br /&gt;AstroSPACES is the world's first open source social networking solution. Coded from scratch, it is highly efficient and very easy to use.&lt;br /&gt;FlightFeather&lt;br /&gt;&lt;br /&gt;FlightFeather's goal is "social networking for everyone". This means that anyone should have a chance to run a popular social networking site -- on minimal hardware, and without wasting bandwidth.&lt;br /&gt;SNOSS&lt;br /&gt;&lt;br /&gt;Social Networking Open Source Software, an open source social networking framework, written in PHP, Javascript and MySQL with an AJAX UI.&lt;br /&gt;OpenSocialNetwork&lt;br /&gt;&lt;br /&gt;OpenSocialNetwork is a social network of open source. Its main task is to create a social network releasing the source code.&lt;br /&gt;S3B&lt;br /&gt;&lt;br /&gt;S3B - Social Semantic Search and Browsing - is a middleware that delivers a set of search and browsing components that can be used in J2EE web applications to deliver user-oriented features based on semantic descriptions and social networking.&lt;br /&gt;Facelift&lt;br /&gt;&lt;br /&gt;Facelift is a visualization and analysis software for online social networking services. It displays a given community as a node-link diagram and provides several search / filtering functions as well as cluster analysis features.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7373694028643264060-4327361373673638508?l=hankliblog.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://hankliblog.blogspot.com/feeds/4327361373673638508/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=7373694028643264060&amp;postID=4327361373673638508' title='4 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7373694028643264060/posts/default/4327361373673638508'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7373694028643264060/posts/default/4327361373673638508'/><link rel='alternate' type='text/html' href='http://hankliblog.blogspot.com/2008/03/opensource-social-network-software_20.html' title='opensource social network software'/><author><name>Hank Li</name><uri>http://www.blogger.com/profile/01921353182145348702</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>4</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7373694028643264060.post-7651227654730092405</id><published>2008-03-16T15:32:00.000-07:00</published><updated>2008-03-16T15:34:00.644-07:00</updated><title type='text'>setup eclipse, tomcat and maven 2 for development</title><content type='html'>copied from  Nick Johnson: http://spatula.net/blog/2007/04/how-to-make-eclipse-tomcat-maven-2-and.html&lt;br /&gt;-------------------&lt;br /&gt;First, obviously, you need to install your prerequisites.  Download and install Tomcat.  Install the &lt;a href="http://www.sysdeo.com/eclipse/tomcatplugin"&gt;Sysdeo Tomcat plugin&lt;/a&gt;. You also want the Maven 2 Eclipse plugin. Installation of these is outside the scope of this post. It is also outside the scope of this post to explain Maven, Tomcat, Servlets and so-on. Use Google.&lt;br /&gt;&lt;br /&gt;Next, bootstrap your project. I found it easiest to change into my Eclipse workspace directory, use mvn to create my archetype for my project, and then run mvn eclipse:eclipse inside the project directory it created. Then go to File | Import in Eclipse and import the project. Finally, enable the Maven 2 plugin for your imported project from the project's context menu, Maven 2 | Enable.&lt;br /&gt;&lt;br /&gt;I found that the only way to make working with Maven bearable was to follow its default layout. This means that web.xml is going in src/main/webapp/WEB-INF and that all of the library dependencies are defined in pom.xml and all of the libraries will download into the Maven 2 Dependencies collection the first time you run mvn on the project.&lt;br /&gt;&lt;br /&gt;Edit pom.xml and make sure you have your dependencies defined how you want them and that your project name and version are what you'd like.&lt;br /&gt;&lt;br /&gt;Now is a good time to run a build of the project just to set up all of the remaining directories, like target. I did this by configuring an m2 build from the External Tools menu using my project's location as the Base directory with the goal "install".&lt;br /&gt;&lt;br /&gt;Now set up the Tomcat plugin. From Window | Preferences | Tomcat, configure the appropriate Tomcat version and Tomcat home. From the context menu of your project, select Properties and then Tomcat. Check "is a Tomcat project." Set the context name to "/" and check "Can update context definition" and "Mark this context as reloadable." Set the subdirectory to "/target/your_project_name-your.project.version". The project name and version here must match what you've defined in pom.xml.&lt;br /&gt;&lt;br /&gt;Now set up Eclipse to build directly to the Maven output directory. This allows you to avoid running a mvn build every time you make a change to a class or resource file. You will still need to run a mvn build if you add or change dependencies or if you change web.xml, however. From the project's properties context menu, choose Java Build Path and set the default output folder to target/your_project_name-your.project.version/WEB-INF/classes.&lt;br /&gt;&lt;br /&gt;Lastly, from your project's context menu, choose Tomcat Project | Update Context Definition.&lt;br /&gt;&lt;br /&gt;So to recap, here are the steps:&lt;br /&gt;&lt;br /&gt;1. Download and install Maven 2, Eclipse, Tomcat, the Maven 2 plugin for Eclipse and the Tomcat plugin for Eclipse.&lt;br /&gt;2. Create a project using Maven. Consult Maven's documentation for more detail or use an existing project that already has a pom.xml.&lt;br /&gt;3. Run mvn eclipse:eclipse to generate Eclipse's metadata files from the project's pom.xml.&lt;br /&gt;4. Import the project into your Eclipse workspace.&lt;br /&gt;5. Edit pom.xml to define the version number and your dependencies.&lt;br /&gt;6. Put web.xml in src/main/webapp/WEB-INF&lt;br /&gt;7. Create a m2 external build and run it to create your target directory structure.&lt;br /&gt;8. Configure the Tomcat plugin to look in Maven's target directory for your webapp's directory structure.&lt;br /&gt;9. Configure Eclipse to build directly to Maven's target directory structure.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7373694028643264060-7651227654730092405?l=hankliblog.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://hankliblog.blogspot.com/feeds/7651227654730092405/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=7373694028643264060&amp;postID=7651227654730092405' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7373694028643264060/posts/default/7651227654730092405'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7373694028643264060/posts/default/7651227654730092405'/><link rel='alternate' type='text/html' href='http://hankliblog.blogspot.com/2008/03/setup-eclipse-tomcat-and-maven-2-for.html' title='setup eclipse, tomcat and maven 2 for development'/><author><name>Hank Li</name><uri>http://www.blogger.com/profile/01921353182145348702</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7373694028643264060.post-8533946846745083202</id><published>2008-03-16T14:07:00.000-07:00</published><updated>2008-03-16T14:09:07.707-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='social network software'/><title type='text'>social network software</title><content type='html'>&lt;pre&gt;"AboutMe is an online social networking software that enables you to&lt;br /&gt;run your own Friendster, Orkut and Tribe.net site! This script allows&lt;br /&gt;users to connect directly to people in their networks and community in&lt;br /&gt;a fun and safe way. This site offers a large variety of features,&lt;br /&gt;ranging from search tools to profile page. In addition, you will also&lt;br /&gt;be able to add more features such as blog, with the advantage of&lt;br /&gt;expanding features."&lt;br /&gt;&lt;br /&gt;AboutMe&lt;br /&gt;&lt;a href="http://www.xceog.net/sn.php"&gt;http://www.xceog.net/sn.php&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;----------------------------------------------------------------------&lt;br /&gt;&lt;br /&gt;"AlstraSoft E-Friends is an online social networking software that&lt;br /&gt;allows you to start your own site just like Friendster and Tribe.net.&lt;br /&gt;The E-Friends software allows members to connect to people in their&lt;br /&gt;personal networks and community, creating a new online interactive&lt;br /&gt;resource that is based on a trusted network of friends and associates&lt;br /&gt;on the internet."&lt;br /&gt;&lt;br /&gt;E-Friends&lt;br /&gt;&lt;a href="http://www.alstrasoft.com/efriends.htm"&gt;http://www.alstrasoft.com/efriends.htm&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;----------------------------------------------------------------------&lt;br /&gt;&lt;br /&gt;"DZOIC Handshakes is a software that allows you to build your own&lt;br /&gt;social and business networking service with totally all features you&lt;br /&gt;may need for this. Script is written in PHP programming language, it&lt;br /&gt;uses MySQL database to store data and Smarty Template Engine to work&lt;br /&gt;with templates and themes (see our system requirements at the top of&lt;br /&gt;this page). All script source code is encoded with Zend Encoder.&lt;br /&gt;&lt;br /&gt;Handshakes script is delivered to you with an installer, that will&lt;br /&gt;guide you through all steps of installation. Handshakes script allows&lt;br /&gt;members to connect to each other and build their personal network."&lt;br /&gt;&lt;br /&gt;Handshakes&lt;br /&gt;&lt;a href="http://www.dzoic.com/features_overview.php"&gt;http://www.dzoic.com/features_overview.php&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;----------------------------------------------------------------------&lt;br /&gt;&lt;br /&gt;"AROUNDMe is the perfect solution for community builders wishing to&lt;br /&gt;bring together multiple mutual interest groups within a shared&lt;br /&gt;knowledge network.&lt;br /&gt;&lt;br /&gt;Features&lt;br /&gt;-Membership Wiki, Blog, Events, Tasks, Polls.&lt;br /&gt;-User multiple profiles.&lt;br /&gt;-Group Wiki, Blog, Events, Tasks, Polls.&lt;br /&gt;-Customisable social networking.&lt;br /&gt;-Really simple publishing tools.&lt;br /&gt;-Membership and group access control system.&lt;br /&gt;-RSS&lt;br /&gt;-Newsletters&lt;br /&gt;-Configurable file upload&lt;br /&gt;-Channels&lt;br /&gt;-Tagging"&lt;br /&gt;&lt;br /&gt;AROUNDMe&lt;br /&gt;&lt;a href="http://www.barnraiser.org/index.php?item_id=25"&gt;http://www.barnraiser.org/index.php?item_id=25&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;----------------------------------------------------------------------&lt;br /&gt;&lt;br /&gt;DATING/MATCHMAKING software:&lt;br /&gt;&lt;br /&gt;DatingBox&lt;br /&gt;&lt;a href="http://www.e-marvel.com/"&gt;http://www.e-marvel.com/&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;Dating Agency Builder&lt;br /&gt;&lt;a href="http://www.datingbuilder.com/?og=1&amp;amp;wk=1412&amp;amp;da=8"&gt;http://www.datingbuilder.com/?og=1&amp;amp;wk=1412&amp;amp;da=8&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;PHPizabi&lt;br /&gt;&lt;a href="http://www.realitymedias.com/izabi/?L=showcase.about"&gt;http://www.realitymedias.com/izabi/?L=showcase.about&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;osDate&lt;br /&gt;&lt;a href="http://www.tufat.com/script39.htm"&gt;http://www.tufat.com/script39.htm&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;eMeeting&lt;br /&gt;&lt;a href="http://datingscripts.co.uk/index.php"&gt;http://datingscripts.co.uk/index.php&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;Match Agency&lt;br /&gt;&lt;a href="http://www.matchagency.biz/product.php"&gt;http://www.matchagency.biz/product.php&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;SkaDate&lt;br /&gt;&lt;a href="http://www.skadate.com/"&gt;http://www.skadate.com/&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;----------------------------------------------------------------------&lt;br /&gt;&lt;br /&gt;My Google search strategy:&lt;br /&gt;&lt;br /&gt;Google Web Search: "social network OR networking software OR script OR package"&lt;br /&gt;://www.google.com/search?hl=en&amp;amp;q=%22social+network+OR+networking+software+OR+script+OR+package%22&lt;br /&gt;&lt;br /&gt;Google Web Search: "your own social network"&lt;br /&gt;://www.google.com/search?hl=en&amp;amp;q=%22your+own+social+network&lt;/pre&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7373694028643264060-8533946846745083202?l=hankliblog.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://hankliblog.blogspot.com/feeds/8533946846745083202/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=7373694028643264060&amp;postID=8533946846745083202' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7373694028643264060/posts/default/8533946846745083202'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7373694028643264060/posts/default/8533946846745083202'/><link rel='alternate' type='text/html' href='http://hankliblog.blogspot.com/2008/03/opensource-social-network-software.html' title='social network software'/><author><name>Hank Li</name><uri>http://www.blogger.com/profile/01921353182145348702</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7373694028643264060.post-5040651436846679814</id><published>2008-03-16T02:11:00.000-07:00</published><updated>2008-03-16T02:13:24.203-07:00</updated><title type='text'>Debugging your Maven Project in Eclipse</title><content type='html'>copied from http://docs.codehaus.org/display/MAVENUSER/Dealing+with+Eclipse-based+IDE&lt;br /&gt;for personal reference&lt;br /&gt;&lt;br /&gt;-----------------------------------&lt;br /&gt;&lt;h1&gt;Debugging your Maven Project in Eclipse&lt;/h1&gt;  &lt;p&gt;&lt;span class="smalltext"&gt;                                                         Added by             &lt;a href="http://docs.codehaus.org/display/%7Efranz%2Bsee"&gt;Franz Allan Valencia See&lt;/a&gt;    , last edited by             &lt;a href="http://docs.codehaus.org/display/%7Ebrianf"&gt;Brian Fox&lt;/a&gt;     on Jul 16, 2007                        (&lt;a href="http://docs.codehaus.org/pages/diffpages.action?pageId=64097&amp;amp;originalId=4390991"&gt;view change&lt;/a&gt;)&lt;/span&gt;&lt;/p&gt;&lt;p&gt;Note that there are two debug modes in maven: the &lt;b&gt;Generic&lt;/b&gt; and the &lt;b&gt;Surefire&lt;/b&gt;. If you want to debug maven itself, one of maven's plugins, or a maven project, use the &lt;b&gt;Generic&lt;/b&gt; Approach. If you want to debug a test in your project launched by surefire, use the &lt;b&gt;Surefire&lt;/b&gt; Approach.&lt;/p&gt;  &lt;h2&gt;&lt;a name="DealingwithEclipse-basedIDE-SettingupMaven"&gt;&lt;/a&gt;Setting up Maven&lt;/h2&gt;  &lt;p&gt;Open &lt;tt&gt;%M2_HOME%/bin/mvn.bat&lt;/tt&gt;&lt;/p&gt;  &lt;p&gt;At line 30, you'll find this,&lt;/p&gt;  &lt;div class="code panel" style="border-width: 1px;"&gt;&lt;div class="codeContent panelContent"&gt; &lt;pre class="code-java"&gt;@REM set MAVEN_OPTS=-Xdebug -Xnoagent -Djava.compiler=NONE -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000&lt;/pre&gt; &lt;/div&gt;&lt;/div&gt;&lt;br /&gt; &lt;br /&gt;  &lt;p&gt;Uncommenting the line by deleting &lt;tt&gt;@REM&lt;/tt&gt;&lt;/p&gt;  &lt;p&gt;Also add&lt;/p&gt;  &lt;div class="preformatted panel" style="border-width: 1px;"&gt;&lt;div class="preformattedContent panelContent"&gt; &lt;pre&gt;set MAVEN_OPTS= &lt;br /&gt;&lt;/pre&gt; &lt;/div&gt;&lt;/div&gt; &lt;p&gt;in the :end section, otherwise the debug will be turned on even when you run the normal mvn.bat &lt;/p&gt;  &lt;p&gt;Save that file as &lt;tt&gt;mvn-debug.bat&lt;/tt&gt; (or any convenient name you may want). You now have two maven batch files, one for normal use, and one for debugging.&lt;/p&gt;  &lt;p&gt;Now when you want to debug maven, run &lt;tt&gt;mvn-debug&lt;/tt&gt; instead of &lt;tt&gt;mvn&lt;/tt&gt; (i.e. instead of &lt;tt&gt;mvn install&lt;/tt&gt;, use &lt;tt&gt;mvn-debug install&lt;/tt&gt;)&lt;br /&gt;&lt;/p&gt;  &lt;h2&gt;&lt;a name="DealingwithEclipse-basedIDE-SettingupEclipse"&gt;&lt;/a&gt;Setting up Eclipse&lt;/h2&gt;   &lt;h3&gt;&lt;a name="DealingwithEclipse-basedIDE-CreateaJavaProjectfortheMavenDebugsession"&gt;&lt;/a&gt;Create a Java Project for the Maven Debug session&lt;/h3&gt;  &lt;p&gt;Create a new Java Project and call it "Maven Debug".  This Project will &lt;b&gt;never&lt;/b&gt; have any source code in it, it is just a shell for attaching the debugger.&lt;/p&gt;  &lt;h3&gt;&lt;a name="DealingwithEclipse-basedIDE-CreateRemoteJavaApplicationDebugConfigurations"&gt;&lt;/a&gt;Create Remote Java Application Debug Configurations&lt;/h3&gt;  &lt;p&gt;Create two debug configurations, one for Generic debugging called "Maven" and one for Surefire debugging called "Maven Surefire"&lt;/p&gt;  &lt;p&gt;&lt;tt&gt;Run&lt;/tt&gt; &gt; &lt;tt&gt;Debug...&lt;/tt&gt; and then right click on &lt;tt&gt;Remote Java Application&lt;/tt&gt; and chose &lt;tt&gt;New Launch Configuration&lt;/tt&gt;.&lt;/p&gt;  &lt;p&gt;On the &lt;tt&gt;Connect&lt;/tt&gt; tab click the &lt;tt&gt;Browse...&lt;/tt&gt; button and select the "Maven Debug" project.  Make sure that the &lt;tt&gt;Connection Properties&lt;/tt&gt; &gt; &lt;tt&gt;Port&lt;/tt&gt; is 8000. (This matches the address value set on the MAVEN_OPTS command line in the mvn-debug.bat file from above)&lt;/p&gt;  &lt;p&gt;On the &lt;tt&gt;Source&lt;/tt&gt; tab click &lt;tt&gt;Add...&lt;/tt&gt; and select all projects that have any Maven source that you want to debug.&lt;/p&gt;  &lt;p&gt;Now do the same thing to create a second Remote Java Application called "Maven Surefire" with a port of 5005.&lt;/p&gt;  &lt;h2&gt;&lt;a name="DealingwithEclipse-basedIDE-GenericDebugging"&gt;&lt;/a&gt;Generic Debugging&lt;/h2&gt;  &lt;p&gt;Select break points in the code you're are going to run.&lt;/p&gt;  &lt;p&gt;Run maven in debug mode, e.g &lt;tt&gt;mvn-debug install&lt;/tt&gt;&lt;/p&gt;  &lt;p&gt;Attach the debugger to the running maven by selecting the "Maven" debug configuration created above.&lt;/p&gt;  &lt;p&gt;Eclipse will now stop Maven at the breakpoints you have enabled.&lt;/p&gt;  &lt;h2&gt;&lt;a name="DealingwithEclipse-basedIDE-SurefireDebugging"&gt;&lt;/a&gt;Surefire Debugging&lt;/h2&gt;  &lt;p&gt;Select break points in the code you're are going to run.&lt;/p&gt;  &lt;p&gt;From your command line, append the following to your maven command.&lt;/p&gt;  &lt;div class="code panel" style="border-width: 1px;"&gt;&lt;div class="codeContent panelContent"&gt; &lt;pre class="code-java"&gt;-Dmaven.surefire.debug&lt;/pre&gt; &lt;/div&gt;&lt;/div&gt;&lt;br /&gt; &lt;br /&gt;  &lt;p&gt;For example, to debug the tests run by the maven lifecycle &lt;tt&gt;install&lt;/tt&gt;, do &lt;tt&gt;mvn install -Dmaven.surefire.debug&lt;/tt&gt;&lt;/p&gt;  &lt;p&gt;Wait for maven to pause its execution and display the message,&lt;/p&gt;  &lt;div class="code panel" style="border-width: 1px;"&gt;&lt;div class="codeContent panelContent"&gt; &lt;pre class="code-java"&gt;Listening &lt;span class="code-keyword"&gt;for&lt;/span&gt; transport dt_socket at address: 5005&lt;/pre&gt; &lt;/div&gt;&lt;/div&gt;&lt;br /&gt; &lt;br /&gt;  &lt;p&gt;Attach the debugger to the running maven by selecting the "Maven Surefire" debug configuration created above.&lt;/p&gt;  &lt;h2&gt;&lt;a name="DealingwithEclipse-basedIDE-TroubleShootingDebugging"&gt;&lt;/a&gt;Trouble Shooting Debugging&lt;/h2&gt;   &lt;h3&gt;&lt;a name="DealingwithEclipse-basedIDE-Sourcenotfound"&gt;&lt;/a&gt;Source not found&lt;/h3&gt;  &lt;p&gt;I "stepped" into a code block and instead of the source I get "Source not found" with an "Edit Source Lookup Path..." button&lt;/p&gt;  &lt;p&gt;This occurs because you do not have a project that contains the source for this class. You will need to checkout the source from the Maven subversion repository and then update the source path of the "Maven Debug" project to include this new project.&lt;/p&gt;  &lt;p&gt;First you need to locate which project in the repository the class file belongs to.&lt;br /&gt;Chances are this class exists on your classpath for a project. Select from the menu "Navigate &gt; Open Type..." and enter the name of the class that is missing. In the matching types list select the correct class and click OK.&lt;/p&gt;  &lt;p&gt;Ensure "Link with Editor" is enabled in your "Package Explorer". With the missing file selected the Package Explorer should have opened the class from a jar file from the classpath of a project. The name of the jar file should help in locating the project in the Maven subversion repository. The SCM location is also contained in the &lt;tt&gt;pom.xml&lt;/tt&gt; file in the jar, this file is located at &lt;tt&gt;META-INF/groupdId/artifactId/pom.xml&lt;/tt&gt;. E.g for the missing file "MavenArchiver.class" this file is contained in "maven-archiver-2.2.jar" and the pom.xml file in "META-INF.maven.org.apache.maven.maven-archiver" lists the SCM connection as "scm:svn:&lt;a href="https://svn.apache.org/repos/asf/maven/shared/tags/maven-archiver-2.2" rel="nofollow"&gt;https://svn.apache.org/repos/asf/maven/shared/tags/maven-archiver-2.2&lt;/a&gt;".&lt;/p&gt;  &lt;p&gt;Checking out the maven project you need and then run &lt;tt&gt;mvn eclipse:eclipse&lt;/tt&gt;.&lt;/p&gt;  &lt;p&gt;From the editor with the missing source, click on "Edit Source Lookup Path..." &gt; "Add..." &gt; "Java Project" &gt; "OK" and select the newly checked out maven project.&lt;/p&gt;  &lt;h3&gt;&lt;a name="DealingwithEclipse-basedIDE-Thesourcedoesnotmatchthedebugstacktrace"&gt;&lt;/a&gt;The source does not match the debug stack trace&lt;/h3&gt;  &lt;p&gt;It is more than likely that you have a different version on your source path than the one in use by Maven.&lt;/p&gt;  &lt;p&gt;The only way to fix this problem is to have matching versions of source to java class files.&lt;br /&gt;This may require checking out the correctly tagged version of the plugin.&lt;/p&gt;  &lt;p&gt;However there is no way to determine which version Maven is using as this is handled by the plexus classworld's class loader.&lt;/p&gt;  &lt;h1&gt;&lt;a name="DealingwithEclipse-basedIDE-DebuggingMavenCorewithEclipse"&gt;&lt;/a&gt;Debugging Maven Core with Eclipse&lt;/h1&gt;  &lt;p&gt;See &lt;a href="http://www.nabble.com/forum/ViewPost.jtp?post=8988667&amp;amp;framed=y&amp;amp;skin=177" rel="nofollow"&gt;Re: debugging maven with eclipse written by John J. Franey&lt;/a&gt; for some setup guidance.  Those instructions should be merged into here at some stage.&lt;/p&gt;  &lt;h1&gt;&lt;a name="DealingwithEclipse-basedIDE-FAQ"&gt;&lt;/a&gt;FAQ&lt;/h1&gt;  &lt;p&gt; Question:&lt;/p&gt;  &lt;p&gt;    1. Why can't I just use Generic Debugging even for my tests?&lt;/p&gt;  &lt;p&gt; Answer:&lt;/p&gt;  &lt;p&gt;    1. Because maven-surefire-plugin forks a new JVM by default, thus, the your MAVEN_OPTS are not passed. There are three fork modes of maven-surefire-plugin: Once (default), Never, and Always. For Once mode, surefire will run another JVM and will do all its testing there. For Never, it will use the same JVM instance as that of maven (this is normally not use so that you can isolate your tests). But if you really want to isloate your tests, run in Always mode. This will run a new JVM instance for every test sets it runs.&lt;/p&gt;  &lt;p&gt; Question:&lt;/p&gt;  &lt;p&gt;    2. Will using argLine parameter of maven-surefire-plugin work instead of the -Dmaven.surefire.debug ? &lt;/p&gt;  &lt;p&gt; Answer:&lt;/p&gt;  &lt;p&gt;    2. Yes. maven.surefire.debug acts like a shorthand version of argeLine=&lt;debugging&gt;. So in most cases, using maven.surefire.debug be enough.&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7373694028643264060-5040651436846679814?l=hankliblog.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://hankliblog.blogspot.com/feeds/5040651436846679814/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=7373694028643264060&amp;postID=5040651436846679814' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7373694028643264060/posts/default/5040651436846679814'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7373694028643264060/posts/default/5040651436846679814'/><link rel='alternate' type='text/html' href='http://hankliblog.blogspot.com/2008/03/debugging-your-maven-project-in-eclipse.html' title='Debugging your Maven Project in Eclipse'/><author><name>Hank Li</name><uri>http://www.blogger.com/profile/01921353182145348702</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7373694028643264060.post-6675346985606904076</id><published>2008-03-16T02:08:00.000-07:00</published><updated>2008-03-16T02:10:28.339-07:00</updated><title type='text'>Development Environment</title><content type='html'>Copied from Matt Raible: http://appfuse.org/display/APF/Development+Environment&lt;br /&gt;For personal reference (before my wiki is setup)&lt;br /&gt;&lt;br /&gt;-------------------&lt;br /&gt;&lt;span style="font-weight: bold;font-size:180%;" &gt;Development Environment&lt;/span&gt;&lt;table class="pageEditInfoOptions" border="0" cellpadding="0" cellspacing="0" width="100%"&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td&gt;Added by &lt;span class="user-flat"&gt;&lt;a href="http://appfuse.org/display/%7Emraible" class="version-item"&gt;Matt Raible&lt;/a&gt;&lt;/span&gt;, last edited by &lt;span class="user-flat"&gt;&lt;a href="http://appfuse.org/display/%7Emraible" class="version-item"&gt;Matt Raible&lt;/a&gt;&lt;/span&gt; on Nov 24, 2007 11:02&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;br /&gt;&lt;h2&gt;About this Tutorial&lt;/h2&gt; &lt;p&gt;This tutorial describes how to setup your development environment to compile/test/deploy AppFuse using Maven and your favorite IDE (&lt;a href="http://appfuse.org/display/APF/Eclipse" title="Eclipse"&gt;Eclipse&lt;/a&gt;, &lt;a href="http://appfuse.org/display/APF/IDEA" title="IDEA"&gt;IDEA&lt;/a&gt; or &lt;a href="http://appfuse.org/display/APF/NetBeans" title="NetBeans"&gt;NetBeans&lt;/a&gt;). Eclipse works well for single-module projects, whereas IDEA and NetBeans work better with multi-module projects. Knowledge of Maven is not required to use AppFuse because the tutorials explain how to use it. If you're interested in learning &lt;a href="http://appfuse.org/display/APF/Maven+2" title="Maven 2"&gt;Maven&lt;/a&gt; in-depth, please download the book &lt;span class="nobr"&gt;&lt;a href="http://www.mergere.com/m2book_download.jsp" rel="nofollow"&gt;Better Builds with Maven&lt;sup&gt;&lt;img class="rendericon" src="http://appfuse.org/images/icons/linkext7.gif" alt="" align="absmiddle" border="0" height="7" width="7" /&gt;&lt;/sup&gt;&lt;/a&gt;&lt;/span&gt; (it's free!).&lt;/p&gt;  &lt;h3&gt;&lt;a name="DevelopmentEnvironment-TableofContents"&gt;&lt;/a&gt;Table of Contents&lt;/h3&gt; &lt;ol&gt;&lt;li&gt;&lt;a href="http://appfuse.org/display/APF/Development+Environment#DevelopmentEnvironment-download"&gt;Download&lt;/a&gt; - links to download Java, Maven and MySQL&lt;/li&gt;&lt;li&gt;&lt;a href="http://appfuse.org/display/APF/Development+Environment#DevelopmentEnvironment-install"&gt;Install&lt;/a&gt; - detailed instructions on where to install everything&lt;/li&gt;&lt;li&gt;&lt;a href="http://appfuse.org/display/APF/Development+Environment#DevelopmentEnvironment-configure"&gt;Configure&lt;/a&gt; - how to configure your environment variables&lt;/li&gt;&lt;li&gt;&lt;a href="http://appfuse.org/display/APF/Development+Environment#DevelopmentEnvironment-tips"&gt;Additional Tips&lt;/a&gt; - tools to boost your productivity&lt;/li&gt;&lt;/ol&gt;   &lt;h2&gt;&lt;a name="DevelopmentEnvironment-Download"&gt;&lt;/a&gt;Download &lt;a name="DevelopmentEnvironment-download"&gt;&lt;/a&gt;&lt;/h2&gt; &lt;ol&gt;&lt;li&gt;&lt;span class="nobr"&gt;&lt;a href="http://java.sun.com/javase/downloads/index.jsp" rel="nofollow"&gt;Download&lt;sup&gt;&lt;img class="rendericon" src="http://appfuse.org/images/icons/linkext7.gif" alt="" align="absmiddle" border="0" height="7" width="7" /&gt;&lt;/sup&gt;&lt;/a&gt;&lt;/span&gt; Java 5 SE. AppFuse should work fine with Java 6, but Maven &lt;span class="nobr"&gt;&lt;a href="http://jira.codehaus.org/browse/MNG-2709" rel="nofollow"&gt;has issues&lt;sup&gt;&lt;img class="rendericon" src="http://appfuse.org/images/icons/linkext7.gif" alt="" align="absmiddle" border="0" height="7" width="7" /&gt;&lt;/sup&gt;&lt;/a&gt;&lt;/span&gt; with multi-module projects.&lt;/li&gt;&lt;li&gt;&lt;span class="nobr"&gt;&lt;a href="http://maven.apache.org/download.html" rel="nofollow"&gt;Download&lt;sup&gt;&lt;img class="rendericon" src="http://appfuse.org/images/icons/linkext7.gif" alt="" align="absmiddle" border="0" height="7" width="7" /&gt;&lt;/sup&gt;&lt;/a&gt;&lt;/span&gt; Maven 2.0.5+.&lt;/li&gt;&lt;li&gt;&lt;span class="nobr"&gt;&lt;a href="http://dev.mysql.com/downloads/mysql/5.0.html#downloads" rel="nofollow"&gt;Download&lt;sup&gt;&lt;img class="rendericon" src="http://appfuse.org/images/icons/linkext7.gif" alt="" align="absmiddle" border="0" height="7" width="7" /&gt;&lt;/sup&gt;&lt;/a&gt;&lt;/span&gt; MySQL 5.0.27+.&lt;/li&gt;&lt;/ol&gt;   &lt;p&gt;Downloading these files to your desktop should work just fine.&lt;/p&gt;  &lt;h2&gt;&lt;a name="DevelopmentEnvironment-Install"&gt;&lt;/a&gt;Install &lt;a name="DevelopmentEnvironment-install"&gt;&lt;/a&gt;&lt;/h2&gt; &lt;p&gt;Make sure you have &lt;span class="nobr"&gt;&lt;a href="http://www.7-zip.org/download.html" rel="nofollow"&gt;7-Zip&lt;sup&gt;&lt;img class="rendericon" src="http://appfuse.org/images/icons/linkext7.gif" alt="" align="absmiddle" border="0" height="7" width="7" /&gt;&lt;/sup&gt;&lt;/a&gt;&lt;/span&gt; or &lt;span class="nobr"&gt;&lt;a href="http://winzip.com/" rel="nofollow"&gt;WinZip&lt;sup&gt;&lt;img class="rendericon" src="http://appfuse.org/images/icons/linkext7.gif" alt="" align="absmiddle" border="0" height="7" width="7" /&gt;&lt;/sup&gt;&lt;/a&gt;&lt;/span&gt; installed (for Windows) and gnutar for OS X before installing these packages. Linux users should be fine with the default tar tools.&lt;/p&gt;  &lt;ol&gt;&lt;li&gt;Create a "Tools" and "SDKs" folder on your hard drive. On Windows, I create these at c:\Tools and c:\SDKs. On *nix, I usually do /opt/dev/tools and install Java in the default locations. Make sure and install Sun's Java if you're on Linux. Now that it's GPL, it shouldn't be difficult to &lt;em&gt;apt-get&lt;/em&gt;.&lt;/li&gt;&lt;li&gt;Create Environment variables for these folders - SDKS_HOME and TOOLS_HOME (optional)&lt;/li&gt;&lt;li&gt;Install Java SE (a.k.a. JDK) in the SDKs directory - keeping the directory names intact.&lt;/li&gt;&lt;li&gt;Unzip/Install Maven in the Tools directory - "maven-x" is what I use for the directory name, where &lt;em&gt;x&lt;/em&gt; is the version number.&lt;/li&gt;&lt;li&gt;Install MySQL in the Tools directory.&lt;/li&gt;&lt;li&gt;Create a "Source" directory on your hard drive (this is where you'll put all your projects and their source code). On *nix, I usually create a "dev" folder in my home directory.&lt;/li&gt;&lt;/ol&gt;   &lt;p&gt;At this point, you should have a directory structure that looks something like the following:&lt;/p&gt;  &lt;div class="code"&gt;&lt;div class="codeContent"&gt; &lt;pre class="code-java"&gt;SDKs&lt;br /&gt;   - jdk1.5.0_10&lt;br /&gt;Tools&lt;br /&gt;   - maven-2.0.5&lt;br /&gt;   - mysql&lt;br /&gt;Source&lt;/pre&gt; &lt;/div&gt;&lt;/div&gt;  &lt;p&gt;After installing these tools, you'll need to &lt;a href="http://appfuse.org/display/APF/Installing+an+SMTP+Server" title="Installing an SMTP Server"&gt;setup an SMTP server&lt;/a&gt; as well. If there's an existing server you'd like to use, simply change the host name in &lt;em&gt;src/main/resources/mail.properties&lt;/em&gt;.&lt;/p&gt;  &lt;p&gt;Now you'll need to configure all these tools so that your operating system knows they're installed.&lt;/p&gt;  &lt;h2&gt;&lt;a name="DevelopmentEnvironment-Configure"&gt;&lt;/a&gt;Configure &lt;a name="DevelopmentEnvironment-configure"&gt;&lt;/a&gt;&lt;/h2&gt; &lt;p&gt;A Windows example is the only one shown here because it's assume the *nix folks are smart enough to figure it out for their system.&lt;/p&gt;  &lt;ol&gt;&lt;li&gt;To set Environment Variables in Windows, either go to Control Panel -&gt; System or right-click My Computer -&gt; Properties.&lt;/li&gt;&lt;li&gt;Click on the _&lt;em&gt;Advanced&lt;/em&gt;_ Tab and then click the _&lt;em&gt;Environment Variables&lt;/em&gt;_ button.&lt;/li&gt;&lt;li&gt;Put focus on the second box (System Variables) by clicking on one of the existing values.&lt;/li&gt;&lt;li&gt;Enter the following variables:  &lt;ul&gt;&lt;li&gt;HOME = c:\Source&lt;/li&gt;&lt;li&gt;SDKS_HOME = c:\SDKs&lt;/li&gt;&lt;li&gt;TOOLS_HOME = c:\Tools&lt;/li&gt;&lt;li&gt;JAVA_HOME = %SDKS_HOME%\jdk1.5.0_10&lt;/li&gt;&lt;li&gt;MAVEN_HOME = %TOOLS_HOME%\maven-2.0.5&lt;/li&gt;&lt;li&gt;MYSQL_HOME = %TOOLS_HOME%\mysql&lt;/li&gt;&lt;li&gt;Append to the PATH variable: %JAVA_HOME%\bin;%MAVEN_HOME%\bin;%MYSQL_HOME%\bin&lt;/li&gt;&lt;/ul&gt;  &lt;/li&gt;&lt;/ol&gt;   &lt;p&gt;You should now be able to open a command prompt and type "java -version", "mvn -version" or "mysql" and not get errors.&lt;/p&gt;  &lt;h2&gt;&lt;a name="DevelopmentEnvironment-AdditionalTips"&gt;&lt;/a&gt;Additional Tips &lt;a name="DevelopmentEnvironment-tips"&gt;&lt;/a&gt;&lt;/h2&gt; &lt;ul&gt;&lt;li&gt;Use &lt;span class="nobr"&gt;&lt;a href="http://www.cygwin.com/" rel="nofollow"&gt;Cygwin&lt;sup&gt;&lt;img class="rendericon" src="http://appfuse.org/images/icons/linkext7.gif" alt="" align="absmiddle" border="0" height="7" width="7" /&gt;&lt;/sup&gt;&lt;/a&gt;&lt;/span&gt; on Windows for running Maven and doing all command line things.  Install it in $TOOLS_HOME/cygwin.&lt;/li&gt;&lt;li&gt;Use &lt;span class="nobr"&gt;&lt;a href="http://www.eclipse.org/" rel="nofollow"&gt;Eclipse&lt;sup&gt;&lt;img class="rendericon" src="http://appfuse.org/images/icons/linkext7.gif" alt="" align="absmiddle" border="0" height="7" width="7" /&gt;&lt;/sup&gt;&lt;/a&gt;&lt;/span&gt; or &lt;span class="nobr"&gt;&lt;a href="http://www.intellij.com/idea" rel="nofollow"&gt;IDEA&lt;sup&gt;&lt;img class="rendericon" src="http://appfuse.org/images/icons/linkext7.gif" alt="" align="absmiddle" border="0" height="7" width="7" /&gt;&lt;/sup&gt;&lt;/a&gt;&lt;/span&gt;. Install them in $TOOLS_HOME/eclipse-x or $TOOLS_HOME/idea-x. Multi-module Maven projects seem to work best in IDEA. NetBeans also has &lt;span class="nobr"&gt;&lt;a href="http://mevenide.codehaus.org/m2-site/mevenide2-netbeans/installation.html" rel="nofollow"&gt;excellent Maven support&lt;sup&gt;&lt;img class="rendericon" src="http://appfuse.org/images/icons/linkext7.gif" alt="" align="absmiddle" border="0" height="7" width="7" /&gt;&lt;/sup&gt;&lt;/a&gt;&lt;/span&gt;, but it's not widely used among AppFuse developers and users. In Eclipse, Ctrl+Shift+R is your best friend; Ctrl+Shift+N in IDEA. See &lt;a href="http://appfuse.org/display/APF/IDEs" title="IDEs"&gt;IDEs&lt;/a&gt; for more information on setting up an AppFuse-based project in your favorite IDE (&lt;a href="http://appfuse.org/display/APF/Eclipse" title="Eclipse"&gt;Eclipse&lt;/a&gt;, &lt;a href="http://appfuse.org/display/APF/IDEA" title="IDEA"&gt;IDEA&lt;/a&gt;, or &lt;a href="http://appfuse.org/display/APF/NetBeans" title="NetBeans"&gt;NetBeans&lt;/a&gt;).&lt;/li&gt;&lt;/ul&gt;   &lt;p&gt;If you're starting work at a new client or at your company, you should do the following to help your development process become more efficient. &lt;/p&gt;  &lt;ol&gt;&lt;li&gt;Setup a source control system.  &lt;span class="nobr"&gt;&lt;a href="http://subversion.tigris.org/" rel="nofollow"&gt;Subversion&lt;sup&gt;&lt;img class="rendericon" src="http://appfuse.org/images/icons/linkext7.gif" alt="" align="absmiddle" border="0" height="7" width="7" /&gt;&lt;/sup&gt;&lt;/a&gt;&lt;/span&gt; is highly recommended. Setting up a commit notification system is recommended when working with other developers. &lt;span class="nobr"&gt;&lt;a href="http://www.cenqua.com/fisheye/" rel="nofollow"&gt;FishEye&lt;sup&gt;&lt;img class="rendericon" src="http://appfuse.org/images/icons/linkext7.gif" alt="" align="absmiddle" border="0" height="7" width="7" /&gt;&lt;/sup&gt;&lt;/a&gt;&lt;/span&gt; works great.&lt;/li&gt;&lt;li&gt;Setup a bug tracking system.  Popular (free) choices are &lt;span class="nobr"&gt;&lt;a href="http://www.bugzilla.org/" rel="nofollow"&gt;Bugzilla&lt;sup&gt;&lt;img class="rendericon" src="http://appfuse.org/images/icons/linkext7.gif" alt="" align="absmiddle" border="0" height="7" width="7" /&gt;&lt;/sup&gt;&lt;/a&gt;&lt;/span&gt; and &lt;span class="nobr"&gt;&lt;a href="http://trac.edgewall.org/" rel="nofollow"&gt;Trac&lt;sup&gt;&lt;img class="rendericon" src="http://appfuse.org/images/icons/linkext7.gif" alt="" align="absmiddle" border="0" height="7" width="7" /&gt;&lt;/sup&gt;&lt;/a&gt;&lt;/span&gt;.  The best one we've seen is &lt;span class="nobr"&gt;&lt;a href="http://www.atlassian.com/software/jira" rel="nofollow"&gt;JIRA&lt;sup&gt;&lt;img class="rendericon" src="http://appfuse.org/images/icons/linkext7.gif" alt="" align="absmiddle" border="0" height="7" width="7" /&gt;&lt;/sup&gt;&lt;/a&gt;&lt;/span&gt;. For more information see &lt;span class="nobr"&gt;&lt;a href="http://www.javaworld.com/javaworld/jw-03-2007/jw-03-bugs.html" rel="nofollow"&gt;What issue tracking system is best for you?&lt;sup&gt;&lt;img class="rendericon" src="http://appfuse.org/images/icons/linkext7.gif" alt="" align="absmiddle" border="0" height="7" width="7" /&gt;&lt;/sup&gt;&lt;/a&gt;&lt;/span&gt;&lt;/li&gt;&lt;li&gt;Setup a Wiki.  We love &lt;span class="nobr"&gt;&lt;a href="http://www.atlassian.com/software/confluence" rel="nofollow"&gt;Confluence&lt;sup&gt;&lt;img class="rendericon" src="http://appfuse.org/images/icons/linkext7.gif" alt="" align="absmiddle" border="0" height="7" width="7" /&gt;&lt;/sup&gt;&lt;/a&gt;&lt;/span&gt; - but it's not free.  Other recommended systems are &lt;span class="nobr"&gt;&lt;a href="http://jspwiki.org/" rel="nofollow"&gt;JSPWiki&lt;sup&gt;&lt;img class="rendericon" src="http://appfuse.org/images/icons/linkext7.gif" alt="" align="absmiddle" border="0" height="7" width="7" /&gt;&lt;/sup&gt;&lt;/a&gt;&lt;/span&gt; and &lt;span class="nobr"&gt;&lt;a href="http://trac.edgewall.org/" rel="nofollow"&gt;Trac&lt;sup&gt;&lt;img class="rendericon" src="http://appfuse.org/images/icons/linkext7.gif" alt="" align="absmiddle" border="0" height="7" width="7" /&gt;&lt;/sup&gt;&lt;/a&gt;&lt;/span&gt;. Trac has a wiki, source control browser and bug-tracking system all-in-one.&lt;/li&gt;&lt;li&gt;Setup a development box to host the source control system, the bug tracking system, and a wiki.  Install &lt;span class="nobr"&gt;&lt;a href="http://hudson.dev.java.net/" rel="nofollow"&gt;Hudson&lt;sup&gt;&lt;img class="rendericon" src="http://appfuse.org/images/icons/linkext7.gif" alt="" align="absmiddle" border="0" height="7" width="7" /&gt;&lt;/sup&gt;&lt;/a&gt;&lt;/span&gt;, &lt;span class="nobr"&gt;&lt;a href="http://cruisecontrol.sourceforge.net/" rel="nofollow"&gt;CruiseControl&lt;sup&gt;&lt;img class="rendericon" src="http://appfuse.org/images/icons/linkext7.gif" alt="" align="absmiddle" border="0" height="7" width="7" /&gt;&lt;/sup&gt;&lt;/a&gt;&lt;/span&gt;, &lt;span class="nobr"&gt;&lt;a href="http://luntbuild.javaforge.com/" rel="nofollow"&gt;Luntbuild&lt;sup&gt;&lt;img class="rendericon" src="http://appfuse.org/images/icons/linkext7.gif" alt="" align="absmiddle" border="0" height="7" width="7" /&gt;&lt;/sup&gt;&lt;/a&gt;&lt;/span&gt; or &lt;span class="nobr"&gt;&lt;a href="http://maven.apache.org/continuum/" rel="nofollow"&gt;Continuum&lt;sup&gt;&lt;img class="rendericon" src="http://appfuse.org/images/icons/linkext7.gif" alt="" align="absmiddle" border="0" height="7" width="7" /&gt;&lt;/sup&gt;&lt;/a&gt;&lt;/span&gt; on this box to do continuous integration for your project. Setting up continuous integration with a Maven 2 project is a piece-of-cake, so you have no excuses! &lt;img class="emoticon" src="http://appfuse.org/images/icons/emoticons/wink.gif" alt="" align="absmiddle" border="0" height="20" width="20" /&gt; If you're interested in commercial CI systems, checkout &lt;span class="nobr"&gt;&lt;a href="http://raibledesigns.com/page/rd?entry=continuum_luntbuild_pulse_and_netbeans" rel="nofollow"&gt;Pulse&lt;sup&gt;&lt;img class="rendericon" src="http://appfuse.org/images/icons/linkext7.gif" alt="" align="absmiddle" border="0" height="7" width="7" /&gt;&lt;/sup&gt;&lt;/a&gt;&lt;/span&gt; or &lt;span class="nobr"&gt;&lt;a href="http://raibledesigns.com/page/rd?entry=bamboo" rel="nofollow"&gt;Bamboo&lt;sup&gt;&lt;img class="rendericon" src="http://appfuse.org/images/icons/linkext7.gif" alt="" align="absmiddle" border="0" height="7" width="7" /&gt;&lt;/sup&gt;&lt;/a&gt;&lt;/span&gt;. See &lt;span class="nobr"&gt;&lt;a href="http://www.javaworld.com/javaworld/jw-11-2006/jw-1101-ci.html" rel="nofollow"&gt;Which open source CI tool is best suited for your application's environment?&lt;sup&gt;&lt;img class="rendericon" src="http://appfuse.org/images/icons/linkext7.gif" alt="" align="absmiddle" border="0" height="7" width="7" /&gt;&lt;/sup&gt;&lt;/a&gt;&lt;/span&gt; for more information on choosing a CI Server.&lt;/li&gt;&lt;li&gt;(optional) Install &lt;span class="nobr"&gt;&lt;a href="http://rollerweblogger.org/" rel="nofollow"&gt;Roller&lt;sup&gt;&lt;img class="rendericon" src="http://appfuse.org/images/icons/linkext7.gif" alt="" align="absmiddle" border="0" height="7" width="7" /&gt;&lt;/sup&gt;&lt;/a&gt;&lt;/span&gt; and use it to report your daily status and issues.  This will allow your client (or supervisor) to track your progress.&lt;/li&gt;&lt;/ol&gt;   &lt;table class="noteMacro" align="center" border="0" cellpadding="5" cellspacing="8" width="85%"&gt;&lt;colgroup&gt;&lt;col width="24"&gt;&lt;col&gt;&lt;/colgroup&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td valign="top"&gt;&lt;img src="http://appfuse.org/images/icons/emoticons/warning.gif" alt="" align="absmiddle" border="0" height="16" width="16" /&gt;&lt;/td&gt;&lt;td&gt;&lt;b class="strong"&gt;Buildix Rocks!&lt;/b&gt;&lt;br /&gt;&lt;span class="nobr"&gt;&lt;a href="http://buildix.thoughtworks.com/" rel="nofollow"&gt;Buildix&lt;sup&gt;&lt;img class="rendericon" src="http://appfuse.org/images/icons/linkext7.gif" alt="" align="absmiddle" border="0" height="7" width="7" /&gt;&lt;/sup&gt;&lt;/a&gt;&lt;/span&gt; is a VMWare image (that can be installed on bare metal) that has Subversion, CruiseControl and Trac all pre-installed. Using it is &lt;span class="nobr"&gt;&lt;a href="http://raibledesigns.com/page/rd?entry=buildix_cruisecontrol_trac_subversion_for" rel="nofollow"&gt;highly recommended&lt;sup&gt;&lt;img class="rendericon" src="http://appfuse.org/images/icons/linkext7.gif" alt="" align="absmiddle" border="0" height="7" width="7" /&gt;&lt;/sup&gt;&lt;/a&gt;&lt;/span&gt;.&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;  &lt;p&gt;If installing and configuring all of this software doesn't boost your productivity, please read &lt;span class="nobr"&gt;&lt;a href="http://raibledesigns.com/page/rd?entry=tips_for_productivity_and_happiness" rel="nofollow"&gt;Tips for Productivity and Happiness at Work&lt;sup&gt;&lt;img class="rendericon" src="http://appfuse.org/images/icons/linkext7.gif" alt="" align="absmiddle" border="0" height="7" width="7" /&gt;&lt;/sup&gt;&lt;/a&gt;&lt;/span&gt; for more suggestions.&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7373694028643264060-6675346985606904076?l=hankliblog.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://hankliblog.blogspot.com/feeds/6675346985606904076/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=7373694028643264060&amp;postID=6675346985606904076' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7373694028643264060/posts/default/6675346985606904076'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7373694028643264060/posts/default/6675346985606904076'/><link rel='alternate' type='text/html' href='http://hankliblog.blogspot.com/2008/03/development-environment.html' title='Development Environment'/><author><name>Hank Li</name><uri>http://www.blogger.com/profile/01921353182145348702</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7373694028643264060.post-53205831452904381</id><published>2008-03-16T01:40:00.000-07:00</published><updated>2008-03-16T01:44:28.900-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='java tip collection'/><title type='text'>solve permgen out of member</title><content type='html'>&lt;span style="font-size:100%;"&gt;&lt;strong style="font-weight: normal; font-family: arial;"&gt;Copied from&lt;br /&gt;&lt;/strong&gt;&lt;/span&gt;&lt;h2 style="font-weight: normal; font-family: arial;" id="h2-name"&gt;&lt;span style="font-size:100%;"&gt;Christian&lt;/span&gt;&lt;/h2&gt;&lt;strong&gt;&lt;span style="font-size:100%;"&gt;&lt;span style="font-weight: normal; font-family: arial;"&gt; http://my.opera.com/karmazilla/blog/2007/03/13/good-riddance-permgen-outofmemoryerror&lt;/span&gt;&lt;br /&gt;&lt;span style="font-weight: normal; font-family: arial;"&gt;&lt;br /&gt;from my personal reference.&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;edit&gt;&lt;/strong&gt;&lt;br /&gt;Before thinking "yay! a fix for my problem!", read this: &lt;a href="http://my.opera.com/karmazilla/blog/2007/03/15/permgen-strikes-back" target="_blank"&gt;http://my.opera.com/karmazilla/blog/2007/03/15/permgen-strikes-back&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;The rest of this article has been left untouched.&lt;br /&gt;&lt;strong&gt;&lt;/edit&gt;&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;I did it!&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;Yes, lads &amp;amp; lasses! If you've been annoyed with having JBoss or Tomcat die with an OutOfMemoryError every fifth time you redeploy your beloved brainchild of a web application, then this is your lucky day! Because I found a fix! It's true! Yay! ....!!!!!11one (can you tell this has been a pain to me?)&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Boring but Serious Theory and Hypothesis part:&lt;/strong&gt;&lt;br /&gt;The "PermGen" error happens, when the Java virtual machine runs out of memory in the permanent generation. Recall that Java has a &lt;i&gt;generational&lt;/i&gt; garbage collector, with four generations: eden, young, old and permanent.&lt;br /&gt;&lt;br /&gt;In the eden generation, objects are very short lived and garbage collection is swift and often.&lt;br /&gt;&lt;br /&gt;The young generation consists of objects that survived the eden generation (or was pushed down to young because the eden generation was full at the time of allocation), garbage collection in the young generation is less frequent but still happens at quite regular intervals (provided that your application actually does something and allocates objects every now and then).&lt;br /&gt;&lt;br /&gt;The old generation, well, you figured it. It contains objects that survived the young generation, or have been pushed down, and garbage collection is even less infrequent but can still happen.&lt;br /&gt;&lt;br /&gt;And finally, the permanent generation. This is for objects that the virtual machine has decided to endorse with eternal life - which is precicely the core of the problem. Objects in the permanent generation are never garbage collected; that is, under &lt;i&gt;normal&lt;/i&gt; circumstances when the jvm is started with &lt;i&gt;normal&lt;/i&gt; command line parameters.&lt;br /&gt;&lt;br /&gt;So what happens when you redeploy your web application is, that your WAR file is unpacked and its class files loaded into the jvm. And here's the thing: almost always ends up in the permanent generation... Because, seriously, who wants to garbage collect their classes?!? Well, apparently application servers do, and here's how we make that happen;&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;PermGen, The Fix:&lt;/strong&gt;&lt;br /&gt;The standard garbage collector can't collect in the permanent generation, but the concurrent collector can. So the first thing we need to do is to make sure that the jvm uses the concurrent garbage collector. This is done by putting this:&lt;br /&gt;&lt;pre&gt;-XX:+UseConcMarkSweepGC&lt;/pre&gt;&lt;br /&gt;In java's command line arguments. But this is not enough. We must also specifically tell it to collect in the permanent generation, and this is done with this command line argument:&lt;br /&gt;&lt;pre&gt;-XX:+CMSPermGenSweepingEnabled&lt;/pre&gt;&lt;br /&gt;Good, now the concurrent collector will take the permantent generation under its wings. But wait! Classes are special, and the jvm is reluctant to let go of them, so we must also explicitly allow classes to be unloaded:&lt;br /&gt;&lt;pre&gt;-XX:+CMSClassUnloadingEnabled&lt;/pre&gt;&lt;br /&gt;Now we're certain that the permanent generation will be properly cleaned. But this raises another issue: what if the jvm unloads classes that might still be needed? I imagine it can be hard for a collector to tell whether or not a class might still be needed with the amount of reflection that goes on in an application server. Therefor, we might want to tweak the amount of memory allocated for the permanent generation, and this is done with this command line parameter:&lt;br /&gt;&lt;pre&gt;-XX:MaxPermSize=128m&lt;/pre&gt;&lt;br /&gt;Which will set the maximum size of our permanent generation to 128 megabytes - tweak it to fit your needs.&lt;br /&gt;&lt;br /&gt;With these parameters properly applied to the jvm that runs your application server, your chances of running into a PermGen OutOfMemoryError will be considerably lessened.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7373694028643264060-53205831452904381?l=hankliblog.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://hankliblog.blogspot.com/feeds/53205831452904381/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=7373694028643264060&amp;postID=53205831452904381' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7373694028643264060/posts/default/53205831452904381'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7373694028643264060/posts/default/53205831452904381'/><link rel='alternate' type='text/html' href='http://hankliblog.blogspot.com/2008/03/solve-permgen-out-of-member.html' title='solve permgen out of member'/><author><name>Hank Li</name><uri>http://www.blogger.com/profile/01921353182145348702</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7373694028643264060.post-1693825336102101944</id><published>2008-02-15T23:08:00.000-08:00</published><updated>2008-02-15T23:21:07.529-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='hibernate'/><category scheme='http://www.blogger.com/atom/ns#' term='second level cache'/><category scheme='http://www.blogger.com/atom/ns#' term='memcached'/><category scheme='http://www.blogger.com/atom/ns#' term='cache provider'/><category scheme='http://www.blogger.com/atom/ns#' term='cache'/><title type='text'>Memcached as Hibernate second cache provider - implementation 2</title><content type='html'>Here is the implementation based on another java memcached client library: &lt;a href="http://bleu.west.spy.net/%7Edustin/projects/memcached/"&gt;http://bleu.west.spy.net/~dustin/projects/memcached/&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;I tested it on my development machine, it works. But I have not do any stress test to compare this implementation and the previous implement. If anybody is going to do it, please post the result here.&lt;br /&gt;&lt;br /&gt;Here is the code for the two classes: provider and cache.&lt;br /&gt;&lt;br /&gt;/**&lt;br /&gt;* Memcached plugin for Hibernate&lt;br /&gt;* configuration (hibernate.cfg.xml)&lt;br /&gt;*&lt;br /&gt;      &lt;property name="cache.provider_class"&gt;&lt;/property&gt;&lt;property name="memcached.servers"&gt;&lt;/property&gt;&lt;pproperty name="cache.provider_class"&gt; &amp;amp;lt pproperty name="cache.provider_class" &amp;amp;gt MemcachedHibernateCacheProvider &amp;amp;lt /pproperty &amp;amp;gt&lt;br /&gt; &amp;amp;lt pproperty name="memcached.servers" &amp;amp;gt 192.168.1.2:11211,192.168.1.3:11211 &amp;amp;lt /pproperty &amp;amp;gt&lt;br /&gt; &amp;amp;lt pproperty name="memcached.failover" &amp;amp;gt true &amp;amp;lt /pproperty &amp;amp;gt&lt;br /&gt; &amp;amp;lt pproperty name="memcached.initConn" &amp;amp;gt 10 &amp;amp;lt /pproperty &amp;amp;gt&lt;br /&gt; &amp;amp;lt pproperty name="memcached.minConn" &amp;amp;gt 10 &amp;amp;lt /pproperty &amp;amp;gt&lt;br /&gt; &amp;amp;lt pproperty name="memcached.maxConn" &amp;amp;gt 1000 &amp;amp;lt /pproperty &amp;amp;gt&lt;br /&gt; &amp;amp;lt pproperty name="memcached.maintSleep" &amp;amp;gt 30 &amp;amp;lt /pproperty &amp;amp;gt&lt;br /&gt; &amp;amp;lt pproperty name="memcached.nagle" &amp;amp;gt false &amp;amp;lt /pproperty &amp;amp;gt&lt;br /&gt; &amp;amp;lt pproperty name="memcached.socketTO" &amp;amp;gt 3000 &amp;amp;lt /pproperty &amp;amp;gt&lt;br /&gt; &amp;amp;lt pproperty name="memcached.aliveCheck" &amp;amp;gt true &amp;amp;lt /pproperty &amp;amp;gt       &lt;br /&gt; &amp;amp;lt pproperty name="memcached.[cache_name_as_full_classname]" &amp;amp;gt 10s|20m|30h|40d &amp;amp;lt /pproperty &amp;amp;gt &lt;/pproperty&gt;&lt;pproperty name="memcached.[cache_name_as_full_classname]"&gt;&lt;/pproperty&gt;&lt;br /&gt;&lt;property name="memcached.[cache_name_as_full_classname]"&gt;&lt;/property&gt;&lt;br /&gt;   &lt;br /&gt;*&lt;br /&gt;*/&lt;br /&gt;&lt;br /&gt;public class MemcachedHibernateCacheProvider2 implements CacheProvider {&lt;br /&gt;&lt;br /&gt;private static final Log log = LogFactory.getLog(MemcachedHibernateCacheProvider2.class);&lt;br /&gt;&lt;br /&gt;public final static String DEFAULT_CACHE_NAME="____DEFAULT_CACHE_REGION";&lt;br /&gt;public static String serverlist;&lt;br /&gt;&lt;br /&gt;private Hashtable&lt;string,&gt; cacheManager = new Hashtable&lt;string,&gt;();&lt;br /&gt;&lt;br /&gt;/* (non-Javadoc)&lt;br /&gt; * @see org.hibernate.cache.CacheProvider#start(java.util.Properties)&lt;br /&gt; */&lt;br /&gt;public void start(Properties props) throws CacheException {&lt;br /&gt;&lt;br /&gt;    String servers = props.getProperty("memcached.servers");&lt;br /&gt;    //log.debug("*** --- *** server is "+ servers);   &lt;br /&gt;    serverlist = servers.replace(',', ' ');&lt;br /&gt;    log.debug("*** --- *** server is "+ serverlist);&lt;br /&gt;    //System.out.println("*** --- *** server is "+ serverlist);&lt;br /&gt;   &lt;br /&gt;    //if(StringUtils.isBlank(servers)){&lt;br /&gt;    if(servers==null || servers.trim().length()==0) {&lt;br /&gt;        throw new CacheException("configuration 'memcached.servers' get a empty value");&lt;br /&gt;    }&lt;br /&gt;&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;/* (non-Javadoc)&lt;br /&gt; * @see org.hibernate.cache.CacheProvider#buildCache(java.lang.String, java.util.Properties)&lt;br /&gt; */&lt;br /&gt;public Cache buildCache(String cacheName, Properties props) throws CacheException {&lt;br /&gt;    if((cacheName==null || cacheName.trim().length()==0))&lt;br /&gt;        cacheName = DEFAULT_CACHE_NAME;&lt;br /&gt;    MemcachedCache2 mCache = cacheManager.get(cacheName);&lt;br /&gt;    if(mCache == null){&lt;br /&gt;        String timeToLive = props.getProperty("memcached."+cacheName);&lt;br /&gt;        int secondToLive = -1;&lt;br /&gt;        //if(StringUtils.isNotBlank(timeToLive)){&lt;br /&gt;        if(timeToLive!=null &amp;amp;&amp;amp; timeToLive.trim().length()&gt;0){&lt;br /&gt;            timeToLive = timeToLive.toLowerCase().trim();&lt;br /&gt;            secondToLive = getSeconds(timeToLive);&lt;br /&gt;        }&lt;br /&gt;        System.out.println("=== Building cache named "+cacheName+" using secondToLive is "+secondToLive);&lt;br /&gt;        try{&lt;br /&gt;            mCache = new MemcachedCache2(serverlist, cacheName, secondToLive);&lt;br /&gt;            cacheManager.put(cacheName, mCache);&lt;br /&gt;        }catch(Exception e){&lt;br /&gt;            throw new CacheException(e);&lt;br /&gt;            //cacheManager.put(cacheName, cacheManager.get(DEFAULT_CACHE_NAME));&lt;br /&gt;        }&lt;br /&gt;    }&lt;br /&gt;    return mCache;&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;private static int getSeconds(String str){&lt;br /&gt;    try{&lt;br /&gt;        switch(str.charAt(str.length()-1)){&lt;br /&gt;        case 's':&lt;br /&gt;            return Integer.parseInt(str.substring(0, str.length()-1));&lt;br /&gt;        case 'm':&lt;br /&gt;            return Integer.parseInt(str.substring(0, str.length()-1)) * 60;&lt;br /&gt;        case 'h':&lt;br /&gt;            return Integer.parseInt(str.substring(0, str.length()-1)) * 3600;&lt;br /&gt;        case 'd':&lt;br /&gt;            return Integer.parseInt(str.substring(0, str.length()-1)) * 86400;&lt;br /&gt;        default:&lt;br /&gt;                return Integer.parseInt(str);&lt;br /&gt;        }&lt;br /&gt;    }catch(NumberFormatException e){&lt;br /&gt;        log.warn("Illegal configuration value : " + str, e);&lt;br /&gt;    }&lt;br /&gt;    return -1;&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;/* (non-Javadoc)&lt;br /&gt; * @see org.hibernate.cache.CacheProvider#stop()&lt;br /&gt; */&lt;br /&gt;public void stop() {&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;/* (non-Javadoc)&lt;br /&gt; * @see org.hibernate.cache.CacheProvider#isMinimalPutsEnabledByDefault()&lt;br /&gt; */&lt;br /&gt;public boolean isMinimalPutsEnabledByDefault() {&lt;br /&gt;    return false;&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;/* (non-Javadoc)&lt;br /&gt; * @see org.hibernate.cache.CacheProvider#nextTimestamp()&lt;br /&gt; */&lt;br /&gt;public long nextTimestamp() {&lt;br /&gt;    return Timestamper.next();&lt;br /&gt;}&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;----------------------------------------------------------------------------------------&lt;br /&gt;&lt;br /&gt;/**&lt;br /&gt;* Cache plugin for Hibernate&lt;br /&gt;* @author Hank Li&lt;br /&gt;*/&lt;br /&gt;public class MemcachedCache2 implements Cache {&lt;br /&gt;&lt;br /&gt;private static final Log log = LogFactory.getLog(MemcachedCache2.class);&lt;br /&gt;&lt;br /&gt;private static final int SIXTY_THOUSAND_MS = 60000;&lt;br /&gt;&lt;br /&gt;private MemcachedClient mc;&lt;br /&gt;private int secondToLive;&lt;br /&gt;private String cacheName;&lt;br /&gt;&lt;br /&gt;/**&lt;br /&gt; * Creates a new Hibernate pluggable cache based on a cache name.&lt;br /&gt; *&lt;br /&gt; */&lt;br /&gt;public MemcachedCache2(String serverlist, String name, int secondToLive)&lt;br /&gt;        throws IOException {&lt;br /&gt;    mc = new MemcachedClient(AddrUtil.getAddresses(serverlist));&lt;br /&gt;    this.secondToLive = secondToLive;&lt;br /&gt;    this.cacheName = name + '_';&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;private String makeupKey(Object key) {&lt;br /&gt;    return cacheName + String.valueOf(key).hashCode();&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;/**&lt;br /&gt; * Gets a value of an element which matches the given key.&lt;br /&gt; *&lt;br /&gt; * @param key&lt;br /&gt; *            the key of the element to return.&lt;br /&gt; * @return The value placed into the cache with an earlier put, or null if&lt;br /&gt; *         not found or expired&lt;br /&gt; * @throws CacheException&lt;br /&gt; */&lt;br /&gt;public Object get(Object key) throws CacheException {&lt;br /&gt;    //log.debug("key: " + key);&lt;br /&gt;    System.out.println("*** key: " + key);&lt;br /&gt;    if (key == null) {&lt;br /&gt;        return null;&lt;br /&gt;    } else {&lt;br /&gt;        //Object rt = mc.get(makeupKey(key));&lt;br /&gt;   &lt;br /&gt;        // Try to get a value, for up to 2 seconds, and cancel if it doesn't return&lt;br /&gt;        Object rt=null;&lt;br /&gt;        //synchronized way&lt;br /&gt;        try {&lt;br /&gt;            rt=mc.get(makeupKey(key));&lt;br /&gt;   &lt;br /&gt;        }catch(Exception alle){&lt;br /&gt;            System.out.println("memcached exception"+alle);&lt;br /&gt;            throw new CacheException(alle);&lt;br /&gt;        }&lt;br /&gt;        /* asynchronized way&lt;br /&gt;        java.util.concurrent.Future&lt;object&gt; f=mc.asyncGet(makeupKey(key));&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;        try {&lt;br /&gt;            rt=f.get(2, TimeUnit.SECONDS);&lt;br /&gt;            //log.debug("future object="+f.toString());&lt;br /&gt;            //log.debug("rt is "+rt);&lt;br /&gt;            //rt=f.get();&lt;br /&gt;        } catch(TimeoutException e) {&lt;br /&gt;            // Since we don't need this, go ahead and cancel the operation.  This&lt;br /&gt;            // is not strictly necessary, but it'll save some work on the server.&lt;br /&gt;            log.error("timeout excpetion", e);&lt;br /&gt;            f.cancel(false);&lt;br /&gt;            // Do other timeout related stuff&lt;br /&gt;        }catch(Exception alle){&lt;br /&gt;            log.error("memcached exception", alle);&lt;br /&gt;        }&lt;br /&gt;        */&lt;br /&gt;        if (rt == null) {&lt;br /&gt;            log.debug("Element for " + key + " is null");&lt;br /&gt;            //System.out.println("--- Element for " + key + " is null");&lt;br /&gt;        }&lt;br /&gt;        return rt;&lt;br /&gt;   &lt;br /&gt;    }&lt;br /&gt;&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;public Object read(Object key) throws CacheException {&lt;br /&gt;    return get((key));&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;/**&lt;br /&gt; * Puts an object into the cache.&lt;br /&gt; *&lt;br /&gt; * @param key&lt;br /&gt; *            a key&lt;br /&gt; * @param value&lt;br /&gt; *            a value&lt;br /&gt; * @throws CacheException&lt;br /&gt; *             if the {@link CacheManager} is shutdown or another&lt;br /&gt; *             {@link Exception} occurs.&lt;br /&gt; */&lt;br /&gt;public void update(Object key, Object value) throws CacheException {&lt;br /&gt;    put((key), value);&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;/**&lt;br /&gt; * Puts an object into the cache.&lt;br /&gt; *&lt;br /&gt; * @param key&lt;br /&gt; *            a key&lt;br /&gt; * @param value&lt;br /&gt; *            a value&lt;br /&gt; * @throws CacheException&lt;br /&gt; *             if the {@link CacheManager} is shutdown or another&lt;br /&gt; *             {@link Exception} occurs.&lt;br /&gt; */&lt;br /&gt;public void put(Object key, Object value) throws CacheException {&lt;br /&gt;&lt;br /&gt;    mc.set(makeupKey(key), secondToLive, value);&lt;br /&gt;&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;/**&lt;br /&gt; * Removes the element which matches the key. &lt;p&gt; If no element matches,&lt;br /&gt; * nothing is removed and no Exception is thrown.&lt;br /&gt; *&lt;br /&gt; * @param key&lt;br /&gt; *            the key of the element to remove&lt;br /&gt; * @throws CacheException&lt;br /&gt; */&lt;br /&gt;public void remove(Object key) throws CacheException {&lt;br /&gt;    mc.delete(makeupKey(key));&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;/**&lt;br /&gt; * Remove all elements in the cache, but leave the cache in a useable state.&lt;br /&gt; *&lt;br /&gt; * @throws CacheException&lt;br /&gt; */&lt;br /&gt;public void clear() throws CacheException {&lt;br /&gt;    mc.flush();&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;/**&lt;br /&gt; * Remove the cache and make it unusable.&lt;br /&gt; *&lt;br /&gt; * @throws CacheException&lt;br /&gt; */&lt;br /&gt;public void destroy() throws CacheException {&lt;br /&gt;&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;/**&lt;br /&gt; * Calls to this method should perform there own synchronization. It is&lt;br /&gt; * provided for distributed caches. Because EHCache is not distributed this&lt;br /&gt; * method does nothing.&lt;br /&gt; */&lt;br /&gt;public void lock(Object key) throws CacheException {&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;/**&lt;br /&gt; * Calls to this method should perform there own synchronization. It is&lt;br /&gt; * provided for distributed caches. Because EHCache is not distributed this&lt;br /&gt; * method does nothing.&lt;br /&gt; */&lt;br /&gt;public void unlock(Object key) throws CacheException {&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;/**&lt;br /&gt; * Gets the next timestamp;&lt;br /&gt; */&lt;br /&gt;public long nextTimestamp() {&lt;br /&gt;    return Timestamper.next();&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;/**&lt;br /&gt; * Returns the lock timeout for this cache.&lt;br /&gt; */&lt;br /&gt;public int getTimeout() {&lt;br /&gt;    // 60 second lock timeout&lt;br /&gt;    return Timestamper.ONE_MS * SIXTY_THOUSAND_MS;&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;public String getRegionName() {&lt;br /&gt;    return null;&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;/**&lt;br /&gt; * Warning: This method can be very expensive to run. Allow approximately 1&lt;br /&gt; * second per 1MB of entries. Running this method could create liveness&lt;br /&gt; * problems because the object lock is held for a long period &lt;/p&gt;&lt;p&gt;&lt;br /&gt; *&lt;br /&gt; * @return the approximate size of memory ehcache is using for the&lt;br /&gt; *         MemoryStore for this cache&lt;br /&gt; */&lt;br /&gt;public long getSizeInMemory() {&lt;br /&gt;    log.warn("cann't getSizeInMemory in memcached!");&lt;br /&gt;    throw new CacheException("cann't getSizeInMemory in memcached!");&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;public long getElementCountInMemory() {&lt;br /&gt;    log.warn("cann't getElementCountInMemory in memcached!");&lt;br /&gt;    throw new CacheException("cann't getElementCountInMemory in memcached!");&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;public long getElementCountOnDisk() {&lt;br /&gt;    log.warn("cann't getElementCountOnDisk in memcached!");&lt;br /&gt;    throw new CacheException("cann't getElementCountOnDisk in memcached!");&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;public Map toMap() {&lt;br /&gt;    log.warn("cann't toMap in memcached!");&lt;br /&gt;    throw new CacheException("cann't toMap in memcached!");&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;public String toString() {&lt;br /&gt;    return "MemCached(" + getRegionName() + ')';&lt;br /&gt;}&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;/p&gt;&lt;/object&gt;&lt;/string,&gt;&lt;/string,&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7373694028643264060-1693825336102101944?l=hankliblog.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://hankliblog.blogspot.com/feeds/1693825336102101944/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=7373694028643264060&amp;postID=1693825336102101944' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7373694028643264060/posts/default/1693825336102101944'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7373694028643264060/posts/default/1693825336102101944'/><link rel='alternate' type='text/html' href='http://hankliblog.blogspot.com/2008/02/memcached-as-hibernate-second-cache.html' title='Memcached as Hibernate second cache provider - implementation 2'/><author><name>Hank Li</name><uri>http://www.blogger.com/profile/01921353182145348702</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7373694028643264060.post-3997568823000072296</id><published>2008-02-15T22:19:00.000-08:00</published><updated>2008-02-15T23:22:37.907-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='hibernate'/><category scheme='http://www.blogger.com/atom/ns#' term='second level cache'/><category scheme='http://www.blogger.com/atom/ns#' term='memcached'/><category scheme='http://www.blogger.com/atom/ns#' term='cache provider'/><category scheme='http://www.blogger.com/atom/ns#' term='cache'/><title type='text'>memcached hibernate cache provider</title><content type='html'>Here is the code to use memcached as hibernate second cache provider. So far it is working wonderful for about a month. I am planning to add more objects to the cache to test its limitation.&lt;br /&gt;&lt;br /&gt;This provider is based on &lt;a href="http://www.whalin.com/memcached/"&gt;http://www.whalin.com/memcached/&lt;/a&gt;. Most part are from Chinese developer Liu Dong's job.&lt;br /&gt;&lt;br /&gt;I also implemented the provider based on  &lt;a href="http://bleu.west.spy.net/%7Edustin/projects/memcached/"&gt;http://bleu.west.spy.net/~dustin/projects/memcached/&lt;/a&gt;. But I have not test it. I will post it in the next release let everybody to test it so that we can compare both libraries.&lt;br /&gt;&lt;br /&gt;There are two classes here. the first one is MemcachedHibernateCacheProvider.java, the second one is the MemcachedCache.java&lt;br /&gt;&lt;br /&gt;/**&lt;br /&gt;* Memcached plugin for Hibernate&lt;br /&gt;* configuration (hibernate.cfg.xml)&lt;br /&gt;*&lt;property name="memcached.[cache_name_as_full_classname]"&gt;&lt;/property&gt;&lt;br /&gt;&lt;pre&gt; &amp;amp;lt pproperty name="cache.provider_class" &amp;amp;gt MemcachedHibernateCacheProvider &amp;amp;lt /pproperty &amp;amp;gt&lt;br /&gt;&amp;amp;lt pproperty name="memcached.servers" &amp;amp;gt 192.168.1.2:11211,192.168.1.3:11211 &amp;amp;lt /pproperty &amp;amp;gt&lt;br /&gt;&amp;amp;lt pproperty name="memcached.failover" &amp;amp;gt true &amp;amp;lt /pproperty &amp;amp;gt&lt;br /&gt;&amp;amp;lt pproperty name="memcached.initConn" &amp;amp;gt 10 &amp;amp;lt /pproperty &amp;amp;gt&lt;br /&gt;&amp;amp;lt pproperty name="memcached.minConn" &amp;amp;gt 10 &amp;amp;lt /pproperty &amp;amp;gt&lt;br /&gt;&amp;amp;lt pproperty name="memcached.maxConn" &amp;amp;gt 1000 &amp;amp;lt /pproperty &amp;amp;gt&lt;br /&gt;&amp;amp;lt pproperty name="memcached.maintSleep" &amp;amp;gt 30 &amp;amp;lt /pproperty &amp;amp;gt&lt;br /&gt;&amp;amp;lt pproperty name="memcached.nagle" &amp;amp;gt false &amp;amp;lt /pproperty &amp;amp;gt&lt;br /&gt;&amp;amp;lt pproperty name="memcached.socketTO" &amp;amp;gt 3000 &amp;amp;lt /pproperty &amp;amp;gt&lt;br /&gt;&amp;amp;lt pproperty name="memcached.aliveCheck" &amp;amp;gt true &amp;amp;lt /pproperty &amp;amp;gt      &lt;br /&gt;&amp;amp;lt pproperty name="memcached.[cache_name_as_full_classname]" &amp;amp;gt 10s|20m|30h|40d &amp;amp;lt /pproperty &amp;amp;gt  &lt;/pre&gt;&lt;br /&gt;*/&lt;br /&gt;&lt;br /&gt;public class MemcachedHibernateCacheProvider implements CacheProvider {&lt;br /&gt;&lt;br /&gt;  private static final Log log = LogFactory.getLog(MemcachedHibernateCacheProvider.class);&lt;br /&gt; &lt;br /&gt;  public final static String DEFAULT_CACHE_NAME="____DEFAULT_CACHE_REGION";&lt;br /&gt;&lt;br /&gt;  private Hashtable&lt;string,&gt; cacheManager = new Hashtable&lt;string,&gt;();&lt;br /&gt;&lt;br /&gt;  /* (non-Javadoc)&lt;br /&gt;   * @see org.hibernate.cache.CacheProvider#start(java.util.Properties)&lt;br /&gt;   */&lt;br /&gt;  public void start(Properties props) throws CacheException {&lt;br /&gt;      SockIOPool pool = SockIOPool.getInstance();&lt;br /&gt;      String servers = props.getProperty("memcached.servers");&lt;br /&gt;      System.out.println("*** --- *** server is "+ servers); &lt;br /&gt;      log.info("*** --- *** server is "+ servers);&lt;br /&gt;      String[] serverlist = servers.split(",");&lt;br /&gt;      //if(StringUtils.isBlank(servers)){&lt;br /&gt;      if(servers==null || servers.trim().length()==0) {&lt;br /&gt;          throw new CacheException("configuration 'memcached.servers' get a empty value");&lt;br /&gt;      }&lt;br /&gt;      pool.setServers(serverlist);&lt;br /&gt;      pool.setFailover( Boolean.valueOf(props.getProperty("memcached.failover")) );&lt;br /&gt;      pool.setInitConn( Integer.valueOf(props.getProperty("memcached.initConn")) );&lt;br /&gt;      pool.setMinConn( Integer.valueOf(props.getProperty("memcached.minConn")) );&lt;br /&gt;      pool.setMaxConn( Integer.valueOf(props.getProperty("memcached.maxConn")) );&lt;br /&gt;      pool.setMaintSleep( Integer.valueOf(props.getProperty("memcached.maintSleep")) );&lt;br /&gt;      pool.setNagle( Boolean.valueOf(props.getProperty("memcached.nagle")) );&lt;br /&gt;      pool.setSocketTO( Integer.valueOf(props.getProperty("memcached.socketTO")) );&lt;br /&gt;      pool.setAliveCheck( Boolean.valueOf(props.getProperty("memcached.aliveCheck")) );&lt;br /&gt;      pool.initialize();&lt;br /&gt;  }&lt;br /&gt;&lt;br /&gt;  /* (non-Javadoc)&lt;br /&gt;   * @see org.hibernate.cache.CacheProvider#buildCache(java.lang.String, java.util.Properties)&lt;br /&gt;   */&lt;br /&gt;  public Cache buildCache(String cacheName, Properties props) throws CacheException {&lt;br /&gt;   &lt;br /&gt;      if((cacheName==null || cacheName.trim().length()==0))&lt;br /&gt;          cacheName = DEFAULT_CACHE_NAME;&lt;br /&gt;      MemcachedCache mCache = cacheManager.get(cacheName);&lt;br /&gt;      if(mCache == null){&lt;br /&gt;          String timeToLive = props.getProperty("memcached."+cacheName);&lt;br /&gt;          int secondToLive = 3600 * 24 * 2; //default is 2 days&lt;br /&gt;          //if(StringUtils.isNotBlank(timeToLive)){&lt;br /&gt;          if(timeToLive!=null &amp;amp;&amp;amp; timeToLive.trim().length()&gt;0){&lt;br /&gt;              timeToLive = timeToLive.toLowerCase().trim();&lt;br /&gt;              secondToLive = getSeconds(timeToLive);&lt;br /&gt;          }&lt;br /&gt;          //System.out.println("=== Created cache "+cacheName+" with secondToLive="+secondToLive);&lt;br /&gt;          log.info("Created cache "+cacheName+" with secondToLive="+secondToLive);&lt;br /&gt;          mCache = new MemcachedCache(cacheName, secondToLive);&lt;br /&gt;          cacheManager.put(cacheName, mCache);&lt;br /&gt;      }&lt;br /&gt;      return mCache;&lt;br /&gt;  }&lt;br /&gt;&lt;br /&gt;  private static int getSeconds(String str){&lt;br /&gt;      try{&lt;br /&gt;          switch(str.charAt(str.length()-1)){&lt;br /&gt;          case 's':&lt;br /&gt;              return Integer.parseInt(str.substring(0, str.length()-1));&lt;br /&gt;          case 'm':&lt;br /&gt;              return Integer.parseInt(str.substring(0, str.length()-1)) * 60;&lt;br /&gt;          case 'h':&lt;br /&gt;              return Integer.parseInt(str.substring(0, str.length()-1)) * 3600;&lt;br /&gt;          case 'd':&lt;br /&gt;              return Integer.parseInt(str.substring(0, str.length()-1)) * 86400;&lt;br /&gt;          default:&lt;br /&gt;                  return Integer.parseInt(str);&lt;br /&gt;          }&lt;br /&gt;      }catch(NumberFormatException e){&lt;br /&gt;          log.warn("Illegal configuration value : " + str, e);&lt;br /&gt;      }&lt;br /&gt;      return -1;&lt;br /&gt;  }&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;  /* (non-Javadoc)&lt;br /&gt;   * @see org.hibernate.cache.CacheProvider#stop()&lt;br /&gt;   */&lt;br /&gt;  public void stop() {&lt;br /&gt;  }&lt;br /&gt;&lt;br /&gt;  /* (non-Javadoc)&lt;br /&gt;   * @see org.hibernate.cache.CacheProvider#isMinimalPutsEnabledByDefault()&lt;br /&gt;   */&lt;br /&gt;  public boolean isMinimalPutsEnabledByDefault() {&lt;br /&gt;      return false;&lt;br /&gt;  }&lt;br /&gt;&lt;br /&gt;  /* (non-Javadoc)&lt;br /&gt;   * @see org.hibernate.cache.CacheProvider#nextTimestamp()&lt;br /&gt;   */&lt;br /&gt;  public long nextTimestamp() {&lt;br /&gt;      return Timestamper.next();&lt;br /&gt;  }&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;-----------------------------------------------------------------------------&lt;br /&gt;&lt;br /&gt;public class MemcachedCache implements Cache {&lt;br /&gt;&lt;br /&gt;  private static final Log log = LogFactory.getLog(MemcachedCache.class);&lt;br /&gt; &lt;br /&gt;  private static final int SIXTY_THOUSAND_MS = 60000;&lt;br /&gt;&lt;br /&gt;  private MemCachedClient mc;&lt;br /&gt;  private int secondToLive;&lt;br /&gt;  private String cacheName;&lt;br /&gt;&lt;br /&gt;  /**&lt;br /&gt;   * Creates a new Hibernate pluggable cache based on a cache name.&lt;br /&gt;   *&lt;br /&gt;   */&lt;br /&gt;  public MemcachedCache(String name, int secondToLive) {&lt;br /&gt;      mc = new MemCachedClient();&lt;br /&gt;      mc.setCompressEnable(true);&lt;br /&gt;      mc.setCompressThreshold(4096);&lt;br /&gt;      this.secondToLive = secondToLive;&lt;br /&gt;      this.cacheName = name + '_';&lt;br /&gt;  }&lt;br /&gt;&lt;br /&gt;  private String makeupKey(Object key){&lt;br /&gt;      return cacheName + key.toString().hashCode();&lt;br /&gt;  }&lt;br /&gt;&lt;br /&gt;  /**&lt;br /&gt;   * Gets a value of an element which matches the given key.&lt;br /&gt;   *&lt;br /&gt;   * @param key&lt;br /&gt;   *            the key of the element to return.&lt;br /&gt;   * @return The value placed into the cache with an earlier put, or null if&lt;br /&gt;   *         not found or expired&lt;br /&gt;   * @throws CacheException&lt;br /&gt;   */&lt;br /&gt;  public Object get(Object key) throws CacheException {&lt;br /&gt;      //if (log.isDebugEnabled()) {&lt;br /&gt;          //log.debug("key: " + key);&lt;br /&gt;      //}&lt;br /&gt;          //System.out.println("*********get  key: in cache " + cache_name + " is " + key);&lt;br /&gt;      if (key == null) {&lt;br /&gt;          return null;&lt;br /&gt;      } else {&lt;br /&gt;          Object rt = mc.get(makeupKey(key));&lt;br /&gt;          if (rt == null) {&lt;br /&gt;              //if (log.isDebugEnabled()) {&lt;br /&gt;                  //log.debug("Element for " + key + " is null");&lt;br /&gt;                  //System.out.println("-- Element for " + key + " is null");&lt;br /&gt;              //}&lt;br /&gt;              return null;&lt;br /&gt;          } else {&lt;br /&gt;              return rt;&lt;br /&gt;          }&lt;br /&gt;      }&lt;br /&gt;&lt;br /&gt;  }&lt;br /&gt;&lt;br /&gt;  public Object read(Object key) throws CacheException {&lt;br /&gt;      return get((key));&lt;br /&gt;  }&lt;br /&gt;&lt;br /&gt;  /**&lt;br /&gt;   * Puts an object into the cache.&lt;br /&gt;   *&lt;br /&gt;   * @param key&lt;br /&gt;   *            a key&lt;br /&gt;   * @param value&lt;br /&gt;   *            a value&lt;br /&gt;   * @throws CacheException&lt;br /&gt;   *             if the {@link CacheManager} is shutdown or another&lt;br /&gt;   *             {@link Exception} occurs.&lt;br /&gt;   */&lt;br /&gt;  public void update(Object key, Object value) throws CacheException {&lt;br /&gt;      put((key), value);&lt;br /&gt;  }&lt;br /&gt;&lt;br /&gt;  /**&lt;br /&gt;   * Puts an object into the cache.&lt;br /&gt;   *&lt;br /&gt;   * @param key&lt;br /&gt;   *            a key&lt;br /&gt;   * @param value&lt;br /&gt;   *            a value&lt;br /&gt;   * @throws CacheException&lt;br /&gt;   *             if the {@link CacheManager} is shutdown or another&lt;br /&gt;   *             {@link Exception} occurs.&lt;br /&gt;   */&lt;br /&gt;  public void put(Object key, Object value) throws CacheException {&lt;br /&gt;      if(secondToLive &lt;=0 )             mc.set(makeupKey(key), value);         else{             Calendar cal = Calendar.getInstance();             cal.add(Calendar.SECOND, secondToLive);             mc.set(makeupKey(key), value, cal.getTime());         }     }         /**       * Removes the element which matches the key. &lt;/string,&gt;&lt;/string,&gt;&lt;p&gt; If no element matches,&lt;br /&gt;   * nothing is removed and no Exception is thrown.&lt;br /&gt;   *&lt;br /&gt;   * @param key&lt;br /&gt;   *            the key of the element to remove&lt;br /&gt;   * @throws CacheException&lt;br /&gt;   */&lt;br /&gt;  public void remove(Object key) throws CacheException {&lt;br /&gt;      mc.delete(makeupKey(key), null);&lt;br /&gt;  }&lt;br /&gt;&lt;br /&gt;  /**&lt;br /&gt;   * Remove all elements in the cache, but leave the cache in a useable state.&lt;br /&gt;   *&lt;br /&gt;   * @throws CacheException&lt;br /&gt;   */&lt;br /&gt;  public void clear() throws CacheException {&lt;br /&gt;      mc.flushAll();&lt;br /&gt;  }&lt;br /&gt;&lt;br /&gt;  /**&lt;br /&gt;   * Remove the cache and make it unuseable.&lt;br /&gt;   *&lt;br /&gt;   * @throws CacheException&lt;br /&gt;   */&lt;br /&gt;  public void destroy() throws CacheException {&lt;br /&gt;&lt;br /&gt;  }&lt;br /&gt;&lt;br /&gt;  /**&lt;br /&gt;   * Calls to this method should perform there own synchronization. It is&lt;br /&gt;   * provided for distributed caches. Because EHCache is not distributed this&lt;br /&gt;   * method does nothing.&lt;br /&gt;   */&lt;br /&gt;  public void lock(Object key) throws CacheException {&lt;br /&gt;  }&lt;br /&gt;&lt;br /&gt;  /**&lt;br /&gt;   * Calls to this method should perform there own synchronization. It is&lt;br /&gt;   * provided for distributed caches. Because EHCache is not distributed this&lt;br /&gt;   * method does nothing.&lt;br /&gt;   */&lt;br /&gt;  public void unlock(Object key) throws CacheException {&lt;br /&gt;  }&lt;br /&gt;&lt;br /&gt;  /**&lt;br /&gt;   * Gets the next timestamp;&lt;br /&gt;   */&lt;br /&gt;  public long nextTimestamp() {&lt;br /&gt;      return Timestamper.next();&lt;br /&gt;  }&lt;br /&gt;&lt;br /&gt;  /**&lt;br /&gt;   * Returns the lock timeout for this cache.&lt;br /&gt;   */&lt;br /&gt;  public int getTimeout() {&lt;br /&gt;      // 60 second lock timeout&lt;br /&gt;      return Timestamper.ONE_MS * SIXTY_THOUSAND_MS;&lt;br /&gt;  }&lt;br /&gt;&lt;br /&gt;  public String getRegionName() {&lt;br /&gt;      return null;&lt;br /&gt;  }&lt;br /&gt;&lt;br /&gt;  /**&lt;br /&gt;   * Warning: This method can be very expensive to run. Allow approximately 1&lt;br /&gt;   * second per 1MB of entries. Running this method could create liveness&lt;br /&gt;   * problems because the object lock is held for a long period &lt;/p&gt;&lt;p&gt;&lt;br /&gt;   *&lt;br /&gt;   * @return the approximate size of memory ehcache is using for the&lt;br /&gt;   *         MemoryStore for this cache&lt;br /&gt;   */&lt;br /&gt;  public long getSizeInMemory() {&lt;br /&gt;      log.warn("cann't getSizeInMemory in memcached!");&lt;br /&gt;      throw new CacheException("cann't getSizeInMemory in memcached!");&lt;br /&gt;  }&lt;br /&gt;&lt;br /&gt;  public long getElementCountInMemory() {&lt;br /&gt;      log.warn("cann't getElementCountInMemory in memcached!");&lt;br /&gt;      throw new CacheException("cann't getElementCountInMemory in memcached!");&lt;br /&gt;  }&lt;br /&gt;&lt;br /&gt;  public long getElementCountOnDisk() {&lt;br /&gt;      log.warn("cann't getElementCountOnDisk in memcached!");&lt;br /&gt;      throw new CacheException("cann't getElementCountOnDisk in memcached!");&lt;br /&gt;  }&lt;br /&gt;&lt;br /&gt;  public Map toMap() {&lt;br /&gt;      log.warn("cann't toMap in memcached!");&lt;br /&gt;      throw new CacheException("cann't toMap in memcached!");&lt;br /&gt;  }&lt;br /&gt;&lt;br /&gt;  public String toString() {&lt;br /&gt;      return "MemCached(" + getRegionName() + ')';&lt;br /&gt;  }&lt;br /&gt;}&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7373694028643264060-3997568823000072296?l=hankliblog.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://hankliblog.blogspot.com/feeds/3997568823000072296/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=7373694028643264060&amp;postID=3997568823000072296' title='3 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7373694028643264060/posts/default/3997568823000072296'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7373694028643264060/posts/default/3997568823000072296'/><link rel='alternate' type='text/html' href='http://hankliblog.blogspot.com/2008/02/memcached-hibernate-cache-provider.html' title='memcached hibernate cache provider'/><author><name>Hank Li</name><uri>http://www.blogger.com/profile/01921353182145348702</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>3</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7373694028643264060.post-1539021510964494542</id><published>2008-01-22T15:53:00.000-08:00</published><updated>2008-01-28T22:26:15.213-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='hibernate'/><category scheme='http://www.blogger.com/atom/ns#' term='terracotta'/><category scheme='http://www.blogger.com/atom/ns#' term='memcached'/><category scheme='http://www.blogger.com/atom/ns#' term='cache provider'/><category scheme='http://www.blogger.com/atom/ns#' term='cache'/><category scheme='http://www.blogger.com/atom/ns#' term='java cache'/><title type='text'>memcached, the best choice for distributed hibernate second cache</title><content type='html'>After painful evaluation of the terracotta, finally I decided to drop it.&lt;br /&gt;&lt;br /&gt;The terracotta concept is good and attracting. But when I am testing, it causes us a lot of trouble for class loading.&lt;br /&gt;&lt;br /&gt;After many workarounds, terracotta server is up and running. But the cpu is pretty high under load and GC time killed the application since responding time is the key for the web application.&lt;br /&gt;&lt;br /&gt;Finally, I decide to write the memcached provider for the hibernate, use use memcached as the second level cache for hibernate. The client API I used is http://www.whalin.com/memcached/. I have not optimized the code yet, but the cpu and memory usage is much lower than terracotta server.&lt;br /&gt;&lt;br /&gt;I also eveluate other java cache solutions, all of them have their advantages. But still none of them can bypass the limitation of heap size and will cause big GC time.&lt;br /&gt;&lt;br /&gt;Compared to those java cache solution, memcached's get/set operation is slower, but comparing to the database operation, the difference of the get/set operations between memcached and ehcache can be ignored.&lt;br /&gt;&lt;br /&gt;If there are more and more data to cache on the road, hibernate + memcached as second level cache is the way to go.&lt;br /&gt;&lt;br /&gt;I am also doing research on the way to use ehcache as local and short term cache and use the memcached as the long term and distributed cache.&lt;br /&gt;&lt;br /&gt;I will post more information about my memcached cache provider for hibernate.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7373694028643264060-1539021510964494542?l=hankliblog.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://hankliblog.blogspot.com/feeds/1539021510964494542/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=7373694028643264060&amp;postID=1539021510964494542' title='7 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7373694028643264060/posts/default/1539021510964494542'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7373694028643264060/posts/default/1539021510964494542'/><link rel='alternate' type='text/html' href='http://hankliblog.blogspot.com/2008/01/bye-bye-terracotta-other-java-caches.html' title='memcached, the best choice for distributed hibernate second cache'/><author><name>Hank Li</name><uri>http://www.blogger.com/profile/01921353182145348702</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>7</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7373694028643264060.post-3866749075771129110</id><published>2007-10-10T17:29:00.000-07:00</published><updated>2007-10-10T22:26:53.506-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='hibernate'/><category scheme='http://www.blogger.com/atom/ns#' term='terracotta'/><category scheme='http://www.blogger.com/atom/ns#' term='memcached'/><category scheme='http://www.blogger.com/atom/ns#' term='cache'/><title type='text'>which cache for the hibernate? memcached, EHCache or terracotta?</title><content type='html'>I am in the process to evaluate which cache is better for my purpose. I will post my research result here.&lt;br /&gt; &lt;p class="MsoNormal"&gt;Greg Luck has done a rough test for memcached and EHCache. &lt;span style=""&gt; &lt;/span&gt;&lt;/p&gt;    &lt;p class="MsoNormal"&gt;&lt;a href="http://gregluck.com/blog/archives/2007/05/comparing_memca.html"&gt;http://gregluck.com/blog/archives/2007/05/comparing_memca.html&lt;/a&gt;&lt;/p&gt;    &lt;p class="MsoNormal"&gt;&lt;o:p&gt;&lt;/o:p&gt;The data shows EHCache is much faster than memcached. I think the testing is not fair, since the memcached is for distributed cache and test for EHCache has tested the local cache only.&lt;/p&gt;&lt;p class="MsoNormal"&gt;&lt;br /&gt;&lt;/p&gt;  &lt;p class="MsoNormal"&gt;&lt;o:p&gt; &lt;/o:p&gt;&lt;/p&gt;  &lt;p class="MsoNormal"&gt;&lt;o:p&gt; &lt;/o:p&gt;&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7373694028643264060-3866749075771129110?l=hankliblog.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://hankliblog.blogspot.com/feeds/3866749075771129110/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=7373694028643264060&amp;postID=3866749075771129110' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7373694028643264060/posts/default/3866749075771129110'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7373694028643264060/posts/default/3866749075771129110'/><link rel='alternate' type='text/html' href='http://hankliblog.blogspot.com/2007/10/java-cache-memcached-vs-terracotta.html' title='which cache for the hibernate? memcached, EHCache or terracotta?'/><author><name>Hank Li</name><uri>http://www.blogger.com/profile/01921353182145348702</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7373694028643264060.post-6828847436210101225</id><published>2007-07-16T07:41:00.000-07:00</published><updated>2007-07-16T08:02:48.876-07:00</updated><title type='text'>SOA and social network</title><content type='html'>facebook open platform has attracted a lot attention.  Since facebook has stayed in php tech field since beginning, it is a nature choice for facebook to choose that way to open its API. But is it the best way to do it?&lt;br /&gt;&lt;br /&gt;SOA has been very popular in the java field. can it be applied to PHP? Stay tune, I will post more about the decision process for zhanzuo.com to choose SOA.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7373694028643264060-6828847436210101225?l=hankliblog.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://hankliblog.blogspot.com/feeds/6828847436210101225/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=7373694028643264060&amp;postID=6828847436210101225' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7373694028643264060/posts/default/6828847436210101225'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7373694028643264060/posts/default/6828847436210101225'/><link rel='alternate' type='text/html' href='http://hankliblog.blogspot.com/2007/07/soa-and-social-network.html' title='SOA and social network'/><author><name>Hank Li</name><uri>http://www.blogger.com/profile/01921353182145348702</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7373694028643264060.post-1953739239793254210</id><published>2007-06-06T23:54:00.000-07:00</published><updated>2007-06-07T00:54:44.030-07:00</updated><title type='text'>Design php site to handle ultra high volume traffic</title><content type='html'>Just like facebook.com, zhanzuo.com provides a space for students. As web2.o site, both facebook.com and zhanzuo.com have to provide new  architect to support ultra high volume traffic that tradition website could not image. Both sites choosed similar but different approach to solve the issue.&lt;br /&gt;&lt;script type="text/javascript" src="http://pub.mybloglog.com/comm2.php?mblID=2007060623322390&amp;amp;c_width=180&amp;amp;c_sn_opt=y&amp;amp;c_rows=5&amp;amp;c_img_size=f&amp;amp;c_heading_text=Recent+Readers&amp;amp;c_color_heading_bg=005A94&amp;amp;c_color_heading=ffffff&amp;amp;c_color_link_bg=E3E3E3&amp;amp;c_color_link=005A94&amp;amp;c_color_bottom_bg=005A94"&gt;&lt;/script&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7373694028643264060-1953739239793254210?l=hankliblog.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://hankliblog.blogspot.com/feeds/1953739239793254210/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=7373694028643264060&amp;postID=1953739239793254210' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7373694028643264060/posts/default/1953739239793254210'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7373694028643264060/posts/default/1953739239793254210'/><link rel='alternate' type='text/html' href='http://hankliblog.blogspot.com/2007/06/design-php-site-to-handle-ultra-high.html' title='Design php site to handle ultra high volume traffic'/><author><name>Hank Li</name><uri>http://www.blogger.com/profile/01921353182145348702</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>1</thr:total></entry></feed>
