<?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-5463345432022943631</id><updated>2012-02-16T08:39:42.975+01:00</updated><category term='jsr299'/><category term='m2eclipse'/><category term='extusb'/><category term='java'/><category term='howto'/><category term='tutorial'/><category term='deployment'/><category term='htc'/><category term='scm'/><category term='glassfish'/><category term='maven'/><category term='tomcat'/><category term='miniusb'/><category term='struts2'/><category term='adp1'/><category term='netbeans'/><category term='portlet'/><category term='liferay'/><category term='android'/><category term='plug'/><category term='ejb'/><category term='git'/><category term='dependencymanagement'/><category term='g1'/><category term='windows'/><category term='servlet'/><category term='operations'/><category term='cdi'/><category term='jee6'/><category term='eclipse'/><category term='jee'/><category term='appclient'/><category term='fluff'/><category term='svn'/><category term='announcements'/><title type='text'>log4ray - Rene's useless Blog</title><subtitle type='html'></subtitle><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://log4ray.blogspot.com/feeds/posts/default'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5463345432022943631/posts/default?max-results=100'/><link rel='alternate' type='text/html' href='http://log4ray.blogspot.com/'/><link rel='hub' href='http://pubsubhubbub.appspot.com/'/><author><name>Rene Gielen</name><uri>http://www.blogger.com/profile/07634251831690301392</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='30' src='http://4.bp.blogspot.com/_KnGpsA-tzAs/S09ziA2u_kI/AAAAAAAAAG0/HT2EK7uLvWo/S220/golden_gate_portrait.jpg'/></author><generator version='7.00' uri='http://www.blogger.com'>Blogger</generator><openSearch:totalResults>9</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>100</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-5463345432022943631.post-7197719091192208355</id><published>2011-05-28T21:58:00.001+02:00</published><updated>2011-05-28T21:58:47.160+02:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='java'/><category scheme='http://www.blogger.com/atom/ns#' term='deployment'/><category scheme='http://www.blogger.com/atom/ns#' term='operations'/><category scheme='http://www.blogger.com/atom/ns#' term='jee'/><category scheme='http://www.blogger.com/atom/ns#' term='windows'/><category scheme='http://www.blogger.com/atom/ns#' term='servlet'/><category scheme='http://www.blogger.com/atom/ns#' term='tomcat'/><title type='text'>Fixing Redeployment Issues for Servlet Applications on Windows</title><content type='html'>&lt;p style="clear: both"&gt;Deployment is hard, redeployment even harder from time to time - especially when your web container, say Tomcat, runs on Windows. Even if you did a good job in avoiding memory leaks and classloader issues, you may experience the problem that the running application fails to undeploy, leaving a couple of files in the &lt;code&gt;webapps&lt;/code&gt; folder that could not be deleted.&lt;br /&gt;&lt;br /&gt;&lt;/p&gt;  &lt;p style="clear: both"&gt;&lt;div&gt;When Bill designed his beautiful operating system (or whatever you want to call it), he decided to introduce pessimistic locking for file system resources. While this generally sounds good regarding concurrency issues, most of us will already have seen some downsides of this behavior, e.g. when trying to open a document by two users or performing an &lt;code&gt;mvn clean&lt;/code&gt; or whatever.&lt;br /&gt;&lt;/div&gt;&lt;/p&gt;  &lt;p style="clear: both"&gt;&lt;div&gt;&lt;br /&gt;The web container will feel this pain, too. Due to the nature of the JRE, resources are not immediately freed when an application is undeployed - they are just candidates to garbage collection now. So when the application's classloader is de-referenced due to application shutdown, resources such as file system handles may stay open for a while, until our friend GC comes along. If things turn out badly, this will cause the described interference with our redeployment process, since files with open handles cannot be deleted.&lt;br /&gt;&lt;/div&gt;&lt;/p&gt;  &lt;p style="clear: both"&gt;&lt;div&gt;&lt;br /&gt;There are a couple of things you can do:&lt;br /&gt;&lt;ul style="clear: both"&gt;&lt;li&gt;ditch Windows - seriously, you're doing server side stuff!! Grab any Linux, Solaris, *BSD (including MacOS) or whateverNIX and enjoy...&lt;br /&gt;&lt;/li&gt;&lt;li&gt;get help from my friends at &lt;a href="http://www.zeroturnaround.com/" target="_blank"&gt;Zeroturnaround&lt;/a&gt; and check out &lt;a href="http://www.zeroturnaround.com/liverebel/" target="_blank"&gt;LiveRebel&lt;/a&gt;, their new magical tool for rolling out seemlessly&lt;br /&gt;&lt;/li&gt;&lt;li&gt;or: add the following listener to your servlet application&lt;/li&gt;&lt;/ul&gt;&lt;br /&gt;&lt;/div&gt;&lt;/p&gt;  &lt;pre style="clear: both"&gt;&lt;code class="prettyprint"&gt;&lt;br /&gt;/**&lt;br /&gt; * ServletContextCleanupListener uses a little hack to get rid of undeployment issues under Windows.&lt;br /&gt; * Just in case you may ask: Free under Apache Software License&lt;br /&gt; *&lt;br /&gt; * @author Rene Gielen&lt;br /&gt; */&lt;br /&gt;public class ServletContextCleanupListener implements ServletContextListener {&lt;br /&gt;&lt;br /&gt;	@Override&lt;br /&gt;	public void contextInitialized( ServletContextEvent sce ) {&lt;br /&gt;		// nothing to do&lt;br /&gt;	}&lt;br /&gt;&lt;br /&gt;	@Override&lt;br /&gt;	public void contextDestroyed( ServletContextEvent sce ) {&lt;br /&gt;		System.gc(); // No excuse - gc NOW&lt;br /&gt;		try {&lt;br /&gt;			Thread.sleep(1000); // ease, dude...&lt;br /&gt;		} catch ( InterruptedException ex ) {&lt;br /&gt;			// Intentionally left blank&lt;br /&gt;		}&lt;br /&gt;	}&lt;br /&gt;}&lt;br /&gt;&lt;/code&gt;&lt;/pre&gt;  &lt;p style="clear: both"&gt;&lt;div&gt;&lt;br /&gt; My client is really happy now, since it solved all his problems. Actually it did not help me to convince him to ditch Windows *sigh* &lt;/div&gt;&lt;/p&gt;&lt;br /&gt;&lt;br class="final-break" style="clear: both" /&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5463345432022943631-7197719091192208355?l=log4ray.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://log4ray.blogspot.com/feeds/7197719091192208355/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://log4ray.blogspot.com/2011/05/fixing-redeployment-issues-for-servlet.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5463345432022943631/posts/default/7197719091192208355'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5463345432022943631/posts/default/7197719091192208355'/><link rel='alternate' type='text/html' href='http://log4ray.blogspot.com/2011/05/fixing-redeployment-issues-for-servlet.html' title='Fixing Redeployment Issues for Servlet Applications on Windows'/><author><name>Rene Gielen</name><uri>http://www.blogger.com/profile/07634251831690301392</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='30' src='http://4.bp.blogspot.com/_KnGpsA-tzAs/S09ziA2u_kI/AAAAAAAAAG0/HT2EK7uLvWo/S220/golden_gate_portrait.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5463345432022943631.post-8375479468065356043</id><published>2010-02-17T15:44:00.000+01:00</published><updated>2010-02-19T15:06:57.487+01:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='java'/><category scheme='http://www.blogger.com/atom/ns#' term='jee6'/><category scheme='http://www.blogger.com/atom/ns#' term='ejb'/><category scheme='http://www.blogger.com/atom/ns#' term='howto'/><category scheme='http://www.blogger.com/atom/ns#' term='tutorial'/><category scheme='http://www.blogger.com/atom/ns#' term='netbeans'/><category scheme='http://www.blogger.com/atom/ns#' term='glassfish'/><category scheme='http://www.blogger.com/atom/ns#' term='appclient'/><title type='text'>Create and Run a JEE6 Client Application with Netbeans 6.8 and Glassfish V3 - Part 2: Enhancing and Deploying the Application</title><content type='html'>&lt;p style="clear: both"&gt;This is the second part of a two part article aiming to share some experiences with developing JEE6 client applications. &lt;a href="http://log4ray.blogspot.com/2010/02/create-and-run-jee6-client-application.html" title="" target="_blank"&gt;In the first part the skeleton of a basic micro-blogging enterprise application was set up&lt;/a&gt;, composed of a client application and an EJB module. In this part we will add a simple Swing form to enable users to post messages and to check the central timeline. It will be covered how to deploy to a standalone server and run the client both with the &lt;em&gt;appclient&lt;/em&gt; tool and with Java Web Start.&lt;/p&gt;&lt;p style="clear: both"&gt;First off, we want to add a JFrame based form to the application. Right click on the &lt;em&gt;Glitter-app-client&lt;/em&gt; source package and chose &lt;em&gt;New &amp;gt; JFrame Form&lt;/em&gt;. In our example the class will be named &lt;em&gt;GlitterJFrame&lt;/em&gt;. In the visual editor, add a couple of UI elements: two text fields, one for the username input and the other for a message to post, along with a list box for the message timeline and two buttons to initiate posting and refreshing of messages. &lt;/p&gt;&lt;p style="clear: both"&gt;&lt;a href="http://lh4.ggpht.com/_KnGpsA-tzAs/S36a6Af5wjI/AAAAAAAAAJg/uv1981m5nDM/s800/Glitter-app-client_-_NetBeans_IDE_6.8.png" class="image-link"&gt;&lt;img class="linked-to-original" src="http://lh5.ggpht.com/_KnGpsA-tzAs/S36a50XHWXI/AAAAAAAAAJc/4i7apnR8its/s800/Glitter-app-client_-_NetBeans_IDE_6-thumb.8.png" height="292" width="478" style=" text-align: center; display: block; margin: 0 auto 10px;" /&gt;&lt;/a&gt;Switch to the source code and add a &lt;em&gt;DefaultListModel&lt;/em&gt; property named &lt;em&gt;timelineModel&lt;/em&gt;, which we will use to populate the message list with the posts from the server. We also need a reference to our &lt;em&gt;GlitterPostEJBRemote&lt;/em&gt;, which will be wired up on application start. &lt;/p&gt;&lt;pre style="clear: both"&gt;&lt;code class="prettyprint"&gt;public class GlitterJFrame extends javax.swing.JFrame {&lt;br /&gt;    @EJB&lt;br /&gt;    private static GlitterPostEJBRemote glitterPostEJB;&lt;br /&gt;    &lt;br /&gt;    private DefaultListModel timelineModel = new DefaultListModel();&lt;br /&gt;    ...&lt;br /&gt;}&lt;br /&gt;&lt;/code&gt;&lt;/pre&gt;&lt;p style="clear: both"&gt;Switch back to design mode, select the list box and activate the editor for model property in the properties view. Select &lt;em&gt;Custom code&lt;/em&gt;, and fill in the name of the newly created property:&lt;/p&gt;&lt;p style="clear: both"&gt;&lt;a href="http://lh3.ggpht.com/_KnGpsA-tzAs/S36a68Tps-I/AAAAAAAAAJo/xS4tn2EWTac/s800/timeline__JList__-_model.png" class="image-link"&gt;&lt;img class="linked-to-original" src="http://lh4.ggpht.com/_KnGpsA-tzAs/S36a6n-f_zI/AAAAAAAAAJk/q9etC2jorTg/s800/timeline__JList__-_model-thumb.png" height="205" align="left" width="500" style=" display: inline; float: left; margin: 0 10px 10px 0;" /&gt;&lt;/a&gt;&lt;br style="clear: both" /&gt;To make our life a little bit easier, we add a convenience constructor as well as an useful &lt;em&gt;toString&lt;/em&gt; implementation to our &lt;em&gt;GlitterPost&lt;/em&gt; entity model class:&lt;/p&gt;&lt;pre style="clear: both"&gt;&lt;code class="prettyprint"&gt;public class GlitterPost implements Serializable {&lt;br /&gt;&lt;br /&gt;    public GlitterPost() {&lt;br /&gt;    }&lt;br /&gt;&lt;br /&gt;    public GlitterPost(String username, String content) {&lt;br /&gt;        this.username = username;&lt;br /&gt;        this.content = content;&lt;br /&gt;    }&lt;br /&gt;    ...&lt;br /&gt;    @Override&lt;br /&gt;    public String toString() {&lt;br /&gt;        StringBuilder sb = new StringBuilder("&amp;lt;")&lt;br /&gt;                .append(username).append("&amp;gt; ")&lt;br /&gt;                .append(content);&lt;br /&gt;        return sb.toString();&lt;br /&gt;    }&lt;br /&gt;}&lt;br /&gt;&lt;/code&gt;&lt;/pre&gt;&lt;p style="clear: both"&gt;Now it's time to perform some action. Double click the &lt;em&gt;Refresh&lt;/em&gt; button to insert a new click handler. The following code snippet is responsible to perform the actual refresh:&lt;/p&gt;&lt;pre style="clear: both"&gt;&lt;code class="prettyprint"&gt;    private void refreshActionPerformed(java.awt.event.ActionEvent evt) {&lt;br /&gt;        refresh();&lt;br /&gt;    }&lt;br /&gt;&lt;br /&gt;    private void refresh() {&lt;br /&gt;        timelineModel.clear();&lt;br /&gt;        List&amp;lt;GlitterPost&amp;gt; posts = glitterPostEJB.findPosts();&lt;br /&gt;        for (GlitterPost post : posts) {&lt;br /&gt;            timelineModel.addElement(post.toString());&lt;br /&gt;        }&lt;br /&gt;    }&lt;br /&gt;&lt;/code&gt;&lt;/pre&gt;&lt;p style="clear: both"&gt;In similar manner a handler for the &lt;em&gt;Post&lt;/em&gt; button is added:&lt;/p&gt;&lt;pre style="clear: both"&gt;&lt;code class="prettyprint"&gt;    private void postActionPerformed(java.awt.event.ActionEvent evt) {&lt;br /&gt;        glitterPostEJB.createPost(new GlitterPost(username.getText(), message.getText()));&lt;br /&gt;        refresh();&lt;br /&gt;        message.setText("");&lt;br /&gt;    }&lt;br /&gt;&lt;/code&gt;&lt;/pre&gt;&lt;p style="clear: both"&gt;Time to run the application: since we already had a &lt;em&gt;Main&lt;/em&gt; class defined in the application client project, we have to change configuration to run the new Swing UI main class rather than the initial one. Right click on the &lt;em&gt;Glitter-app-client&lt;/em&gt; project and select &lt;em&gt;Properties &amp;gt; Run&lt;/em&gt;. Change &lt;em&gt;Main Class&lt;/em&gt; to &lt;em&gt;GlitterJFrame&lt;/em&gt;:&lt;/p&gt;&lt;p style="clear: both"&gt;&lt;a href="http://lh5.ggpht.com/_KnGpsA-tzAs/S36a7wVHHKI/AAAAAAAAAJw/cwANsuDpEuM/s800/Project_Properties_-_Glitter-app-client.png" class="image-link"&gt;&lt;img class="linked-to-original" src="http://lh6.ggpht.com/_KnGpsA-tzAs/S36a7Yg26tI/AAAAAAAAAJs/bCAKVNd2X3I/s800/Project_Properties_-_Glitter-app-client-thumb.png" height="235" align="left" width="500" style=" display: inline; float: left; margin: 0 10px 10px 0;" /&gt;&lt;/a&gt;&lt;br style="clear: both" /&gt;Run the &lt;em&gt;GlitterEA&lt;/em&gt; application. If everything worked out well, the application window appears and the functionality can be tested:&lt;/p&gt;&lt;p style="clear: both"&gt;&lt;a href="http://lh3.ggpht.com/_KnGpsA-tzAs/S36a8jPux8I/AAAAAAAAAJ4/csu2GiGc3oE/s800/bin.png" class="image-link"&gt;&lt;img class="linked-to-original" src="http://lh5.ggpht.com/_KnGpsA-tzAs/S36a8YaNTHI/AAAAAAAAAJ0/Wnh7JKIY37A/s800/bin-thumb.png" height="318" align="left" width="500" style=" display: inline; float: left; margin: 0 10px 10px 0;" /&gt;&lt;/a&gt;&lt;br style="clear: both" /&gt;At this point, the application could be considered to have it's initial functionality in place and is ready to be rolled out. The Glassfish V3 infrastructure imposes two basic ways to enable a server deployed client application to be run locally on client computers:&lt;/p&gt;&lt;ul style="clear: both"&gt;&lt;li&gt;Using a local &lt;a href="http://docs.sun.com/app/docs/doc/820-7701/appclient-1m?a=view" target="_blank"&gt;appclient&lt;/a&gt; container&lt;br /&gt;&lt;/li&gt;&lt;li&gt;Provisioning via Java WebStart&lt;/li&gt;&lt;/ul&gt;&lt;p style="clear: both"&gt;The Application Client Container (ACC) is a runtime environment for running a JEE client application locally, featuring transparent communication with the server based enterprise application as well as serving dependency injection. The &lt;em&gt;appclient&lt;/em&gt; utility enables you to start a downloaded client application locally.&lt;/p&gt;&lt;p style="clear: both"&gt;With the Netbeans embedded Glassfish instance still running, it is quite easy to give this a try. To get a version of the client application that can be run locally, we need to download the client stubs  from the server. Open a command shell and change to a folder of your choice. Locate the Glassfish home and invoke &lt;em&gt;$GLASSFISH_HOME/bin/asadmin&lt;/em&gt; with the &lt;em&gt;get-client-stubs&lt;/em&gt; command:&lt;br /&gt;&lt;code&gt;&lt;br /&gt;&amp;gt; /Applications/NetBeans/sges-v3/glassfish/bin/asadmin get-client-stubs --appname GlitterEA .&lt;/code&gt; &lt;br /&gt;&lt;br /&gt;After having issued this command, the current working directory should contain the file &lt;em&gt;GlitterEAClient.jar&lt;/em&gt; along with a folder named &lt;em&gt;GlitterEAClient&lt;/em&gt; which contains further resources. To start the application, the &lt;em&gt;$GLASSFISH_HOME/bin/appclient&lt;/em&gt; tool is needed:&lt;/p&gt;&lt;p style="clear: both"&gt;&lt;code&gt;&amp;gt; /Applications/NetBeans/sges-v3/glassfish/bin/appclient -client GlitterEAClient.jar&lt;/code&gt;&lt;/p&gt;&lt;p style="clear: both"&gt; &lt;/p&gt;&lt;p style="clear: both"&gt;Most likely some exceptions with complaints about recursive invocations will occur, which seem to be safe to be ignored. After a short while the client window should appear and work as expected.&lt;/p&gt;&lt;p style="clear: both"&gt;Nevertheless, this solves only half of the problem. Running the application against a standalone server opposed to the instance started and controlled by Netbeans might cause some troubles, especially when using the same Glassfish installation for both Netbeans and standalone deployment.&lt;/p&gt;&lt;p style="clear: both"&gt;To get an understanding what the troubles are, try the following:&lt;/p&gt;&lt;ol style="clear: both"&gt;&lt;li&gt;Stop the Netbeans controlled Glassfish instance under &lt;em&gt;Services &amp;gt; Servers&lt;/em&gt;&lt;br /&gt;&lt;/li&gt;&lt;li&gt;Stop the Netbeans controlled JavaDB instance under &lt;em&gt;Services &amp;gt; Databases&lt;/em&gt;&lt;br /&gt;&lt;/li&gt;&lt;li&gt;Switch to your command shell&lt;br /&gt;&lt;/li&gt;&lt;li&gt;Start the standalone JavaDB instance:&lt;br /&gt;&lt;code&gt;$GLASSFISH_HOME/bin/asadmin start-database&lt;/code&gt;&lt;br /&gt;&lt;/li&gt;&lt;li&gt;Start the standalone Glassfish domain:&lt;br /&gt;&lt;code&gt;$GLASSFISH_HOME/bin/asadmin start-domain domain1&lt;/code&gt;&lt;br /&gt;&lt;/li&gt;&lt;li&gt;Invoke the client application with appclient as described above &lt;/li&gt;&lt;/ol&gt;&lt;p style="clear: both"&gt;You will notice a couple of things going wrong:&lt;/p&gt;&lt;ul style="clear: both"&gt;&lt;li&gt;While the application may seem to start up normally and without problems, as soon as you hit the &lt;em&gt;Refresh&lt;/em&gt; or &lt;em&gt;Post&lt;/em&gt; button exceptions will be thrown. A short investigation reveals that the glitter database is missing.&lt;br /&gt;Indeed the standalone JavaDB instance does not know anything about the &lt;em&gt;glitter&lt;/em&gt; database yet, since we created it against the Netbeans managed instance which uses a local storage folder in the user's home directory. For the standalone instance we need to create the &lt;em&gt;glitter&lt;/em&gt; database again.&lt;br /&gt;&lt;/li&gt;&lt;li&gt;If you activate Java Web Start for the GlitterEA application via the Glassfish web administration console on http://localhost:4848 (detailed description follows), you will notice that starting the application fails when trying to launch it.&lt;br /&gt;The reason is that Netbeans uses a simplified deployment process when running the application from within the IDE, which besides others will cause the server side client application jars not to be signed as needed for Web Start. See this &lt;a href="http://forums.java.net/jive/thread.jspa?messageID=377649" target="_blank"&gt;java.net forum thread&lt;/a&gt; for more detailed information on that topic.&lt;/li&gt;&lt;/ul&gt;&lt;p style="clear: both"&gt;Let's start a deployment from scratch to get around these problems. We now assume that &lt;em&gt;$GLASSFISH_HOME/bin&lt;/em&gt; is in your path, to invoke &lt;em&gt;asadmin&lt;/em&gt; and &lt;em&gt;appclient&lt;/em&gt;. If not, prefix the commands with the correct directory as shown above. We also assume that the standalone Glassfish instance as well as the standalone JavaDB instance are already started as describes earlier.&lt;/p&gt;&lt;ol style="clear: both"&gt;&lt;li&gt;In Netbeans, right click on the &lt;em&gt;GlitterEA&lt;/em&gt; project and select &lt;em&gt;Clean and Build&lt;/em&gt;. This will create an up to date ear-file in the &lt;em&gt;dist&lt;/em&gt; folder of our project. We will need this for later deployment.&lt;br /&gt;&lt;/li&gt;&lt;li&gt;Undeploy &lt;em&gt;GlitterEA&lt;/em&gt; if it is deployed already, either in the web admin console (which is suitable for all the following steps as well) or via shell:&lt;br /&gt;&lt;code&gt;asadmin undeploy GlitterEA&lt;/code&gt;&lt;br /&gt;&lt;/li&gt;&lt;li&gt;Delete the database pool glitterPool if existent:&lt;br /&gt;&lt;code&gt;asadmin delete-jdbc-connection-pool --cascade=true "glitterPool"&lt;/code&gt;&lt;br /&gt;&lt;/li&gt;&lt;li&gt;Recreate the connection pool, this time including the advice to create the database if it does not exist:&lt;br /&gt;&lt;code&gt;asadmin create-jdbc-connection-pool \&lt;br /&gt;--datasourceclassname=org.apache.derby.jdbc.ClientConnectionPoolDataSource \&lt;br /&gt;--property user=glitter:password=glitter:databaseName=glitter:connectionAttributes=\;create\\=true \&lt;br /&gt;--restype=javax.sql.DataSource glitterPool&lt;/code&gt;&lt;br /&gt;&lt;/li&gt;&lt;li&gt;Recreate the JDBC resource:&lt;br /&gt;&lt;code&gt;asadmin create-jdbc-resource --connectionpoolid glitterPool jdbc/glitterDS&lt;/code&gt;&lt;br /&gt;&lt;/li&gt;&lt;li&gt;Deploy the GlitterEA.ear we created earlier:&lt;br /&gt;&lt;code&gt;asadmin deploy ~/NetBeansProjects/GlitterEA/dist/GlitterEA.ear&lt;/code&gt;&lt;br /&gt;Note: Although it is possible to extend the command line with the option &lt;code&gt;--property java-web-start-enabled=true&lt;/code&gt;, Glassfish V3 currently does not seem to recognize this to enable WebStart capabilities for the deployed application, which we will cover later&lt;br /&gt;&lt;/li&gt;&lt;li&gt;After making sure that your current working directory is the one containing the client stubs we retrieved earlier, or alternatively re-fetching the client stubs to your local directory of choice, try again to start the client application locally:&lt;br /&gt;&lt;code&gt;appclient -client GlitterEAClient.jar&lt;/code&gt;&lt;/li&gt;&lt;/ol&gt;&lt;p style="clear: both"&gt;Now the client application should start and work as expected.&lt;/p&gt;&lt;p style="clear: both"&gt;Although this is interesting for testing purposes, this is not really a suitable solution for provisioning the application to client desktops. That is where the Java Web Start feature of Glassfish comes more than handy. Given a clean standalone deployment as just described, navigate to your web administration console usually found under &lt;a href="http://localhost:4848/" target="_blank"&gt;http://localhost:4848/&lt;/a&gt;. Select &lt;em&gt;Applications &amp;gt; GlitterEA&lt;/em&gt;, activate the &lt;em&gt;Java Web Start&lt;/em&gt; checkbox and click &lt;em&gt;Save&lt;/em&gt;:&lt;/p&gt;&lt;p style="clear: both"&gt;&lt;a href="http://lh5.ggpht.com/_KnGpsA-tzAs/S36a9jzsO_I/AAAAAAAAAKA/0oEEnwpBYjA/s800/Edit_Application.png" class="image-link"&gt;&lt;img class="linked-to-original" src="http://lh5.ggpht.com/_KnGpsA-tzAs/S36a9IHe6_I/AAAAAAAAAJ8/f-EcDVBdb2c/s800/Edit_Application-thumb.png" height="246" align="left" width="500" style=" display: inline; float: left; margin: 0 10px 10px 0;" /&gt;&lt;/a&gt;&lt;br style="clear: both" /&gt;After that the Launch action is available for the &lt;em&gt;Glitter-app-client.jar&lt;/em&gt; module:&lt;/p&gt;&lt;p style="clear: both"&gt;&lt;a href="http://lh4.ggpht.com/_KnGpsA-tzAs/S36a-T44UKI/AAAAAAAAAKI/rypfMCiHcOw/s800/Edit_Application1.png" class="image-link"&gt;&lt;img class="linked-to-original" src="http://lh6.ggpht.com/_KnGpsA-tzAs/S36a-GU3H-I/AAAAAAAAAKE/7fydR5yDZ9w/s800/Edit_Application1-thumb.png" height="82" align="left" width="500" style=" display: inline; float: left; margin: 0 10px 10px 0;" /&gt;&lt;/a&gt;&lt;br style="clear: both" /&gt;Clicking the Launch link brings you to the application launch page:&lt;/p&gt;&lt;p style="clear: both"&gt;&lt;a href="http://lh4.ggpht.com/_KnGpsA-tzAs/S36a_6Ge8NI/AAAAAAAAAKQ/C6EcwPUvQps/s800/Application_Client_Launch_Page.png" class="image-link"&gt;&lt;img class="linked-to-original" src="http://lh4.ggpht.com/_KnGpsA-tzAs/S36a_duEHyI/AAAAAAAAAKM/evB7J4jehmM/s800/Application_Client_Launch_Page-thumb.png" height="234" align="left" width="499" style="  display: inline; float: left; margin: 0 10px 10px 0;" /&gt;&lt;/a&gt;&lt;br style="clear: both" /&gt;Click the Launch button to enjoy the application being run via Java Web Start after having confirmed the security information dialog box. An alternative way to launch the application, also suitable to create a program launcher on the client computers is to use this command line (remember to replace &lt;em&gt;localhost&lt;/em&gt; with the server name of choice):&lt;br /&gt;&lt;code&gt;javaws http://localhost:8080/GlitterEA/Glitter-app-client&lt;/code&gt;&lt;/p&gt;&lt;p style="clear: both"&gt;For more information on how to configure and use Java Web Start with Glassfish V3, see the &lt;a href="http://docs.sun.com/app/docs/doc/820-7695/beakt?l=en&amp;amp;a=view" target="_blank"&gt;Glassfish V3 documentation&lt;/a&gt; and this &lt;a href="http://java.sun.com/developer/technicalArticles/J2EE/jws-glassfish/" target="_blank"&gt;useful article&lt;/a&gt;.&lt;/p&gt;&lt;p style="clear: both"&gt;Please keep in mind that this tutorial was not intended to address Swing or EJB best practices, the idea was to keep these parts as simple as possible and concentrate on the client application concept.&lt;/p&gt;&lt;p style="clear: both"&gt;The source code can be found (and forked) at &lt;a href="http://github.com/rgielen/GlitterEA" target="_blank"&gt;github&lt;/a&gt;. For feedback, leave a comment or &lt;a href="http://twitter.com/rgielen" target="_blank"&gt;contact me on Twitter&lt;/a&gt;.&lt;/p&gt;&lt;br class='final-break' style='clear: both' /&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5463345432022943631-8375479468065356043?l=log4ray.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://log4ray.blogspot.com/feeds/8375479468065356043/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://log4ray.blogspot.com/2010/02/create-and-run-jee6-client-application_17.html#comment-form' title='15 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5463345432022943631/posts/default/8375479468065356043'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5463345432022943631/posts/default/8375479468065356043'/><link rel='alternate' type='text/html' href='http://log4ray.blogspot.com/2010/02/create-and-run-jee6-client-application_17.html' title='Create and Run a JEE6 Client Application with Netbeans 6.8 and Glassfish V3 - Part 2: Enhancing and Deploying the Application'/><author><name>Rene Gielen</name><uri>http://www.blogger.com/profile/07634251831690301392</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='30' src='http://4.bp.blogspot.com/_KnGpsA-tzAs/S09ziA2u_kI/AAAAAAAAAG0/HT2EK7uLvWo/S220/golden_gate_portrait.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://lh5.ggpht.com/_KnGpsA-tzAs/S36a50XHWXI/AAAAAAAAAJc/4i7apnR8its/s72-c/Glitter-app-client_-_NetBeans_IDE_6-thumb.8.png' height='72' width='72'/><thr:total>15</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5463345432022943631.post-4896834674136378725</id><published>2010-02-12T23:18:00.005+01:00</published><updated>2010-02-19T15:15:52.120+01:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='java'/><category scheme='http://www.blogger.com/atom/ns#' term='jee6'/><category scheme='http://www.blogger.com/atom/ns#' term='ejb'/><category scheme='http://www.blogger.com/atom/ns#' term='howto'/><category scheme='http://www.blogger.com/atom/ns#' term='tutorial'/><category scheme='http://www.blogger.com/atom/ns#' term='netbeans'/><category scheme='http://www.blogger.com/atom/ns#' term='glassfish'/><category scheme='http://www.blogger.com/atom/ns#' term='appclient'/><title type='text'>Create and Run a JEE6 Client Application with Netbeans 6.8 and Glassfish V3 - Part 1: Creating a Basic Application</title><content type='html'>&lt;p style="clear: both"&gt;While there are lots of examples around on how to create web based EE6 applications, it is a little harder to find a concise tutorial for developing and deploying EE application clients. This is part one of a &lt;a href="http://log4ray.blogspot.com/2010/02/create-and-run-jee6-client-application_17.html"&gt;two&lt;/a&gt; part article aiming to share some experiences on that topic.&lt;/p&gt;&lt;p style="clear: both"&gt;Assuming you have a copy of Netbeans 6.8 with Glassfish V3 integration already installed and working, let's start with creating a new Enterprise Application project:&lt;/p&gt;&lt;p style="clear: both"&gt;&lt;a href="http://lh4.ggpht.com/_KnGpsA-tzAs/S3XTgoyocJI/AAAAAAAAAHY/0YILpNxxEd0/s800/New_Project1.png" class="image-link"&gt;&lt;img class="linked-to-original" src="http://lh6.ggpht.com/_KnGpsA-tzAs/S3XTf725MFI/AAAAAAAAAHU/Y3f7I-PG-KM/s800/New_Project1-thumb1.png" height="353" align="left" width="500" style=" display: inline; float: left; margin: 0 10px 10px 0;" /&gt;&lt;/a&gt;&lt;br style="clear: both" /&gt;In the next dialog, we name the project "GlitterEA" and stay pretty much with the default options. After clicking next, we configure the application to use the default Glassfish 3 domain and to attach both an EJB and an application client module, the latter one with a suitable main class:&lt;/p&gt;&lt;p style="clear: both"&gt;&lt;a href="http://lh5.ggpht.com/_KnGpsA-tzAs/S3XThs6BmTI/AAAAAAAAAHg/eeh6K-uL8LY/s800/New_Enterprise_Application.png" class="image-link"&gt;&lt;img class="linked-to-original" src="http://lh5.ggpht.com/_KnGpsA-tzAs/S3XThNKvbyI/AAAAAAAAAHc/UISbGJt9SW0/s800/New_Enterprise_Application-thumb.png" height="277" align="left" width="500" style=" display: inline; float: left; margin: 0 10px 10px 0;" /&gt;&lt;/a&gt;&lt;br style="clear: both" /&gt;Next up, we want to get our EJB module set up to do something useful. For the example, our domain model is a very simple microblog service, to which users can publish their messages and read what others have written. We will create a single entity, accompanied by a stateless session bean exposing the needed services.&lt;/p&gt;&lt;p style="clear: both"&gt;We start bottom up by creating a new JavaDB database from within the Netbeans Services tab &lt;a href="http://netbeans.org/kb/docs/ide/java-db.html#starting" title="Working with the Java DB (Derby) Database" target="_blank"&gt;as described here in the Netbeans documentation&lt;/a&gt;. We name it &lt;em&gt;glitter&lt;/em&gt;, which will be also the username and the password, and stay with the default location.&lt;/p&gt;&lt;p style="clear: both"&gt;Next we create a suitable connection pool as well as a matching JDBC resource for our application. Right click on the Glitter-ejb project and select &lt;em&gt;New &amp;gt; Other... &amp;gt; Glassfish &amp;gt; JDBC Connection Pool&lt;/em&gt;:&lt;/p&gt;&lt;p style="clear: both"&gt;&lt;a href="http://lh4.ggpht.com/_KnGpsA-tzAs/S3XTi5jrryI/AAAAAAAAAHo/N1TXVg_HTz8/s800/New_File1.png" class="image-link"&gt;&lt;img class="linked-to-original" src="http://lh6.ggpht.com/_KnGpsA-tzAs/S3XTiHLkvQI/AAAAAAAAAHk/Rv8D2XcUnP8/s800/New_File1-thumb.png" height="322" align="left" width="500" style=" display: inline; float: left; margin: 0 10px 10px 0;" /&gt;&lt;/a&gt;&lt;br style="clear: both" /&gt;We name the pool &lt;em&gt;glitterPool&lt;/em&gt; and chose our newly created database for the connection:&lt;/p&gt;&lt;p style="clear: both"&gt;&lt;a href="http://lh4.ggpht.com/_KnGpsA-tzAs/S3XTj04L5EI/AAAAAAAAAHw/q325DpvZDek/s800/New_JDBC_Connection_Pool.png" class="image-link"&gt;&lt;img class="linked-to-original" src="http://lh4.ggpht.com/_KnGpsA-tzAs/S3XTjZVtkfI/AAAAAAAAAHs/YtCtH7HJv8w/s800/New_JDBC_Connection_Pool-thumb.png" height="292" align="left" width="500" style=" display: inline; float: left; margin: 0 10px 10px 0;" /&gt;&lt;/a&gt;&lt;br style="clear: both" /&gt;In the next dialog, we add something like &lt;em&gt;Glitter Microblogging&lt;/em&gt; as description. We leave the connection pool properties as suggested and proceed with the &lt;em&gt;Next&lt;/em&gt; button. Since we don't have to change any optional connection pool properties as presented in dialog step 4, we chose to short circuit by clicking &lt;em&gt;Finish&lt;/em&gt;.&lt;/p&gt;&lt;p style="clear: both"&gt;Now we want to add a JDBC resource to which we can refer in our application. Right click on the Glitter-ejb project and select &lt;em&gt;New &amp;gt; Other... &amp;gt; Glassfish &amp;gt; JDBC Resource&lt;/em&gt;. Chose &lt;em&gt;glitterPool&lt;/em&gt; as the pool to use, and name the resource &lt;em&gt;jdbc:/glitterDS&lt;/em&gt;. We are safe to click finish now since we don't want to provide additional properties.&lt;/p&gt;&lt;p style="clear: both"&gt;&lt;a href="http://lh3.ggpht.com/_KnGpsA-tzAs/S3XTlHyR_UI/AAAAAAAAAH4/Qv4dfXj1ego/s800/New_JDBC_Resource1.png" class="image-link"&gt;&lt;img class="linked-to-original" src="http://lh3.ggpht.com/_KnGpsA-tzAs/S3XTknarRjI/AAAAAAAAAH0/mjwb5RS4pLc/s800/New_JDBC_Resource1-thumb.png" height="355" align="left" width="498" style=" display: inline; float: left; margin: 0 10px 10px 0;" /&gt;&lt;/a&gt;&lt;br style="clear: both" /&gt;Now we are ready to actually work on our EJB module. First off, we add an appropriate persistence unit. Right click on the Glitter-ejb project and select &lt;em&gt;New &amp;gt; Persistence Unit&lt;/em&gt;. Configure it as seen here:&lt;/p&gt;&lt;p style="clear: both"&gt;&lt;a href="http://lh4.ggpht.com/_KnGpsA-tzAs/S3XTmLfKBLI/AAAAAAAAAIA/c_iwyu0q200/s800/New_Persistence_Unit.png" class="image-link"&gt;&lt;img class="linked-to-original" src="http://lh5.ggpht.com/_KnGpsA-tzAs/S3XTliRJV_I/AAAAAAAAAH8/SmqHlNYo2Z8/s800/New_Persistence_Unit-thumb.png" height="259" align="left" width="500" style="  display: inline; float: left; margin: 0 10px 10px 0;" /&gt;&lt;/a&gt;&lt;br style="clear: both" /&gt;&lt;strong&gt;Note:&lt;/strong&gt; Please check the generated &lt;em&gt;sun-resources.xml&lt;/em&gt; file in the &lt;em&gt;Server Resources&lt;/em&gt; folder. After adding the JDBC resource, you might experience an empty &lt;code&gt;&amp;lt;property /&amp;gt;&lt;/code&gt; element in there. Remove the line, since Glassfish will give you a terribly long exception stack when parsing an property element without name attribute during resource setup at deploy time.&lt;/p&gt;&lt;p style="clear: both"&gt;Let's get to coding. Create a new source package in the Glitter-ejb module, for example &lt;em&gt;net.itneering.glitter.ejb&lt;/em&gt;. Right click on the newly created package and chose &lt;em&gt;New &amp;gt; Entity Class&lt;/em&gt;. Name it GlitterPost and stay with the Long primary key type. Two more properties need to be added in the resulting Java class, &lt;em&gt;username&lt;/em&gt; and &lt;em&gt;content&lt;/em&gt;. In addition, a named query for selecting the posting timeline is put in place. Slightly shortened, this will be the resulting code:&lt;/p&gt;&lt;pre style="clear: both"&gt;&lt;code class="prettyprint"&gt;&lt;br /&gt;@Entity&lt;br /&gt;@NamedQuery(name="findAllPosts",&lt;br /&gt;            query="SELECT p FROM GlitterPost p ORDER BY p.id DESC")&lt;br /&gt;public class GlitterPost implements Serializable {&lt;br /&gt;&lt;br /&gt;    @Id&lt;br /&gt;    @GeneratedValue(strategy = GenerationType.AUTO)&lt;br /&gt;    private Long id;&lt;br /&gt;&lt;br /&gt;    String username;&lt;br /&gt;    &lt;br /&gt;    @Column(length = 2000)&lt;br /&gt;    private String content;&lt;br /&gt;&lt;br /&gt;    public Long getId() {&lt;br /&gt;        return id;&lt;br /&gt;    }&lt;br /&gt;&lt;br /&gt;    public void setId(Long id) {&lt;br /&gt;        this.id = id;&lt;br /&gt;    }&lt;br /&gt;&lt;br /&gt;    public String getUsername() {&lt;br /&gt;        return username;&lt;br /&gt;    }&lt;br /&gt;&lt;br /&gt;    public void setUsername(String username) {&lt;br /&gt;        this.username = username;&lt;br /&gt;    }&lt;br /&gt;&lt;br /&gt;    public String getContent() {&lt;br /&gt;        return content;&lt;br /&gt;    }&lt;br /&gt;&lt;br /&gt;    public void setContent(String content) {&lt;br /&gt;        this.content = content;&lt;br /&gt;    }&lt;br /&gt;&lt;br /&gt;}&lt;br /&gt;&lt;/code&gt;&lt;/pre&gt;&lt;p style="clear: both"&gt;To expose some useful services for the client application, a simple stateless session bean is added by right clicking on the same source package and choosing &lt;em&gt;New &amp;gt; Session Bean&lt;/em&gt;. It is called &lt;em&gt;GitterPostEJB&lt;/em&gt; and will also need an remote interface:&lt;/p&gt;&lt;p style="clear: both"&gt;&lt;a href="http://lh3.ggpht.com/_KnGpsA-tzAs/S3XTnT_ME6I/AAAAAAAAAII/-lMGo1MZ_IQ/s800/New_Session_Bean.png" class="image-link"&gt;&lt;img class="linked-to-original" src="http://lh5.ggpht.com/_KnGpsA-tzAs/S3XTm2nsa6I/AAAAAAAAAIE/20sQfDpAMa8/s800/New_Session_Bean-thumb.png" height="435" align="left" width="500" style=" display: inline; float: left; margin: 0 10px 10px 0;" /&gt;&lt;/a&gt;&lt;br style="clear: both" /&gt;Some basic &lt;a href="http://en.wikipedia.org/wiki/Create,_read,_update_and_delete" title="Lookup CRUD in WikiPedia" target="_blank"&gt;CRUD&lt;/a&gt; methods are added to &lt;em&gt;GlitterPostEJB&lt;/em&gt;, as well as the EntityManager reference to be injected with an EntityManager instance for the &lt;em&gt;GlitterPU&lt;/em&gt; persistence unit:&lt;/p&gt;&lt;pre style="clear: both"&gt;&lt;code class="prettyprint"&gt;&lt;br /&gt;@Stateless&lt;br /&gt;public class GlitterPostEJB implements GlitterPostEJBRemote {&lt;br /&gt;&lt;br /&gt;    @PersistenceContext(unitName = "GlitterPU")&lt;br /&gt;    private EntityManager em;&lt;br /&gt;&lt;br /&gt;    public GlitterPost createPost(GlitterPost post) {&lt;br /&gt;        em.persist(post);&lt;br /&gt;        return post;&lt;br /&gt;    }&lt;br /&gt;&lt;br /&gt;    public void deletePost(GlitterPost post) {&lt;br /&gt;        em.remove(em.merge(post));&lt;br /&gt;    }&lt;br /&gt;&lt;br /&gt;    public GlitterPost updatePost(GlitterPost post) {&lt;br /&gt;        return em.merge(post);&lt;br /&gt;    }&lt;br /&gt;&lt;br /&gt;    public List&amp;lt;GlitterPost&amp;gt; findPosts() {&lt;br /&gt;        Query query = em.createNamedQuery("findAllPosts");&lt;br /&gt;        return query.getResultList();&lt;br /&gt;    }&lt;br /&gt;&lt;br /&gt;    public GlitterPost findPostById(Long id) {&lt;br /&gt;        return em.find(GlitterPost.class, id);&lt;br /&gt;    }&lt;br /&gt;}&lt;br /&gt;&lt;/code&gt;&lt;/pre&gt;&lt;p style="clear: both"&gt;Two of these methods we will need for our application client, so let's expose them in the &lt;em&gt;GlitterEJBRemote&lt;/em&gt; interface:&lt;/p&gt;&lt;pre style="clear: both"&gt;&lt;code class="prettyprint"&gt;@Remote&lt;br /&gt;public interface GlitterPostEJBRemote {&lt;br /&gt;    public List&amp;lt;GlitterPost&amp;gt; findPosts();&lt;br /&gt;    public GlitterPost createPost(GlitterPost post);&lt;br /&gt;}&lt;/code&gt;&lt;/pre&gt;&lt;p style="clear: both"&gt;That's pretty much it for the EJB module. Now it's time to check if the client application will work as expected. We will check both the findPosts and the createPost methods with a simple call sequence and some printing to standard out. Modify the Main class of the Glitter-app-client module as follows:&lt;/p&gt;&lt;pre style="clear: both"&gt;&lt;code class="prettyprint"&gt;public class Main {&lt;br /&gt;    @EJB&lt;br /&gt;    private static GlitterPostEJBRemote glitterPostEJB;&lt;br /&gt;&lt;br /&gt;    public static void main(String[] args) {&lt;br /&gt;        List&amp;lt;GlitterPost&amp;gt; list = glitterPostEJB.findPosts();&lt;br /&gt;        System.out.println(list);&lt;br /&gt;        glitterPostEJB.createPost(new GlitterPost());&lt;br /&gt;        // Now the list should contain the post we just created&lt;br /&gt;        list = glitterPostEJB.findPosts();&lt;br /&gt;        System.out.println(list);&lt;br /&gt;    }&lt;br /&gt;}&lt;br /&gt;&lt;/code&gt;&lt;/pre&gt;&lt;p style="clear: both"&gt;Save the file and right click the GlitterEA project. Select &lt;em&gt;Run&lt;/em&gt; to start the application. If everything worked out well, the following output will be shown in the GlitterEA console:&lt;/p&gt;&lt;pre style="clear: both"&gt;&lt;code&gt;Copying 1 file to /Users/rene/NetBeansProjects/GlitterEA/dist&lt;br /&gt;Copying 4 files to /Users/rene/NetBeansProjects/GlitterEA/dist/GlitterEAClient&lt;br /&gt;Feb 12, 2010 10:25:34 PM com.sun.enterprise.transaction.JavaEETransactionManagerSimplified initDelegates&lt;br /&gt;INFO: Using com.sun.enterprise.transaction.jts.JavaEETransactionManagerJTSDelegate as the delegate&lt;br /&gt;[]&lt;br /&gt;[net.itneering.glitter.ejb.GlitterPost[id=1]]&lt;/code&gt;&lt;/pre&gt;&lt;p style="clear: both"&gt;In the &lt;a href="http://log4ray.blogspot.com/2010/02/create-and-run-jee6-client-application_17.html"&gt;second part of this article&lt;/a&gt; we will add a simple JFrame based Swing form to enable users to post messages and to check the central timeline. It will also cover how to deploy to a standalone server and run the client both with the &lt;em&gt;appclient&lt;/em&gt; tool and with Java WebStart. The final &lt;a href="http://github.com/rgielen/GlitterEA"&gt;source code of the project&lt;/a&gt; will then be published as well.&lt;/p&gt;&lt;p style="clear: both"&gt;&lt;/p&gt;&lt;br class='final-break' style='clear: both' /&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5463345432022943631-4896834674136378725?l=log4ray.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://log4ray.blogspot.com/feeds/4896834674136378725/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://log4ray.blogspot.com/2010/02/create-and-run-jee6-client-application.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5463345432022943631/posts/default/4896834674136378725'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5463345432022943631/posts/default/4896834674136378725'/><link rel='alternate' type='text/html' href='http://log4ray.blogspot.com/2010/02/create-and-run-jee6-client-application.html' title='Create and Run a JEE6 Client Application with Netbeans 6.8 and Glassfish V3 - Part 1: Creating a Basic Application'/><author><name>Rene Gielen</name><uri>http://www.blogger.com/profile/07634251831690301392</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='30' src='http://4.bp.blogspot.com/_KnGpsA-tzAs/S09ziA2u_kI/AAAAAAAAAG0/HT2EK7uLvWo/S220/golden_gate_portrait.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://lh6.ggpht.com/_KnGpsA-tzAs/S3XTf725MFI/AAAAAAAAAHU/Y3f7I-PG-KM/s72-c/New_Project1-thumb1.png' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5463345432022943631.post-8445512176292576546</id><published>2010-01-14T20:37:00.001+01:00</published><updated>2010-01-14T20:37:08.915+01:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='scm'/><category scheme='http://www.blogger.com/atom/ns#' term='jsr299'/><category scheme='http://www.blogger.com/atom/ns#' term='struts2'/><category scheme='http://www.blogger.com/atom/ns#' term='dependencymanagement'/><category scheme='http://www.blogger.com/atom/ns#' term='maven'/><category scheme='http://www.blogger.com/atom/ns#' term='cdi'/><title type='text'>Bootstrap missing Maven project dependencies from source</title><content type='html'>&lt;p style="clear: both"&gt;From time to time one might face the problem that a required dependency for a Maven based project is not found in a public Maven repository, although it's source is accessible and it even turns out to be a maven based build. If you are fine with downloading the source, building and installing the needed artifacts into your local or company's repository, you are done quite easily. But what if you want to open your own project to a wider community, unable to share a common repository - how to produce a common, reproducible (kind of) and self-contained project build?&lt;br /&gt;&lt;br /&gt;Here is where the bootstrap goal of the Maven scm plugin comes handy. It allows you to check out your dependency from source control and build and install it as a subtask of your own project build. If this is done before the main build's dependencies are resolved, you will get a nicely resolved self-contained build.&lt;/p&gt;&lt;pre style="clear: both"&gt;&lt;code class="prettyprint"&gt;&lt;br /&gt;&amp;lt;dependencies&amp;gt;&lt;br /&gt;    &amp;lt;dependency&amp;gt;&lt;br /&gt;        &amp;lt;groupid&amp;gt;org.jboss.weld&amp;lt;/groupid&amp;gt;&lt;br /&gt;        &amp;lt;artifactid&amp;gt;weld-se&amp;lt;/artifactid&amp;gt;&lt;br /&gt;        &amp;lt;version&amp;gt;1.0.0-SNAPSHOT&amp;lt;/version&amp;gt;&lt;br /&gt;        &amp;lt;scope&amp;gt;test&amp;lt;/scope&amp;gt;&lt;br /&gt;    &amp;lt;/dependency&amp;gt;&lt;br /&gt;    ...&lt;br /&gt;&amp;lt;/dependencies&amp;gt;&lt;br /&gt;&amp;lt;profiles&amp;gt;&lt;br /&gt;    &amp;lt;profile&amp;gt;&lt;br /&gt;        &amp;lt;id&amp;gt;bootstrap&amp;lt;/id&amp;gt;&lt;br /&gt;        &amp;lt;build&amp;gt;&lt;br /&gt;            &amp;lt;plugins&amp;gt;&lt;br /&gt;                &amp;lt;plugin&amp;gt;&lt;br /&gt;                    &amp;lt;groupid&amp;gt;org.apache.maven.plugins&amp;lt;/groupid&amp;gt;&lt;br /&gt;                    &amp;lt;artifactid&amp;gt;maven-scm-plugin&amp;lt;/artifactid&amp;gt;&lt;br /&gt;                    &amp;lt;version&amp;gt;1.0&amp;lt;/version&amp;gt;&lt;br /&gt;                    &amp;lt;executions&amp;gt;&lt;br /&gt;                        &amp;lt;execution&amp;gt;&lt;br /&gt;                            &amp;lt;id&amp;gt;resolve-weld-se&amp;lt;/id&amp;gt;&lt;br /&gt;                            &amp;lt;phase&amp;gt;initialize&amp;lt;/phase&amp;gt;&lt;br /&gt;                            &amp;lt;goals&amp;gt;&lt;br /&gt;                                &amp;lt;goal&amp;gt;bootstrap&amp;lt;/goal&amp;gt;&lt;br /&gt;                            &amp;lt;/goals&amp;gt;&lt;br /&gt;                            &amp;lt;configuration&amp;gt;&lt;br /&gt;                                &amp;lt;goals&amp;gt;install&amp;lt;/goals&amp;gt;&lt;br /&gt;                                &amp;lt;connectionurl&amp;gt;scm:svn:http://anonsvn.jboss.org/repos/weld/java-se/trunk&lt;br /&gt;                                &amp;lt;/connectionurl&amp;gt;&lt;br /&gt;                            &amp;lt;/configuration&amp;gt;&lt;br /&gt;                        &amp;lt;/execution&amp;gt;&lt;br /&gt;                    &amp;lt;/executions&amp;gt;&lt;br /&gt;                &amp;lt;/plugin&amp;gt;&lt;br /&gt;            &amp;lt;/plugins&amp;gt;&lt;br /&gt;        &amp;lt;/build&amp;gt;&lt;br /&gt;    &amp;lt;/profile&amp;gt; &lt;br /&gt;&amp;lt;/profiles&amp;gt;&lt;/code&gt;&lt;/pre&gt;&lt;p style="clear: both"&gt;This is an example for resolving JBoss Weld SE, the standalone version of the Weld CDI / JSR299 dependency injection container for JEE6, which I needed to build the &lt;a href="http://svn.apache.org/repos/asf/struts/sandbox/trunk/struts2-cdi-plugin/" title="Struts 2 sandbox: CDI plugin"&gt;Struts 2 CDI plugin&lt;/a&gt;. Currently it is not found in a public maven repo, while the source is freely available. Declaring this as a needed dependency would result in Maven not being able to resolve it in against any known repository, finally notifying you that you have to install it manually in your local repository.&lt;br /&gt;&lt;br /&gt;But if you now - at least for the first time - call your build with &lt;code&gt;mvn -P bootstrap &amp;lt;goal&amp;gt;&lt;/code&gt; to run with activated "bootstrap" profile, the project you depend on will be checked out from source, built and finally installed in your local maven repository during the initialize phase of your own project's build - et voilà, your project will now (hopefully) compile with nicely resolved dependencies.&lt;/p&gt;&lt;br class='final-break' style='clear: both' /&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5463345432022943631-8445512176292576546?l=log4ray.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://log4ray.blogspot.com/feeds/8445512176292576546/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://log4ray.blogspot.com/2010/01/bootstrap-missing-maven-project.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5463345432022943631/posts/default/8445512176292576546'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5463345432022943631/posts/default/8445512176292576546'/><link rel='alternate' type='text/html' href='http://log4ray.blogspot.com/2010/01/bootstrap-missing-maven-project.html' title='Bootstrap missing Maven project dependencies from source'/><author><name>Rene Gielen</name><uri>http://www.blogger.com/profile/07634251831690301392</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='30' src='http://4.bp.blogspot.com/_KnGpsA-tzAs/S09ziA2u_kI/AAAAAAAAAG0/HT2EK7uLvWo/S220/golden_gate_portrait.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5463345432022943631.post-3006513215434156584</id><published>2009-10-16T19:40:00.002+02:00</published><updated>2010-01-14T20:52:54.993+01:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='m2eclipse'/><category scheme='http://www.blogger.com/atom/ns#' term='liferay'/><category scheme='http://www.blogger.com/atom/ns#' term='howto'/><category scheme='http://www.blogger.com/atom/ns#' term='eclipse'/><category scheme='http://www.blogger.com/atom/ns#' term='portlet'/><category scheme='http://www.blogger.com/atom/ns#' term='maven'/><title type='text'>Setting up a Portlet Development Environment with Eclipse 3.5, Maven and Liferay 5.2</title><content type='html'>&lt;p style="clear: both"&gt;While normally I would prefer Netbeans or IDEA for developing Liferay based applications, I had to setup an Eclipse based environment due to client's needs. Basically this is a protocol incorporating known sources such as &lt;a href="http://www.jroller.com/holy/entry/developing_portlets_for_liferay_in"&gt;Developing portlets for Liferay in Eclipse&lt;/a&gt; or &lt;a href="http://www.jorgeferrer.com/portal/node/14"&gt;A portlet dev. environment using maven2&lt;/a&gt;.&lt;/p&gt;&lt;p style="clear: both"&gt;If you haven't already, get a Eclipse copy from &lt;a href="http://www.eclipse.org/downloads/"&gt;Eclipse Downloads&lt;/a&gt;. Install it and chose a workspace when starting. I prefer to setup a clean workspace for the Liferay setup, but this is of course no requirement.&lt;/p&gt;&lt;p style="clear: both"&gt;&lt;a href="http://lh5.ggpht.com/_KnGpsA-tzAs/Std9vEcJrTI/AAAAAAAAAE8/2ZzWHbvK5yo/s800/Add_Site.jpg" class="image-link"&gt;&lt;img class="linked-to-original" src="http://lh5.ggpht.com/_KnGpsA-tzAs/Std9uojzLXI/AAAAAAAAAE4/0DhDlNQgtgI/s800/Add_Site-thumb.jpg" height="186" align="right" width="380" style=" display: inline; float: right; margin: 0 0 10px 10px;" /&gt;&lt;/a&gt;Next, we need some plugins, most of which are served by external update sites which have to be added via the Help &amp;gt; Install New Software menu. Click Add... to register a new site, afterwards chose the site in the "Work with..." dropdown box to get a list of available modules. Check the modules of choice and let the wizard do the rest. The following plugins are needed:&lt;/p&gt;&lt;ol style="clear: both"&gt;&lt;li&gt;Subclipse 1.6&lt;br /&gt;Homepage: &lt;a href="http://subclipse.tigris.org/"&gt;subclipse.tigris.org&lt;/a&gt;&lt;br style="text-decoration: underline;" /&gt;Update Site URL: &lt;a href="http://subclipse.tigris.org/update_1.6.x"&gt;http://subclipse.tigris.org/update_1.6.x&lt;/a&gt;&lt;br style="text-decoration: underline;" /&gt;Full installation recommended&lt;/li&gt;&lt;li&gt;m2eclipse 0.99 dev&lt;br /&gt;Homepage / Documentation: &lt;a href="http://docs.codehaus.org/display/M2ECLIPSE/Home" title=""&gt;Maven Integration for Eclipse - Codehaus&lt;/a&gt;&lt;br style="text-decoration: underline;" /&gt;Update Site URL: &lt;a href="http://m2eclipse.sonatype.org/update-dev"&gt;http://m2eclipse.sonatype.org/update-dev&lt;/a&gt;&lt;u&gt;&lt;br /&gt;&lt;/u&gt;Full install recommended, except "Maven Integration for ADJT", since it seems to have unresolved dependencies (at least by the time of writing this)&lt;/li&gt;&lt;li&gt;BIRT 2.5&lt;br /&gt;Update Site URL: &lt;a href="http://download.eclipse.org/birt/update-site/2.5/" title="http://download.eclipse.org/birt/update-site/2.5/" id="rwiw"&gt;http://download.eclipse.org/birt/update-site/2.5/&lt;/a&gt;&lt;br style="text-decoration: underline;" /&gt;Note: Just add the update site, since it is needed for dependency resolving for JBoss Tools&lt;/li&gt;&lt;li&gt;JBoss Tools&lt;br /&gt;Homepage / Documentation: &lt;a href="http://www.jboss.org/tools"&gt;JBoss Tools&lt;/a&gt;&lt;br /&gt;Update Site URL: &lt;a href="http://download.jboss.org/jbosstools/updates/development/" title="http://download.jboss.org/jbosstools/updates/development/" id="kffg"&gt;http://download.jboss.org/jbosstools/updates/development/&lt;/a&gt;&lt;br style="text-decoration: underline;" /&gt;Feel free to check what you like, but if a feature has something like "Portlet", "Richfaces" or "JSF" in it's name, it is highly recommended to include, while the SDKs should usually be less of interest.&lt;/li&gt;&lt;/ol&gt;&lt;p style="clear: both"&gt;Now it's time to get you a copy of Liferay from the &lt;a href="http://www.liferay.com/web/guest/downloads/portal" title=""&gt;Liferay Portal Download Page&lt;/a&gt;. The following steps assume that you get the Community Edition Tomcat 6.0 Bundle. Unzip / untar the bundle into a directory of choice - my recommendation is the Eclipse workspace directory we want to use for our Liferay development.&lt;/p&gt;&lt;p style="clear: both"&gt;&lt;a href="http://lh3.ggpht.com/_KnGpsA-tzAs/SteZFXtW3fI/AAAAAAAAAFE/VZQgPED5Hcg/s800/New_Server.jpg" class="image-link"&gt;&lt;img class="linked-to-original" src="http://lh6.ggpht.com/_KnGpsA-tzAs/StegN0zrShI/AAAAAAAAAFo/2j-kIunZ6ak/s800/New_Server-thumb.jpg" height="403" align="right" width="380" style=" display: inline; float: right; margin: 0 0 10px 10px;" /&gt;&lt;/a&gt;At first, a new server configuration for our Liferay installation has to be defined. Activate the Server tab at the bottom, right click in the free area and chose "New &amp;gt; Server". Fill the dialog as shown and click "Next". In the following dialog, chose the Tomcat directory within your Liferay installation folder and an appropriate JRE (1.6+ recommended). You are safe to click "Finish" now, since we have no resources to configure for the server yet. Double click the newly configured server in the server tab to open it's configuration options.&lt;/p&gt;&lt;p style="clear: both"&gt;There are a couple of things we want to adjust:&lt;/p&gt;&lt;ul style="clear: both"&gt;&lt;li&gt;Set a longer start (300s) and stop (60s) timeout, since Liferay has to take it's time&lt;/li&gt;&lt;li&gt;Make sure that the Tomcat installation folder will be used for deployment&lt;/li&gt;&lt;li&gt;Select a suitable deploy path. Since we will configure Maven to do our deployment, we chose the Tomcat temp folder rather than webapps or the Liferay hot deployment folder.&lt;/li&gt;&lt;li&gt;Adjust the VM start parameters to increase the heap and PermGen space limit. Therefore, click "Open launch configuration" and add something like &lt;em&gt;-Xmx512m -XX:MaxPermSize=192m&lt;/em&gt; to "Arguments &amp;gt; VM arguments"&lt;/li&gt;&lt;/ul&gt;&lt;p style="clear: both"&gt;The following screenshot shows the values chosen in the server configuration tab.&lt;/p&gt;&lt;p style="clear: both"&gt;&lt;a href="http://lh6.ggpht.com/_KnGpsA-tzAs/StecqDbmR-I/AAAAAAAAAFU/KT4Q8DpwNfI/s800/Java_EE_-_Lifray_5.2.3___Tomcat_v6.0_Server___localhost_-_Eclipse_-__Users_rene_DevHome_workspace1.jpg" class="image-link"&gt;&lt;img class="linked-to-original" src="http://lh5.ggpht.com/_KnGpsA-tzAs/StegOqEf3wI/AAAAAAAAAFw/XNcNFWSHS-I/s800/Java_EE_-_Lifray_5-thumb.2.3___Tomcat_v6.0_Server___localhost_-_Eclipse_-__Users_rene_DevHome_workspace1.jpg" height="240" align="left" width="378" style=" display: inline; float: left; margin: 0 10px 10px 0;" /&gt;&lt;/a&gt;Now is a good time to start the configured server for the first time and check that everything works. Especially if starting the very first time, some patience is needed since Liferay will need a lot of time to initialize. If everything went well, your browser should open a new window or tab with the portal content.&lt;/p&gt;&lt;p style="clear: both"&gt;&lt;a href="http://lh4.ggpht.com/_KnGpsA-tzAs/StiJCu-xI7I/AAAAAAAAAF8/C4pE0wSIF_M/s800/New_Maven_Project.jpg" class="image-link"&gt;&lt;img class="linked-to-original" src="http://lh4.ggpht.com/_KnGpsA-tzAs/StiJCBn7TGI/AAAAAAAAAF4/s4uJ1nY2oqc/s800/New_Maven_Project-thumb.jpg" height="383" align="right" width="380" style=" display: inline; float: right; margin: 0 0 10px 10px;" /&gt;&lt;/a&gt;For the first portlet application, m2eclipse's feature to create new Maven projects based on Maven archetypes comes handy. Select "File &amp;gt; New &amp;gt; Other ... &amp;gt; Maven &amp;gt; Maven Project" and click "Next". The following dialog may remain unchanged, so click "Next" again. The next dialog gives you the actual archetype selection. Chose the "internal" catalog to find the standard portlet archetype. After clicking "Next", you will be able to provide a group and artifact id, an initial version and the main package to place your Java classes. Hitting the "Finish" button will make the new project show up in the Project Explorer. Check that it is marked as a web project. If not, you may have missed to in install the m2eclipse WTP support feature.&lt;/p&gt;&lt;p style="clear: both"&gt;Check the project properties and make sure that the JRE System Library under "Java Build Path &amp;gt; Libraries" points to a "modern" Java execution environment such as 1.6. If not, hit the "Edit" button to fix this.&lt;/p&gt;&lt;p style="clear: both"&gt;Next step is to fix the portlet-class entry in portlet.xml, which the current maven portlet archetype seems to mess up with a combination of group id with artifact id. Replace it with the fully qualified name of the MyPortlet class found under the package you provided when creating the project from the archetype:&lt;/p&gt;&lt;p style="clear: both"&gt;&lt;pre style="clear: both"&gt;&lt;code class="prettyprint"&gt;&lt;br /&gt;&amp;lt;?xml version="1.0" encoding="UTF-8"?&amp;gt;&lt;br /&gt;&amp;lt;portlet-app xsi:schemalocation="http://java.sun.com/xml/ns/portlet/portlet-app_1_0.xsd&lt;br /&gt;                            http://java.sun.com/xml/ns/portlet/portlet-app_1_0.xsd" version="1.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://java.sun.com/xml/ns/portlet/portlet-app_1_0.xsd"&amp;gt;&lt;br /&gt;&lt;br /&gt;    &amp;lt;portlet&amp;gt;&lt;br /&gt;        &amp;lt;description&amp;gt;Write here a short description about your portlet.&amp;lt;/description&amp;gt;&lt;br /&gt;        &amp;lt;portlet-name&amp;gt;simple-portlet&amp;lt;/portlet-name&amp;gt;&lt;br /&gt;        &amp;lt;display-name&amp;gt;simple-portlet Portlet&amp;lt;/display-name&amp;gt;&lt;br /&gt;&lt;br /&gt;        &amp;lt;portlet-class&amp;gt;net.itneering.simpleportlet.MyPortlet&amp;lt;/portlet-class&amp;gt;&lt;br /&gt;&lt;br /&gt;        &amp;lt;supports&amp;gt;&lt;br /&gt;            &amp;lt;mime-type&amp;gt;text/html&amp;lt;/mime-type&amp;gt;&lt;br /&gt;            &amp;lt;portlet-mode&amp;gt;VIEW&amp;lt;/portlet-mode&amp;gt;&lt;br /&gt;        &amp;lt;/supports&amp;gt;&lt;br /&gt;&lt;br /&gt;        &amp;lt;supported-locale&amp;gt;en&amp;lt;/supported-locale&amp;gt;&lt;br /&gt;&lt;br /&gt;        &amp;lt;portlet-info&amp;gt;&lt;br /&gt;            &amp;lt;title&amp;gt;Put the portlet title here&amp;lt;/title&amp;gt;&lt;br /&gt;            &amp;lt;short-title&amp;gt;Portlet Short Title&amp;lt;/short-title&amp;gt;&lt;br /&gt;            &amp;lt;keywords&amp;gt;put keywords here&amp;lt;/keywords&amp;gt;&lt;br /&gt;        &amp;lt;/portlet-info&amp;gt;&lt;br /&gt;    &amp;lt;/portlet&amp;gt;&lt;br /&gt;&amp;lt;/portlet-app&amp;gt; &lt;/code&gt;&lt;/pre&gt;&lt;p style="clear: both"&gt;&lt;/p&gt;&lt;p style="clear: both"&gt;Now everything is ready to configure our pom to let Maven do the deployment to Liferay. For the hot deployment, Liferay requires us to drop a war file in &lt;em&gt;&amp;lt;Liferay Home Directory&amp;gt;&lt;/em&gt;/deploy. While you could configure this to be some other directory, the requirement for the war packaging remains. The usual way Eclipse handles the deployment, which is copying the web application resources to the configured Tomcat webapps folder, will not work, since Liferay has to get it's hand on the configured portlets before Tomcat.&lt;/p&gt;&lt;p style="clear: both"&gt;For that reason Maven will be utilized to not only build the war artifact, but also copy it to the Liferay's hot deployment directory. While copying the artifact to an arbitrary filesystem location is not a core feature of Maven nor a Maven plugin I'm aware of, it is quite easy to accomplish since Maven's antrun plugin can do the job for us. All we have to do is bind it to a suitable phase, in this case the package phase which will be targeted by invoking package, install and deploy goals. To do so, add the following snippet to the pom.xml file:&lt;/p&gt;&lt;p style="clear: both"&gt;&lt;code&gt;&lt;/code&gt;&lt;/p&gt;&lt;p style="clear: both"&gt;&lt;code&gt;&lt;/code&gt;&lt;/p&gt;&lt;p style="clear: both"&gt;&lt;pre style="clear: both"&gt;&lt;code class="prettyprint"&gt;&lt;br /&gt;&amp;lt;build&amp;gt;&lt;br /&gt;    &amp;lt;finalname&amp;gt;simple-portlet&amp;lt;/finalname&amp;gt;&lt;br /&gt;    &amp;lt;plugins&amp;gt;&lt;br /&gt;        &amp;lt;plugin&amp;gt;&lt;br /&gt;            &amp;lt;artifactid&amp;gt;maven-antrun-plugin&amp;lt;/artifactid&amp;gt;&lt;br /&gt;            &amp;lt;executions&amp;gt;&lt;br /&gt;                &amp;lt;execution&amp;gt;&lt;br /&gt;                    &amp;lt;phase&amp;gt;package&amp;lt;/phase&amp;gt;&lt;br /&gt;                    &amp;lt;configuration&amp;gt;&lt;br /&gt;                        &amp;lt;tasks&amp;gt;&lt;br /&gt;                            &amp;lt;copy todir="../liferay-portal-5.2.3/deploy" file="target/simple-portlet.war"&amp;gt;&lt;br /&gt;                        &amp;lt;/copy&amp;gt;&amp;lt;/tasks&amp;gt;&lt;br /&gt;                    &amp;lt;/configuration&amp;gt;&lt;br /&gt;                    &amp;lt;goals&amp;gt;&lt;br /&gt;                        &amp;lt;goal&amp;gt;run&amp;lt;/goal&amp;gt;&lt;br /&gt;                    &amp;lt;/goals&amp;gt;&lt;br /&gt;                &amp;lt;/execution&amp;gt;&lt;br /&gt;            &amp;lt;/executions&amp;gt;&lt;br /&gt;        &amp;lt;/plugin&amp;gt;&lt;br /&gt;    &amp;lt;/plugins&amp;gt;&lt;br /&gt;&amp;lt;/build&amp;gt;&lt;/code&gt;&lt;/pre&gt;&lt;/p&gt;&lt;p style="clear: both"&gt;Please note that if you change the finalName, you will have to adjust the copy target as well. Unfortunately, the ${finalName} variable will not get substituted if you'd try this.&lt;/p&gt;&lt;p style="clear: both"&gt;While we do not have to, as a final step the application should be added to the server profile we created. This will help Eclipse to find the code of our project and it's dependencies when it comes to debugging. To do so, right click the server in the Servers tab and chose "Add and remove ...", then add the portlet application to the "Configured" list.&lt;/p&gt;&lt;p style="clear: both"&gt;Now start the server, if you like in debug mode. When Liferay is up and running, right click your pom.xml and chose "Run as &amp;gt; Maven package". The war file gets built and copied the deployment folder. A few seconds later you should notice Liferay registering the portlet application in the console. You are now ready to add the portlet to a portal page and set breakpoints or do hot code replacements in debug mode.&lt;/p&gt;&lt;p style="clear: both"&gt;&lt;/p&gt;&lt;p style="clear: both"&gt;&lt;/p&gt;&lt;br class='final-break' style='clear: both' /&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5463345432022943631-3006513215434156584?l=log4ray.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://log4ray.blogspot.com/feeds/3006513215434156584/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://log4ray.blogspot.com/2009/10/setting-up-portlet-development.html#comment-form' title='6 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5463345432022943631/posts/default/3006513215434156584'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5463345432022943631/posts/default/3006513215434156584'/><link rel='alternate' type='text/html' href='http://log4ray.blogspot.com/2009/10/setting-up-portlet-development.html' title='Setting up a Portlet Development Environment with Eclipse 3.5, Maven and Liferay 5.2'/><author><name>Rene Gielen</name><uri>http://www.blogger.com/profile/07634251831690301392</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='30' src='http://4.bp.blogspot.com/_KnGpsA-tzAs/S09ziA2u_kI/AAAAAAAAAG0/HT2EK7uLvWo/S220/golden_gate_portrait.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://lh5.ggpht.com/_KnGpsA-tzAs/Std9uojzLXI/AAAAAAAAAE4/0DhDlNQgtgI/s72-c/Add_Site-thumb.jpg' height='72' width='72'/><thr:total>6</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5463345432022943631.post-1160079528307676495</id><published>2009-05-07T00:26:00.002+02:00</published><updated>2009-11-04T09:38:38.783+01:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='scm'/><category scheme='http://www.blogger.com/atom/ns#' term='git'/><category scheme='http://www.blogger.com/atom/ns#' term='svn'/><title type='text'>Git-a-bit - How Git can be useful when being tied to Subversion</title><content type='html'>&lt;p style="clear: both"&gt;There's been a lot of talk lately about the new distributed version control systems like &lt;a href="http://www.selenic.com/mercurial/wiki/"&gt;Mercurial&lt;/a&gt;, &lt;a href="http://bazaar-vcs.org/"&gt;Bazaar&lt;/a&gt; or &lt;a href="http://git-scm.com/"&gt;Git&lt;/a&gt;. It feels like just yesterday we started the fight to convince the world to switch from &lt;a href="http://www.cvshome.org/"&gt;CVS&lt;/a&gt; to &lt;a href="http://subversion.tigris.org/"&gt;Subversion&lt;/a&gt;, and hopefully most of us won. But now more and more projects and even companies are switching to one of the new &lt;a href="http://en.wikipedia.org/wiki/Software_configuration_management"&gt;SCM&lt;/a&gt; systems, which might make one both consider why they do so and if one would have to undergo all that pain of convincing and migrating again if the concept looks appealing.&lt;/p&gt;&lt;p style="clear: both"&gt;Distributed version control systems offer many advantages. They support offline working without the need of large feature cumulating commits when going back online again, which might be the first usecase people see and understand easily. But scratching the surface a bit, it reveals that there is a lot more, like ultra powerful (of course distributed) branching and merging facilities enabling new development team workflows such as continuous integration per developer/pair, enhanced environments for subteam or featureset driven branches, and a lot more.&lt;/p&gt;&lt;p style="clear: both"&gt;Let's say you got intrigued by the features and the advanced workflows those new systems offer and you might have decided to give Git a try because you heard that your &lt;a href="http://www.jetbrains.com/idea/"&gt;IDEA&lt;/a&gt; IDE now supports full Git integration, and you are convinced that &lt;a href="http://en.wikipedia.org/wiki/Linus_Torvalds"&gt;Linus&lt;/a&gt; is a cool guy - what next? Move your or your companies' repositories to Git? Even more complicated, if you are a freelancer or consultant like I am, convince all your customers that this is the next cool thing and they have to switch immediately?&lt;/p&gt;&lt;p style="clear: both"&gt;A scenario I recently experimented with came up when I was thinking about a feasible process to enable a local CI infrastructure for experimental changes on the &lt;a href="http://struts.apache.org/2.1.6/index.html"&gt;Struts 2&lt;/a&gt; codebase. While we have our central CI builds set up, they mostly make sense for features which are targeted for soon to integrate improvements, unless you are working on a fresh early branch like upcoming version 2.2. You would not want to push highly experimental code that might break builds for a longer time or even might never make it into a release to the upstream repository. Nevertheless, when your experiments turn out to be both stable and useful, you would want to push them as a whole to the main repository.&lt;/p&gt;&lt;p style="clear: both"&gt;The solution I came up with was to use &lt;a href="http://git.or.cz/course/svn.html"&gt;git-svn&lt;/a&gt; locally, which is not only able to make a git repository mirror out of a svn repo, but also to push changes back to the original svn repository. It helped me to introduce a very useful workflow, allowing me to commit small changes to my local git repository, triggering a local &lt;a href="https://hudson.dev.java.net/"&gt;Hudson&lt;/a&gt; build, while I go over to the next change. I'm also able to pull incoming svn changes easily, improving the quality of the local integration test and solve merge issues upfront. After implementing and testing all changes, the commit to the svn repository then goes as a whole.&lt;/p&gt;&lt;p style="clear: both"&gt;I started to build the Git mirror infrastructure from scratch, without knowing the concise &lt;a href="http://wiki.apache.org/general/GitAtApache"&gt;Apache documentation&lt;/a&gt; on that topic which &lt;a href="http://jroller.com/mrdon/"&gt;Don Brown&lt;/a&gt; pointed me to later. The only downside for my boilerplate solution was that since our svn tree is part of the huge Apache svn repository containing all revisions of all projects, the initial creation of the git-svn repo took about one (!!) day - it scanned about 7.3 million revisions only to get our "small" tree synced. But once done, things ran very fast, and getting the local infrastructure with Hudson and IDEA Git up and running was just peanuts.&lt;/p&gt;&lt;p style="clear: both"&gt;After all, I found this workflow also very useful for my clients' projects, both for having a CI infrastructure set up even when the client refuses to and to have a good offline working infrastructure in place.&lt;/p&gt;&lt;br class='final-break' style='clear: both' /&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5463345432022943631-1160079528307676495?l=log4ray.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://log4ray.blogspot.com/feeds/1160079528307676495/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://log4ray.blogspot.com/2009/05/git-bit-how-git-can-be-useful-when.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5463345432022943631/posts/default/1160079528307676495'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5463345432022943631/posts/default/1160079528307676495'/><link rel='alternate' type='text/html' href='http://log4ray.blogspot.com/2009/05/git-bit-how-git-can-be-useful-when.html' title='Git-a-bit - How Git can be useful when being tied to Subversion'/><author><name>Rene Gielen</name><uri>http://www.blogger.com/profile/07634251831690301392</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='30' src='http://4.bp.blogspot.com/_KnGpsA-tzAs/S09ziA2u_kI/AAAAAAAAAG0/HT2EK7uLvWo/S220/golden_gate_portrait.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5463345432022943631.post-5622260359366200206</id><published>2009-03-04T00:12:00.004+01:00</published><updated>2009-03-04T01:05:01.751+01:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='announcements'/><title type='text'>Moved - You're now watching my shiny new official blog</title><content type='html'>&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://2.bp.blogspot.com/_KnGpsA-tzAs/Sa2_Na7d7zI/AAAAAAAAAEs/ckmGunfHG-8/s1600-h/boxes.jpg"&gt;&lt;img style="margin: 0pt 0pt 10px 10px; float: right; cursor: pointer; width: 200px; height: 133px;" src="http://2.bp.blogspot.com/_KnGpsA-tzAs/Sa2_Na7d7zI/AAAAAAAAAEs/ckmGunfHG-8/s200/boxes.jpg" alt="" id="BLOGGER_PHOTO_ID_5309109773027634994" border="0" /&gt;&lt;/a&gt;After some weeks of evaluation, I've decided to move my blog over here. The interface is compelling and the tool support, líke e.g. offline authoring, rocks.  I still love the fantastic &lt;a href="http://jroller.com/"&gt;JRoller&lt;/a&gt; service and I have to thank for enjoying a free and high quality service there. But now let's start over here, combined with the hope that the easier authoring will push me to write more frequntly (to be proven ...)&lt;br /&gt;I have to admit that I've not posted too many articles yet, but some of them might still be of interest -  so here is a short link list of my previous posts on &lt;a href="http://jroller.com/ray/"&gt;Ray's Blog&lt;/a&gt;:&lt;br /&gt;&lt;ul&gt;&lt;li&gt;&lt;a href="http://www.jroller.com/ray/entry/struts2_voted_as_cool_by"&gt;Struts2 voted as cool by Devoxx2008 visitors&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href="http://www.jroller.com/ray/entry/http_proxy_servlet_for_ajax"&gt;HTTP Proxy Servlet for Ajax Calls with Authentication Support&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href="http://www.jroller.com/ray/entry/enhancing_configurability_by_logging_hibernate"&gt;Enhancing configurability by logging Hibernate SQL statements using Log4j&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href="http://www.jroller.com/ray/entry/managing_log4j_logging_levels_for"&gt;Managing log4j Logging Levels for WebApps at Runtime using JMX&lt;/a&gt;&lt;/li&gt;&lt;/ul&gt;There are already a couple of new topics I want to write about, let's see if I find the passion to do so :)&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5463345432022943631-5622260359366200206?l=log4ray.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://log4ray.blogspot.com/feeds/5622260359366200206/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://log4ray.blogspot.com/2009/03/moved-youre-now-watching-my-shiny-new.html#comment-form' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5463345432022943631/posts/default/5622260359366200206'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5463345432022943631/posts/default/5622260359366200206'/><link rel='alternate' type='text/html' href='http://log4ray.blogspot.com/2009/03/moved-youre-now-watching-my-shiny-new.html' title='Moved - You&apos;re now watching my shiny new official blog'/><author><name>Rene Gielen</name><uri>http://www.blogger.com/profile/07634251831690301392</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='30' src='http://4.bp.blogspot.com/_KnGpsA-tzAs/S09ziA2u_kI/AAAAAAAAAG0/HT2EK7uLvWo/S220/golden_gate_portrait.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://2.bp.blogspot.com/_KnGpsA-tzAs/Sa2_Na7d7zI/AAAAAAAAAEs/ckmGunfHG-8/s72-c/boxes.jpg' height='72' width='72'/><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5463345432022943631.post-8532317621700533747</id><published>2009-01-13T20:07:00.006+01:00</published><updated>2009-10-16T00:24:27.988+02:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='htc'/><category scheme='http://www.blogger.com/atom/ns#' term='plug'/><category scheme='http://www.blogger.com/atom/ns#' term='miniusb'/><category scheme='http://www.blogger.com/atom/ns#' term='howto'/><category scheme='http://www.blogger.com/atom/ns#' term='adp1'/><category scheme='http://www.blogger.com/atom/ns#' term='extusb'/><category scheme='http://www.blogger.com/atom/ns#' term='g1'/><category scheme='http://www.blogger.com/atom/ns#' term='android'/><title type='text'>Howto connect Mini-USB plug to HTC phone</title><content type='html'>&lt;p style="clear: both"&gt;I ordered a power adapter for my amazing little Android developer phone aka HTC Dream last week. When I unpacked it, I was a little disappointed because it looked like it was the wrong plug to be delivered, namely a conventional Mini-USB plug rather than a HTC ExtUSB one. I contacted the seller and complained, but he was desperately trying to convince me that it would work. Lucky enough, before making a total fool of me, I gave it a second try - and voila, it works! To document this, I &lt;a href="http://www.youtube.com/watch?v=26XvfxTmuIo"&gt;recorded a demonstration video&lt;/a&gt; (of rather poor quality, better turn of sound) - to help my seller argue, and to convince other people that it works after all.&lt;/p&gt;&lt;p style="clear: both"&gt;&lt;/p&gt;&lt;br class='final-break' style='clear: both' /&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5463345432022943631-8532317621700533747?l=log4ray.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://log4ray.blogspot.com/feeds/8532317621700533747/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://log4ray.blogspot.com/2009/01/howto-connect-mini-usb-plug-to-htc.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5463345432022943631/posts/default/8532317621700533747'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5463345432022943631/posts/default/8532317621700533747'/><link rel='alternate' type='text/html' href='http://log4ray.blogspot.com/2009/01/howto-connect-mini-usb-plug-to-htc.html' title='Howto connect Mini-USB plug to HTC phone'/><author><name>Rene Gielen</name><uri>http://www.blogger.com/profile/07634251831690301392</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='30' src='http://4.bp.blogspot.com/_KnGpsA-tzAs/S09ziA2u_kI/AAAAAAAAAG0/HT2EK7uLvWo/S220/golden_gate_portrait.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5463345432022943631.post-786202603589773156</id><published>2009-01-11T18:02:00.005+01:00</published><updated>2009-01-11T18:39:04.746+01:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='fluff'/><title type='text'>So empty ...</title><content type='html'>&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://2.bp.blogspot.com/_KnGpsA-tzAs/SWouIQPwLeI/AAAAAAAAABo/dkiCI25RVKU/s1600-h/question.jpg"&gt;&lt;img style="margin: 0pt 0pt 10px 10px; float: right; cursor: pointer; width: 105px; height: 159px;" src="http://2.bp.blogspot.com/_KnGpsA-tzAs/SWouIQPwLeI/AAAAAAAAABo/dkiCI25RVKU/s320/question.jpg" alt="" id="BLOGGER_PHOTO_ID_5290091431634939362" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;After starting this blogger site (and, well, saving this name I really like), I was heading back to my old blog site &lt;a href="http://jroller.com/ray"&gt;at JRoller&lt;/a&gt;, although it isn't that slick to work with as blogger is. Coming back here after some time now, I realized a couple of things:&lt;br /&gt;&lt;ul&gt;&lt;li&gt;this blog is desperately empty&lt;/li&gt;&lt;li&gt;the UI and publishing / linking options are really great here&lt;/li&gt;&lt;li&gt;if you're already googlenized (using GMail, Reader , GTalk, Docs and what not), it is so easy &lt;strike&gt;for Google to track my hole life&lt;/strike&gt; to connect things nicely&lt;/li&gt;&lt;li&gt;sooner or later my brandnew &lt;a href="http://code.google.com/intl/de/android/dev-devices.html"&gt;adp1&lt;/a&gt; phone will have a blogger client, I bet&lt;/li&gt;&lt;li&gt;I should spend more time blogging....&lt;/li&gt;&lt;/ul&gt;I'm seriously considering  to move my useless thoughts here, but I'm not convinced yet.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5463345432022943631-786202603589773156?l=log4ray.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://log4ray.blogspot.com/feeds/786202603589773156/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://log4ray.blogspot.com/2009/01/so-empty.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5463345432022943631/posts/default/786202603589773156'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5463345432022943631/posts/default/786202603589773156'/><link rel='alternate' type='text/html' href='http://log4ray.blogspot.com/2009/01/so-empty.html' title='So empty ...'/><author><name>Rene Gielen</name><uri>http://www.blogger.com/profile/07634251831690301392</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='30' src='http://4.bp.blogspot.com/_KnGpsA-tzAs/S09ziA2u_kI/AAAAAAAAAG0/HT2EK7uLvWo/S220/golden_gate_portrait.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://2.bp.blogspot.com/_KnGpsA-tzAs/SWouIQPwLeI/AAAAAAAAABo/dkiCI25RVKU/s72-c/question.jpg' height='72' width='72'/><thr:total>0</thr:total></entry></feed>
