<?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'><id>tag:blogger.com,1999:blog-30587633</id><updated>2009-12-07T21:29:18.236-08:00</updated><title type='text'>My Wiki</title><subtitle type='html'>Compilation of most of the technical stuff that i encounter as part of my job.</subtitle><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://jaitechwriteups.blogspot.com/feeds/posts/default'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/30587633/posts/default?orderby=updated'/><link rel='alternate' type='text/html' href='http://jaitechwriteups.blogspot.com/'/><link rel='hub' href='http://pubsubhubbub.appspot.com/'/><link rel='next' type='application/atom+xml' href='http://www.blogger.com/feeds/30587633/posts/default?start-index=26&amp;max-results=25&amp;orderby=updated'/><author><name>Jaikiran</name><uri>http://www.blogger.com/profile/08503182723143814781</uri><email>noreply@blogger.com</email></author><generator version='7.00' uri='http://www.blogger.com'>Blogger</generator><openSearch:totalResults>26</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>25</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-30587633.post-5837437145581090703</id><published>2009-09-25T06:52:00.000-07:00</published><updated>2009-09-25T07:08:39.447-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='JBoss'/><title type='text'>JBoss Community Asylum - Cool place to get JBoss Community podcasts</title><content type='html'>It's been a while since i last blogged. Mainly because there wasn't anything interesting/useful that was worth sharing here. However, one of the news worth sharing, is the launch of &lt;a href="http://asylum.libsyn.com/"&gt;JBoss Community Asylum&lt;/a&gt;. It's been started by Max R Andersen (JBoss tooling), Emmanuel Bernard (Hibernate team) and Michael Neale (Drools team) and will be sharing podcasts related to JBoss Community and its projects: news, interviews etc.&lt;br /&gt;&lt;br /&gt;The first podcast has already been uploaded. So for those who missed the recent JBoss World event, this first podcast is an summary of what happened there. So don't miss it, you can get it &lt;a href="http://asylum.libsyn.com/index.php?post_id=529471"&gt;here&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;And stay tuned to that site for more such podcasts in the near future!&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/30587633-5837437145581090703?l=jaitechwriteups.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://jaitechwriteups.blogspot.com/feeds/5837437145581090703/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='https://www.blogger.com/comment.g?blogID=30587633&amp;postID=5837437145581090703' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/30587633/posts/default/5837437145581090703'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/30587633/posts/default/5837437145581090703'/><link rel='alternate' type='text/html' href='http://jaitechwriteups.blogspot.com/2009/09/jboss-community-asylum-cool-place-to.html' title='JBoss Community Asylum - Cool place to get JBoss Community podcasts'/><author><name>Jaikiran</name><uri>http://www.blogger.com/profile/08503182723143814781</uri><email>noreply@blogger.com</email><gd:extendedProperty xmlns:gd='http://schemas.google.com/g/2005' name='OpenSocialUserId' value='07020825996152190351'/></author><thr:total xmlns:thr='http://purl.org/syndication/thread/1.0'>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-30587633.post-3838017972955995046</id><published>2009-04-30T00:02:00.000-07:00</published><updated>2009-04-30T00:13:14.617-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='JBoss'/><title type='text'>JBossAS now has an admin-console!</title><content type='html'>JBoss AS users have always asked why JBoss does not have an admin console. Personally, i have always liked working directly on the configuration files without needing any web application or any other tool for doing the same. That's because i like spending more and more time on the AS. But for users who want to just get things done without having to worry about how it is done or which file gets placed where and want to manage the deployments through a web application, a decent admin console was always a neccessity. Its good news now for all JBoss AS users - starting &lt;a href="http://www.jboss.org/jbossas/downloads/"&gt;5.1.0.CR1 version&lt;/a&gt;, JBoss AS now has an excellent admin console!&lt;br /&gt;&lt;br /&gt;I decided to give it a try, during this weekend, to see what features it provides. This article is just to give you some idea about what the admin-console has. The best place to look for all other details and feature list of the admin-console, is the &lt;a href="http://www.jboss.org/embjopr"&gt;Embedded Jopr project page&lt;/a&gt;. So here's an account of what i found about the admin-console. &lt;br /&gt;&lt;br /&gt;The admin console is available by default in the "default" and "all" server configurations. The application is available as a WAR file "admin-console.war" in the deploy folder of these configurations. You can access the admin-console at the following URL http://localhost:8080/admin-console. By default, the username for the application is "admin" and the password is "admin".&lt;br /&gt;&lt;br /&gt;Once you login to the admin-console, you will notice a list of menu items on the left hand side of the screen. The right hand side of the screen is a multi-tabbed details page. So let's click on the "Applications" menu item on the left hand side menu. This shows a list of all applications on the server. Each of these applications is categorized based on the type of the application. Some of the categories are : EJB2.x application, EJB3.x application, WAR, EAR, MC beans. There's also Embedded WARs - these are WAR files which are deployed within an EAR file. Apart from applications, the admin-console also displays resources like JMS factories, JMS destinations (queues/topics), datasources. For each of these applications and resources, the admin-console shows the status (UP/DOWN) of those applications/resources. You can delete existing resources or applications by clicking on the "Delete" button on the details page.&lt;br /&gt;&lt;br /&gt;The admin-console allows you to deploy new applications (WAR, EAR etc...) and also add new resources. So let's see how to deploy an EAR file. On the left hand side menu, click on the Enterprise Application (EARs) link under the Applications. Then on the details page, you will notice a "Add a new resource" button. Click on it. Use the Browse button to select the EAR you want to deploy. This page also gives you an option to deploy the EAR either as an archive or in a exploded format. Select appropriate option and click Continue. That's it, if the application is deployed successfully, you will see an appropriate message and also the status of the application will be shown as "UP". For all those who want to deploy applications in the traditional way (copying to deploy folder), you can still do it. The admin-console dynamically updates it list of deployed applications and on the next refresh, you will notice your application being listed. &lt;br /&gt;&lt;br /&gt;As i mentioned earlier, the details page is a multi-tabbed page. It has a Metrics tab, Control tab, Configuration tab etc... So let's see what the "Control" tab can be used for. Select the Enterprise Application link (from the left hand menu) and drill down to the application of your choice. Then click on the "Control" tab. You will notice options to "Start", "Stop" and "Restart" the application. The other tabs like "Configuration", "Metrics" show many details about the selected application or resource.  &lt;br /&gt;&lt;br /&gt;Overall, the admin-console is a great addition to JBoss AS and provides that you expect from a decent admin-console. Users who have long waited for such an admin-console in JBoss will finally get what they asked for! So go to the &lt;a href="http://www.jboss.org/jbossas/downloads/"&gt;JBossAS download page&lt;/a&gt; and get the latest 5.1.0.CR1 version and start playing with the console.&lt;br /&gt;&lt;br /&gt;As always, if you have any suggestions or issues to report, feel free to do so in the &lt;a href="http://www.jboss.org/index.html?module=bb&amp;op=viewforum&amp;f=294"&gt;Embedded Jopr forum&lt;/a&gt;.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/30587633-3838017972955995046?l=jaitechwriteups.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://jaitechwriteups.blogspot.com/feeds/3838017972955995046/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='https://www.blogger.com/comment.g?blogID=30587633&amp;postID=3838017972955995046' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/30587633/posts/default/3838017972955995046'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/30587633/posts/default/3838017972955995046'/><link rel='alternate' type='text/html' href='http://jaitechwriteups.blogspot.com/2009/04/jbossas-now-has-admin-console.html' title='JBossAS now has an admin-console!'/><author><name>Jaikiran</name><uri>http://www.blogger.com/profile/08503182723143814781</uri><email>noreply@blogger.com</email><gd:extendedProperty xmlns:gd='http://schemas.google.com/g/2005' name='OpenSocialUserId' value='07020825996152190351'/></author><thr:total xmlns:thr='http://purl.org/syndication/thread/1.0'>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-30587633.post-1698673966823685579</id><published>2009-04-07T01:09:00.000-07:00</published><updated>2009-04-07T01:16:12.750-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='EJB'/><category scheme='http://www.blogger.com/atom/ns#' term='J2EE'/><category scheme='http://www.blogger.com/atom/ns#' term='JBoss'/><title type='text'>JBoss EJB3 tutorials and docs</title><content type='html'>I thought i will blog this, since i have been seeing many of the community members looking for some documentation or tutorials for EJB3 on JBoss. Obviously, for anyone who's trying to learn a new technology, the best place to start will be the tutorials. Many of you might be already aware that the new JBossAS-5.x series have been released to the community. Just recently we uploaded a completely new set of EJB3 tutorials and reference documentation targeted for JBossAS-5. These tutorials and reference documentation is available &lt;a href="http://www.jboss.org/jbossejb3/docs/"&gt;here&lt;/a&gt;. The earlier set of tutorials which are targeted for AS-4.x are available &lt;a href="http://www.jboss.org/jbossejb3/docs/tutorial/"&gt;here&lt;/a&gt;. &lt;br /&gt;&lt;br /&gt;The new set of tutorials have been modified to work against AS5. The changes mainly include changes to deployment descriptors or any JBoss specific EJB3 features. The complete source code for the tutorials is available for download at the same URL. &lt;br /&gt;&lt;br /&gt;The important point to note is that these tutorials will be maintained to work against the latest release of EJB3 plugin. So what is EJB3 plugin? JBossAS-5 ships with EJB3 support by default. As you all know, the JBoss EJB3 project and the JBoss AS project are maintained separately and as such have their own release cycles. So what happens if we introduced something new in EJB3 or do a major bug fix for the community in EJB3 project? How do we make it available to the community who use EJB3 support provided by AS5? That's where the EJB3 plugin comes in picture. The EJB3 plugin provides a mechanism where you can patch newer versions of EJB3 into AS5. This way, if there are any major bug fixes or enhancements you are waiting for from the EJB3 community, then you can use the EJB3 plugin to patch it in AS5. &lt;br /&gt;&lt;br /&gt;The next question would be, when and where do i get the EJB3 plugin for the AS. EJB3 project has come up with a release cycle where, every 2nd and 4th Friday of the month there will be a EJB3 release. These releases are downloadable at the &lt;a href="http://www.jboss.org/jbossejb3/downloads/"&gt;JBoss EJB3 download page&lt;/a&gt; . So how do you use this plugin against the AS? It's pretty simple. All you need is:&lt;br /&gt;&lt;br /&gt;- JBossAS-5 installation&lt;br /&gt;- Ant 1.7&lt;br /&gt;&lt;br /&gt;Download the plugin which is nothing but a jar file and run the following command&lt;br /&gt;&lt;br /&gt;&lt;pre name="code" class="java"&gt;&lt;br /&gt;java -jar jboss-ejb3-plugin-x.x.x-installer.jar &lt; path to JBossAS5.x &gt;&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;Note that jboss-ejb3-plugin-x.x.x-installer.jar is the name of the jar file you downloaded.&lt;br /&gt;&lt;br /&gt;So that gives you an idea about what the plugin is. Coming back to the EJB3 tutorials, I mentioned earlier that these tutorials are maintained to work against the latest release of EJB3 plugin. What this means is, you won't find a tutorial in a broken state (tutorials that are no longer running). The tutorials are tested against every release of the EJB3 plugin. So if something in the tutorials breaks, then that's fixed at the right place before they are released to the community.  &lt;br /&gt;&lt;br /&gt;If anyone has any suggestions or questions about the tutorials or the EJB3 docs, feel free to start a discussion in the &lt;a href="http://www.jboss.org/index.html?module=bb&amp;op=viewforum&amp;f=221"&gt;JBoss EJB3 forum&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/30587633-1698673966823685579?l=jaitechwriteups.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://jaitechwriteups.blogspot.com/feeds/1698673966823685579/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='https://www.blogger.com/comment.g?blogID=30587633&amp;postID=1698673966823685579' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/30587633/posts/default/1698673966823685579'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/30587633/posts/default/1698673966823685579'/><link rel='alternate' type='text/html' href='http://jaitechwriteups.blogspot.com/2009/04/jboss-ejb3-tutorials-and-docs.html' title='JBoss EJB3 tutorials and docs'/><author><name>Jaikiran</name><uri>http://www.blogger.com/profile/08503182723143814781</uri><email>noreply@blogger.com</email><gd:extendedProperty xmlns:gd='http://schemas.google.com/g/2005' name='OpenSocialUserId' value='07020825996152190351'/></author><thr:total xmlns:thr='http://purl.org/syndication/thread/1.0'>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-30587633.post-5499750918740837916</id><published>2009-02-24T00:54:00.000-08:00</published><updated>2009-02-24T00:59:59.358-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='JBoss'/><title type='text'>JBossAS 5.0.1 GA released</title><content type='html'>JBossAS-5.0.1 GA has been released today. The download is available on the &lt;a href="http://www.jboss.org/jbossas/downloads/"&gt;JBoss download site&lt;/a&gt;. One of the major issues that has been fixed in this release is the one that was &lt;a href="http://www.jboss.org/index.html?module=bb&amp;op=viewtopic&amp;t=147622"&gt;reported in the community&lt;/a&gt; and was related to "tmp" file handling of deployments by VFS.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/30587633-5499750918740837916?l=jaitechwriteups.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://jaitechwriteups.blogspot.com/feeds/5499750918740837916/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='https://www.blogger.com/comment.g?blogID=30587633&amp;postID=5499750918740837916' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/30587633/posts/default/5499750918740837916'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/30587633/posts/default/5499750918740837916'/><link rel='alternate' type='text/html' href='http://jaitechwriteups.blogspot.com/2009/02/jbossas-501-ga-released.html' title='JBossAS 5.0.1 GA released'/><author><name>Jaikiran</name><uri>http://www.blogger.com/profile/08503182723143814781</uri><email>noreply@blogger.com</email><gd:extendedProperty xmlns:gd='http://schemas.google.com/g/2005' name='OpenSocialUserId' value='07020825996152190351'/></author><thr:total xmlns:thr='http://purl.org/syndication/thread/1.0'>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-30587633.post-4414396329564192550</id><published>2009-01-14T04:04:00.000-08:00</published><updated>2009-01-15T03:06:57.325-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='JBoss'/><title type='text'>Recognition to community contributors - JBoss Community Leadership Awards</title><content type='html'>It's a well known fact that community support for an open source project is always necessary for the growth of the project. Support can be in any form - documentation, bug fixes, feature enhancements, active participation in the forums etc... JBoss has taken the initiative to recognize such community users who have contributed in a great way, towards the growth of various projects hosted at JBoss. The &lt;a href="http://www.jboss.org/community/poll.jspa"&gt;JBoss Community Leadership Awards&lt;/a&gt; aims at recognizing such community members. There are various categories for the awards - checkout the poll page. You can cast your vote under any of those categories. This is a chance to cast your vote for those who might have helped you, in some way or the other, while using projects hosted at JBoss :)&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/30587633-4414396329564192550?l=jaitechwriteups.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://jaitechwriteups.blogspot.com/feeds/4414396329564192550/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='https://www.blogger.com/comment.g?blogID=30587633&amp;postID=4414396329564192550' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/30587633/posts/default/4414396329564192550'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/30587633/posts/default/4414396329564192550'/><link rel='alternate' type='text/html' href='http://jaitechwriteups.blogspot.com/2009/01/recognition-to-community-contributors.html' title='Recognition to community contributors - JBoss Community Leadership Awards'/><author><name>Jaikiran</name><uri>http://www.blogger.com/profile/08503182723143814781</uri><email>noreply@blogger.com</email><gd:extendedProperty xmlns:gd='http://schemas.google.com/g/2005' name='OpenSocialUserId' value='07020825996152190351'/></author><thr:total xmlns:thr='http://purl.org/syndication/thread/1.0'>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-30587633.post-1045530071347283195</id><published>2008-12-06T06:09:00.000-08:00</published><updated>2008-12-06T06:54:18.796-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='JBoss'/><title type='text'>JBossAS-5.0 goes GA</title><content type='html'>JBossAS-5.0 GA community edition has been released a few days back!!! Many of you might be knowing that the JBoss-5.0 development was going on for a few years now. After 4 Betas and 2 CRs the application server is now GA. JBossAS-5.0 GA complies with JavaEE5.&lt;br /&gt;&lt;br /&gt;Some of you who keep an watch on the JBoss forums and mailing lists, might already be aware that JBoss-5 was completely rearchitectured. There have been a variety of architectural changes that have been introduced in JBoss-5. So what does this mean to a developer who's been using JBoss-4.x so far? The purpose of this article is to highlight the changes that have come in as part of JBoss-5. I won't be dwelling a lot into the technical details (i will leave it to the experts), but will try to give an overview of changes in this version from JBoss-4.x. This article is aimed at making you aware about things to keep in mind when you start using JBoss-5.&lt;br /&gt;&lt;br /&gt;So let's start!&lt;br /&gt;&lt;br /&gt;1) Additional server profiles/configurations :&lt;br /&gt;&lt;br /&gt;JBoss-4.x AS community users will be used to seeing 3 server profiles being shipped by JBoss in the %JBOSS_HOME%/server folder. The "all", "default" and the "minimal". JBoss-5.0 GA adds couple of more profiles to this. Now in JBoss-5 you have "all", "default", "minimal", "web" and "standard". &lt;br /&gt;&lt;br /&gt; * The "web" profile is meant to contain services which will allow simple web applications (servlet, jsps) to be deployed. It also has support for JTA, JCA and JPA. Some of you might ask how is it different from the "minimal" configuration. If you look in the deployers folder of "minimal" profile, you will find that there are no deployers available in the "deployers" folder nor any applications in the "deploy" folder. The "minimal" profile is mainly meant for letting the developers decide what services they want to be available. The "minimal" is just an empty profile which the users can build upon depending on their needs, whereas the "web" is a subset of the "default" and allows deploying web applications.&lt;br /&gt;&lt;br /&gt; * The "standard" profile is the one against which the tests for JavaEE support were run against.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;2) Separation of "deployers" and "deploy" :&lt;br /&gt;&lt;br /&gt;If you look in the "deploy" folder of a JBoss-4.x system, you will notice that it contains two types of deployables. Some of the deployables are meant to deploy other applications. For example: The jbossweb.deployer in the deploy folder is actually used for deploying web applications (WAR). With JBoss-5, there is now a clear separation between the deployer and the deployable. You will notice that in JBoss-5, there is a "deployers" folder under each server profile %JBOSS_HOME%/server/&lt; serverName&gt;/deployers. The jbossweb.deployer, which i used as an example earlier, is now in this "deployers" folder along with various other deployers. The actual applications that are to be deployed reside in the "deploy" folder %JBOSS_HOME%/server/&lt; serverName&gt;/deploy.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;3) Libraries are now moved to a common/lib folder:&lt;br /&gt;&lt;br /&gt;In JBoss-4.x, you will notice that the lib folder under each server profile contains almost the same set of jar files. This obviously leads to increased disk space usage. In JBoss-5.0 GA, these common jar files which are required by all these server profiles is now moved to %JBOSS_HOME%/common/lib folder. This common/lib will act as a parent to all server/&lt; serverName&gt;/lib folders. If you want to add any jar for a specific server profile, then you can add it to the %JBOSS_HOME%/server/&lt; serverName&gt;/lib folder. For example: The database drivers that are required by the datasources can be placed in the server profile specific lib folder (%JBOSS_HOME%/server/&lt; serverName&gt;/lib). With the addition of this new common/lib folder, two new JBoss system properties have been introduced:&lt;br /&gt;&lt;br /&gt;&lt;pre name="code" class="java"&gt;&lt;br /&gt; * jboss.common.base.url - This evaluates to ${jboss.home.url}/common&lt;br /&gt; * jboss.common.lib.url - This evaluates to ${jboss.common.base.url}/lib&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;All other JBoss system properties available in JBoss-4.x &lt;a href="http://www.jboss.org/community/docs/DOC-10730"&gt;http://www.jboss.org/community/docs/DOC-10730&lt;/a&gt; continue to remain in JBoss-5.&lt;br /&gt;&lt;br /&gt;4) For Windows users, its now one step easier to run JBoss as a service :&lt;br /&gt;&lt;br /&gt;For JBoss-4.x Windows users, running the server as a service required downloading an appropriate version of JBoss Native and then using the service.bat in the JBoss Native to install the service. In JBoss-5.0 GA, its now one step less. JBossAS comes with JBoss Native installed by default. This way, the user no longer has to download the JBoss Native package separetely. The service.bat for installing the service can be found in the %JBOSS_HOME%/bin folder.&lt;br /&gt;&lt;br /&gt;5) New jmx-console :&lt;br /&gt;&lt;br /&gt;The jmx-console now comes with a better "professional looking" look :-)&lt;br /&gt;&lt;br /&gt;As i mentioned earlier, in this article, i'am going to leave out all the technical details about the changes that have come in JBoss-5. I'll leave it for my next articles, which i plan to do pretty soon after spending some time on this new GA version :-) But in the meantime, JBossAS enthusiasts can start playing with the GA version by downloading it from &lt;a href="http://www.jboss.org/jbossas/downloads/"&gt;here&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;And yes, if you run into any issues using JBossAS-5, feel free to post in the AS-5 dedicated forum  &lt;a href="http://www.jboss.com/index.html?module=bb&amp;op=viewforum&amp;f=287"&gt;here&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/30587633-1045530071347283195?l=jaitechwriteups.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://jaitechwriteups.blogspot.com/feeds/1045530071347283195/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='https://www.blogger.com/comment.g?blogID=30587633&amp;postID=1045530071347283195' title='4 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/30587633/posts/default/1045530071347283195'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/30587633/posts/default/1045530071347283195'/><link rel='alternate' type='text/html' href='http://jaitechwriteups.blogspot.com/2008/12/jbossas-50-goes-ga.html' title='JBossAS-5.0 goes GA'/><author><name>Jaikiran</name><uri>http://www.blogger.com/profile/08503182723143814781</uri><email>noreply@blogger.com</email><gd:extendedProperty xmlns:gd='http://schemas.google.com/g/2005' name='OpenSocialUserId' value='07020825996152190351'/></author><thr:total xmlns:thr='http://purl.org/syndication/thread/1.0'>4</thr:total></entry><entry><id>tag:blogger.com,1999:blog-30587633.post-8396523203424873234</id><published>2008-08-20T01:26:00.000-07:00</published><updated>2008-08-20T01:43:26.702-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='J2EE'/><category scheme='http://www.blogger.com/atom/ns#' term='JBoss'/><category scheme='http://www.blogger.com/atom/ns#' term='Hibernate'/><title type='text'>How to upgrade Hibernate in JBoss</title><content type='html'>JBoss comes shipped with Hibernate by default. Upgrading Hibernate is similar to upgrading any other 3rd party library in your application deployed on JBoss. As long as you understand how the classloading works in JBoss, the upgrading should be pretty straightforward. &lt;br /&gt;&lt;br /&gt;For a brief (well not so brief) background about classloaders in JBoss, have a look at these wiki articles:&lt;br /&gt;&lt;br /&gt;&lt;a href="http://wiki.jboss.org/wiki/JBossClassLoadingUseCases"&gt;How classloading works in JBoss&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;a href="http://wiki.jboss.org/wiki/ClassLoadingConfiguration"&gt;How to configure classloaders in JBoss&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;Once you read through these wiki articles, you will understand that if your application needs to have its own version of a library (does not matter if it is Hibernate or some other 3rd party library), you will have to configure classloader scoping through the xml file. &lt;br /&gt;&lt;br /&gt;So why am i writing this stuff all over again, when these two wiki articles have enough details about classloading scoping? Its mainly because of some tricky issues, which have been reported in the JBoss forums, with upgrading Hibernate (specifically to Hibernate version 3.2.6) on JBoss-4.2.x (specifically JBoss-4.2.2 GA). The rest of the article tries to explain these issues and way to fix them. Though this is written to be more oriented towards upgrading Hibernate, whatever has been explained here will apply to almost every 3rd party library upgrade on JBoss.&lt;br /&gt;&lt;br /&gt;So let's start then!&lt;br /&gt;&lt;br /&gt;Details about the default installation of JBoss-4.2.2 GA:&lt;br /&gt;&lt;br /&gt;JBoss-4.2.2 GA ships with &lt;br /&gt;&lt;br /&gt;&lt;pre name="code" class="java"&gt; &lt;br /&gt;&lt;br /&gt;Hibernate EntityManager 3.2.1.GA&lt;br /&gt;Hibernate Annotations 3.2.1.GA&lt;br /&gt;Hibernate 3.2.4.sp1&lt;br /&gt;&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;What we intend to do is, upgrade Hibernate to use 3.2.6 GA. Let's assume, we have an EAR which will be deployed to JBoss:&lt;br /&gt;&lt;br /&gt;&lt;pre name="code" class="xml"&gt;&lt;br /&gt;&lt;br /&gt;MyApp.ear&lt;br /&gt; |&lt;br /&gt; |--- META-INF&lt;br /&gt; |      |&lt;br /&gt; |      |&lt;br /&gt; |      |--- application.xml&lt;br /&gt; |      | &lt;br /&gt; |      |--- jboss-app.xml&lt;br /&gt; |&lt;br /&gt; |&lt;br /&gt; |--- lib&lt;br /&gt; |    |&lt;br /&gt; |    |--- [some jar files required by my app]&lt;br /&gt; |&lt;br /&gt; |&lt;br /&gt; |--- MyApp.war&lt;br /&gt;&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;So first step would be package the upgraded Hibernate jar files in the application (MyApp.ear). Its crucial to understand that you have to be absolutely sure that you have packaged all the required hibernate jars and the correct versions of those jars in your application. &lt;a href="http://www.hibernate.org/6.html#A3"&gt;This&lt;/a&gt; Hibernate compatibility matrix will help you in picking up the correct versions. However, you still have to know "which" hibernate jars you need to package in the application. &lt;br /&gt;&lt;br /&gt;Based on what i have seen in the forums, the issues faced while upgrading Hibernate were more related to users missing out certain dependent hibernate jar files. Debugging such issues was not very easy since, the errors that got thrown were not simple ClassNotFoundException (which you usually associate with a missing jar). Various errors like ClassCastException, NoSuchMethodException were thrown mainly because Hibernate in this version (3.2.6 GA) refactored a lot of their code to move them to different "projects". For example, the org.hibernate.search package was earlier in the "Hibernate Annotations" project (hibernate-annotations.jar) but with this new release, it was moved to a separate "Hibernate Search" project (hibernate-search.jar). Same applies to org.hibernate.validator package which earlier was in the "Hibernate Annotations" project (hibernate-annotations.jar) but with this new release, it was moved to a separate "Hibernate Validator" project.&lt;br /&gt;&lt;br /&gt;So how does it matter if those hibernate packages were moved to a different project (jar)? Here's a very brief explanation of what happens:&lt;br /&gt;&lt;br /&gt;- JBoss, in its lib folder, has an older version of Hibernate (3.2.4) and other hibernate related jar files, including the hibernate-annotations.jar. In this version, the hibernate-annotations.jar contained the org.hibernate.search and org.hibernate.validator and various other packages.&lt;br /&gt;&lt;br /&gt;- You decide to upgrade Hibernate in your application by packaging the hibernate jars in your application and enabling classloader configuration. You package *only* the latest version of core hibernate jar, the hibernate-annotations.jar and maybe even the hibernate-entitymanager.jar.&lt;br /&gt;Note: You have NOT packaged the hibernate-validator.jar nor the hibernate-search.jar.&lt;br /&gt;&lt;br /&gt;- You start JBoss and the server tries to deploy your application. While deploying, for configuring Hibernate, various Hibernate classes are used, which includes the classes belonging to core hibernate jar and also org.hibernate.validator and org.hibernate.search packages. &lt;br /&gt;&lt;br /&gt;- Since you have configured classloader scoping for your application, JBoss loads the hibernate core classes, the hibernate entitymanager classes and the hibernate annotation classes from the upgraded jars packaged in your application.&lt;br /&gt;&lt;br /&gt;- But when a class belonging to org.hibernate.validator or org.hibernate.search package is being requested for, JBoss sees that these classes are not present the jars packaged in your application. So it delegates the classloading to the parent classloader which looks for the classes in the jar files present in the JBoss lib folder (%JBOSS_HOME%/server/&lt; serverName&gt;/lib folder). Here it finds that these packages are present in the hibernate-annotations.jar (older version) and loads those classes from there. While doing so, it also loads the related classes from various other hibernate packages (which might already have been loaded by a different classloader - remember the classes loaded from the jars in your application). Ultimately, this results to the same classes being loaded twice by different classloaders. Later on when you access these classes in your application you might run into ClassCastExceptions.&lt;br /&gt;&lt;br /&gt;This is just one example of what might go wrong. Infact, you might not get a clear picture based on this brief explanation. So if you are interested in understanding better (and have some time), then go through these forum discussions which have a lot more details (and which actually made me come up with this article):&lt;br /&gt;&lt;br /&gt;&lt;a href="http://www.jboss.com/index.html?module=bb&amp;op=viewtopic&amp;t=120419&amp;postdays=0&amp;postorder=asc&amp;start=10"&gt;ClassCastException for org.hibernate.search.event.FullTextIndexEventListener&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;a href="http://www.jboss.com/index.html?module=bb&amp;op=viewtopic&amp;t=133202"&gt;Again the ClassCastException for org.hibernate.search.event.FullTextIndexEventListener&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;a href="http://www.jboss.com/index.html?module=bb&amp;op=viewtopic&amp;t=140725&amp;postdays=0&amp;postorder=asc&amp;start=0"&gt;This time a NoSuchMethodException: org.hibernate.validator.ClassValidator.&lt;init&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;So now that we have seen what kind of issues you might run into while upgrading, let's now come back to our original plan of upgrading hibernate :)&lt;br /&gt;&lt;br /&gt;1) Enable classloader scoping through jboss-app.xml:&lt;br /&gt;&lt;br /&gt;&lt;pre name="code" class="xml"&gt;&lt;br /&gt;&lt;br /&gt;&amp;lt;jboss-app&amp;gt;&lt;br /&gt;&lt;br /&gt;&amp;lt;loader-repository&amp;gt;&lt;br /&gt;   org.myapp:loader=SomeClassloader&lt;br /&gt;   &amp;lt;loader-repository-config&amp;gt;&lt;br /&gt;      java2ParentDelegation=false&lt;br /&gt;   &amp;lt;/loader-repository-config&amp;gt;&lt;br /&gt; &amp;lt;/loader-repository&amp;gt; &lt;br /&gt;&lt;br /&gt;  &lt;br /&gt;&amp;lt;/jboss-app&amp;gt;&lt;br /&gt;&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;Note: The string org.myapp:loader=SomeClassloader is any unique ObjectName&lt;br /&gt;&lt;br /&gt;2) Include the following jar files in the application package:&lt;br/&gt;&lt;br /&gt;&lt;br /&gt;&lt;pre name="code" class="java"&gt;&lt;br /&gt;&lt;br /&gt;Hibernate Core jar (3.2.6 GA)&lt;br /&gt;Hibernate Annotations jar (3.2.x or 3.3.x)&lt;br /&gt;Hibernate EntityManager jar (3.2.x or 3.3.x)&lt;br /&gt;Hibernate Validator jar (3.0.x)&lt;br /&gt;Hibernate Search jar (3.0.x)&lt;br /&gt;and maybe even Lucene Core jar (lucene-core-2.2.0.jar)&lt;br /&gt;&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;Note: Please follow &lt;a href="http://www.hibernate.org/6.html"&gt;this&lt;/a&gt; page for downloading and figuring out the correct version of hibernate jars required (compatibility matrix).&lt;br /&gt;&lt;br /&gt;So this is how your application packaging will look like finally:&lt;br /&gt;&lt;br /&gt;&lt;pre name="code" class="xml"&gt;&lt;br /&gt;&lt;br /&gt;MyApp.ear&lt;br /&gt; |&lt;br /&gt; |--- META-INF&lt;br /&gt; |     |&lt;br /&gt; |     |&lt;br /&gt; |     |--- application.xml&lt;br /&gt; |     | &lt;br /&gt; |     |--- jboss-app.xml&lt;br /&gt; |&lt;br /&gt; |&lt;br /&gt; |--- lib&lt;br /&gt; |     |&lt;br /&gt; |     |--- [some jar files required by my app]&lt;br /&gt; |     |&lt;br /&gt; |     |--- hibernate3.jar (the hibernate core jar)&lt;br /&gt; |     | &lt;br /&gt; |     |--- hibernate-annotations.jar &lt;br /&gt; |     |&lt;br /&gt; |     |--- hibernate-entitymanager.jar &lt;br /&gt; |     |  &lt;br /&gt; |     |--- hibernate-validator.jar &lt;br /&gt; |     |&lt;br /&gt; |     |--- hibernate-search.jar &lt;br /&gt; |     |&lt;br /&gt; |     |--- lucene-core-2.2.0.jar&lt;br /&gt; | &lt;br /&gt; |&lt;br /&gt; |--- MyApp.war&lt;br /&gt;&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;&lt;br/&gt;&lt;br /&gt;&lt;br /&gt;That's it! The upgrade itself is simple enough. Note that, in this article, i have used an EAR as an example, but this applies to WAR files too. In WAR files, the jars will be placed in the WEB-INF/lib folder and the classloader configuration will be done through the jboss-web.xml file which will be in WEB-INF folder.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/30587633-8396523203424873234?l=jaitechwriteups.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://jaitechwriteups.blogspot.com/feeds/8396523203424873234/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='https://www.blogger.com/comment.g?blogID=30587633&amp;postID=8396523203424873234' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/30587633/posts/default/8396523203424873234'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/30587633/posts/default/8396523203424873234'/><link rel='alternate' type='text/html' href='http://jaitechwriteups.blogspot.com/2008/08/how-to-upgrade-hibernate-in-jboss.html' title='How to upgrade Hibernate in JBoss'/><author><name>Jaikiran</name><uri>http://www.blogger.com/profile/08503182723143814781</uri><email>noreply@blogger.com</email><gd:extendedProperty xmlns:gd='http://schemas.google.com/g/2005' name='OpenSocialUserId' value='07020825996152190351'/></author><thr:total xmlns:thr='http://purl.org/syndication/thread/1.0'>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-30587633.post-7300413982975113399</id><published>2007-10-06T01:07:00.001-07:00</published><updated>2008-07-12T10:09:15.722-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Java'/><category scheme='http://www.blogger.com/atom/ns#' term='J2EE'/><category scheme='http://www.blogger.com/atom/ns#' term='JBoss'/><title type='text'>Why do i get NameNotFoundException while doing a JNDI lookup?</title><content type='html'>Many a times when you are doing a lookup in the JNDI tree, you see javax.naming.NameNotFoundException. A simple code that does the lookup will look something like:&lt;br /&gt;&lt;br /&gt;&lt;pre name="code" class="java"&gt;&lt;br /&gt;Context ctx = new InitialContext();&lt;br /&gt;Object obj = ctx.lookup("somepath/somename");&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;This code just looks up the JNDI tree to get an object bound by the name "somepath/somename". Looks simple. However, chances are that you might even see this exception:&lt;br /&gt;&lt;br /&gt;&lt;pre name="code" class="java"&gt;&lt;br /&gt;javax.naming.NameNotFoundException: &lt;b&gt;somepath&lt;/b&gt; not bound&lt;br /&gt; at org.jnp.server.NamingServer.getBinding(NamingServer.java:529)&lt;br /&gt; at org.jnp.server.NamingServer.getBinding(NamingServer.java:537)&lt;br /&gt; at org.jnp.server.NamingServer.getObject(NamingServer.java:543)&lt;br /&gt; at org.jnp.server.NamingServer.lookup(NamingServer.java:267)&lt;br /&gt; at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)&lt;br /&gt; at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)&lt;br /&gt; at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)&lt;br /&gt; at java.lang.reflect.Method.invoke(Method.java:585)&lt;br /&gt; at sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:294)&lt;br /&gt; at sun.rmi.transport.Transport$1.run(Transport.java:153)&lt;br /&gt; at java.security.AccessController.doPrivileged(Native Method)&lt;br /&gt; at sun.rmi.transport.Transport.serviceCall(Transport.java:149)&lt;br /&gt; at sun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.java:460)&lt;br /&gt; at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport.java:701)&lt;br /&gt; at java.lang.Thread.run(Thread.java:595)&lt;br /&gt; at sun.rmi.transport.StreamRemoteCall.exceptionReceivedFromServer(StreamRemoteCall.java:247)&lt;br /&gt; at sun.rmi.transport.StreamRemoteCall.executeCall(StreamRemoteCall.java:223)&lt;br /&gt; at sun.rmi.server.UnicastRef.invoke(UnicastRef.java:126)&lt;br /&gt; at org.jnp.server.NamingServer_Stub.lookup(Unknown Source)&lt;br /&gt; at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:625)&lt;br /&gt; at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:587)&lt;br /&gt; at javax.naming.InitialContext.lookup(InitialContext.java:351)&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;Look closely at the stacktrace. It shows that while looking up the JNDI tree it could not find the jndi name "somepath" (this name may vary). The reason is simple, the JNDI tree does not have any object bound by this name. &lt;br /&gt;&lt;br /&gt;To quote the javadocs of this exception "This exception is thrown when a component of the name cannot be resolved because it is not bound."&lt;br /&gt;&lt;br /&gt;So how do i know, what's the name to which my object is bound? Each application server, usually provides a JNDI view which can be used to see the contents of the JNDI tree. If you know what object you are looking for (ex: the name of the bean), then you can traverse this JNDI tree to see what name it is bound to. The JNDI view is specific to every application server.&lt;br /&gt;&lt;br /&gt;To give an example, JBoss provides its JDNI tree view, through the JMX console. Here are the steps, one has to follow to check the JNDI tree contents on JBoss:&lt;br /&gt;&lt;br /&gt;- Go to http://&lt; server&gt;:&lt; port&gt;/jmx-console (Ex: http://localhost:8080/jmx-console)&lt;br /&gt;- Search for service=JNDIView on the jmx-console page&lt;br /&gt;- Click on that link&lt;br /&gt;- On the page that comes up click on the &lt;i&gt;Invoke&lt;/i&gt; button beside the &lt;i&gt;list()&lt;/i&gt; method&lt;br /&gt;- The page that comes up will show the contents of the JNDI tree. &lt;br /&gt;&lt;br /&gt;Here's an sample of how the output looks like(just a small part of the entire output):&lt;br /&gt;&lt;br /&gt;&lt;pre name="code" class="xml"&gt;&lt;br /&gt;java: Namespace&lt;br /&gt;&lt;br /&gt;  +- XAConnectionFactory (class: org.jboss.mq.SpyXAConnectionFactory)&lt;br /&gt;  +- DefaultDS (class: org.jboss.resource.adapter.jdbc.WrapperDataSource)&lt;br /&gt;  +- SecurityProxyFactory (class: org.jboss.security.SubjectSecurityProxyFactory)&lt;br /&gt;  +- DefaultJMSProvider (class: org.jboss.jms.jndi.JNDIProviderAdapter)&lt;br /&gt;  +- comp (class: javax.naming.Context)&lt;br /&gt;  +- JmsXA (class: org.jboss.resource.adapter.jms.JmsConnectionFactoryImpl)&lt;br /&gt;  +- ConnectionFactory (class: org.jboss.mq.SpyConnectionFactory)&lt;br /&gt;  +- jaas (class: javax.naming.Context)&lt;br /&gt;  |   +- dukesbank (class: org.jboss.security.plugins.SecurityDomainContext)&lt;br /&gt;  |   +- HsqlDbRealm (class: org.jboss.security.plugins.SecurityDomainContext)&lt;br /&gt;  |   +- jbossmq (class: org.jboss.security.plugins.SecurityDomainContext)&lt;br /&gt;  |   +- JmsXARealm (class: org.jboss.security.plugins.SecurityDomainContext)&lt;br /&gt; &lt;br /&gt;&lt;br /&gt;Global JNDI Namespace&lt;br /&gt;&lt;br /&gt;  +- ebankTxController (proxy: $Proxy79 implements interface com.sun.ebank.ejb.tx.TxControllerHome,interface javax.ejb.Handle)&lt;br /&gt;  +- ebankAccountController (proxy: $Proxy75 implements interface com.sun.ebank.ejb.account.AccountControllerHome,interface javax.ejb.Handle)&lt;br /&gt;  +- TopicConnectionFactory (class: org.jboss.naming.LinkRefPair)&lt;br /&gt;  +- jmx (class: org.jnp.interfaces.NamingContext)&lt;br /&gt;  |   +- invoker (class: org.jnp.interfaces.NamingContext)&lt;br /&gt;  |   |   +- RMIAdaptor (proxy: $Proxy48 implements interface org.jboss.jmx.adaptor.rmi.RMIAdaptor,interface org.jboss.jmx.adaptor.rmi.RMIAdaptorExt)&lt;br /&gt;  |   +- rmi (class: org.jnp.interfaces.NamingContext)&lt;br /&gt;  |   |   +- RMIAdaptor[link -&gt; jmx/invoker/RMIAdaptor] (class: javax.naming.LinkRef)&lt;br /&gt;  +- HTTPXAConnectionFactory (class: org.jboss.mq.SpyXAConnectionFactory)&lt;br /&gt;  +- ConnectionFactory (class: org.jboss.mq.SpyConnectionFactory)&lt;br /&gt;  +- ebankCustomer (proxy: $Proxy67 implements interface com.sun.ebank.ejb.customer.LocalCustomerHome)&lt;br /&gt;  +- UserTransactionSessionFactory (proxy: $Proxy14 implements interface org.jboss.tm.usertx.interfaces.UserTransactionSessionFactory)&lt;br /&gt;  +- ebankCustomerController (proxy: $Proxy77 implements interface com.sun.ebank.ejb.customer.CustomerControllerHome,interface javax.ejb.Handle)&lt;br /&gt;  +- HTTPConnectionFactory (class: org.jboss.mq.SpyConnectionFactory)&lt;br /&gt;  +- XAConnectionFactory (class: org.jboss.mq.SpyXAConnectionFactory)&lt;br /&gt;  +- TransactionSynchronizationRegistry (class: com.arjuna.ats.internal.jta.transaction.arjunacore.TransactionSynchronizationRegistryImple)&lt;br /&gt;  +- ebankAccount (proxy: $Proxy68 implements interface com.sun.ebank.ejb.account.LocalAccountHome)&lt;br /&gt;  +- UserTransaction (class: org.jboss.tm.usertx.client.ClientUserTransaction)&lt;br /&gt;  +- UILXAConnectionFactory[link -&gt; XAConnectionFactory] (class: javax.naming.LinkRef)&lt;br /&gt;  +- UIL2XAConnectionFactory[link -&gt; XAConnectionFactory] (class: javax.naming.LinkRef)&lt;br /&gt;  +- queue (class: org.jnp.interfaces.NamingContext)&lt;br /&gt;  |   +- A (class: org.jboss.mq.SpyQueue)&lt;br /&gt;  |   +- testQueue (class: org.jboss.mq.SpyQueue)&lt;br /&gt;  |   +- ex (class: org.jboss.mq.SpyQueue)&lt;br /&gt;  |   +- DLQ (class: org.jboss.mq.SpyQueue)&lt;br /&gt;  |   +- D (class: org.jboss.mq.SpyQueue)&lt;br /&gt;  |   +- C (class: org.jboss.mq.SpyQueue)&lt;br /&gt;  |   +- B (class: org.jboss.mq.SpyQueue)&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;Let's see what this tells us. Let's consider the Global JNDI Namespace first. It contains (among other things) the following:&lt;br /&gt;&lt;pre name="code" class="xml"&gt;&lt;br /&gt;+- ebankTxController (proxy: $Proxy79 implements interface com.sun.ebank.ejb.tx.TxControllerHome,interface javax.ejb.Handle)&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;This tells me that an object which implements com.sun.ebank.ejb.tx.TxControllerHome and javax.ejb.Handle interfaces is bound to the JNDI tree by the jndi-name "ebankTxController". So if at all i have to lookup this object, my lookup code would be something like:&lt;br /&gt;&lt;br /&gt;&lt;pre name="code" class="java"&gt;&lt;br /&gt;Context ctx = new InitialContext();&lt;br /&gt;ctx.lookup("ebankTxController");&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;Similarly in the same Global JDNI Namespace, we see :&lt;br /&gt;&lt;br /&gt;&lt;pre name="code" class="xml"&gt;&lt;br /&gt;+- queue (class: org.jnp.interfaces.NamingContext)&lt;br /&gt;  |   +- A (class: org.jboss.mq.SpyQueue)&lt;br /&gt;  &lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;Make note of the nesting of the names here. This tells me that an object of type org.jboss.mq.SpyQueue is bound by the name "A under the path queue". So your lookup for this object should look like:&lt;br /&gt;&lt;br /&gt;&lt;pre name="code" class="java"&gt;&lt;br /&gt;Context ctx = new InitialContext();&lt;br /&gt;ctx.lookup("queue/A");&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;Now let's move on to the java: namespace in the JNDI tree view above. The difference between a Global JNDI namespace and the java: namespace is that, the object bound in the java: namespace can be looked-up ONLY by clients within the SAME JVM. Whereas, in case of Global JNDI namespace, the objects bound in this namespace can be looked-up by clients, even if they are not in the same JVM as the server. One would ask, how does this matter? Consider a standalone java program(client) which tries to lookup some object on the server (running in its own JVM). Whenever a standalone client is started (using the java command), a new JVM is instantiated. As a result, the server (which is started in its own JVM) and the client are running on different JVMs. Effectively, the client will NOT be able to lookup objects bound in the java: namespace of the server. However, the client can lookup the objects present in the Global JNDI namespace of the server.&lt;br /&gt;&lt;br /&gt;So, why are we discussing these details, in a topic which was meant to explain the NameNotFoundException? Let's consider the java: namespace output above. There's a &lt;br /&gt;&lt;br /&gt;&lt;pre name="code" class="xml"&gt;&lt;br /&gt;+- DefaultDS (class: org.jboss.resource.adapter.jdbc.WrapperDataSource)&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;This tells me that there's an object bound to the name DefaultDS in the java: namespace. So my lookup code would be:&lt;br /&gt;&lt;br /&gt;&lt;pre name="code" class="java"&gt;&lt;br /&gt;Context ctx = new InitialContext();&lt;br /&gt;ctx.lookup("java:/DefaultDS");&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;As explained above, this code is going to return you the object, if this piece of code runs in the same JVM as the server. However, if this piece of code is run from a client in different JVM (maybe a standalone client), then it's going to run into NameNotFoundException. The reason i explained the java: and the Global JNDI namespace is that, sometimes people are surprised that even though the JNDI view shows that the object is bound in the java: namespace(with the same name as the one they pass to the lookup method), they still run into NameNotFoundException. The probable reason might be, the client is in a different JVM.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/30587633-7300413982975113399?l=jaitechwriteups.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://jaitechwriteups.blogspot.com/feeds/7300413982975113399/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='https://www.blogger.com/comment.g?blogID=30587633&amp;postID=7300413982975113399' title='30 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/30587633/posts/default/7300413982975113399'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/30587633/posts/default/7300413982975113399'/><link rel='alternate' type='text/html' href='http://jaitechwriteups.blogspot.com/2007/10/why-do-i-get-namenotfoundexception.html' title='Why do i get NameNotFoundException while doing a JNDI lookup?'/><author><name>Jaikiran</name><uri>http://www.blogger.com/profile/08503182723143814781</uri><email>noreply@blogger.com</email><gd:extendedProperty xmlns:gd='http://schemas.google.com/g/2005' name='OpenSocialUserId' value='07020825996152190351'/></author><thr:total xmlns:thr='http://purl.org/syndication/thread/1.0'>30</thr:total></entry><entry><id>tag:blogger.com,1999:blog-30587633.post-961658827782776693</id><published>2008-04-19T03:50:00.000-07:00</published><updated>2008-07-12T10:07:15.885-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Log4j'/><category scheme='http://www.blogger.com/atom/ns#' term='JBoss'/><title type='text'>How do i use my own log4j properties or xml file in JBoss</title><content type='html'>This article is mainly for those who had a hard time configuring "their own" log4j.properties or log4j.xml within their application on JBoss. For a brief background on this, please read through this &lt;a href="http://wiki.jboss.org/wiki/ScopedLoggingConfig"&gt;JBoss wiki&lt;/a&gt;. As explained in that wiki, JBoss uses its own version of log4j.xml and log4j jar, making it difficult to use your own version of the log4j properties/xml files. The wiki also lists down the steps required to configure your application to use its own log4j config file. However, i have seen people complain in the forums that those steps either dont work for them or the steps are too involved and not worth a try.&lt;br /&gt;&lt;br /&gt;People at JBoss had taken note of these issues (see the &lt;a href="http://jira.jboss.org/jira/browse/JBAS-1853"&gt;related JIRA&lt;/a&gt;) and starting JBoss-4.2.x, the steps involved to configure your own log4j config file in JBoss are pretty simple and straight-forward. In this example, i will try to explain these steps for a EAR file as well as a WAR file. The version that i am using here is JBoss-4.2.2GA (which is the latest stable version at this point). In the examples here, i use a log4j.properties file. The steps are the same even for a log4j.xml.&lt;br /&gt;&lt;br /&gt;So here's what is required to get it working in a EAR file:&lt;br /&gt;&lt;br /&gt;1) Create a log4j.properties and package it with your application and make it available in the classpath (i placed the log4j.properties file at the root of the EAR file). &lt;br /&gt;&lt;br /&gt;2) Also package the appropriate version of log4j jar with your application (this step and the next step are important because you will have to ensure that log4j initializes separately for your application and picks up the log4j.properties file). Place this log4j jar file in the application package so that it is made available in the classpath (i placed it in a folder named lib of the EAR file - remember that any jars in the lib folder of the EAR are by default added to the classpath and made available to the entire application, starting JBoss-4.2.x version).&lt;br /&gt;&lt;br /&gt;3) Enable classloader isolation for your application. This is necessary as explained in step#2. You will have to create a jboss-app.xml file and place it in the META-INF folder of the EAR. The jboss-app.xml looks like:&lt;br /&gt;&lt;br /&gt;&lt;pre name="code" class="xml"&gt;&lt;br /&gt;&amp;lt;jboss-app&amp;gt;&lt;br /&gt; &amp;lt;loader-repository&amp;gt;&lt;br /&gt;   org.myapp:loader=MyClassLoader&lt;br /&gt;   &amp;lt;loader-repository-config&amp;gt;&lt;br /&gt;      java2ParentDelegation=false&lt;br /&gt;   &amp;lt;/loader-repository-config&amp;gt;&lt;br /&gt; &amp;lt;/loader-repository&amp;gt;&lt;br /&gt;   &lt;br /&gt;&amp;lt;/jboss-app&amp;gt; &lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br/&gt;&lt;br /&gt;&lt;br /&gt;This is how the EAR file would look like:&lt;br /&gt;&lt;br /&gt;&lt;pre name="code" class="xml"&gt;&lt;br /&gt;&lt;br /&gt;myApp.ear&lt;br /&gt;  |&lt;br /&gt;  |--- log4j.properties&lt;br /&gt;  |&lt;br /&gt;  |--- META-INF&lt;br /&gt;  |     |&lt;br /&gt;  |     |--- application.xml&lt;br /&gt;  |     |&lt;br /&gt;  |     |--- jboss-app.xml&lt;br /&gt;  |&lt;br /&gt;  |--- lib&lt;br /&gt;  |     |&lt;br /&gt;  |     |--- log4jxxx.jar &lt;br /&gt;&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;&lt;br/&gt;&lt;br /&gt;&lt;br /&gt;That's it! Your application now will use it own version of log4j config file as well log4j jar.&lt;br /&gt;&lt;br /&gt;Steps involved for a WAR file are similar (If the WAR file is part of an EAR file, then you don't have to follow the steps below. The steps mentioned above for an EAR file are sufficient for a WAR inside an EAR):&lt;br /&gt;&lt;br /&gt;1) Create a log4j.properties and package it with your application and make it available in the classpath (i placed the log4j.properties file in the WEB-INF/classes folder of the WAR).&lt;br /&gt;&lt;br /&gt;2) Also package the appropriate version of log4j jar with your application (this step and the next step are important because you will have to ensure that log4j initializes separately for your application and picks up the log4j.properties file). Place this log4j jar file in the application package so that it is made available in the classpath (i placed it in a WEB-INF/lib of the WAR file).&lt;br /&gt;&lt;br /&gt;3) Enable classloader isolation for your application. This is necessary as explained in step#2. You will have to create a jboss-web.xml file and place it in the WEB-INF folder of the WAR. The jboss-web.xml looks like:&lt;br /&gt;&lt;br /&gt;&lt;pre name="code" class="xml"&gt;&lt;br /&gt;&lt;br /&gt;&amp;lt;jboss-web&amp;gt;&lt;br /&gt;    &amp;lt;class-loading java2ClassLoadingCompliance="false"&amp;gt;&lt;br /&gt; &amp;lt;loader-repository&amp;gt;&lt;br /&gt; org.myapp:loader=MyClassLoader&lt;br /&gt; &amp;lt;loader-repository-config&amp;gt;java2ParentDelegation=false&amp;lt;/loader-repository-config&amp;gt;&lt;br /&gt; &amp;lt;/loader-repository&amp;gt;&lt;br /&gt; &amp;lt;/class-loading&amp;gt;&lt;br /&gt;&amp;lt;/jboss-web&amp;gt;  &lt;br /&gt;&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br/&gt;&lt;br /&gt;&lt;br /&gt;This is how the WAR file would look like:&lt;br /&gt;&lt;br /&gt;&lt;pre name="code" class="xml"&gt;&lt;br /&gt;myApp.war&lt;br /&gt;  |&lt;br /&gt;  |--- WEB-INF&lt;br /&gt;  |     |&lt;br /&gt;  |     |--- web.xml&lt;br /&gt;  |     |&lt;br /&gt;  |     |--- jboss-web.xml&lt;br /&gt;  |     |&lt;br /&gt;  |     |--- classes&lt;br /&gt;  |     |     |&lt;br /&gt;  |     |     |--- log4j.properties&lt;br /&gt;  | &lt;br /&gt;  |&lt;br /&gt;  |--- lib&lt;br /&gt;  |     |&lt;br /&gt;  |     |--- log4jxxx.jar &lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br/&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/30587633-961658827782776693?l=jaitechwriteups.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://jaitechwriteups.blogspot.com/feeds/961658827782776693/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='https://www.blogger.com/comment.g?blogID=30587633&amp;postID=961658827782776693' title='10 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/30587633/posts/default/961658827782776693'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/30587633/posts/default/961658827782776693'/><link rel='alternate' type='text/html' href='http://jaitechwriteups.blogspot.com/2008/04/how-do-i-use-my-own-log4j-properties-or.html' title='How do i use my own log4j properties or xml file in JBoss'/><author><name>Jaikiran</name><uri>http://www.blogger.com/profile/08503182723143814781</uri><email>noreply@blogger.com</email><gd:extendedProperty xmlns:gd='http://schemas.google.com/g/2005' name='OpenSocialUserId' value='07020825996152190351'/></author><thr:total xmlns:thr='http://purl.org/syndication/thread/1.0'>10</thr:total></entry><entry><id>tag:blogger.com,1999:blog-30587633.post-115200247714809892</id><published>2006-07-04T01:10:00.000-07:00</published><updated>2008-07-12T09:50:06.594-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='EJB'/><category scheme='http://www.blogger.com/atom/ns#' term='J2EE'/><category scheme='http://www.blogger.com/atom/ns#' term='JAAS'/><title type='text'>Accessing a secure EJB through a standalone java client</title><content type='html'>&lt;span style="font-family:georgia;font-size:85%;"&gt;To access a secure resource(may be a EJB), from a standalone client, you need to do a JAAS login. Here's an simple example which shows how to implement the same. But before going to the example, here's the reason why we need to do a login. Consider a secured EJB "MyTestEJB", deployed on a app server. The normal proceedure that you follow in a web-application to lookup the EJB and invoke a method on the same is as follows:&lt;/span&gt;&lt;br /&gt;&lt;pre name="code" class="java"&gt;&lt;br /&gt;Context context = new InitialContext(); &lt;br /&gt;//lookup the home object &lt;br /&gt;Object lookupObj = context.lookup("MyTestEJBHomeJndiName"); &lt;br /&gt;MyTestEJBHome home = (MyTestEJBHome) PortableRemoteObject.narrow(lookupObj, MyTestEJBHome.class); &lt;br /&gt;//create the bean object from the home object &lt;br /&gt;MyTestEJB myBean = home.create(); &lt;br /&gt;//invoke the method on the bean &lt;br /&gt;myBean.someMethod(); &lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:georgia;font-size:85%;"&gt;In the steps above, when the method create is called on the home object, the app server internally checks whether the user who is doing this operation, is authenticated and authorised to do the same. If not, it will throw a SecurityException. The above statements will usually work in a web-application where usually you have a login page to carry out the login process.&lt;br /&gt;&lt;br /&gt;Now, consider the case with a standalone java client which has just got a main method and which needs to invoke the secure bean. The application server will have no knowledge about which user is trying to do the operations on the bean(is he authenticated or authorised?). This is the reason why the standalone client needs to do a JAAS login, to let the application server know which user is trying to do the operation on the bean. Now lets look at the code for doing the same. Here we have a standalone java client with a main() method:&lt;/span&gt;&lt;br /&gt;&lt;pre name="code" class="java"&gt;&lt;br /&gt;package myapp;&lt;br /&gt;&lt;br /&gt;import javax.ejb.CreateException;&lt;br /&gt;import javax.naming.Context;&lt;br /&gt;import javax.naming.InitialContext;&lt;br /&gt;import javax.naming.NamingException;&lt;br /&gt;import javax.rmi.PortableRemoteObject;&lt;br /&gt;import javax.security.auth.login.LoginContext;&lt;br /&gt;import javax.security.auth.login.LoginException;&lt;br /&gt;import java.io.Serializable;&lt;br /&gt;import java.rmi.RemoteException;&lt;br /&gt;&lt;br /&gt;/**&lt;br /&gt; *&lt;br /&gt; * Stand-alone client invoking a method on a secure EJB&lt;br /&gt; *&lt;br /&gt; */&lt;br /&gt;public final class SomeStandAloneClient {&lt;br /&gt;&lt;br /&gt;&lt;br /&gt; /**&lt;br /&gt;  * Default constructor&lt;br /&gt;  *&lt;br /&gt;  */&lt;br /&gt; public SomeStandAloneClient() {&lt;br /&gt;&lt;br /&gt; }&lt;br /&gt;&lt;br /&gt; /**&lt;br /&gt;  * Main method&lt;br /&gt;  *&lt;br /&gt;  * @param args Command line arguments&lt;br /&gt;  */&lt;br /&gt; public static void main(String[] args) {&lt;br /&gt;&lt;br /&gt;  //obtain the username and password which are passed as part of command line arguments&lt;br /&gt;  String userName = args[0];&lt;br /&gt;  String password = args[1];&lt;br /&gt;&lt;br /&gt;  System.out.println("Logging in user: " + userName);&lt;br /&gt;&lt;br /&gt;  /*&lt;br /&gt;   * The name of the file which will contain the login configurations&lt;br /&gt;   */&lt;br /&gt;  final String authFile = "someFilename.someExtension";&lt;br /&gt;&lt;br /&gt;  /*&lt;br /&gt;   * Set the filename above, as part of system property, so that while doing a login,&lt;br /&gt;   * this file will be used to check the login configurations&lt;br /&gt;   */&lt;br /&gt;  System.setProperty("java.security.auth.login.config", authFile);&lt;br /&gt;&lt;br /&gt;  /*&lt;br /&gt;   * During the login process(i.e. when the login() method on the LoginContext is called),&lt;br /&gt;   * the control will be transferred to a CallbackHandler. The CallbackHandler will be&lt;br /&gt;   * responsible for populating the Callback object with the username and password, which&lt;br /&gt;   * will be later on used by the login process&lt;br /&gt;   *&lt;br /&gt;   * The "MyCallbackHandler" is your own class and you can give any name to it. MyCallbackHandler&lt;br /&gt;   * expects the username and password to be passed through its constructor, but this is NOT&lt;br /&gt;   * mandatory when you are writing your own callback handler.&lt;br /&gt;   *&lt;br /&gt;   *&lt;br /&gt;   */&lt;br /&gt;  MyCallbackHandler handler = new MyCallbackHandler(userName,password);&lt;br /&gt;&lt;br /&gt;  try {&lt;br /&gt;&lt;br /&gt;   /*&lt;br /&gt;    * Create a login context. Here, as the first parameter, you will specify which&lt;br /&gt;    * configuration(mentioned in the "authFile" above) will be used. Here we are specifying&lt;br /&gt;    * "someXYZLogin" as the configuration to be used. Note: This has to match the configuration&lt;br /&gt;    * specified in the someFilename.someExtension authFile above.&lt;br /&gt;    * The login context expects a CallbackHandler as the second parameter. Here we are specifying&lt;br /&gt;    * the instance of MyCallbackHandler created earlier. The "handle()" method of this handler&lt;br /&gt;    * will be called during the login process.&lt;br /&gt;    */&lt;br /&gt;   LoginContext lc = new LoginContext("someXYZLogin",handler);&lt;br /&gt;&lt;br /&gt;   /*&lt;br /&gt;    * Do the login&lt;br /&gt;    */&lt;br /&gt;   lc.login();&lt;br /&gt;&lt;br /&gt;   System.out.println("Successfully logged in user: " + userName);&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;  } catch (LoginException le) {&lt;br /&gt;&lt;br /&gt;   System.out.println("Login failed");&lt;br /&gt;   le.printStackTrace();&lt;br /&gt;   return;&lt;br /&gt;  }&lt;br /&gt;&lt;br /&gt;  try{&lt;br /&gt;&lt;br /&gt;   /*&lt;br /&gt;    * Now that the user has logged in, invoke the method on the EJB&lt;br /&gt;    */&lt;br /&gt;&lt;br /&gt;   Context context = new InitialContext();&lt;br /&gt;&lt;br /&gt;   //lookup the home object&lt;br /&gt;   Object lookupObj = context.lookup("MyTestEJBHomeJndiName");&lt;br /&gt;   MyTestEJBHome home = (MyTestEJBHome) PortableRemoteObject.narrow(lookupObj, MyTestEJBHome.class);&lt;br /&gt;&lt;br /&gt;   //create the bean object from the home object&lt;br /&gt;   MyTestEJB myBean = home.create();&lt;br /&gt;&lt;br /&gt;   //invoke the method on the bean&lt;br /&gt;   myBean.someMethod();&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;  } catch (RemoteException re) {&lt;br /&gt;&lt;br /&gt;   System.out.println("Remote exception: ");&lt;br /&gt;   re.printStackTrace();&lt;br /&gt;   return;&lt;br /&gt; &lt;br /&gt;  } catch (NamingException ne) {&lt;br /&gt;&lt;br /&gt;   System.out.println("NamingException: ");&lt;br /&gt;   ne.printStackTrace();&lt;br /&gt;   return;&lt;br /&gt; &lt;br /&gt;  } catch (CreateException ce) {&lt;br /&gt; &lt;br /&gt;   System.out.println("CreateException: ");&lt;br /&gt;   ce.printStackTrace();&lt;br /&gt;   return;&lt;br /&gt;  }&lt;br /&gt;&lt;br /&gt;&lt;br /&gt; } //end of main()&lt;br /&gt;&lt;br /&gt;} //end of SomeStandAloneClient&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;span style="font-family:georgia;font-size:85%;"&gt;Now the CallbackHandler:&lt;/span&gt;&lt;br /&gt;&lt;pre name="code" class="java"&gt;&lt;br /&gt;package myapp;&lt;br /&gt;&lt;br /&gt;import java.io.IOException;&lt;br /&gt;&lt;br /&gt;import javax.security.auth.callback.Callback;&lt;br /&gt;import javax.security.auth.callback.CallbackHandler;&lt;br /&gt;import javax.security.auth.callback.NameCallback;&lt;br /&gt;import javax.security.auth.callback.PasswordCallback;&lt;br /&gt;import javax.security.auth.callback.UnsupportedCallbackException;&lt;br /&gt;&lt;br /&gt;/**&lt;br /&gt; *&lt;br /&gt; * CallbackHandler which will be invoked by the login module during the login&lt;br /&gt; * process of the client. This is a simple CallbackHandler which sets the username&lt;br /&gt; * and password, which will be later used by the Login module for authorizing the&lt;br /&gt; * subject. This class only handles NameCallback and PasswordCallback. It throws&lt;br /&gt; * an UnsupportedCallbackException, if the Callback is other than the two mentioned&lt;br /&gt; * above.&lt;br /&gt; * The username and password are provided as input to this class through its constructor.&lt;br /&gt; *&lt;br /&gt; *&lt;br /&gt; */&lt;br /&gt;public class MyCallbackHandler implements CallbackHandler {&lt;br /&gt;&lt;br /&gt; /**&lt;br /&gt;  * Username which will be set in the NameCallback, when NameCallback is handled&lt;br /&gt;  */&lt;br /&gt; private String username;&lt;br /&gt;&lt;br /&gt; /**&lt;br /&gt;  * Password which will be set in the PasswordCallback, when PasswordCallback is handled&lt;br /&gt;  */&lt;br /&gt; private String password;&lt;br /&gt;&lt;br /&gt; /**&lt;br /&gt;  * Constructor&lt;br /&gt;  * @param username The username&lt;br /&gt;  * @param password The password&lt;br /&gt;  */&lt;br /&gt; public MyCallbackHandler(String username, String password) {&lt;br /&gt;  this.username = username;&lt;br /&gt;  this.password = password;&lt;br /&gt; }&lt;br /&gt;&lt;br /&gt; /** &lt;br /&gt;  * @param callbacks Instances of Callbacks &lt;br /&gt;  * @throws IOException IOException &lt;br /&gt;  * @throws UnsupportedCallbackException If Callback is other than NameCallback or PasswordCallback &lt;br /&gt;  */ &lt;br /&gt; public void handle(Callback callbacks[]) throws IOException, UnsupportedCallbackException {&lt;br /&gt;&lt;br /&gt;  for(int i = 0; i &lt; callbacks.length; i++) {&lt;br /&gt;      if(callbacks[i] instanceof NameCallback) {&lt;br /&gt;   NameCallback nc = (NameCallback)callbacks[i];&lt;br /&gt;   nc.setName(username);&lt;br /&gt;      } else if(callbacks[i] instanceof PasswordCallback) {&lt;br /&gt;   PasswordCallback pc = (PasswordCallback)callbacks[i];&lt;br /&gt;   pc.setPassword(password.toCharArray());&lt;br /&gt;      } else {&lt;br /&gt;   throw new UnsupportedCallbackException(callbacks[i], "Unrecognized Callback");&lt;br /&gt;      }&lt;br /&gt;&lt;br /&gt;  }&lt;br /&gt; }&lt;br /&gt;}&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;span style="font-family:georgia;font-size:85%;"&gt;The file containing the login configuration(in our case "someFilename.someExtension"):&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:georgia;font-size:85%;color:#660000;"&gt;someXYZLogin{&lt;br /&gt;org.jboss.security.ClientLoginModule required;&lt;br /&gt;};&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:georgia;font-size:85%;"&gt;Remember, the someXYZLogin configuration name is the same that i provided to the constructor of the LoginContext. The contents of the above file let the LoginContext know, which class will be actually responsible for doing the login. In this case, since i am using jboss, we have specified "org.jboss.security.ClientLoginModule" as the class.&lt;br /&gt;&lt;br /&gt;Please make sure that the login configuration file is under the same directory from where you will be running your client.&lt;br /&gt;&lt;br /&gt;The command to run your client is the same that you would use to run a normal java class:&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:georgia;font-size:85%;color:#660000;"&gt;java SomeStandAloneClient someUsername somePassword&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:georgia;font-size:85%;"&gt;The someUsername and somePassword will be the arguments that you will pass to the main() method.&lt;br /&gt;&lt;br /&gt;This is just a simple example. Internally, there are a lot of things, that go on as part of login. The following link has a great explanation about the same(JAAS related things are explained starting from the "An Introduction to JAAS" section in that article). I highly recommend, to go through it atleast once:&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;a href="http://www.huihoo.com/jboss/online_manual/3.2.3/Chap8.html"&gt;&lt;span style="font-family:georgia;font-size:85%;"&gt;Article on Security&lt;/span&gt;&lt;/a&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="font-family:georgia;font-size:85%;color:#660000;"&gt;&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/30587633-115200247714809892?l=jaitechwriteups.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://jaitechwriteups.blogspot.com/feeds/115200247714809892/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='https://www.blogger.com/comment.g?blogID=30587633&amp;postID=115200247714809892' title='11 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/30587633/posts/default/115200247714809892'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/30587633/posts/default/115200247714809892'/><link rel='alternate' type='text/html' href='http://jaitechwriteups.blogspot.com/2006/07/accessing-secure-ejb-through.html' title='Accessing a secure EJB through a standalone java client'/><author><name>Jaikiran</name><uri>http://www.blogger.com/profile/08503182723143814781</uri><email>noreply@blogger.com</email><gd:extendedProperty xmlns:gd='http://schemas.google.com/g/2005' name='OpenSocialUserId' value='07020825996152190351'/></author><thr:total xmlns:thr='http://purl.org/syndication/thread/1.0'>11</thr:total></entry><entry><id>tag:blogger.com,1999:blog-30587633.post-115270337772667612</id><published>2006-07-12T02:22:00.000-07:00</published><updated>2008-07-12T09:48:43.897-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Log4j'/><title type='text'>Create your own logging level in log4j</title><content type='html'>&lt;span&gt;&lt;br /&gt;If you need to add your own logging level in log4j, then you can do it as follows. You will have to create your own class which will extend from Level. Here's a sample code for the same: &lt;br /&gt;&lt;br /&gt;MyTraceLevel.java: &lt;br /&gt;&lt;pre name="code" class="java"&gt;&lt;br /&gt;package org.myapp.log;&lt;br /&gt;&lt;br /&gt;import org.apache.log4j.Level;&lt;br /&gt;/**&lt;br /&gt; * My own {@link org.apache.log4j.Level} for logging. &lt;br /&gt; * &lt;br /&gt; * @author Jaikiran Pai &lt;br /&gt; * &lt;br /&gt; */ &lt;br /&gt;public class MyTraceLevel extends Level { &lt;br /&gt;&lt;br /&gt; /** &lt;br /&gt;  * Value of my trace level. This value is lesser than &lt;br /&gt;  * {@link org.apache.log4j.Priority#DEBUG_INT} &lt;br /&gt;  * and higher than {@link org.apache.log4j.Level#TRACE_INT} &lt;br /&gt;  */ &lt;br /&gt; public static final int MY_TRACE_INT = DEBUG_INT - 10; &lt;br /&gt; &lt;br /&gt; /** &lt;br /&gt;  * {@link Level} representing my log level &lt;br /&gt;  */ &lt;br /&gt; public static final Level MY_TRACE = new MyTraceLevel(MY_TRACE_INT,"MY_TRACE",7);&lt;br /&gt;&lt;br /&gt;     /**&lt;br /&gt;       * Constructor&lt;br /&gt;        *&lt;br /&gt;       * @param arg0&lt;br /&gt;       * @param arg1&lt;br /&gt;       * @param arg2&lt;br /&gt;        */&lt;br /&gt;     protected MyTraceLevel(int arg0, String arg1, int arg2) {&lt;br /&gt;         super(arg0, arg1, arg2);&lt;br /&gt;&lt;br /&gt;     }&lt;br /&gt;&lt;br /&gt;     /**&lt;br /&gt;      * Checks whether sArg is "MY_TRACE" level. If yes then returns &lt;br /&gt;      * {@link MyTraceLevel#MY_TRACE}, else calls &lt;br /&gt;      * {@link MyTraceLevel#toLevel(String, Level)} passing it &lt;br /&gt;      * {@link Level#DEBUG} as the defaultLevel.&lt;br /&gt;       *&lt;br /&gt;       * @see Level#toLevel(java.lang.String)&lt;br /&gt;       * @see Level#toLevel(java.lang.String, org.apache.log4j.Level)&lt;br /&gt;       *&lt;br /&gt;       */&lt;br /&gt;     public static Level toLevel(String sArg) {&lt;br /&gt;         if (sArg != null &amp;&amp; sArg.toUpperCase().equals("MY_TRACE")) {&lt;br /&gt;             return MY_TRACE;&lt;br /&gt;         }&lt;br /&gt;         return (Level) toLevel(sArg, Level.DEBUG);&lt;br /&gt;     }&lt;br /&gt;&lt;br /&gt;     /**&lt;br /&gt;      * Checks whether val is {@link MyTraceLevel#MY_TRACE_INT}. &lt;br /&gt;  * If yes then returns {@link MyTraceLevel#MY_TRACE}, else calls &lt;br /&gt;  * {@link MyTraceLevel#toLevel(int, Level)} passing it {@link Level#DEBUG}&lt;br /&gt;  * as the defaultLevel&lt;br /&gt;  *&lt;br /&gt;       * @see Level#toLevel(int)&lt;br /&gt;       * @see Level#toLevel(int, org.apache.log4j.Level)&lt;br /&gt;       *&lt;br /&gt;       */&lt;br /&gt;     public static Level toLevel(int val) {&lt;br /&gt;         if (val == MY_TRACE_INT) {&lt;br /&gt;             return MY_TRACE;&lt;br /&gt;         }&lt;br /&gt;         return (Level) toLevel(val, Level.DEBUG);&lt;br /&gt;     }&lt;br /&gt;&lt;br /&gt;     /**&lt;br /&gt;      * Checks whether val is {@link MyTraceLevel#MY_TRACE_INT}. &lt;br /&gt;      * If yes then returns {@link MyTraceLevel#MY_TRACE},&lt;br /&gt;      * else calls {@link Level#toLevel(int, org.apache.log4j.Level)}&lt;br /&gt;      *&lt;br /&gt;      * @see Level#toLevel(int, org.apache.log4j.Level)&lt;br /&gt;      */&lt;br /&gt;     public static Level toLevel(int val, Level defaultLevel) {&lt;br /&gt;         if (val == MY_TRACE_INT) {&lt;br /&gt;             return MY_TRACE;&lt;br /&gt;         }&lt;br /&gt;         return Level.toLevel(val,defaultLevel);&lt;br /&gt;     }&lt;br /&gt;&lt;br /&gt;     /**&lt;br /&gt;      * Checks whether sArg is "MY_TRACE" level. &lt;br /&gt;  * If yes then returns {@link MyTraceLevel#MY_TRACE}, else calls&lt;br /&gt;  * {@link Level#toLevel(java.lang.String, org.apache.log4j.Level)}&lt;br /&gt;  *&lt;br /&gt;  * @see Level#toLevel(java.lang.String, org.apache.log4j.Level)&lt;br /&gt;  */&lt;br /&gt; public static Level toLevel(String sArg, Level defaultLevel) {     &lt;br /&gt;        if(sArg != null &amp;&amp; sArg.toUpperCase().equals("MY_TRACE")) {&lt;br /&gt;            return MY_TRACE;&lt;br /&gt;        }&lt;br /&gt;        return Level.toLevel(sArg,defaultLevel);&lt;br /&gt; }&lt;br /&gt;}&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;Now, you will have to configure your log4j.xml: &lt;br /&gt;&lt;pre name="code" class="xml"&gt;&lt;br /&gt;&amp;lt;?xml version="1.0" encoding="UTF-8"?&amp;gt;&lt;br /&gt;&amp;lt;!DOCTYPE log4j:configuration SYSTEM "log4j.dtd"&amp;gt; &lt;br /&gt;&amp;lt;log4j:configuration xmlns:log4j="http://jakarta.apache.org/log4j/"debug="false"&amp;gt; &lt;br /&gt;&amp;lt;!-- ================================= --&amp;gt; &lt;br /&gt;&amp;lt;!-- Preserve messages in a local file --&amp;gt; &lt;br /&gt;&amp;lt;!-- ================================= --&amp;gt; &lt;br /&gt;&amp;lt;!-- A size based rolling appender --&amp;gt; &lt;br /&gt;&amp;lt;appender name="FILE" class="org.apache.log4j.FileAppender"&amp;gt; &lt;br /&gt;&amp;lt;param name="File" value="D:/log/myLogFile.log"/&amp;gt; &lt;br /&gt;&amp;lt;param name="Append" value="false"/&amp;gt; &lt;br /&gt;&amp;lt;layout class="org.apache.log4j.PatternLayout"&amp;gt; &lt;br /&gt;&amp;lt;param name="ConversionPattern" value="%d{ISO8601} %-5p [%c] %m%n"/&amp;gt; &lt;br /&gt;&amp;lt;/layout&amp;gt; &lt;br /&gt;&amp;lt;/appender&amp;gt; &lt;br /&gt;&amp;lt;!-- ============================== --&amp;gt; &lt;br /&gt;&amp;lt;!-- Append messages to the console --&amp;gt; &lt;br /&gt;&amp;lt;!-- ============================== --&amp;gt; &lt;br /&gt;&amp;lt;appender name="CONSOLE" class="org.apache.log4j.ConsoleAppender"&amp;gt; &lt;br /&gt;&amp;lt;param name="Target" value="System.out"/&amp;gt; &lt;br /&gt;&amp;lt;param name="Threshold" value="INFO"/&amp;gt; &lt;br /&gt;&amp;lt;layout class="org.apache.log4j.PatternLayout"&amp;gt; &lt;br /&gt;&amp;lt;!-- The default pattern: Date Priority [Category] Message\n --&amp;gt; &lt;br /&gt;&amp;lt;param name="ConversionPattern" value="%d{ISO8601} %-5p [%c{1}] %m%n"/&amp;gt; &lt;br /&gt;&amp;lt;/layout&amp;gt; &lt;br /&gt;&amp;lt;/appender&amp;gt; &lt;br /&gt;&amp;lt;!-- ================ --&amp;gt; &lt;br /&gt;&amp;lt;!-- Limit categories --&amp;gt; &lt;br /&gt;&amp;lt;!-- ================ --&amp;gt; &lt;br /&gt;&amp;lt;category name="org.myapp"&amp;gt; &lt;br /&gt;&amp;lt;priority value="MY_TRACE" class="org.myapp.log.MyTraceLevel" /&amp;gt; &lt;br /&gt;&amp;lt;appender-ref ref="FILE"/&amp;gt; &lt;br /&gt;&amp;lt;/category&amp;gt; &lt;br /&gt;&amp;lt;!-- ======================= --&amp;gt; &lt;br /&gt;&amp;lt;!-- Setup the Root category --&amp;gt; &lt;br /&gt;&amp;lt;!-- ======================= --&amp;gt; &lt;br /&gt;&amp;lt;root&amp;gt; &lt;br /&gt;&amp;lt;appender-ref ref="CONSOLE"/&amp;gt; &lt;br /&gt;&amp;lt;/root&amp;gt; &lt;br /&gt;&amp;lt;/log4j:configuration&amp;gt; &lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;Here's a test program which can be used for testing whether the new log level that you introduced is being identified or not: &lt;br /&gt;&lt;br /&gt;TestMyLogLevel.java:&lt;br /&gt;&lt;pre name="code" class="java"&gt;&lt;br /&gt;package org.myapp.core; &lt;br /&gt;&lt;br /&gt;import org.apache.log4j.Level; &lt;br /&gt;import org.apache.log4j.Logger; &lt;br /&gt;import org.myapp.log.MyTraceLevel; &lt;br /&gt;&lt;br /&gt;/** &lt;br /&gt; * Tests whether the new log level {@link org.myapp.log.MyTraceLevel#MY_TRACE} &lt;br /&gt; * is working &lt;br /&gt; * &lt;br /&gt; * @author Jaikiran Pai &lt;br /&gt; * &lt;br /&gt; */ &lt;br /&gt;public class TestMyLogLevel { &lt;br /&gt;&lt;br /&gt; /** &lt;br /&gt;  * Writes a log message with {@link org.myapp.log.MyTraceLevel#MY_TRACE} &lt;br /&gt;  * and another message with {@link Level#DEBUG}&lt;br /&gt;       *&lt;br /&gt;       * @param args&lt;br /&gt;       */&lt;br /&gt; public static void main(String[] args) {&lt;br /&gt;  Logger logger = Logger.getLogger(TestMyLogLevel.class);&lt;br /&gt;  logger.log(MyTraceLevel.MY_TRACE,"I am MY_TRACE log");&lt;br /&gt;  logger.log(Level.DEBUG ,"I am a debug message");&lt;br /&gt; }&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;Finally, here's the log file that got generated: &lt;br /&gt;&lt;pre name="code" class="java"&gt;&lt;br /&gt;2006-07-12 13:45:40,633 MY_TRACE [org.myapp.core.TestMyLogLevel] I am MY_TRACE log &lt;br /&gt;2006-07-12 13:45:40,633 DEBUG [org.myapp.core.TestMyLogLevel] I am a debug message &lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;Points to note: &lt;br /&gt;&lt;br /&gt;- The int value that you specify for your log level is important. Here i have defined "MY_TRACE" log level is to be higher than the DEBUG level but lower than the TRACE level provided by log4j. So whenever you have set a priority level to DEBUG on the category(in your log4j.xml file), the MY_TRACE level logs will *NOT* make it to the log file. &lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/30587633-115270337772667612?l=jaitechwriteups.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://jaitechwriteups.blogspot.com/feeds/115270337772667612/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='https://www.blogger.com/comment.g?blogID=30587633&amp;postID=115270337772667612' title='3 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/30587633/posts/default/115270337772667612'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/30587633/posts/default/115270337772667612'/><link rel='alternate' type='text/html' href='http://jaitechwriteups.blogspot.com/2006/07/create-your-own-logging-level-in-log4j.html' title='Create your own logging level in log4j'/><author><name>Jaikiran</name><uri>http://www.blogger.com/profile/08503182723143814781</uri><email>noreply@blogger.com</email><gd:extendedProperty xmlns:gd='http://schemas.google.com/g/2005' name='OpenSocialUserId' value='07020825996152190351'/></author><thr:total xmlns:thr='http://purl.org/syndication/thread/1.0'>3</thr:total></entry><entry><id>tag:blogger.com,1999:blog-30587633.post-115641723637641389</id><published>2006-08-24T03:59:00.000-07:00</published><updated>2008-07-12T09:47:31.459-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='JBoss'/><title type='text'>How to create a Queue/Topic in JBoss?</title><content type='html'>&lt;span&gt;&lt;br /&gt;Queues/Topics are known as administered objects and in jboss they can be deployed through ServiceDotXml files. Let’s name our file, myapp-destination-service.xml. The contents of the file should look like:&lt;br /&gt;&lt;pre name="code" class="xml"&gt;&lt;br /&gt;&lt;br /&gt;&amp;lt;?xml version=&amp;quot;1.0&amp;quot; encoding=&amp;quot;UTF-8&amp;quot;?&amp;gt;&lt;br /&gt;&lt;br /&gt;&amp;lt;server&amp;gt;&lt;br /&gt;   &amp;lt;!--My queue, named: myAppQueue --&amp;gt;&lt;br /&gt;  &amp;lt;mbean code=&amp;quot;org.jboss.mq.server.jmx.Queue&amp;quot;&lt;br /&gt;  name=&amp;quot;jboss.mq.destination:service=Queue,name=myAppQueue&amp;quot;&amp;gt;&lt;br /&gt;    &amp;lt;depends optional-attribute-name=&amp;quot;DestinationManager&amp;quot;&amp;gt;jboss.mq:service=DestinationManager&amp;lt;/depends&amp;gt;&lt;br /&gt;  &amp;lt;/mbean&amp;gt;&lt;br /&gt;   &amp;lt;!-- My topic, named: myAppTopic --&amp;gt;&lt;br /&gt;  &amp;lt;mbean code=&amp;quot;org.jboss.mq.server.jmx.Topic&amp;quot;&lt;br /&gt;  name=&amp;quot;jboss.mq.destination:service=Topic,name=myAppTopic&amp;quot;&amp;gt;&lt;br /&gt;    &amp;lt;depends optional-attribute-name=&amp;quot;DestinationManager&amp;quot;&amp;gt;jboss.mq:service=DestinationManager&amp;lt;/depends&amp;gt;&lt;br /&gt;  &amp;lt;/mbean&amp;gt;&lt;br /&gt;    &lt;br /&gt;  &amp;lt;/server&amp;gt;&lt;br /&gt;&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Place this file in your %JBOSS_HOME%/server/default/deploy directory and start the server.&lt;br /&gt;(Note: If you are using the ‘all’ configuration or the ‘minimal’ configuration then you will have to place this file in the %JBOSS_HOME%/server/all/deploy  or %JBOSS_HOME%/server/minimal/deploy   directory, as appropriate).&lt;br /&gt;&lt;br /&gt;The above queue/topic will be bound to the jndi name: queue/myAppQueue and topic/myAppTopic respectively.&lt;br /&gt;&lt;br /&gt;Note:&lt;br /&gt;&lt;br /&gt;1) The above file is meant for JBoss-3.2.3. Though there might be slight changes to later versions of JBoss, the basic configuration mechanism remains the same.&lt;br /&gt;&lt;br /&gt;2) JBoss also comes with preconfigured queues/topics. These configurations can be found in the &lt;strong&gt;jbossmq-destinations-service.xml&lt;/strong&gt; file which is present in %JBOSS_HOME%/server/default/deploy/jms directory&lt;br /&gt;&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/30587633-115641723637641389?l=jaitechwriteups.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://jaitechwriteups.blogspot.com/feeds/115641723637641389/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='https://www.blogger.com/comment.g?blogID=30587633&amp;postID=115641723637641389' title='3 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/30587633/posts/default/115641723637641389'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/30587633/posts/default/115641723637641389'/><link rel='alternate' type='text/html' href='http://jaitechwriteups.blogspot.com/2006/08/how-to-create-queuetopic-in-jboss.html' title='How to create a Queue/Topic in JBoss?'/><author><name>Jaikiran</name><uri>http://www.blogger.com/profile/08503182723143814781</uri><email>noreply@blogger.com</email><gd:extendedProperty xmlns:gd='http://schemas.google.com/g/2005' name='OpenSocialUserId' value='07020825996152190351'/></author><thr:total xmlns:thr='http://purl.org/syndication/thread/1.0'>3</thr:total></entry><entry><id>tag:blogger.com,1999:blog-30587633.post-115641797492077417</id><published>2006-08-24T04:12:00.000-07:00</published><updated>2008-07-12T09:46:52.834-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='EJB'/><category scheme='http://www.blogger.com/atom/ns#' term='J2EE'/><title type='text'>Lookup an EJB from a different application, deployed on the same server, in JBoss</title><content type='html'>&lt;span&gt;&lt;br /&gt;Question:&lt;br /&gt;I have a web application through which i want to access an EJB which is deployed as a separate appliaction on the same server. How do i do it?&lt;br /&gt;Answer:&lt;br /&gt;In the web.xml of your war(the web application through which you want to access the EJB), have the following entry:&lt;br /&gt;&lt;pre name="code" class="xml"&gt;&lt;br /&gt;&lt;br /&gt;&amp;lt;ejb-ref&amp;gt;&lt;br /&gt;&lt;br /&gt;&amp;lt;ejb-ref-name&amp;gt;GiveAnNameByWhichYouWouldLikeToReferTheBeanInYourWebApp&amp;lt;/ejb-ref-name&amp;gt;&lt;br /&gt;    &amp;lt;ejb-ref-type&amp;gt;session&amp;lt;/ejb-ref-type&amp;gt;&lt;br /&gt;    &amp;lt;home&amp;gt;packageName.ClassNameOfTheHomeObjectOfTheBeanYouWantToRefer&amp;lt;/home&amp;gt;&lt;br /&gt;    &amp;lt;remote&amp;gt;packageName.ClassNameOfTheRemoteObjectOfTheBeanYouWantToRefer&amp;lt;/remote&amp;gt;&lt;br /&gt;  &amp;lt;/ejb-ref&amp;gt;&lt;br /&gt;  &lt;br /&gt;&lt;/pre&gt; &lt;br /&gt;In the jboss-web.xml of your war, have the following entry:&lt;br /&gt;&lt;pre name="code" class="xml"&gt;&lt;br /&gt;&lt;br /&gt;  &amp;lt;ejb-ref&amp;gt;&lt;br /&gt;      &amp;lt;!--The ejb-ref-name should be same as the one given in the web.xml above --&amp;gt;&lt;br /&gt;      &amp;lt;ejb-ref-name&amp;gt;GiveANameByWhichYouWouldLikeToReferTheBeanInYourWebApp&amp;lt;/ejb-ref-name&amp;gt;&lt;br /&gt;      &amp;lt;!--Example:somecontext/somejndiName.YouWillFindThisJndiNameInTheJboss.xmlOfTheEJB--&amp;gt;&lt;br /&gt;      &amp;lt;jndi-name&amp;gt;TheJndiNametoWhichTheBeanIsBound&amp;lt;/jndi-name&amp;gt;&lt;br /&gt;   &amp;lt;/ejb-ref&amp;gt;&lt;br /&gt;   &lt;br /&gt;  &lt;/pre&gt;&lt;br /&gt;For more info, have a look at the dtds of web.xml (http://java.sun.com/dtd/web-app_2_3.dtd) and jboss-web.xml(http://www.jboss.org/j2ee/dtd)&lt;br /&gt;In your code, do the lookup as:&lt;br /&gt; &lt;br /&gt;&lt;pre name="code" class="java"&gt; &lt;br /&gt;Context ic = new InitialContext();&lt;br /&gt;Object home=ic.lookup("java:comp/env/TheNameThatYouHadGivenInEjb-ref-nameTagOfJbossWeb.xml");&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;  &lt;br /&gt;Here’s an example:&lt;br /&gt;&lt;br /&gt;&lt;b&gt;web.xml:&lt;/b&gt;&lt;br /&gt;&lt;pre name="code" class="xml"&gt;&lt;br /&gt;&amp;lt;ejb-ref&amp;gt;&lt;br /&gt;    &amp;lt;ejb-ref-name&amp;gt;MyTestBean&amp;lt;/ejb-ref-name&amp;gt;&lt;br /&gt;    &amp;lt;ejb-ref-type&amp;gt;session&amp;lt;/ejb-ref-type&amp;gt;&lt;br /&gt;    &amp;lt;home&amp;gt;com.test.ejb.MyBeanHome&amp;lt;/home&amp;gt;&lt;br /&gt;    &amp;lt;remote&amp;gt;com.test.ejb.MyBeanRemote&amp;lt;/remote&amp;gt;&lt;br /&gt;  &amp;lt;/ejb-ref&amp;gt;&lt;br /&gt;  &lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;&lt;b&gt;jboss-web.xml:&lt;/b&gt;&lt;br /&gt;&lt;pre name="code" class="xml"&gt;&lt;br /&gt; &amp;lt;ejb-ref&amp;gt;&lt;br /&gt;   &amp;lt;ejb-ref-name&amp;gt;MyTestBean&amp;lt;/ejb-ref-name&amp;gt;&lt;br /&gt;   &amp;lt;jndi-name&amp;gt;myejb/test/MyTestBean&amp;lt;/jndi-name&amp;gt;&lt;br /&gt;  &amp;lt;/ejb-ref&amp;gt;&lt;br /&gt; &lt;br /&gt; &lt;/pre&gt;&lt;br /&gt;Lookup code:&lt;br /&gt;&lt;pre name="code" class="java"&gt;&lt;br /&gt;Context ic = new InitialContext();&lt;br /&gt;  Object ejbHome = ic.lookup("java:comp/env/MyTestBean");&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/30587633-115641797492077417?l=jaitechwriteups.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://jaitechwriteups.blogspot.com/feeds/115641797492077417/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='https://www.blogger.com/comment.g?blogID=30587633&amp;postID=115641797492077417' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/30587633/posts/default/115641797492077417'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/30587633/posts/default/115641797492077417'/><link rel='alternate' type='text/html' href='http://jaitechwriteups.blogspot.com/2006/08/lookup-ejb-from-different-application.html' title='Lookup an EJB from a different application, deployed on the same server, in JBoss'/><author><name>Jaikiran</name><uri>http://www.blogger.com/profile/08503182723143814781</uri><email>noreply@blogger.com</email><gd:extendedProperty xmlns:gd='http://schemas.google.com/g/2005' name='OpenSocialUserId' value='07020825996152190351'/></author><thr:total xmlns:thr='http://purl.org/syndication/thread/1.0'>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-30587633.post-115642008050965644</id><published>2006-08-24T04:47:00.000-07:00</published><updated>2008-07-12T09:45:19.360-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Java'/><title type='text'>Convert exception stacktrace to String object</title><content type='html'>&lt;span&gt;&lt;br /&gt;Usually whenever a exception occurs, we use the method printStackTrace() on the exception object to display the stacktrace. However, if the stacktrace has to be stored into a String  object then the following piece of code will prove handy:&lt;br /&gt;&lt;pre name="code" class="java"&gt;&lt;br /&gt;  /**&lt;br /&gt;     * Creates and returns a {@link java.lang.String} from &lt;code&gt;t&lt;/code&gt;’s stacktrace &lt;br /&gt;     * @param t Throwable whose stack trace is required&lt;br /&gt;     * @return String representing the stack trace of the exception&lt;br /&gt;     */&lt;br /&gt;    public String getStackTrace(Throwable t) {&lt;br /&gt;        StringWriter stringWritter = new StringWriter();&lt;br /&gt;        PrintWriter printWritter = new PrintWriter(stringWritter, true);&lt;br /&gt;        t.printStackTrace(printWritter);&lt;br /&gt;        printWritter.flush();&lt;br /&gt;        stringWritter.flush(); &lt;br /&gt;&lt;br /&gt;       return stringWritter.toString();&lt;br /&gt;    } &lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/30587633-115642008050965644?l=jaitechwriteups.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://jaitechwriteups.blogspot.com/feeds/115642008050965644/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='https://www.blogger.com/comment.g?blogID=30587633&amp;postID=115642008050965644' title='4 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/30587633/posts/default/115642008050965644'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/30587633/posts/default/115642008050965644'/><link rel='alternate' type='text/html' href='http://jaitechwriteups.blogspot.com/2006/08/convert-exception-stacktrace-to-string.html' title='Convert exception stacktrace to String object'/><author><name>Jaikiran</name><uri>http://www.blogger.com/profile/08503182723143814781</uri><email>noreply@blogger.com</email><gd:extendedProperty xmlns:gd='http://schemas.google.com/g/2005' name='OpenSocialUserId' value='07020825996152190351'/></author><thr:total xmlns:thr='http://purl.org/syndication/thread/1.0'>4</thr:total></entry><entry><id>tag:blogger.com,1999:blog-30587633.post-115642085225158748</id><published>2006-08-24T04:59:00.000-07:00</published><updated>2008-07-12T09:44:49.356-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Hibernate'/><title type='text'>Custom reverse engineering strategy in Hibernate</title><content type='html'>&lt;span&gt;&lt;br /&gt;Hibernate has tools to create mapping files(hbm files) and domain model classes from database schemas(reverse engineering). &lt;jdbcconfguration&gt; can be used as part of ant task to do this. Hibernate creates the property names using its default reverse engineering strategy. Hibernate also, provides a way through which the user can specify his own custom reverse engineering strategy through which he can follow his own naming conventions etc…&lt;br /&gt;&lt;br /&gt;There is a reversestrategy attribute which can be set to some custom class, which implements org.hibernate.cfg.reveng.ReverseEngineeringStrategy, in the &lt;jdbcconfiguration&gt;. Here’s an example:&lt;br /&gt;&lt;pre name="code" class="xml"&gt;&lt;br /&gt;&amp;lt;jdbcconfiguration configurationfile=&amp;quot;hibernate.cfg.xml&amp;quot;  &lt;br /&gt;&lt;br /&gt;    packagename=&amp;quot;${package.name}&amp;quot;  &lt;br /&gt;&lt;br /&gt;    revengfile=&amp;quot;hibernate.reveng.xml&amp;quot;  &lt;br /&gt;&lt;br /&gt;    reversestrategy=&amp;quot;org.myapp.hibernate.tool.SampleReverseEngineeringStrategy&amp;quot;/&amp;gt;&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;The org.myapp.hibernate.tool.SampleReverseEngineeringStrategy is our own custom class which implements org.hibernate.cfg.reveng.ReverseEngineeringStrategy. In this example, our SampleReverseEngineeringStrategy, overrides the columnToPropertyName(TableIdentifier table, String column) method to provide a custom implementation for generating property names out of a column name. Here’s the SampleReverseEngineeringStrategy code:&lt;br /&gt;&lt;pre name="code" class="java"&gt;&lt;br /&gt;package org.myapp.hibernate.tool;  &lt;br /&gt;&lt;br /&gt;import java.util.regex.Matcher;  &lt;br /&gt;import java.util.regex.Pattern;  &lt;br /&gt;import org.hibernate.cfg.reveng.DelegatingReverseEngineeringStrategy;  &lt;br /&gt;import org.hibernate.cfg.reveng.ReverseEngineeringStrategy;  &lt;br /&gt;import org.hibernate.cfg.reveng.TableIdentifier;  &lt;br /&gt;/**  &lt;br /&gt; *  &lt;br /&gt; * @author Jaikiran Pai  &lt;br /&gt; *  &lt;br /&gt; */  &lt;br /&gt;public class SampleReverseEngineeringStrategy extends DelegatingReverseEngineeringStrategy {  &lt;br /&gt;/**  &lt;br /&gt;  * Constructor  &lt;br /&gt;  *  &lt;br /&gt;  * @param delegate {@link org.hibernate.cfg.reveng.ReverseEngineeringStrategy}  &lt;br /&gt;  */  &lt;br /&gt; public SampleReverseEngineeringStrategy(ReverseEngineeringStrategy delegate) {  &lt;br /&gt;  super(delegate);  &lt;br /&gt; }  &lt;br /&gt;&lt;br /&gt;/**  &lt;br /&gt;  * Changes the default behaviour of naming the property. &lt;br&gt;  &lt;br /&gt;  * Does the following replacements(not neccessarily in the order) and returns the resulting  &lt;br /&gt;  * {@link String} as property name:&lt;br /&gt;  *  - Converts the first letter of the &lt;code&gt;column&lt;/code&gt; to uppercase&lt;br /&gt;  *  - Converts the letters following a ‘_’ character to uppercase in the &lt;code&gt;column&lt;/code&gt;  &lt;br /&gt;  *  - Removes any underscores present from &lt;code&gt;column&lt;/code&gt;  &lt;br /&gt;  *  &lt;br /&gt;  * @see org.hibernate.cfg.reveng.DelegatingReverseEngineeringStrategy  &lt;br /&gt;  * @see org.hibernate.cfg.reveng.ReverseEngineeringStrategy  &lt;br /&gt;  *  &lt;br /&gt;  * @param table {@link TableIdentifier}  &lt;br /&gt;  * @param column  &lt;br /&gt;  * @return Returns the propert name after converting it appropriately  &lt;br /&gt;  */  &lt;br /&gt;public String columnToPropertyName(TableIdentifier table, String column) {  &lt;br /&gt;&lt;br /&gt;  String replacedColumn = replaceFirstLetterToUpperCase(column);  &lt;br /&gt;   &lt;br /&gt;   replacedColumn = removeUnderScoresAndConvertNextLetterToUpperCase(replacedColumn);  &lt;br /&gt;&lt;br /&gt;   if (anyReplacementsMadeToOriginalColumnName(column,replacedColumn)) {  &lt;br /&gt;  &lt;br /&gt;  return replacedColumn;  &lt;br /&gt;&lt;br /&gt;   }  &lt;br /&gt;&lt;br /&gt;   /*  &lt;br /&gt;    * Let DelegatingReverseEngineeringStrategy handle this  &lt;br /&gt;    */  &lt;br /&gt;   return super.columnToPropertyName(table, column);  &lt;br /&gt; }  &lt;br /&gt;&lt;br /&gt; /**  &lt;br /&gt;  *  &lt;br /&gt;  * Returns true if the &lt;code&gt;originalString&lt;/code&gt; and &lt;code&gt;replacedString&lt;/code&gt; are NOT equal  &lt;br /&gt;  * (meaning there was some replacement done to the original column name). Else returns false.&lt;br /&gt;  *  &lt;br /&gt;  * @param originalString The original column name  &lt;br /&gt;  * @param replacedString The column name after doing necessary replacements  &lt;br /&gt;  * @return Returns true if the &lt;code&gt;originalString&lt;/code&gt; and &lt;code&gt;replacedString&lt;/code&gt; are NOT equal  &lt;br /&gt;  * (meaning there was some replacement done to the original column name). Else returns false.  &lt;br /&gt;  *   &lt;br /&gt;  * @throws {@link NullPointerException} if &lt;code&gt;originalString&lt;/code&gt; is null.  &lt;br /&gt;  */  &lt;br /&gt; protected boolean anyReplacementsMadeToOriginalColumnName(String originalString, String replacedString) {  &lt;br /&gt;  if (originalString.equals(replacedString)) {  &lt;br /&gt;    return false;  &lt;br /&gt;&lt;br /&gt;   }  &lt;br /&gt;&lt;br /&gt;   return true;  &lt;br /&gt; }  &lt;br /&gt;&lt;br /&gt; /**  &lt;br /&gt;  * Converts the first letter of the &lt;code&gt;input&lt;/code&gt; to uppercase and  &lt;br /&gt;  * returns the resultant {@link String}.  &lt;br /&gt;  *   &lt;br /&gt;  * Ex: If the &lt;code&gt;input&lt;/code&gt; is startDate then the resulting {@link String}  &lt;br /&gt;  * after replacement will be StartDate  &lt;br /&gt;  *  &lt;br /&gt;  * @param input The {@link String} whose contents have to be replaced  &lt;br /&gt;  * @return Returns a {@link String} after doing the appropriate replacements  &lt;br /&gt;  */  &lt;br /&gt; protected String replaceFirstLetterToUpperCase(String input) {  &lt;br /&gt;&lt;br /&gt;   /*  &lt;br /&gt;    * The pattern to match a String starting with lower case  &lt;br /&gt;    */  &lt;br /&gt;   final String startsWithLowerCasePattern = "^[a-z]";  &lt;br /&gt;   &lt;br /&gt;   Pattern patternForReplacingLowerCase = Pattern.compile(startsWithLowerCasePattern);  &lt;br /&gt;   Matcher regexMatcher = patternForReplacingLowerCase.matcher(input);  &lt;br /&gt;&lt;br /&gt; /*  &lt;br /&gt;  * This will hold the replaced contents  &lt;br /&gt;  */  &lt;br /&gt; StringBuffer replacedContents = new StringBuffer();  &lt;br /&gt;&lt;br /&gt; /*  &lt;br /&gt;  * Check whether the first letter starts with lowercase.  &lt;br /&gt;  * If yes, change it to uppercase, else pass on the control to  &lt;br /&gt;  * DelegatingReverseEngineeringStrategy  &lt;br /&gt;  *  &lt;br /&gt;  */  &lt;br /&gt; if (regexMatcher.find()) {  &lt;br /&gt;&lt;br /&gt;  String firstCharacter = regexMatcher.group();  &lt;br /&gt;  /*  &lt;br /&gt;   * Convert it to uppercase  &lt;br /&gt;   */  &lt;br /&gt;  regexMatcher.appendReplacement(replacedContents,firstCharacter.toUpperCase());  &lt;br /&gt;  regexMatcher.appendTail(replacedContents);  &lt;br /&gt;  regexMatcher.reset();  &lt;br /&gt;  &lt;br /&gt;  /*  &lt;br /&gt;   * Return the replaced contents  &lt;br /&gt;   */  &lt;br /&gt;    return replacedContents.toString();  &lt;br /&gt;&lt;br /&gt;   }  &lt;br /&gt;&lt;br /&gt;        //no replacements to do, just return the original input  &lt;br /&gt;        return input;  &lt;br /&gt;&lt;br /&gt; }  &lt;br /&gt;&lt;br /&gt; /**  &lt;br /&gt;  * Converts the letters following a ‘_’ character to uppercase and also removes  &lt;br /&gt;  * the ‘_’ character from the &lt;code&gt;input&lt;/code&gt; and returns the resulting {@link String}.   &lt;br /&gt;  * Carries out a 2 pass strategy to do the replacements. During the first pass,  &lt;br /&gt;  * replaces all the letters that immidiately follow a ‘_’ to uppercase.  &lt;br /&gt;  * Ex: If the &lt;code&gt;input&lt;/code&gt; is _start_Date__today_ then after the first pass of replacement, the  &lt;br /&gt;  * resultant string will be _Start_Date__Today_  &lt;br /&gt;  *   &lt;br /&gt;  * This replaced {@link String} is then passed ahead for second pass (if no replacements were  &lt;br /&gt;  * done during first pass, then the original {@link String} is passed). During the second pass  &lt;br /&gt;  * the underscores are removed.  &lt;br /&gt;  * Ex: If the &lt;code&gt;input&lt;/code&gt; is _start_Date__today_ then after BOTH the passes the  &lt;br /&gt;  * resultant string will be StartDateToday  &lt;br /&gt;  *  &lt;br /&gt;  * @param input The {@link String} whose contents have to be replaced  &lt;br /&gt;  * @return Returns a {@link String} after doing the appropriate replacements  &lt;br /&gt;  */  &lt;br /&gt; protected String removeUnderScoresAndConvertNextLetterToUpperCase(String input) {  &lt;br /&gt;&lt;br /&gt;   /*  &lt;br /&gt;    * The pattern which matches a String that starts with a letter immidiately after  &lt;br /&gt;    * a ‘_’ character  &lt;br /&gt;    */  &lt;br /&gt;   final String stringFollowingUnderScore = "[.]*_[a-zA-Z]+";  &lt;br /&gt;&lt;br /&gt;   Pattern patternForReplacingLowerCase = Pattern.compile(stringFollowingUnderScore);  &lt;br /&gt;          Matcher regexMatcher = patternForReplacingLowerCase.matcher(input);  &lt;br /&gt;          /*  &lt;br /&gt;           * This will hold the replaced contents  &lt;br /&gt;           */  &lt;br /&gt;          StringBuffer replacedContents = new StringBuffer();  &lt;br /&gt;&lt;br /&gt;          boolean foundAnyMatch = false;  &lt;br /&gt;&lt;br /&gt;          while (regexMatcher.find()) {  &lt;br /&gt;   foundAnyMatch = true;  &lt;br /&gt;   String matchedString = regexMatcher.group();  &lt;br /&gt;       /*  &lt;br /&gt;          * The character immidiately following the underscore  &lt;br /&gt;   * Example:  &lt;br /&gt;          * If matchedString is _tMn then originalCharAfterUnderScore will be the  &lt;br /&gt;          * character t  &lt;br /&gt;          */  &lt;br /&gt;&lt;br /&gt;        char originalCharAfterUnderScore = matchedString.charAt(1);  &lt;br /&gt;         /*  &lt;br /&gt;          * Convert the character to uppercase  &lt;br /&gt;          */  &lt;br /&gt;&lt;br /&gt;        String replacedCharAfterUnderScore = String.valueOf(originalCharAfterUnderScore).toUpperCase();  &lt;br /&gt;&lt;br /&gt;        /*  &lt;br /&gt;          * Now place this replaced character back into the matchedString  &lt;br /&gt;          */  &lt;br /&gt;&lt;br /&gt;        String replacement = matchedString.replace(originalCharAfterUnderScore,replacedCharAfterUnderScore.charAt(0));  &lt;br /&gt;&lt;br /&gt;        /*  &lt;br /&gt;   * Append this to the replacedColumn, which will be returned back to the user  &lt;br /&gt;          */  &lt;br /&gt;  regexMatcher.appendReplacement(replacedContents,replacement);  &lt;br /&gt;&lt;br /&gt;     } //end of while  &lt;br /&gt;&lt;br /&gt;        regexMatcher.appendTail(replacedContents);  &lt;br /&gt; regexMatcher.reset();  &lt;br /&gt; &lt;br /&gt; /*  &lt;br /&gt;         * Now the input string has been replaced to contain uppercase letters after the underscore.  &lt;br /&gt;         * Ex: If input string was "_start_Date_today" then at this point after the above processing,  &lt;br /&gt;        * the replaced string will be "_Start_Date_Today"  &lt;br /&gt;  * The only thing that remains now is to remove the underscores from the input string.  &lt;br /&gt;        * The following statements do this part.  &lt;br /&gt;        *  &lt;br /&gt;        */  &lt;br /&gt;&lt;br /&gt;      if (foundAnyMatch) {  &lt;br /&gt;       return removeUnderScores(replacedContents.toString());  &lt;br /&gt;       &lt;br /&gt;   } else {  &lt;br /&gt;     return removeUnderScores(input);  &lt;br /&gt;     &lt;br /&gt;   }  &lt;br /&gt;&lt;br /&gt; }  &lt;br /&gt;&lt;br /&gt; /**  &lt;br /&gt;  * Removes any underscores present from &lt;code&gt;input&lt;/code&gt; and returns the  &lt;br /&gt;  * resulting {@link String}  &lt;br /&gt;  * Ex: If the &lt;code&gt;input&lt;/code&gt; is _start_Date__today_ then the resulting {@link String}  &lt;br /&gt;  * after replacement will be startDatetoday  &lt;br /&gt;  *&lt;br /&gt;  * @param input The {@link String} whose contents have to be replaced  &lt;br /&gt;  * @return Returns a {@link String} after doing the appropriate replacements  &lt;br /&gt;  */  &lt;br /&gt; protected String removeUnderScores(String input) {  &lt;br /&gt;&lt;br /&gt;   /*  &lt;br /&gt;  * Pattern for matching underscores  &lt;br /&gt;     */  &lt;br /&gt;  Pattern patternForUnderScore = Pattern.compile("[.]*_[.]*");  &lt;br /&gt;&lt;br /&gt;    Matcher regexMatcher = patternForUnderScore.matcher(input);  &lt;br /&gt;  /*  &lt;br /&gt;      * This will hold the return value  &lt;br /&gt;   */  &lt;br /&gt;    StringBuffer returnVal = new StringBuffer();  &lt;br /&gt;       boolean foundAnyMatch = false;  &lt;br /&gt;   &lt;br /&gt;     while (regexMatcher.find()) {  &lt;br /&gt;        foundAnyMatch = true;  &lt;br /&gt;&lt;br /&gt;     String matchedString = regexMatcher.group();  &lt;br /&gt;&lt;br /&gt;     /*  &lt;br /&gt;       * Remove the underscore  &lt;br /&gt;   */  &lt;br /&gt;     regexMatcher.appendReplacement(returnVal,"");  &lt;br /&gt;&lt;br /&gt;      }  &lt;br /&gt;&lt;br /&gt;      regexMatcher.appendTail(returnVal);  &lt;br /&gt; regexMatcher.reset();  &lt;br /&gt;&lt;br /&gt;      /*  &lt;br /&gt;        * If any match was found(and replaced) then return the replaced string.  &lt;br /&gt;        * Else return the original input.  &lt;br /&gt;  */  &lt;br /&gt;      if (foundAnyMatch) {  &lt;br /&gt;        return returnVal.toString();  &lt;br /&gt;&lt;br /&gt;      }  &lt;br /&gt; return input;  &lt;br /&gt;&lt;br /&gt; }  &lt;br /&gt;&lt;br /&gt;}&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;In the example above, the columnToPropertyName method is overridden to do the following:&lt;br /&gt;&lt;br /&gt;- Creates property names that start with a Capital case(By default, Hibernate creates property names in camel-case)&lt;br /&gt;- Converts the letter, that follows a ‘_’ (underscore character) to uppercase in the property name&lt;br /&gt;- Removes any underscores in the property name&lt;br /&gt;&lt;br /&gt;Ex: If the column name is start_Date_today, then the resulting property name after using the SampleReverseEngineeringStrategy would be StartDateToday.&lt;br /&gt;&lt;br /&gt;Here’s a documentation from Hibernate about &lt;a href="http://www.hibernate.org/hib_docs/tools/reference/en/html/reverseengineering.html"&gt;Controlling Reverse Engineering &lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/30587633-115642085225158748?l=jaitechwriteups.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://jaitechwriteups.blogspot.com/feeds/115642085225158748/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='https://www.blogger.com/comment.g?blogID=30587633&amp;postID=115642085225158748' title='5 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/30587633/posts/default/115642085225158748'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/30587633/posts/default/115642085225158748'/><link rel='alternate' type='text/html' href='http://jaitechwriteups.blogspot.com/2006/08/custom-reverse-engineering-strategy-in.html' title='Custom reverse engineering strategy in Hibernate'/><author><name>Jaikiran</name><uri>http://www.blogger.com/profile/08503182723143814781</uri><email>noreply@blogger.com</email><gd:extendedProperty xmlns:gd='http://schemas.google.com/g/2005' name='OpenSocialUserId' value='07020825996152190351'/></author><thr:total xmlns:thr='http://purl.org/syndication/thread/1.0'>5</thr:total></entry><entry><id>tag:blogger.com,1999:blog-30587633.post-2048504929183242270</id><published>2007-04-18T03:59:00.000-07:00</published><updated>2008-07-12T09:43:01.510-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Webservice'/><category scheme='http://www.blogger.com/atom/ns#' term='Java'/><category scheme='http://www.blogger.com/atom/ns#' term='J2EE'/><category scheme='http://www.blogger.com/atom/ns#' term='JBoss'/><title type='text'>Webservice client using dynamic proxy</title><content type='html'>In one of my &lt;a href="http://jaitechwriteups.blogspot.com/2006/12/simple-webservice-on-jboss-using-axis.html"&gt;previous posts&lt;/a&gt;, i explained how to create a WebService and access it from a simple client. If you look at the client code which accesses the webservice, you will find that the client is using the stubs that were created at deploy time. Such clients which use "static stubs" for accessing webservices are known as "Static Stub Clients". In such approach, the clients will have to have the stubs in their classpath. &lt;br /&gt;&lt;br /&gt;Another approach of accessing the webservices is through Dynamic Proxies where the proxies are generated at runtime. I will be showing a simple client which uses dynamic proxies to access an webservice. I wont be explaining the steps to deploy the webservice (which i have already done in &lt;a href="http://jaitechwriteups.blogspot.com/2006/12/simple-webservice-on-jboss-using-axis.html"&gt;my other post&lt;/a&gt;). This example assumes that the webservice is already deployed on the server.&lt;br /&gt;&lt;br /&gt;The client code will be accessing the HelloWorld service and invoking the sayHelloTo method on that service (Refer &lt;a href="http://jaitechwriteups.blogspot.com/2006/12/simple-webservice-on-jboss-using-axis.html"&gt;my other post&lt;/a&gt; to see how the service has been deployed onto the server)&lt;br /&gt;&lt;br /&gt;Here's the code for the client:&lt;br /&gt;&lt;br /&gt;&lt;pre name="code" class="java"&gt;&lt;br /&gt;package org.myapp.service.client;&lt;br /&gt;&lt;br /&gt;import java.net.MalformedURLException;&lt;br /&gt;import java.net.URL;&lt;br /&gt;&lt;br /&gt;import javax.xml.namespace.QName;&lt;br /&gt;import javax.xml.rpc.Service;&lt;br /&gt;import javax.xml.rpc.ServiceException;&lt;br /&gt;import javax.xml.rpc.ServiceFactory;&lt;br /&gt;&lt;br /&gt;import org.myapp.service.HelloWorldService;&lt;br /&gt;&lt;br /&gt;/**&lt;br /&gt; * Simple webservice client which uses dynamic proxy&lt;br /&gt; *&lt;br /&gt; * @author Jaikiran Pai&lt;br /&gt; */&lt;br /&gt;public class DynamicProxyClient {&lt;br /&gt;&lt;br /&gt;    public static void main(String args[]) {&lt;br /&gt;&lt;br /&gt;        try {&lt;br /&gt;            &lt;br /&gt;            // ServiceFactory instance&lt;br /&gt;            ServiceFactory serviceFactory = ServiceFactory.newInstance();&lt;br /&gt;            System.out.println("Got the service factory");&lt;br /&gt;            String wsdlURLString = "http://localhost:8080/axis/services/HelloWorld?wsdl";&lt;br /&gt;            URL wsdlURL = new URL(wsdlURLString);&lt;br /&gt;            String serviceName = "HelloWorldServiceService";&lt;br /&gt;            String nameSpaceURI = "http://jaikiran.com";&lt;br /&gt;            String portName = "HelloWorld";&lt;br /&gt;            // get hold of the service by passing the URL of the wsdl and the&lt;br /&gt;            // service name&lt;br /&gt;            Service service = serviceFactory.createService(wsdlURL, new QName(&lt;br /&gt;                    nameSpaceURI, serviceName));&lt;br /&gt;            System.out.println("Got the service: " + service);&lt;br /&gt;            // create the service proxy&lt;br /&gt;            HelloWorldService serviceProxy = (HelloWorldService) service&lt;br /&gt;                    .getPort(new QName(nameSpaceURI, portName),&lt;br /&gt;                            HelloWorldService.class);&lt;br /&gt;            System.out.println("Got the service proxy: " + serviceProxy);&lt;br /&gt;            System.out.println("Invoking method on service proxy........");&lt;br /&gt;            System.out.println(serviceProxy.sayHelloTo("Dynamic user"));&lt;br /&gt;&lt;br /&gt;        } catch (ServiceException e) {&lt;br /&gt;            // TODO Auto-generated catch block&lt;br /&gt;            e.printStackTrace();&lt;br /&gt;        } catch (MalformedURLException e) {&lt;br /&gt;            // TODO Auto-generated catch block&lt;br /&gt;            e.printStackTrace();&lt;br /&gt;        }&lt;br /&gt;    }&lt;br /&gt;&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;1) Our first step would be to create a ServiceFactory instance, using which we can get access to a deployed service.&lt;br /&gt;&lt;br /&gt;&lt;pre name="code" class="java"&gt;&lt;br /&gt;ServiceFactory serviceFactory = ServiceFactory.newInstance();&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;2) Once the ServiceFactory has been created, we will be getting hold of the service which is deployed on the server. To do this, we require&lt;br /&gt; a) The url of the wsdl of the deployed service. In this example it will be http://localhost:8080/axis/services/HelloWorld?wsdl&lt;br /&gt; &lt;br /&gt; b) The namespace uri. In this example it will be http://jaikiran.com (You can get this uri from the wsdl file)&lt;br /&gt; &lt;br /&gt; c) The name of the service which you want to access. In this example it will be HelloWorldServiceService&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;pre name="code" class="java"&gt;&lt;br /&gt;String wsdlURLString = "http://localhost:8080/axis/services/HelloWorld?wsdl";&lt;br /&gt;URL wsdlURL = new URL(wsdlURLString);&lt;br /&gt;String serviceName = "HelloWorldServiceService";&lt;br /&gt;String nameSpaceURI = "http://jaikiran.com";&lt;br /&gt;&lt;br /&gt;// get hold of the service by passing the URL of the wsdl and the&lt;br /&gt;// service name&lt;br /&gt;Service service = serviceFactory.createService(wsdlURL, new QName(&lt;br /&gt;                    nameSpaceURI, serviceName));&lt;br /&gt;                    &lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;3) At this point you have got access to the service. But in order to invoke an method on the service, you will have to create a proxy (dynamic proxy) from this service. The Service class, has an API getPort, which creates the proxy. In order to create the proxy, we will have to pass the portName of the service (again, this can be obtained in the wsdl file), the namespace uri and the class type of the service. In this example the service interface is org.myapp.service.HelloWorldService, so we will be passing this as the class as follows:&lt;br /&gt;&lt;br /&gt;&lt;pre name="code" class="java"&gt;&lt;br /&gt;String portName = "HelloWorld";&lt;br /&gt;// create the service proxy&lt;br /&gt;HelloWorldService serviceProxy = (HelloWorldService) service&lt;br /&gt;                    .getPort(new QName(nameSpaceURI, portName),&lt;br /&gt;                     org.myapp.service.HelloWorldService.class);&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;                     &lt;br /&gt;4) At this point we have got the service proxy which is of type org.myapp.service.HelloWorldService. We can now invoke our sayHelloTo method on this proxy:&lt;br /&gt;&lt;br /&gt;&lt;pre name="code" class="java"&gt;&lt;br /&gt;System.out.println(serviceProxy.sayHelloTo("Dynamic user"));&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;Simple, isnt it? You have successfully invoked the webservice through a standalone client using dynamic proxy.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/30587633-2048504929183242270?l=jaitechwriteups.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://jaitechwriteups.blogspot.com/feeds/2048504929183242270/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='https://www.blogger.com/comment.g?blogID=30587633&amp;postID=2048504929183242270' title='9 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/30587633/posts/default/2048504929183242270'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/30587633/posts/default/2048504929183242270'/><link rel='alternate' type='text/html' href='http://jaitechwriteups.blogspot.com/2007/04/webservice-client-using-dynamic-proxy.html' title='Webservice client using dynamic proxy'/><author><name>Jaikiran</name><uri>http://www.blogger.com/profile/08503182723143814781</uri><email>noreply@blogger.com</email><gd:extendedProperty xmlns:gd='http://schemas.google.com/g/2005' name='OpenSocialUserId' value='07020825996152190351'/></author><thr:total xmlns:thr='http://purl.org/syndication/thread/1.0'>9</thr:total></entry><entry><id>tag:blogger.com,1999:blog-30587633.post-7849849994570325313</id><published>2008-07-11T22:23:00.000-07:00</published><updated>2008-07-11T22:36:34.471-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Javascript'/><category scheme='http://www.blogger.com/atom/ns#' term='Misc'/><title type='text'>SyntaxHighlighter - Great and simple to use javascript utility</title><content type='html'>This had been on my todo list for a long time now. I finally got the &lt;a href="http://code.google.com/p/syntaxhighlighter/"&gt;SyntaxHighlighter&lt;/a&gt; integrated in this blog. &lt;br&gt;&lt;br /&gt;&lt;br /&gt;Most of my posts in this blog include java code or xml content. And i always used to spend most of my time formatting the way the java code was rendered in the blog. I wont have to worry about that anymore. I am very much impressed by this excellent yet simple piece of utility! I have edited &lt;a href="http://jaitechwriteups.blogspot.com/2006/12/simple-webservice-on-jboss-using-axis.html"&gt;some of my earlier posts in the blog&lt;/a&gt; to make use of the &lt;a href="http://code.google.com/p/syntaxhighlighter/"&gt;SyntaxHighlighter&lt;/a&gt;. Editing wasn't a big deal. It was as simple as adding a "name" and "class" attribute to the "pre" tags.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/30587633-7849849994570325313?l=jaitechwriteups.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://jaitechwriteups.blogspot.com/feeds/7849849994570325313/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='https://www.blogger.com/comment.g?blogID=30587633&amp;postID=7849849994570325313' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/30587633/posts/default/7849849994570325313'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/30587633/posts/default/7849849994570325313'/><link rel='alternate' type='text/html' href='http://jaitechwriteups.blogspot.com/2008/07/syntaxhighlighter-great-and-simple-to.html' title='SyntaxHighlighter - Great and simple to use javascript utility'/><author><name>Jaikiran</name><uri>http://www.blogger.com/profile/08503182723143814781</uri><email>noreply@blogger.com</email><gd:extendedProperty xmlns:gd='http://schemas.google.com/g/2005' name='OpenSocialUserId' value='07020825996152190351'/></author><thr:total xmlns:thr='http://purl.org/syndication/thread/1.0'>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-30587633.post-2296523205344856577</id><published>2006-12-10T02:07:00.000-08:00</published><updated>2008-07-11T22:17:45.349-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Webservice'/><category scheme='http://www.blogger.com/atom/ns#' term='Java'/><category scheme='http://www.blogger.com/atom/ns#' term='J2EE'/><category scheme='http://www.blogger.com/atom/ns#' term='JBoss'/><title type='text'>Simple Webservice on JBoss using Axis</title><content type='html'>Download the latest stable version of Axis from &lt;a href="http://ws.apache.org/axis/java/releases.html"&gt;Axis Releases&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;1) Deploying Axis web application on JBoss:&lt;br /&gt;&lt;br /&gt;I used Axis 1.4 on JBoss-4.0.4 GCA. Assuming you downloaded Axis to D: , copy the "axis" folder present in D:\Axis-1.4\webapps folder to %JBOSS_HOME%\server\default\deploy folder. The "axis" folder that you copied is nothing but an web application (containing of some servlets and jsps provided by Axis). In JBoss for a web application to be deployed, it has to be named *.war, so rename the "axis" folder in  %JBOSS_HOME%\server\default\deploy to axis.war. At this point, the axis web application is ready to be deployed on JBoss. But before starting JBoss, delete the commons-logging-x.x.x.jar and log4j-x.x.x.jar present in %JBOSS_HOME%\server\default\deploy\axis.war\WEB-INF\lib directory, since JBoss maintains its own versions of these jars and packaging these jars in your application will throw exceptions of JBoss startup. After you have deleted these jars, start the JBoss server using the run.bat present in %JBOSS_HOME%\bin folder.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;2) Verify Axis web application is deployed and running:&lt;br /&gt;&lt;br /&gt;After JBoss has started successfully, go to the following URL to check whether axis is deployed properly:&lt;br /&gt;&lt;br /&gt;http://localhost:8080/axis&lt;br /&gt;&lt;br /&gt;If Axis was deployed successfully, you will see a welcome page which will have a few links, one of them named "List" which can be used to view the already deployed webservices. Axis by default comes with a few sample webservices which you can see on clicking the "List" link.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;3) Writing our own webservice:&lt;br /&gt;&lt;br /&gt;3a - The Java classes/interfaces:&lt;br /&gt;&lt;br /&gt;Lets create a simple webservice which will echo a message to the user who passes his name. We will have an interface named HelloWorldService:&lt;br /&gt;&lt;br /&gt;&lt;pre name="code" class="java"&gt;&lt;br /&gt;package org.myapp.service;&lt;br /&gt;&lt;br /&gt;public interface HelloWorldService {&lt;br /&gt;    &lt;br /&gt;    public String sayHelloTo(String userName);&lt;br /&gt;&lt;br /&gt;}&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;And here's the implementing class:&lt;br /&gt;&lt;br /&gt;&lt;pre name="code" class="java"&gt;&lt;br /&gt;package org.myapp.service;&lt;br /&gt;&lt;br /&gt;public class HelloWorldServiceImpl implements HelloWorldService {&lt;br /&gt;&lt;br /&gt;    public String sayHelloTo(String userName) {&lt;br /&gt; &lt;br /&gt; //message&lt;br /&gt;        String hello = "Hello " + userName + ". You are being watched";&lt;br /&gt;&lt;br /&gt;        System.out.println(hello);&lt;br /&gt;        &lt;br /&gt; //return the message&lt;br /&gt;        return hello;&lt;br /&gt;    }&lt;br /&gt;&lt;br /&gt;}&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Do you see anything special in this class or the interface? No, you wont. So how do you convert these into webservices? Read on...&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;3b - Create a wsdl file:&lt;br /&gt;&lt;br /&gt;Now that we have the interface and the class ready, lets create a wsdl file out of these java classes. Axis comes with utilities which allow you to create the wsdl file from a java file. I wrote a small ant target which will do this for me:&lt;br /&gt;&lt;br /&gt;&lt;pre name="code" class="xml"&gt;&lt;br /&gt;&amp;lt;!--  Sets classpath for build  --&amp;gt;&lt;br /&gt;&amp;lt;path id="classpath"&amp;gt;&lt;br /&gt; &amp;lt;pathelement path="${java.class.path}" /&amp;gt;&lt;br /&gt; &amp;lt;fileset dir="${lib}"&amp;gt;&lt;br /&gt;  &amp;lt;include name="**/*.jar" /&amp;gt;&lt;br /&gt; &amp;lt;/fileset&amp;gt;&lt;br /&gt; &amp;lt;pathelement path="${classes.dir}" /&amp;gt;&lt;br /&gt;&amp;lt;/path&amp;gt;&lt;br /&gt;&lt;br /&gt;&amp;lt;taskdef name="axis-java2wsdl" classname="org.apache.axis.tools.ant.wsdl.Java2WsdlAntTask" &amp;gt;&lt;br /&gt;         &amp;lt;classpath refid="classpath"/&amp;gt;&lt;br /&gt;&amp;lt;/taskdef&amp;gt;&lt;br /&gt;&lt;br /&gt;&amp;lt;target name="generateWSDL" description="Generates wsdl files from the java service interfaces"&amp;gt;&lt;br /&gt; &amp;lt;mkdir dir="${wsdl.dir}"/&amp;gt;&lt;br /&gt; &amp;lt;axis-java2wsdl classpathref="classpath"&lt;br /&gt;   output="${wsdl.dir}/HelloWorld.wsdl"&lt;br /&gt;   location="http://localhost:8080/axis/services/HelloWorld"&lt;br /&gt;   namespace="http://jaikiran.com"&lt;br /&gt;   classname="org.myapp.service.HelloWorldService"&amp;gt;&lt;br /&gt;&lt;br /&gt;  &amp;lt;mapping namespace="http://jaikiran.com" package="org.myapp.service"/&amp;gt;&lt;br /&gt; &lt;br /&gt; &amp;lt;/axis-java2wsdl&amp;gt;&lt;br /&gt;&amp;lt;/target&amp;gt;&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;Note: You can find the entire build.xml, that i used, at the end of this article.&lt;br /&gt;&lt;br /&gt;You will require the org.apache.axis.tools.ant.wsdl.Java2WsdlAntTask class which is provided by axis to be in the classpath of Ant. This class comes  bundled in the axis-ant.jar which i have included in the classpath of this task using the classpathref.&lt;br /&gt;&lt;br /&gt;In this target you specify parameters like:&lt;br /&gt;location - this is where the webservice will be deployed.&lt;br /&gt;namespace - the namespace for your webservice&lt;br /&gt;classname - the fully qualified name of the interface which you wrote in step 3a, above.&lt;br /&gt;and also a mapping between the webservice namespace and your application packages.&lt;br /&gt;&lt;br /&gt;This target will generate the wsdl file named HelloWorld.wsdl in the directory which you specified in the 'output' parameter of the target.&lt;br /&gt;&lt;br /&gt;3c - Create the deploy.wsdd, undeploy.wsdd and the stubs:&lt;br /&gt;&lt;br /&gt;Now that you have created a wsdl for your webservice, lets go ahead and create the deploy.wsdd (used for deploying a webservice on the server), undeploy.wsdd (used for undeploying a webservice from the server) and the required stubs for invoking the webservice from a java client.&lt;br /&gt;Again, Axis provides utilities for creating these files. Axis accepts the wsdl file, which we created in step 3b as an input to create these files. Here's the Ant target which does this for us:&lt;br /&gt;&lt;br /&gt;&lt;pre name="code" class="xml"&gt;&lt;br /&gt;&amp;lt;taskdef name="axis-wsdl2java" classname="org.apache.axis.tools.ant.wsdl.Wsdl2javaAntTask" &amp;gt;&lt;br /&gt; &amp;lt;classpath refid="classpath"/&amp;gt;&lt;br /&gt;&amp;lt;/taskdef&amp;gt;&lt;br /&gt; &lt;br /&gt;&amp;lt;target name="generateWSDD" description="Generates wsdd files from the wsdl files"&amp;gt;&lt;br /&gt; &amp;lt;mkdir dir="${wsdd.dir}"/&amp;gt;&lt;br /&gt; &amp;lt;axis-wsdl2java&lt;br /&gt;       output="${wsdd.dir}"&lt;br /&gt;       deployscope="Application"&lt;br /&gt;       serverside="true"&lt;br /&gt;       url="${wsdl.dir}\HelloWorld.wsdl"&amp;gt;&lt;br /&gt; &amp;lt;/axis-wsdl2java&amp;gt;&lt;br /&gt;&amp;lt;/target&amp;gt;&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;This single target creates the deploy.wsdd, undeploy.wsdd and the stubs. As already mentioned, this target takes the wsdl file as an input which we have specified in the 'url' parameter of the axis-wsdl2java target. The files will be created in the directory mentioned in the 'output' parameter of this target. The deploy.wsdd file that gets generated will contain something like:&lt;br /&gt;&lt;br /&gt;&lt;pre name="code" class="xml"&gt;&lt;br /&gt;&amp;lt;!-- Use this file to deploy some handlers/chains and services      --&amp;gt;&lt;br /&gt;&amp;lt;!-- Two ways to do this:                                           --&amp;gt;&lt;br /&gt;&amp;lt;!--   java org.apache.axis.client.AdminClient deploy.wsdd          --&amp;gt;&lt;br /&gt;&amp;lt;!--      after the axis server is running                          --&amp;gt;&lt;br /&gt;&amp;lt;!-- or                                                             --&amp;gt;&lt;br /&gt;&amp;lt;!--   java org.apache.axis.utils.Admin client|server deploy.wsdd   --&amp;gt;&lt;br /&gt;&amp;lt;!--      from the same directory that the Axis engine runs         --&amp;gt;&lt;br /&gt;&lt;br /&gt;&amp;lt;deployment&lt;br /&gt;    xmlns="http://xml.apache.org/axis/wsdd/"&lt;br /&gt;    xmlns:java="http://xml.apache.org/axis/wsdd/providers/java"&amp;gt;&lt;br /&gt;&lt;br /&gt;  &amp;lt;!-- Services from HelloWorldServiceService WSDL service --&amp;gt;&lt;br /&gt;&lt;br /&gt;  &amp;lt;service name="HelloWorld" provider="java:RPC" style="rpc" use="encoded"&amp;gt;&lt;br /&gt;      &amp;lt;parameter name="wsdlTargetNamespace" value="http://jaikiran.com"/&amp;gt;&lt;br /&gt;      &amp;lt;parameter name="wsdlServiceElement" value="HelloWorldServiceService"/&amp;gt;&lt;br /&gt;      &amp;lt;parameter name="wsdlServicePort" value="HelloWorld"/&amp;gt;&lt;br /&gt;      &amp;lt;parameter name="className" value="com.jaikiran.HelloWorldSoapBindingImpl"/&amp;gt;&lt;br /&gt;      &amp;lt;parameter name="wsdlPortType" value="HelloWorldService"/&amp;gt;&lt;br /&gt;      &amp;lt;parameter name="typeMappingVersion" value="1.2"/&amp;gt;&lt;br /&gt;      &amp;lt;operation name="sayHelloTo" qname="operNS:sayHelloTo" xmlns:operNS="http://jaikiran.com" returnQName="sayHelloToReturn" returnType="rtns:string" xmlns:rtns="http://www.w3.org/2001/XMLSchema" soapAction="" &amp;gt;&lt;br /&gt;        &amp;lt;parameter qname="in0" type="tns:string" xmlns:tns="http://www.w3.org/2001/XMLSchema"/&amp;gt;&lt;br /&gt;      &amp;lt;/operation&amp;gt;&lt;br /&gt;      &amp;lt;parameter name="allowedMethods" value="sayHelloTo"/&amp;gt;&lt;br /&gt;      &amp;lt;parameter name="scope" value="Application"/&amp;gt;&lt;br /&gt;&lt;br /&gt;  &amp;lt;/service&amp;gt;&lt;br /&gt;&amp;lt;/deployment&amp;gt;&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;You might notice that during all these steps we never mentioned our implementing class (HelloWorldServiceImpl) in any of the targets. As you can see above in the deploy.wsdd, Axis has created its own implementing class for the HelloWorldService and provided default implementations in that class. In the deploy.wsdd file, it mentioned the implementation class as follows:&lt;br /&gt;&lt;br /&gt;&amp;lt;parameter name="className" value="com.jaikiran.HelloWorldSoapBindingImpl"/&amp;gt;&lt;br /&gt;&lt;br /&gt;The reason why Axis created this implementing class is that it never knew that we had created our own implementation. The input that we provided to Axis for generating the wsdd files was a wsdl file through which Axis could never have known that we already have a implementation class.&lt;br /&gt;&lt;br /&gt;Our next step would be to modify the deploy.wsdd file to mention our implementation class, in place of Axis'. So let's change the 'className' parameter to:&lt;br /&gt;&lt;br /&gt;&amp;lt;parameter name="className" value="org.myapp.service.HelloWorldServiceImpl"/&amp;gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;3d - Deploy the webservice onto the server:&lt;br /&gt;&lt;br /&gt;Now we are almost ready to deploy the webservice onto the server. But before doing that, we will have to make the HelloWorldService.class and HelloWorldServiceImpl.class available in the server's classpath so that when we use this webservice, the server wont throw ClassNotFoundException. So let's compile these 2 classes and place the class files in the %JBOSS_HOME%\server\default\deploy\axis.war\WEB-INF\classes folder. Here's the Ant target that i used to compile these classes:&lt;br /&gt;&lt;br /&gt;&lt;pre name="code" class="xml"&gt;&lt;br /&gt;&amp;lt;target name="compile" description="Compiles java source code"&amp;gt;&lt;br /&gt; &amp;lt;mkdir dir="${classes.dir}"/&amp;gt;&lt;br /&gt; &amp;lt;javac destdir="${classes.dir}" classpathref="classpath" fork="true" srcdir="${compile.src}" excludes="org/myapp/service/client/**/*.java"/&amp;gt;&lt;br /&gt;&amp;lt;/target&amp;gt;&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;Once this is done, we are ready to deploy the webservice onto the server. Axis again provides a utility to do this. Here's the target for deploying the service onto the server. This target just invokes the org.apache.axis.client.AdminClient java class passing it the deploy.wsdd file as an argument.&lt;br /&gt;&lt;br /&gt;&lt;pre name="code" class="xml"&gt;&lt;br /&gt;&amp;lt;target name="deployWebservice" description="Deploys the webservice onto the server, using the wsdd file and Axis' AdminClient"&amp;gt;&lt;br /&gt; &amp;lt;java classname="org.apache.axis.client.AdminClient" classpathref="classpath" fork="true"&amp;gt;&lt;br /&gt;  &amp;lt;arg value="${wsdd.dir}/com/jaikiran/deploy.wsdd"/&amp;gt;&lt;br /&gt; &amp;lt;/java&amp;gt;&lt;br /&gt;&amp;lt;/target&amp;gt;&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;Now that we have deployed the webservice, lets verify whether its deployed successfully. Let's again go to http://localhost:8080/axis . Here again lets click the "List" link to see all the available webservices. This time you will notice that our HelloWorld service is also listed over here. You can view the wsdl of this webservice, by clicking the wsdl link next to it. Our webservice has been deployed at http://localhost:8080/axis/services/HelloWorld as you can see from the wsdl contents. So let's hit this url. You will see a message like:&lt;br /&gt;&lt;br /&gt;HelloWorld&lt;br /&gt;&lt;br /&gt;Hi there, this is an AXIS service!&lt;br /&gt;Perhaps there will be a form for invoking the service here...&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;4) Java client for accessing the webservice that we created:&lt;br /&gt;&lt;br /&gt;Let's now create a simple java client which accesses the webservice that we just deployed on the server.&lt;br /&gt;You might remember that in step 3c, we even created the stubs required to access the webservice. We will use these stubs in our java client to access the webservice. Here's the simple java client:&lt;br /&gt;&lt;br /&gt;&lt;pre name="code" class="java"&gt;&lt;br /&gt;package org.myapp.service.client;&lt;br /&gt;&lt;br /&gt;import com.jaikiran.HelloWorldService;&lt;br /&gt;import com.jaikiran.HelloWorldServiceServiceLocator;&lt;br /&gt;&lt;br /&gt;public class ServiceClient {&lt;br /&gt;&lt;br /&gt;    /**&lt;br /&gt;     * @param args&lt;br /&gt;     */&lt;br /&gt;    public static void main(String[] args) {&lt;br /&gt;&lt;br /&gt;        try {&lt;br /&gt;        &lt;br /&gt;            //Get hold of the webservice using the locator provided by Axis  &lt;br /&gt;            HelloWorldService helloWorldService = new HelloWorldServiceServiceLocator().getHelloWorld();&lt;br /&gt;&lt;br /&gt;     //Invoke the method on the webservice  &lt;br /&gt;            String message = helloWorldService.sayHelloTo("someUserName");&lt;br /&gt;            &lt;br /&gt;            System.out.println("Client received: " + message);&lt;br /&gt;            &lt;br /&gt;        } catch (Exception e) {&lt;br /&gt;            e.printStackTrace();&lt;br /&gt;        }&lt;br /&gt;    }&lt;br /&gt;&lt;br /&gt;}&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;In this class you will notice that we are using HelloWorldServiceServiceLocator and the HelloWorldService which Axis generated for us. Running this client will invoke the webservice deployed on the server.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;5) Ant build file&lt;br /&gt;&lt;br /&gt;Here's the complete build.xml that i used as part of this example:&lt;br /&gt;&lt;br /&gt;&lt;pre name="code" class="xml"&gt;&lt;br /&gt;&amp;lt;?xml version="1.0" encoding="UTF-8"?&amp;gt;&lt;br /&gt;&amp;lt;project name="MyApp" basedir=".." default="compile"&amp;gt;&lt;br /&gt; &lt;br /&gt;  &amp;lt;property name="conf.dir" location="${basedir}/conf" /&amp;gt;&lt;br /&gt;  &amp;lt;property name="build.dir" location="${basedir}/build"/&amp;gt;&lt;br /&gt;  &amp;lt;property name="classes.dir" location="${build.dir}/classes" /&amp;gt;&lt;br /&gt;  &amp;lt;property name="compile.src" location="${basedir}/src" /&amp;gt;&lt;br /&gt;  &amp;lt;property name="lib" location="${basedir}/lib" /&amp;gt;&lt;br /&gt;  &amp;lt;property name="wsdl.dir" location="${build.dir}/wsdl" /&amp;gt;&lt;br /&gt;  &amp;lt;property name="wsdd.dir" location="${build.dir}/wsdd" /&amp;gt;&lt;br /&gt;&lt;br /&gt;  &lt;br /&gt;  &amp;lt;!--  Sets classpath for build  --&amp;gt;&lt;br /&gt;  &amp;lt;path id="classpath"&amp;gt;&lt;br /&gt;   &amp;lt;pathelement path="${java.class.path}" /&amp;gt;&lt;br /&gt;   &amp;lt;fileset dir="${lib}"&amp;gt;&lt;br /&gt;    &amp;lt;include name="**/*.jar" /&amp;gt;&lt;br /&gt;   &amp;lt;/fileset&amp;gt;&lt;br /&gt;   &amp;lt;pathelement path="${classes.dir}" /&amp;gt;&lt;br /&gt;  &amp;lt;/path&amp;gt;&lt;br /&gt;&lt;br /&gt; &lt;br /&gt; &lt;br /&gt; &amp;lt;taskdef name="axis-java2wsdl" classname="org.apache.axis.tools.ant.wsdl.Java2WsdlAntTask" &amp;gt;&lt;br /&gt;         &amp;lt;classpath refid="classpath"/&amp;gt;&lt;br /&gt;   &amp;lt;/taskdef&amp;gt;&lt;br /&gt; &lt;br /&gt; &amp;lt;taskdef name="axis-wsdl2java" classname="org.apache.axis.tools.ant.wsdl.Wsdl2javaAntTask" &amp;gt;&lt;br /&gt;          &amp;lt;classpath refid="classpath"/&amp;gt;&lt;br /&gt; &amp;lt;/taskdef&amp;gt;&lt;br /&gt; &lt;br /&gt; &amp;lt;target name="clean-all" description="Cleans(Deletes) the contents of all output directories"&amp;gt;&lt;br /&gt;  &amp;lt;delete dir="${classes.dir}"/&amp;gt;&lt;br /&gt;  &amp;lt;delete dir="${wsdl.dir}"/&amp;gt;&lt;br /&gt;  &amp;lt;delete dir="${wsdd.dir}"/&amp;gt;&lt;br /&gt; &amp;lt;/target&amp;gt;&lt;br /&gt; &lt;br /&gt; &amp;lt;target name="build-all" description="Builds the entire project" depends="clean-all,compile,generateWSDL,generateWSDD,compileStubs,compile-client"&amp;gt;&lt;br /&gt; &lt;br /&gt; &amp;lt;/target&amp;gt;&lt;br /&gt;&lt;br /&gt; &amp;lt;target name="compile" description="Compiles java source code"&amp;gt;&lt;br /&gt;  &amp;lt;mkdir dir="${classes.dir}"/&amp;gt;&lt;br /&gt;  &amp;lt;javac destdir="${classes.dir}" classpathref="classpath" fork="true" srcdir="${compile.src}" excludes="org/myapp/service/client/**/*.java"/&amp;gt;&lt;br /&gt; &amp;lt;/target&amp;gt;&lt;br /&gt; &lt;br /&gt; &amp;lt;target name="compile-client" description="Compiles the webservice client" depends="compile"&amp;gt;&lt;br /&gt;  &amp;lt;mkdir dir="${classes.dir}"/&amp;gt;&lt;br /&gt;  &amp;lt;javac destdir="${classes.dir}" classpathref="classpath" fork="true" srcdir="${compile.src}" includes="org/myapp/service/client/**/*.java"/&amp;gt;&lt;br /&gt; &amp;lt;/target&amp;gt;&lt;br /&gt; &lt;br /&gt; &amp;lt;target name="generateWSDL" description="Generates wsdl files from the java service interfaces"&amp;gt;&lt;br /&gt;  &amp;lt;mkdir dir="${wsdl.dir}"/&amp;gt;&lt;br /&gt;  &amp;lt;axis-java2wsdl classpathref="classpath"&lt;br /&gt;           output="${wsdl.dir}/HelloWorld.wsdl"&lt;br /&gt;           location="http://localhost:8080/axis/services/HelloWorld"&lt;br /&gt;           namespace="http://jaikiran.com"&lt;br /&gt;           classname="org.myapp.service.HelloWorldService"&amp;gt;&lt;br /&gt;     &amp;lt;mapping namespace="http://jaikiran.com" package="org.myapp.service"/&amp;gt;&lt;br /&gt;  &amp;lt;/axis-java2wsdl&amp;gt;&lt;br /&gt; &amp;lt;/target&amp;gt;&lt;br /&gt; &lt;br /&gt; &amp;lt;target name="generateWSDD" description="Generates wsdd files from the wsdl files"&amp;gt;&lt;br /&gt;  &amp;lt;mkdir dir="${wsdd.dir}"/&amp;gt;&lt;br /&gt;  &amp;lt;axis-wsdl2java&lt;br /&gt;        output="${wsdd.dir}"&lt;br /&gt;        deployscope="Application"&lt;br /&gt;        serverside="true"&lt;br /&gt;        url="${wsdl.dir}\HelloWorld.wsdl"&amp;gt;&lt;br /&gt;  &amp;lt;/axis-wsdl2java&amp;gt;&lt;br /&gt; &amp;lt;/target&amp;gt;&lt;br /&gt; &lt;br /&gt; &amp;lt;target name="compileStubs" description="Compiles the java classes(stubs) generated by Axis using the wsdl2java task"&amp;gt;&lt;br /&gt;  &amp;lt;mkdir dir="${classes.dir}"/&amp;gt;&lt;br /&gt;  &amp;lt;javac destdir="${classes.dir}" classpathref="classpath" fork="true" srcdir="${wsdd.dir}"/&amp;gt;&lt;br /&gt; &amp;lt;/target&amp;gt;&lt;br /&gt; &lt;br /&gt; &amp;lt;target name="deployWebservice" description="Deploys the webservice onto the server, using the wsdd file and Axis' AdminClient"&amp;gt;&lt;br /&gt;  &amp;lt;java classname="org.apache.axis.client.AdminClient" classpathref="classpath" fork="true"&amp;gt;&lt;br /&gt;   &amp;lt;arg value="${wsdd.dir}/com/jaikiran/deploy.wsdd"/&amp;gt;&lt;br /&gt;  &amp;lt;/java&amp;gt;&lt;br /&gt; &amp;lt;/target&amp;gt;&lt;br /&gt; &lt;br /&gt; &amp;lt;target name="undeployWebservice" description="Undeploys webservice using the wsdd file and the Axis' AdminClient"&amp;gt;&lt;br /&gt;  &amp;lt;java classname="org.apache.axis.client.AdminClient" classpathref="classpath" fork="true"&amp;gt;&lt;br /&gt;   &amp;lt;arg value="${wsdd.dir}/com/jaikiran/undeploy.wsdd"/&amp;gt;&lt;br /&gt;  &amp;lt;/java&amp;gt;&lt;br /&gt; &amp;lt;/target&amp;gt;&lt;br /&gt; &lt;br /&gt; &amp;lt;target name="runWebserviceClient" description="Executes the java client which access the webservice"&amp;gt;&lt;br /&gt;   &amp;lt;java classname="org.myapp.service.client.ServiceClient" classpathref="classpath" fork="true"/&amp;gt;&lt;br /&gt; &amp;lt;/target&amp;gt;&lt;br /&gt;  &lt;br /&gt;&amp;lt;/project&amp;gt;&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;6) The project directory structure&lt;br /&gt;&lt;br /&gt;This is how my project's directory structure looks like (just in case you want to create a similar one):&lt;br /&gt;&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;Sample Webservice&lt;br /&gt; |&lt;br /&gt; |&lt;br /&gt; |------------- src&lt;br /&gt; |               | &lt;br /&gt; |               |---- org&lt;br /&gt; |                      |--- myapp&lt;br /&gt; |                             |---- service&lt;br /&gt; |                                     |------- HelloWorldService.java&lt;br /&gt; |                                     |&lt;br /&gt; |                                     |------- HelloWorldServiceImpl.java&lt;br /&gt; |                                     |&lt;br /&gt; |                                     |----- client&lt;br /&gt; |                                              |-------- ServiceClient.java&lt;br /&gt; |&lt;br /&gt; |&lt;br /&gt; |------------- build&lt;br /&gt; |                |----- build.xml&lt;br /&gt; |&lt;br /&gt; |&lt;br /&gt; |------------- lib&lt;br /&gt;                 | &lt;br /&gt;                 |----- activation.jar&lt;br /&gt;                 |----- axis.jar&lt;br /&gt;                 |----- axis-ant.jar&lt;br /&gt;                 |----- commons-discovery-0.2.jar&lt;br /&gt;                 |----- commons-logging-1.0.4.jar&lt;br /&gt;                 |----- jaxrpc.jar&lt;br /&gt;                 |----- mailapi_1_3_1.jar&lt;br /&gt;                 |----- saaj.jar&lt;br /&gt;                 |----- wsdl4j-1.5.1.jar&lt;br /&gt;&lt;br /&gt;&lt;/pre&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/30587633-2296523205344856577?l=jaitechwriteups.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://jaitechwriteups.blogspot.com/feeds/2296523205344856577/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='https://www.blogger.com/comment.g?blogID=30587633&amp;postID=2296523205344856577' title='77 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/30587633/posts/default/2296523205344856577'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/30587633/posts/default/2296523205344856577'/><link rel='alternate' type='text/html' href='http://jaitechwriteups.blogspot.com/2006/12/simple-webservice-on-jboss-using-axis.html' title='Simple Webservice on JBoss using Axis'/><author><name>Jaikiran</name><uri>http://www.blogger.com/profile/08503182723143814781</uri><email>noreply@blogger.com</email><gd:extendedProperty xmlns:gd='http://schemas.google.com/g/2005' name='OpenSocialUserId' value='07020825996152190351'/></author><thr:total xmlns:thr='http://purl.org/syndication/thread/1.0'>77</thr:total></entry><entry><id>tag:blogger.com,1999:blog-30587633.post-8173928952828911221</id><published>2007-01-04T06:01:00.000-08:00</published><updated>2008-07-11T22:10:23.596-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Java'/><category scheme='http://www.blogger.com/atom/ns#' term='J2EE'/><title type='text'>How to read a properties file in a web application</title><content type='html'>The code to do this is pretty simple. But going by the number of people who keep asking this question, i thought i would post the code over here. Let's consider that you have a war file named SampleApp.war which has a properties file named myApp.properties at it's root : &lt;br /&gt;&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;&lt;br /&gt;SampleApp.war&lt;br /&gt;   |&lt;br /&gt;   |-------- myApp.properties&lt;br /&gt;   |&lt;br /&gt;   |-------- WEB-INF&lt;br /&gt;                |&lt;br /&gt;                |---- classes&lt;br /&gt;                         |&lt;br /&gt;                         |----- org&lt;br /&gt;                                 |------ myApp&lt;br /&gt;                                           |------- MyPropertiesReader.class&lt;br /&gt;                                           &lt;br /&gt;&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;                               &lt;br /&gt;   &lt;br /&gt;Let's assume that you want to read the property named "abc" present in the properties file:&lt;br /&gt;&lt;br /&gt;----------------&lt;br /&gt;myApp.properties:&lt;br /&gt;----------------&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;abc=some value&lt;br /&gt;xyz=some other value&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;Let's consider that the class org.myApp.MyPropertiesReader present in your application wants to read the property. Here's the code for the same:&lt;br /&gt;&lt;br /&gt;&lt;pre name="code" class="java"&gt;&lt;br /&gt;&lt;br /&gt;package org.myapp;&lt;br /&gt;&lt;br /&gt;import java.io.IOException;&lt;br /&gt;import java.io.InputStream;&lt;br /&gt;import java.util.Properties;&lt;br /&gt;&lt;br /&gt;/**&lt;br /&gt; * Simple class meant to read a properties file&lt;br /&gt; * &lt;br /&gt; * @author Jaikiran Pai&lt;br /&gt; * &lt;br /&gt; */&lt;br /&gt;public class MyPropertiesReader {&lt;br /&gt;&lt;br /&gt;    /**&lt;br /&gt;     * Default Constructor&lt;br /&gt;     * &lt;br /&gt;     */&lt;br /&gt;    public MyPropertiesReader() {&lt;br /&gt;&lt;br /&gt;    }&lt;br /&gt;&lt;br /&gt;    /**&lt;br /&gt;     * Some Method&lt;br /&gt;     * &lt;br /&gt;     * @throws IOException&lt;br /&gt;     * &lt;br /&gt;     */&lt;br /&gt;    public void doSomeOperation() throws IOException {&lt;br /&gt;        // Get the inputStream&lt;br /&gt;        InputStream inputStream = this.getClass().getClassLoader()&lt;br /&gt;                .getResourceAsStream("myApp.properties");&lt;br /&gt;&lt;br /&gt;        Properties properties = new Properties();&lt;br /&gt;&lt;br /&gt;        System.out.println("InputStream is: " + inputStream);&lt;br /&gt;&lt;br /&gt;        // load the inputStream using the Properties&lt;br /&gt;        properties.load(inputStream);&lt;br /&gt;        // get the value of the property&lt;br /&gt;        String propValue = properties.getProperty("abc");&lt;br /&gt;&lt;br /&gt;        System.out.println("Property value is: " + propValue);&lt;br /&gt;    }&lt;br /&gt;&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Pretty straight-forward. Now suppose the properties file is not at the root of the application, but inside a folder (let's name it config) in the web application, something like:&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;&lt;br /&gt;SampleApp.war&lt;br /&gt;   |&lt;br /&gt;   |-------- config&lt;br /&gt;   |           |------- myApp.properties   &lt;br /&gt;   |           &lt;br /&gt;   |&lt;br /&gt;   |-------- WEB-INF&lt;br /&gt;                |&lt;br /&gt;                |---- classes&lt;br /&gt;                         |&lt;br /&gt;                         |----- org&lt;br /&gt;                                 |------ myApp&lt;br /&gt;                                           |------- MyPropertiesReader.class&lt;br /&gt;                                           &lt;br /&gt;&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;There will just be one line change in the above code:&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;pre name="code" class="java"&gt;&lt;br /&gt;&lt;br /&gt;  public void doSomeOperation() throws IOException {&lt;br /&gt;        //Get the inputStream--&amp;gt;This time we have specified the folder name too.&lt;br /&gt;        InputStream inputStream = this.getClass().getClassLoader()&lt;br /&gt;                .getResourceAsStream("config/myApp.properties");&lt;br /&gt;        &lt;br /&gt;        Properties properties = new Properties();&lt;br /&gt;         &lt;br /&gt;        System.out.println("InputStream is: " + inputStream);&lt;br /&gt;        &lt;br /&gt;        //load the inputStream using the Properties&lt;br /&gt;        properties.load(inputStream);&lt;br /&gt;        //get the value of the property&lt;br /&gt;        String propValue = properties.getProperty("abc");&lt;br /&gt;        &lt;br /&gt;        System.out.println("Property value is: " + propValue);&lt;br /&gt;    }&lt;br /&gt;    &lt;br /&gt;&lt;/pre&gt;&lt;br /&gt; &lt;br /&gt; That's all that is required to get it working.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/30587633-8173928952828911221?l=jaitechwriteups.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://jaitechwriteups.blogspot.com/feeds/8173928952828911221/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='https://www.blogger.com/comment.g?blogID=30587633&amp;postID=8173928952828911221' title='22 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/30587633/posts/default/8173928952828911221'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/30587633/posts/default/8173928952828911221'/><link rel='alternate' type='text/html' href='http://jaitechwriteups.blogspot.com/2007/01/how-to-read-properties-file-in-web.html' title='How to read a properties file in a web application'/><author><name>Jaikiran</name><uri>http://www.blogger.com/profile/08503182723143814781</uri><email>noreply@blogger.com</email><gd:extendedProperty xmlns:gd='http://schemas.google.com/g/2005' name='OpenSocialUserId' value='07020825996152190351'/></author><thr:total xmlns:thr='http://purl.org/syndication/thread/1.0'>22</thr:total></entry><entry><id>tag:blogger.com,1999:blog-30587633.post-7758777114422914952</id><published>2006-10-30T22:01:00.000-08:00</published><updated>2006-10-30T22:11:23.469-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='J2EE'/><title type='text'>How to package an application into a ear file</title><content type='html'>This is for those who want to know the ideal and most common way an application is packaged in the form of an ear file. Here's how the application structure will look like:&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;myApp.ear&lt;br /&gt; |&lt;br /&gt; |--------- META-INF&lt;br /&gt; |            |&lt;br /&gt; |            |---------- application.xml&lt;br /&gt; |&lt;br /&gt; |--------- myEJB.jar&lt;br /&gt; |            |&lt;br /&gt; |            |--------- META-INF&lt;br /&gt; |            |            |&lt;br /&gt; |            |            |-------- ejb-jar.xml  &lt;br /&gt; |            |&lt;br /&gt; |            |------ org&lt;br /&gt; |            |         |----- myApp&lt;br /&gt; |            |                 |------- ejb&lt;br /&gt; |                                        |-------- *.class&lt;br /&gt; |&lt;br /&gt; |---------- myWeb.war&lt;br /&gt; |              |&lt;br /&gt; |              |----- WEB-INF&lt;br /&gt; |                      |------ web.xml&lt;br /&gt; |                      |&lt;br /&gt; |                      |------ jsp&lt;br /&gt; |                               |---- *.jsp&lt;br /&gt; |&lt;br /&gt; |---------- commonUtil.jar&lt;br /&gt;               |&lt;br /&gt;               |--------- org&lt;br /&gt;                           |----- myApp&lt;br /&gt;                                    |------ common&lt;br /&gt;                                             |----- *.class&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;The application.xml present in the META-INF folder of the ear will contain the following:&lt;br /&gt;&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;&amp;lt;?xml version="1.0" encoding="UTF-8"?&amp;gt;&lt;br /&gt;&amp;lt;!DOCTYPE application PUBLIC "-//Sun Microsystems, Inc.//DTD J2EE Application 1.3//EN" "http://java.sun.com/dtd/application_1_3.dtd"&amp;gt;&lt;br /&gt;&amp;lt;application&amp;gt;&lt;br /&gt; &amp;lt;display-name&amp;gt;helloworld&amp;lt;/display-name&amp;gt;&lt;br /&gt; &lt;br /&gt; &amp;lt;module&amp;gt;&lt;br /&gt;  &amp;lt;java&amp;gt;commonUtil.jar&amp;lt;/java&amp;gt;&lt;br /&gt; &amp;lt;/module&amp;gt;&lt;br /&gt; &lt;br /&gt; &amp;lt;module&amp;gt;&lt;br /&gt;  &amp;lt;web&amp;gt;&lt;br /&gt;   &amp;lt;web-uri&amp;gt;myWeb.war&amp;lt;/web-uri&amp;gt;&lt;br /&gt;   &amp;lt;context-root&amp;gt;/myWeb&amp;lt;/context-root&amp;gt;&lt;br /&gt;  &amp;lt;/web&amp;gt;&lt;br /&gt; &amp;lt;/module&amp;gt;&lt;br /&gt; &lt;br /&gt; &amp;lt;module&amp;gt;&lt;br /&gt;  &amp;lt;ejb&amp;gt;myEJB.jar&amp;lt;/ejb&amp;gt;&lt;br /&gt; &amp;lt;/module&amp;gt;&lt;br /&gt; &lt;br /&gt;&amp;lt;/application&amp;gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;/pre&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/30587633-7758777114422914952?l=jaitechwriteups.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://jaitechwriteups.blogspot.com/feeds/7758777114422914952/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='https://www.blogger.com/comment.g?blogID=30587633&amp;postID=7758777114422914952' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/30587633/posts/default/7758777114422914952'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/30587633/posts/default/7758777114422914952'/><link rel='alternate' type='text/html' href='http://jaitechwriteups.blogspot.com/2006/10/how-to-package-application-into-ear.html' title='How to package an application into a ear file'/><author><name>Jaikiran</name><uri>http://www.blogger.com/profile/08503182723143814781</uri><email>noreply@blogger.com</email><gd:extendedProperty xmlns:gd='http://schemas.google.com/g/2005' name='OpenSocialUserId' value='07020825996152190351'/></author><thr:total xmlns:thr='http://purl.org/syndication/thread/1.0'>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-30587633.post-115643390456699330</id><published>2006-08-24T08:35:00.000-07:00</published><updated>2006-10-30T05:51:44.677-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Hibernate'/><title type='text'>inverse attribute in Hibernate - What does it mean?</title><content type='html'>&lt;span&gt;&lt;br /&gt;&lt;br /&gt;This is the best explanation, that i have seen till date, about Hibernate's "inverse" attribute:&lt;br /&gt;&lt;a href="http://blogs.warwick.ac.uk/colinyates/entry/hibernates_bizzare_interpretation/"&gt;Meaning of "inverse" in Hibernate&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/30587633-115643390456699330?l=jaitechwriteups.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://jaitechwriteups.blogspot.com/feeds/115643390456699330/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='https://www.blogger.com/comment.g?blogID=30587633&amp;postID=115643390456699330' title='3 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/30587633/posts/default/115643390456699330'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/30587633/posts/default/115643390456699330'/><link rel='alternate' type='text/html' href='http://jaitechwriteups.blogspot.com/2006/08/inverse-attribute-in-hibernate-what.html' title='inverse attribute in Hibernate - What does it mean?'/><author><name>Jaikiran</name><uri>http://www.blogger.com/profile/08503182723143814781</uri><email>noreply@blogger.com</email><gd:extendedProperty xmlns:gd='http://schemas.google.com/g/2005' name='OpenSocialUserId' value='07020825996152190351'/></author><thr:total xmlns:thr='http://purl.org/syndication/thread/1.0'>3</thr:total></entry><entry><id>tag:blogger.com,1999:blog-30587633.post-115642264706547400</id><published>2006-08-24T05:30:00.000-07:00</published><updated>2006-10-30T05:51:44.606-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Hibernate'/><title type='text'>Evict collection from Hibernate second level cache</title><content type='html'>&lt;span&gt;&lt;br /&gt;Hibernate allows persistent objects to be cached in its second level cache(The first level cache in Hibernate is the Session object which is ON by default). Applications can switch on the second level cache.  When a object is being retrieved by the application through Hibernate, Hibernate first checks in its Session cache and then the Second level cache to see if the object has be retrieved already. If it finds it either the Session cache or the Second level cache, it will NOT fire a query to the database.&lt;br /&gt;While configuring second level cache, the object can be cached and also the collections contained in the object can be cached. Have a look at the following example:&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;&amp;lt;hibernate-mapping default-lazy=&amp;quot;false&amp;quot; &amp;gt; &lt;br /&gt; &amp;lt;class name=&amp;quot;org.myapp.ho.Parent&amp;quot; table=&amp;quot;Parent&amp;quot;&amp;gt; &lt;br /&gt;    &amp;lt;b&amp;gt;&amp;lt;cache usage=&amp;quot;read-only&amp;quot; /&amp;gt; &amp;lt;/b&amp;gt;&lt;br /&gt;    &amp;lt;id name=&amp;quot;id&amp;quot; type=&amp;quot;Integer&amp;quot; column=&amp;quot;ID&amp;quot; /&amp;gt; &lt;br /&gt;  &amp;lt;set name=&amp;quot;myChildren&amp;quot;&amp;gt; &lt;br /&gt;     &amp;lt;b&amp;gt; &amp;lt;cache usage=&amp;quot;read-only&amp;quot;/&amp;gt; &amp;lt;/b&amp;gt;&lt;br /&gt;     &amp;lt;one-to-many class=&amp;quot;org.myapp.ho.Child&amp;quot;/&amp;gt; &lt;br /&gt;  &amp;lt;/set&amp;gt; &lt;br /&gt; &amp;lt;/class&amp;gt; &lt;br /&gt;&amp;lt;/hibernate-mapping&amp;gt;&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;&amp;lt;hibernate-mapping default-lazy=&amp;quot;false&amp;quot; &amp;gt; &lt;br /&gt;   &amp;lt;class name=&amp;quot;org.myapp.ho.Child&amp;quot; table=&amp;quot;Child&amp;quot;&amp;gt;&lt;br /&gt;      &amp;lt;b&amp;gt;&amp;lt;cache usage=&amp;quot;read-only&amp;quot; /&amp;gt;&amp;lt;/b&amp;gt;&lt;br /&gt;      &amp;lt;id name=&amp;quot;id&amp;quot; type=&amp;quot;Integer&amp;quot; column=&amp;quot;ID&amp;quot; /&amp;gt; &lt;br /&gt;   &amp;lt;/class&amp;gt; &lt;br /&gt;&amp;lt;/hibernate-mapping&amp;gt;&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;Note that we have used the cache setting at 3 places:&lt;br /&gt; 1) The org.myapp.ho.Parent object&lt;br /&gt; 2) The "myChildren" collection in the org.myapp.ho.Parent object&lt;br /&gt; 3) The org.myapp.ho.Child object&lt;br /&gt;When you configure a collection to be second level cached in Hibernate, it internally maintains a SEPERATE cache for these collection than the one which it uses to cache the parent objects. So in the example above, the “myChildren” will be cached separately than the org.myapp.ho.Parent object.&lt;br /&gt;There might be cases where applications would want to evict objects from the cache. If its the Session cache from which the application has to evict the object then the call to Session.evict will cascade even to collections and will evict the collection from the *Session cache*. However, if the object(and the collections contained in it) have to be evicted from the second level cache, then the application has to *explicitly* call the evictCollection method on the SessionFactory to remove the *collection* contained in the Parent object. The reason behind this is, as already mentioned, the collections are cached separately, than the parent objects, in the second level cache.&lt;br /&gt;So, in our example above, if we have to evict the Parent with id 500 and its collection from the second level cache, then here’s what has to be done:&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;SessionFactory sf = MyUtil.getSessionFactory();&lt;br /&gt;//this will evict the Parent Object from the second level cache&lt;br /&gt;sf.evict(org.myapp.ho.Parent.class,new Integer(500)); &lt;br /&gt;//this will evict the collection from the second level cache for the Parent with id=500&lt;br /&gt;sf.evictCollection(org.myapp.ho.Parent.class.getName() +  ".myChildren", new Integer(500)); &lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;The first parameter to the evictCollection method is the ‘roleName’ of the collection. The roleName is formed as follows:&lt;br /&gt;&lt;br /&gt;roleName = NameOfTheParentClass + "." + NameOfTheCollectionInsideTheParent&lt;br /&gt;&lt;br /&gt;The second parameter the evictCollection method is the id of the parent object, to which this collection belongs. &lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/30587633-115642264706547400?l=jaitechwriteups.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://jaitechwriteups.blogspot.com/feeds/115642264706547400/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='https://www.blogger.com/comment.g?blogID=30587633&amp;postID=115642264706547400' title='11 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/30587633/posts/default/115642264706547400'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/30587633/posts/default/115642264706547400'/><link rel='alternate' type='text/html' href='http://jaitechwriteups.blogspot.com/2006/08/evict-collection-from-hibernate-second.html' title='Evict collection from Hibernate second level cache'/><author><name>Jaikiran</name><uri>http://www.blogger.com/profile/08503182723143814781</uri><email>noreply@blogger.com</email><gd:extendedProperty xmlns:gd='http://schemas.google.com/g/2005' name='OpenSocialUserId' value='07020825996152190351'/></author><thr:total xmlns:thr='http://purl.org/syndication/thread/1.0'>11</thr:total></entry><entry><id>tag:blogger.com,1999:blog-30587633.post-115641688503559904</id><published>2006-08-24T03:53:00.000-07:00</published><updated>2006-10-30T05:51:44.230-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Java'/><title type='text'>How to enable Garbage Collection (GC) logs</title><content type='html'>&lt;span&gt;&lt;br /&gt;To enable GC logs, the -Xloggc:logFileName option will have to be passed when java command is being executed. Additionally if the detailed log of the GC is required, then an additional -XX:+PrintGCDetails option will have to be passed.&lt;br /&gt;&lt;br /&gt;&lt;pre&gt;Example: java -Xloggc:D:/log/myLogFile.log -XX:+PrintGCDetails myProg &lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/30587633-115641688503559904?l=jaitechwriteups.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://jaitechwriteups.blogspot.com/feeds/115641688503559904/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='https://www.blogger.com/comment.g?blogID=30587633&amp;postID=115641688503559904' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/30587633/posts/default/115641688503559904'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/30587633/posts/default/115641688503559904'/><link rel='alternate' type='text/html' href='http://jaitechwriteups.blogspot.com/2006/08/how-to-enable-garbage-collection-gc.html' title='How to enable Garbage Collection (GC) logs'/><author><name>Jaikiran</name><uri>http://www.blogger.com/profile/08503182723143814781</uri><email>noreply@blogger.com</email><gd:extendedProperty xmlns:gd='http://schemas.google.com/g/2005' name='OpenSocialUserId' value='07020825996152190351'/></author><thr:total xmlns:thr='http://purl.org/syndication/thread/1.0'>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-30587633.post-115211186260064253</id><published>2006-07-05T07:57:00.000-07:00</published><updated>2006-10-30T05:51:43.883-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Log4j'/><title type='text'>I get "log4j:WARN No appenders could be found for logger" message</title><content type='html'>&lt;span style="font-family:georgia;font-size:85%;"&gt;While using log4j in your application, sometimes you might encounter the following message:&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;&lt;span style="color:#660000;"&gt;log4j:WARN No appenders could be found for logger(somePackageName.someClassName).&lt;br /&gt;log4j:WARN Please initialize the log4j system properly.&lt;/span&gt;&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;The reason why you see this message is that your log4j configuration file(i.e. log4j.xml or log4j.properties) is NOT found in the classpath. Placing the log4j configuration file in the applications classpath should solve the issue. If you want to find out how log4j tries to configure itself, have a look at my earlier post :&lt;br /&gt;&lt;br /&gt;&lt;a href="http://jaitechwriteups.blogspot.com/2006/07/know-how-log4j-tries-to-configure.html" target="_blank()"&gt;Know how log4j tries to configure itself&lt;/a&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:georgia;font-size:85%;"&gt;&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="font-family:georgia;font-size:85%;"&gt;&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/30587633-115211186260064253?l=jaitechwriteups.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://jaitechwriteups.blogspot.com/feeds/115211186260064253/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='https://www.blogger.com/comment.g?blogID=30587633&amp;postID=115211186260064253' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/30587633/posts/default/115211186260064253'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/30587633/posts/default/115211186260064253'/><link rel='alternate' type='text/html' href='http://jaitechwriteups.blogspot.com/2006/07/i-get-log4jwarn-no-appenders-could-be.html' title='I get &quot;log4j:WARN No appenders could be found for logger&quot; message'/><author><name>Jaikiran</name><uri>http://www.blogger.com/profile/08503182723143814781</uri><email>noreply@blogger.com</email><gd:extendedProperty xmlns:gd='http://schemas.google.com/g/2005' name='OpenSocialUserId' value='07020825996152190351'/></author><thr:total xmlns:thr='http://purl.org/syndication/thread/1.0'>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-30587633.post-115200668776820895</id><published>2006-07-04T02:44:00.000-07:00</published><updated>2006-10-30T05:51:43.820-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Log4j'/><title type='text'>Know how log4j tries to configure itself</title><content type='html'>&lt;span style="font-family:georgia;font-size:85%;"&gt;Large number of applications use &lt;a href="http://logging.apache.org/log4j/docs/documentation.html" target="_blank()"&gt;log4j&lt;/a&gt; for logging. Sometimes you may encounter cases where you sense that log4j is using some other configurations, other than the one that you expected it to use. You can debug the same by switching on the debug flag on log4j. Here's how you can do it:&lt;br /&gt;&lt;br /&gt;Add &lt;span style="color:#660000;"&gt;&lt;strong&gt;-Dlog4j.debug&lt;/strong&gt; &lt;/span&gt;to the command line. log4j will output info to std. out. telling you how it tries to configure itself.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/30587633-115200668776820895?l=jaitechwriteups.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://jaitechwriteups.blogspot.com/feeds/115200668776820895/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='https://www.blogger.com/comment.g?blogID=30587633&amp;postID=115200668776820895' title='18 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/30587633/posts/default/115200668776820895'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/30587633/posts/default/115200668776820895'/><link rel='alternate' type='text/html' href='http://jaitechwriteups.blogspot.com/2006/07/know-how-log4j-tries-to-configure.html' title='Know how log4j tries to configure itself'/><author><name>Jaikiran</name><uri>http://www.blogger.com/profile/08503182723143814781</uri><email>noreply@blogger.com</email><gd:extendedProperty xmlns:gd='http://schemas.google.com/g/2005' name='OpenSocialUserId' value='07020825996152190351'/></author><thr:total xmlns:thr='http://purl.org/syndication/thread/1.0'>18</thr:total></entry></feed>