<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>JavaBeat &#187; JBoss</title>
	<atom:link href="http://www.javabeat.net/category/web-frameworks/jboss/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.javabeat.net</link>
	<description>Java Technology News</description>
	<lastBuildDate>Fri, 24 May 2013 01:32:07 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.5.1</generator>
		<item>
		<title>JBoss AS 5 Performance Tuning</title>
		<link>http://www.javabeat.net/2011/01/jboss-as-5-performance-tuning/</link>
		<comments>http://www.javabeat.net/2011/01/jboss-as-5-performance-tuning/#comments</comments>
		<pubDate>Sat, 29 Jan 2011 17:53:10 +0000</pubDate>
		<dc:creator>krishnas</dc:creator>
				<category><![CDATA[JBoss]]></category>

		<guid isPermaLink="false">http://www.javabeat.net/?p=1525</guid>
		<description><![CDATA[<p>Connect to us ( <a href="https://twitter.com/javabeat">@twitter</a> | <a href="https://www.facebook.com/javabeat.net">@facebook )</p><p>JBoss AS 5 Performance TuningJBoss AS 5 Performance Tuning will teach you how to deliver fast applications on the JBoss Application Server and Apache Tomcat, giving you a decisive competitive advantage over your competitors. You will learn how to optimize hardware resources, meeting your application requirements with less expenditure. The performance of Java Enterprise applications is the sum [...]</p>]]></description>
				<content:encoded><![CDATA[<p>Connect to us ( <a href="https://twitter.com/javabeat">@twitter</a> | <a href="https://www.facebook.com/javabeat.net">@facebook )</p><div class="wpInsert wpInsertInPostAd wpInsertLeft" style="float: left; margin: 5px; padding: 0px;"><script type="text/javascript"><!--
google_ad_client = "ca-pub-1490953723360528";
/* Article-Rect */
google_ad_slot = "9976259118";
google_ad_width = 300;
google_ad_height = 250;
//-->
</script>
<script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script></div><a id="dd_start"></a><p><center>JBoss AS 5 Performance Tuning</center><b>JBoss</b> AS 5 Performance Tuning will teach you how to deliver fast applications on the <b>JBoss</b> Application Server and Apache Tomcat, giving you a decisive competitive advantage over your competitors. You will learn how to optimize hardware resources, meeting your application requirements with less expenditure.</p>
<p>The performance of Java Enterprise applications is the sum of a set of components including the Java Virtual Machine configuration, the application server configuration (in our case, <b>JBoss</b> AS), the application code itself, and ultimately the operating system. This<br />
book will show you how to apply the correct tuning methodology and use the tuning tools that will help you to monitor and address any performance issues.</p>
<p>By looking more closely at the Java Virtual Machine, you will get a deeper understanding of what the available options are for your applications, and how their performance will be affected. Learn about thread pool tuning, EJB tuning, and JMS tuning, which are crucial parts of enterprise applications.</p>
<p>The persistence layer and the <b>JBoss Clustering</b> service are two of the most crucial elements which need to be configured correctly in order to run a fast application. These aspects are covered in detail with a chapter dedicated to each of them.</p>
<p>Finally, Web server tuning is the last (but not least) topic covered, which shows how to configure and develop web applications that get the most out of the embedded Tomcat web server.</p>
<h2>What This Book Covers</h2>
<p><i>Chapter 1, Performance Tuning Concepts</i>, discusses correct tuning methodology and how it fits in the overall software development cycle.</p>
<p><i>Chapter 2, Installing the Tools for Tuning</i>, shows how to install and configure the instruments for tuning, including VisualVM, JMeter, Eclipse TPTP Platform, and basic OS tools.</p>
<p><i>Chapter 3, Tuning the Java Virtual Machine</i>, provides an in-depth analysis of the JVM heap and garbage collector parameters, which are used to start up the application server.</p>
<p><i>Chapter 4, Tuning the <b>JBoss</b> AS</i>, discusses the application server&#8217;s core services including the <b>JBoss</b> System Thread Pool, the Connection Pool, and the Logging Service.</p>
<p><i>Chapter 5, Tuning the Middleware Services</i>, covers the tuning of middleware services including the EJB and JMS services.</p>
<p><i>Chapter 6, Tuning the Persistence Layer</i>, introduces the principles of good database design and the core concepts of Java Persistence API with special focus on <b>JBoss</b>&#8216;s implementation (Hibernate).</p>
<p><i>Chapter 7, <b>JBoss AS Cluster Tuning</b></i>, covers <b>JBoss Clustering</b> service covering the lowlevel details of server communication and how to use <b>JBoss</b> Cache for optimal data replication and caching.</p>
<p><i>Chapter 8, Tomcat Web Server Tuning</i>, covers the <b>JBoss</b> Web server performance tuning including mod_jk, mod_proxy, and mod_cluster modules.</p>
<p><i>Chapter 9, Tuning Web Applications on <b>JBoss</b> AS</i>, discusses developing fast web applications using JSF API and <b>JBoss</b> richfaces libraries.</p>
<p><center><b>JBoss AS Cluster Tuning</b></center></p>
<pre><code><i>
	6th Circle of Hell: Heresy. This circle houses administrators who accurately set up
	a cluster to use Buddy Replication. Without caring about steady sessions.
</i></code></pre>
<p style="text-align: left;">Clustering allows us to run applications on several parallel instances (also known as cluster nodes). The load is distributed across different servers, and even if any of the servers fails, the application is still accessible via other cluster nodes. Clustering is crucial for scalable Enterprise applications, as you can improve performance by simply adding more nodes to the cluster.</p>
<p>In this chapter, we will cover the basic building blocks of JBoss Clustering with the following schedule:</p>
<ul>
<li>A short introduction to <b>JBoss Clustering platform</b></li>
</ul>
<ul>
<li>In the next section we will cover the low level details of the JGroups library, which is used for all clustering-related communications between nodes</li>
</ul>
<ul>
<li>In the third section we will discuss <b>JBoss</b> Cache, which provides distributed cache and state replication services for the <b>JBoss</b> cluster on top of the JGroups library</li>
</ul>
<h2>Introduction to JBoss clustering</h2>
<p>Clustering plays an important role in Enterprise applications as it lets you split the load of your application across several nodes, granting robustness to your<br />
applications. As we discussed earlier, for optimal results it&#8217;s better to limit the size of your JVM to a maximum of 2-2.5GB, otherwise the dynamics of the<br />
garbage collector will decrease your application&#8217;s performance.</p>
<p>Combining relatively smaller Java heaps with a solid clustering configuration can lead to a better, scalable configuration plus significant hardware savings.</p>
<p>The only drawback to scaling out your applications is an increased complexity in the programming model, which needs to be correctly understood by aspiring architects.</p>
<p>JBoss AS comes out of the box with clustering support. There is no all-in-one library that deals with clustering but rather a set of libraries, which cover different kinds of aspects. The following picture shows how these libraries are arranged:</p>
<p><center><img alt="" src="images/2011/01/JBoss-AS-Cluster-Tuning/1.jpg" /></center>The backbone of <b>JBoss Clustering</b> is the <b>JGroups</b> library, which provides the communication between members of the cluster. Built upon JGroups we meet two building blocks, the <b>JBoss Cache</b> framework and the <b>HAPartition</b> service. <b>JBoss</b> Cache handles the consistency of your application across the cluster by means of a replicated and transactional cache.</p>
<p>On the other hand, HAPartition is an abstraction built on top of a JGroups Channel that provides support for making and receiving RPC invocations from one or more cluster members. For example <b>HA-JNDI</b> (High Availability JNDI) or <b>HA Singleton </b>(High Availability Singleton) both use HAPartition to share a single Channel and multiplex RPC invocations over it, eliminating the configuration complexity and runtime overhead of having each service create its own Channel. (If you need more information about the HAPartition service you can consult the JBoss AS documentation http://community.jboss.org/wiki/jBossAS5ClusteringGuide.). In the next section we will learn more about the JGroups library and how to configure it to reach the best performance for clustering communication.</p>
<h2>Configuring JGroups transport</h2>
<p>Clustering requires communication between nodes to synchronize the state of running applications or to notify changes in the cluster definition. JGroups (http://jgroups.org/manual/html/index.html) is a reliable group communication toolkit written entirely in Java. It is based on IP multicast, but extends by providing reliability and group membership.</p>
<p>Member processes of a group can be located on the same host, within the same Local Area Network (LAN), or across a Wide Area Network (WAN). A member can be in turn part of multiple groups. The following picture illustrates a detailed view of JGroups architecture:</p>
<p><center><img alt="" src="images/2011/01/JBoss-AS-Cluster-Tuning/2.jpg" /></center>A JGroups process consists basically of three parts, namely the Channel, Building blocks, and the Protocol stack. The <i>Channel</i> is a simple socket-like interface used by application programmers to build reliable group communication applications. <i>Building blocks</i> are an abstraction interface layered on top of Channels, which can be used instead of Channels whenever a higher-level interface is required. Finally we have the <i>Protocol stack</i>, which implements the properties specified for a given channel.</p>
<pre><code>
	In theory, you could configure every service to bind to a
	different Channel. However this would require a complex thread
	infrastructure with too many thread context switches. For this
	reason, JBoss AS is configured by default to use <i>a single Channel</i>
	to multiplex all the traffic across the cluster.</code></pre>
<p>The Protocol stack contains a number of layers in a bi-directional list. All messages sent and received over the channel have to pass through all protocols. Every layer may modify, reorder, pass or drop a message, or add a header to a message. A fragmentation layer might break up a message into several smaller messages, adding a header with an ID to each fragment, and re-assemble the fragments on the receiver&#8217;s side.</p>
<p>The composition of the Protocol stack (that is, its layers) is determined by the creator of the channel: an XML file defines the layers to be used (and the parameters for each layer).</p>
<pre><code>	Knowledge about the Protocol stack is not necessary when
	just using <b>Channels</b> in an application. However, when an
	application wishes to ignore the default properties for a Protocol
	stack, and configure their own stack, then knowledge about what
	the individual layers are supposed to do is needed.</code></pre>
<p>In JBoss AS, the configuration of the Protocol stack is located in the file, \deploy\cluster\jgroups-channelfactory.sar\META-INF\jgroupschannelfactory-stacks.xml.</p><div class="wpInsert wpInsertInPostAd wpInsertMiddle" style="margin: 5px; padding: 0px;"><script type="text/javascript"><!--
google_ad_client = "ca-pub-1490953723360528";
/* Article-Middle-Med-Rect */
google_ad_slot = "7805667846";
google_ad_width = 300;
google_ad_height = 250;
//-->
</script>
<script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script></div>
<p>The file is quite large to fit here, however, in a nutshell, it contains the following basic elements:</p>
<p><center><img alt="" src="images/2011/01/JBoss-AS-Cluster-Tuning/3.jpg" /></center>The first part of the file includes the <b>UDP</b> transport configuration. UDP is thedefault protocol for JGroups and uses multicast (or, if not available, multiple unicast messages) to send and receive messages.</p>
<pre><code>	A multicast UDP socket can send and receive datagrams from multiple
	clients. The interesting and useful feature of multicast is that a client
	can contact multiple servers with a single packet, without knowing the
	specific IP address of any of the hosts.</code></pre>
<p>Next to the UDP transport configuration, three protocol stacks are defined:</p>
<ul>
<li>udp: The default IP multicast based stack, with flow control</li>
</ul>
<ul>
<li>udp-async: The protocol stack optimized for high-volume asynchronous RPCs</li>
</ul>
<ul>
<li>udp-sync: The stack optimized for low-volume synchronous RPCs</li>
</ul>
<p>Thereafter, the <b>TCP transport configuration</b> is defined . TCP stacks are typically used when IP multicasting cannot be used in a network (for example, because it is disabled) or because you want to create a network over a WAN (that&#8217;s conceivably possible but sharing data across remote geographical sites is a scary option from the performance point of view).</p>
<p>You can opt for two TCP protocol stacks:</p>
<ul>
<li>tcp: Addresses the default TCP Protocol stack which is best suited to high-volume asynchronous calls.</li>
</ul>
<ul>
<li>tcp-async: Addresses the TCP Protocol stack which can be used for low-volume synchronous calls.</li>
</ul>
<pre><code>
	If you need to switch to TCP stack, you can simply include the following
	in your command line args that you pass to JBoss:
	-Djboss.default.jgroups.stack=tcp
	Since you are not using multicast in your TCP communication, this
	requires configuring the addresses/ports of all the possible nodes in the
	cluster. You can do this by using the property -Djgroups.tcpping.
	initial_hosts. For example:
	-Djgroups.tcpping.initial_hosts=host1[7600],host2[7600]</code></pre>
<p>Ultimately, the configuration file contains two stacks which can be used for optimising JBoss Messaging Control Channel (jbm-control) and Data Channel (jbm-data).</p>
<h2>How to optimize the UDP transport configuration</h2>
<p>The default UDP transport configuration ships with a list of attributes, which can be tweaked once you know what they are for. A complete reference to the UDP transport configuration can be found on the JBoss clustering guide (http://docs. jboss.org/jbossclustering/cluster_guide/5.1/html/jgroups.chapt. html); for the purpose of our book we will point out which are the most interesting ones for fine-tuning your transport. Here&#8217;s the core section of the UDP transport configuration:</p>
<p>The biggest performance hit can be achieved by properly tuning the attributes concerning buffer size (ucast_recv_buf_size, ucast_send_buf_size, mcast_recv_buf_size, and mcast_send_buf_size ).</p>
<pre><code>	&lt;UDP
		singleton_name="shared-udp"
		mcast_port="${jboss.jgroups.udp.mcast_port:45688}"
		mcast_addr="${jboss.partition.udpGroup:228.11.11.11}"
		tos="8"
		ucast_recv_buf_size="20000000"
		ucast_send_buf_size="640000"
		mcast_recv_buf_size="25000000"
		mcast_send_buf_size="640000"
		loopback="true"
		discard_incompatible_packets="true"
		enable_bundling="false"
		max_bundle_size="64000"
		max_bundle_timeout="30"
		. . . .
	/&gt;
</code></pre>
<p>As a matter of fact, in order to guarantee optimal performance and adequate reliability of UDP multicast, it is essential to size network buffers correctly. Using inappropriate network buffers the chances are that you will experience <i>a high frequency of UDP packets being dropped</i> in the network layers, which therefore need to be retransmitted.</p>
<p>The default values for JGroups&#8217; UDP transmission are 20MB and 64KB for unicast transmission and respectively 25MB and 64KB for multicast transmission. While these values sound appropriate for most cases, they can be insufficient for applications sending lots of cluster messages. Think about an application sending a thousand 1KB messages: with the default receive size, we will not be able to buffer all packets, thus increasing the chance of packet loss and costly retransmission.</p>
<p>Monitoring the intra-clustering traffic can be done through the jboss.jgroups domain Mbeans. For example, in order to monitor the amount of bytes sent and received with the UDP transmission protocol, just open your jmx-console and point at the jboss.jgroups domain. Then select your cluster partition. (Default the partition if you are running with default cluster settings). In the following snapshot (we are including only the relevant properties) we can see the amount of Messages sent/received along with their size (in bytes).</p>
<p><center><img alt="" src="images/2011/01/JBoss-AS-Cluster-Tuning/4.jpg" /></center>Besides increasing the JGroups&#8217; buffer size, another important aspect to consider is that most operating systems allow a maximum UDP buffer size, which is generally <i>ower</i> than JGroups&#8217; defaults. For completeness, we include here a list of default maximum UDP buffer size:</p>
<p><center><img alt="" src="images/2011/01/JBoss-AS-Cluster-Tuning/5.jpg" /></center>So, as a rule of thumb, you should always configure your operating system to take advantage of the JGroups&#8217; transport configuration. The following table shows the command required to increase the maximum buffer to 25 megabytes. You will need root privileges in order to modify these kernel parameters:</p>
<p><center><img alt="" src="images/2011/01/JBoss-AS-Cluster-Tuning/6.jpg" /></center>Another option that is worth trying is enable_bundling, <b>which</b> specifies whether to enable message bundling. If true, the transport protocol would queue outgoing messages until max_bundle_size bytes have accumulated, or max_bundle_time milliseconds have elapsed, whichever occurs first.</p>
<p>The advantage of using this approach is that the transport protocol <i>would send bundled queued messages in one single larger message</i>. Message bundling can have significant performance benefits for channels using asynchronous high volume messages (for example, JBoss Cache components configured for REPL_ASYNC. JBoss Cache will be covered in the next section named Tuning JBoss Cache).</p>
<p>On the other hand, for applications based on a synchronous exchange of RCPs, the introduction of message bundling would introduce a considerable latency so it is not recommended in this case. (That&#8217;s the case with JBoss Cache components configured as REPL_SYNC).</p>
<h2>How to optimize the JGroups&#8217; Protocol stack</h2>
<p>The Protocol stack contains a list of layers protocols, which need to be crossed by the message. A layer does not necessarily correspond to a transport protocol: for example a layer might take care to fragment the message or to assemble it. What&#8217;s important to understand is that when a message is sent, it travels down in the stack, while when it&#8217;s received it walks just the way back.</p>
<p>For example, in the next picture, the <b>FLUSH</b> protocol would be executed first, then the <b>STATE</b>, the <b>GMS</b>, and so on. Vice versa, when the message is received, it would meet the <b>PING</b> protocol first, them <b>MERGE2</b>, up to <b>FLUSH</b>.</p>
<p><center><img alt="" src="images/2011/01/JBoss-AS-Cluster-Tuning/7.jpg" /></center>Following here, is the list of protocols triggered by the default UDP&#8217;s Protocol stack.</p>
<pre><code>	&lt;stack name="udp"
		description="Default: IP multicast based stack, with flow
	control."&gt;
		&lt;config&gt;
			&lt;PING timeout="2000" num_initial_members="3"/&gt;
			&lt;MERGE2 max_interval="100000" min_interval="20000"/&gt;
			&lt;FD_SOCK/&gt;
			&lt;FD timeout="6000" max_tries="5" shun="true"/&gt;
			&lt;VERIFY_SUSPECT timeout="1500"/&gt;
			&lt;pbcast.NAKACK use_mcast_xmit="false" gc_lag="0"
				retransmit_timeout="300,600,1200,2400,4800"
				discard_delivered_msgs="true"/&gt;
			&lt;UNICAST timeout="300,600,1200,2400,3600"/&gt;
			&lt;pbcast.STABLE stability_delay="1000"
				desired_avg_gossip="50000"
				max_bytes="400000"/&gt;
			&lt;pbcast.GMS print_local_addr="true" join_timeout="3000"
				shun="true"
				view_bundling="true"
				view_ack_collection_timeout="5000"/&gt;
			&lt;FC max_credits="2000000" min_threshold="0.10"
				ignore_synchronous_response="true"/&gt;
			&lt;FRAG2 frag_size="60000"/&gt;
			&lt;pbcast.STATE_TRANSFER/&gt;
			&lt;pbcast.FLUSH timeout="0"/&gt;
		&lt;/config&gt;
	&lt;/stack&gt;</code></pre>
<p>The following table will shed some light on the above cryptic configuration:</p>
<p><center><img alt="" src="images/2011/01/JBoss-AS-Cluster-Tuning/8.jpg" /></center><center><img alt="" src="images/2011/01/JBoss-AS-Cluster-Tuning/9.jpg" /></center>While all the above protocols play a role in message exchanging, it&#8217;s not necessary that you know the inner details of all of them for tuning your applications. So we will focus just on a few interesting ones.</p>
<p>The FC protocol, for example can be used to adapt the rate of messages sent with the rate of messages received. This has the advantage of creating an homogeneous rate of exchange, where no sender member overwhelms receiver nodes, thus preventing potential problems like filling up buffers causing packet loss. Here&#8217;s an example of FC configuration:</p>
<pre><code>	&lt;FC max_credits="2000000"
		min_threshold="0.10"
		ignore_synchronous_response="true"/&gt;</code></pre>
<p>The message rate adaptation is done with a simple credit system in which each time a sender sends a message a credit is subtracted (equal to the amount of bytes sent). Conversely, when a receiver collects a message, a credit is added.</p>
<ul>
<li>max_credits specifies the maximum number of credits (in bytes) and should obviously be smaller than the JVM heap size</li>
</ul>
<ul>
<li>min_threshold specifies the value of min_credits as a percentage of the max_credits element</li>
</ul>
<ul>
<li>ignore_synchronous_response specifies whether threads that have carried messages up to the application should be allowed to carry outgoing messages back down through FC without blocking for credits</li>
</ul>
<p>The following image depicts a simple scenario where HostA is sending messages (and thus its max_credits is reduced) to HostB and HostC, which increase their max_credits accordingly.</p>
<p><center><img alt="" src="images/2011/01/JBoss-AS-Cluster-Tuning/10.jpg" /></center>The FC protocol, while providing a control over the flow of messages, can be a bad choice for applications that are issuing synchronous group RPC calls. In this kind of applications, if you have fast senders issuing messages, but some slow receivers across the cluster, the <i>overall rate of calls will be slowed down</i>. For this reason, <i>remove FD </i><i>from your protocol list if you are sending synchronous messages</i> or just switch to the udpsync protocol stack.</p>
<pre><code>	Besides JGroups, some network interface cards (NICs) and switches
	perform <b>ethernet flow control</b> (IEEE 802.3x), which causes overhead
	to senders when packet loss occurs. In order to avoid a redundant flow
	control, you are advised to remove ethernet flow control. For managed
	switches, you can usually achieve this via a web or Telnet/SSH interface.
	For unmanaged switches, unfortunately the only chance is to hope that
	ethernet flow control is disabled, or to replace the switch.
	If you are using NICs, you can disable ethernet flow control by means of
	a simple shell command, for example, on Linux with the ethtool:
	/sbin/ethtool -A eth0 autoneg off tx on rx on
	If you want simply to verify if ethernet flow control is off:
	/sbin/ethtool -a eth0</code></pre>
<p>One more thing you must be aware of is that, by using JGroups, cluster nodes must store all messages received for potential retransmission in case of a failure. However, if we store all messages forever, we will run out of memory. The distributed garbage<br />
collection service in JGroups periodically removes messages that have been seen by all nodes from the memory in each node. The distributed garbage collection service is configured in the pbcast.STABLE sub-element like so:</p>
<pre><code>	&lt;pbcast.STABLE stability_delay="1000"
		desired_avg_gossip="5000"
		max_bytes="400000"/&gt;
</code></pre>
<p>The configurable attributes are as follows:</p>
<ul>
<li>desired_avg_gossip: Specifies the interval (in milliseconds) between garbage collection runs. Setting this parameter to 0 disables this service.</li>
</ul>
<ul>
<li>max_bytes: Specifies the maximum number of bytes to receive before triggering a garbage collection run. Setting this parameter to 0 disables this service.</li>
</ul>
<pre><code>	You are advised to set a max_bytes value if you have a 	high-traffic cluster.</code></pre>
<div class='dd_outer'><div class='dd_inner'><div id='dd_ajax_float'><div class='dd_button_v'><script src="http://connect.facebook.net/en_US/all.js#xfbml=1"></script><fb:like href="http%3A%2F%2Fwww.javabeat.net%2Fcategory%2Fweb-frameworks%2Fjboss%2Ffeed%2F" send="false" show_faces="false"  layout="box_count" width="50"  ></fb:like></div><div style='clear:left'></div><div class='dd_button_v'><script type='text/javascript' src='https://apis.google.com/js/plusone.js'></script><g:plusone size='tall' href='http://www.javabeat.net/category/web-frameworks/jboss/feed/'></g:plusone></div><div style='clear:left'></div><div class='dd_button_v'><a href="http://twitter.com/share" class="twitter-share-button" data-url="http://www.javabeat.net/category/web-frameworks/jboss/feed/" data-count="vertical" data-text="JBoss" data-via="javabeat" ></a><script type="text/javascript" src="http://platform.twitter.com/widgets.js"></script></div><div style='clear:left'></div><div class='dd_button_extra_v'><script type="text/javascript">jQuery(document).load(function(){ stLight.options({publisher:'bab47279-62c9-46af-addc-79fd1fe8fee0'}); });</script><div class="st_email_custom"><span id='dd_email_text'>email</span></div></div><div style='clear:left'></div><div class='dd_button_extra_v'><div id='dd_print_button'><span id='dd_print_text'><a href='javascript:window:print()'>print</a></span></div></div><div style='clear:left'></div></div></div></div><script type="text/javascript">var dd_offset_from_content = 44; var dd_top_offset_from_content = 0;</script><script type="text/javascript" src="http://www.javabeat.net/wp-content/plugins/digg-digg//js/diggdigg-floating-bar.js?ver=5.3.0"></script><div class="wpInsert wpInsertInPostAd wpInsertBelow" style="margin: 5px; padding: 0px;"><script type="text/javascript"><!--
google_ad_client = "ca-pub-1490953723360528";
/* JB-Footer-LU 468x15 */
google_ad_slot = "8789107210";
google_ad_width = 468;
google_ad_height = 15;
//-->
</script>
<script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script></div>]]></content:encoded>
			<wfw:commentRss>http://www.javabeat.net/2011/01/jboss-as-5-performance-tuning/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>JBoss Tools 3 Developer&#8217;s Guide</title>
		<link>http://www.javabeat.net/2009/10/jboss-tools-3-developers-guide/</link>
		<comments>http://www.javabeat.net/2009/10/jboss-tools-3-developers-guide/#comments</comments>
		<pubDate>Sat, 10 Oct 2009 14:12:15 +0000</pubDate>
		<dc:creator>krishnas</dc:creator>
				<category><![CDATA[JBoss]]></category>
		<category><![CDATA[JBoss Tools]]></category>

		<guid isPermaLink="false">http://www.javabeat.net/?p=2007</guid>
		<description><![CDATA[<p>Connect to us ( <a href="https://twitter.com/javabeat">@twitter</a> | <a href="https://www.facebook.com/javabeat.net">@facebook )</p><p>JBoss Tools 3 Developer’s GuideThis book will show you how to develop a set of Java projects using a variety of technologies and scenarios. Everything is described through the &#8220;eyes&#8221; of JBoss Tools. After we settle on the project (or scenario) that will be developed, we will configure the proper environment for the current tool [...]</p>]]></description>
				<content:encoded><![CDATA[<p>Connect to us ( <a href="https://twitter.com/javabeat">@twitter</a> | <a href="https://www.facebook.com/javabeat.net">@facebook )</p><div class="wpInsert wpInsertInPostAd wpInsertLeft" style="float: left; margin: 5px; padding: 0px;"><script type="text/javascript"><!--
google_ad_client = "ca-pub-1490953723360528";
/* Article-Rect */
google_ad_slot = "9976259118";
google_ad_width = 300;
google_ad_height = 250;
//-->
</script>
<script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script></div><p><center><strong>JBoss Tools 3 Developer’s Guide</strong></center>This book will show you how to develop a set of Java projects using a variety of technologies and scenarios. Everything is described through the &#8220;eyes&#8221; of JBoss Tools.</p>
<p>After we settle on the project (or scenario) that will be developed, we will configure the proper environment for the current tool (those projects selected will cover between them the main components of a web application in terms of the backstage technology). We<br />
continue by exploring the tool for accomplishing our tasks and developing the project&#8217;s components. A cocktail of images, theoretical aspects, source codes, and step-by-step examples will offer you a thoroughgoing for every tool. At the end, the project will be<br />
deployed and tested. In addition, every chapter is &#8220;lard&#8221; with pure notions about the underlying technology, which will initiate you into, or remind you of, the basic aspects of it.</p>
<p>This book will show you complete and functional applications, and will familiarize you with the main aspects of every tool. By the end you will have been provided with sufficient information to successfully handle your own projects through JBoss Tools.</p>
<h2>What This Book Covers</h2>
<p><em>Chapter 1</em> is a compressive chapter that will help you discover the features brought by the new JBoss Tools 3.0. The main goal of this chapter is to make an introduction to what will follow in the next chapters and to &#8220;wake up&#8221; your curiosity. In addition, the reader<br />
can see different possibilities of installing JBoss Tools on different platforms and for different goals.</p>
<p><em>Chapter 2</em> teaches you how to use Eclipse and JBoss AS in a symbiotic manner. In this chapter you will see how to use the JBoss AS Tools to configure, start, stop and monitor the JBoss AS directly from Eclipse IDE. Also, you can see how to create and deploy<br />
new projects.</p>
<p><em>Chapter 3</em> is a collection of tag-components from different technologies as Ajax, JSF, RichFaces, Seam, and so on. Because the components are built on the drag-and-drop technique, this tool is very easy to use, especially when you need a fast method for<br />
generating tags into JSP pages. This chapter will cover—with description and examples—the most important tags that can be generated through JBoss Palette. Also, the chapter will contain a section about the Palette Options.</p>
<p><em>Chapter 4</em> will talk about punctual framework&#8217;s tools and I will start with JBoss Tools for Java Server Faces. After I present the Faces Config Editor, which is the main visual component for JSF support, I will follow the framework mains characteristics and I will<br />
discuss—from the JSF Tools perspective—about managed beans, validators, converters, navigation rules, and so on.</p>
<p><em>Chapter 5</em> will give you a complete cover of the graphical Struts editors that are used for generating/managing XML documents (configuration, tiles, validators). Also, you will see how to work with code generation and debug support for Struts projects. Everything will be sustained by images (captures) and examples.</p>
<p><em>Chapter 6</em> will show you how to accomplish the most important modules of a Seam project, like Action, Form, Entity, and so on through the Seam Tools filter in the first part. Later, in the second part of the chapter, you will work with the visual editors<br />
dedicated to increasing the speed of developing/controlling Seam components.</p>
<p><em>Chapter 7</em> will show some advanced skills, like Hibernate and Ant, generation of POJOs, debugging goals and reverse engineering control after a detailed presentation of how to use Hibernate Tools to speed up the configuration and mapping tasks.</p>
<p><em>Chapter 8</em> will discuss about the jBPM Tools. You will see how to develop and test a complete jBPM project.</p>
<p><em>Chapter 9</em> will detail the main concepts of JBossESB Services, and you will see how to use ESB Tools to develop such a Service.</p>
<p><em>Chapter 10</em> will help you create from scratch a WSDL document using WSDL Editor. You will generate a complete web service from a WSDL document and from a Java bean using WS Tools wizards, and you will publish a web service using jUDDI and Web Services Explorer. In addition, you will see how to generate a web service&#8217;s client, how to test a web service through Web Services Explorer, how to convert WSDL documents to WSIL documents and how to inspect WSDL web services through WSIL and WSE.</p>
<p><em>Chapter 11</em> will work with the Portal Tools. You will see how to use the wizards for creating projects with Portlet Facets, creating the Java Portlet wizard and creating the JSF/Seam Portlet wizard.</p>
<h3>JBoss Tools Palette</h3>
<p>In this chapter, we will discuss the JBoss Tools Palette, which is a very useful tool designed especially for speeding up the development of JSP, JSF, HTML, XHTML or any other text file that contains tags. In principle, JBoss Tools Palette is a collection of<br />
common tags, exposed through a flexible and easy-to-use interface.</p>
<p>By default, JBoss Tools Palette is available in the <strong>Web Development</strong> perspective that can be displayed from the <strong>Window</strong> menu by selecting the <strong>Open Perspective | Other </strong>option. In the following screenshot, you can see the default look of this palette:</p>
<p><center><a href="http://www.javabeat.net/wp-content/uploads/2009/10/1.jpg"><img class="aligncenter size-full wp-image-4327" title="1" src="http://www.javabeat.net/wp-content/uploads/2009/10/1.jpg" alt="" width="207" height="169" /></a></center>Let&#8217;s dissect this palette to see how it makes our life easier!</p>
<h2>JBoss Tools Palette Toolbar</h2>
<p>Note that on the top right corner of the palette, we have a toolbar made of three buttons (as shown in the following screenshot). They are (from left to right):</p>
<ul>
<li><strong><strong>Palette Editor</strong></strong></li>
<li><strong><strong>Show/Hide</strong></strong></li>
<li><strong><strong>Import</strong></strong></li>
</ul>
<p><center><a href="http://www.javabeat.net/wp-content/uploads/2009/10/2.jpg"><img class="aligncenter size-full wp-image-4328" title="2" src="http://www.javabeat.net/wp-content/uploads/2009/10/2.jpg" alt="" width="260" height="129" /></a></center>Each of these buttons accomplishes different tasks for offering a high level of flexibility and customizability. Next, we will focus our attention on each one of these buttons.</p>
<h2>Palette Editor</h2>
<p>Clicking on the <strong>Palette Editor</strong> icon will display the <strong>Palette Editor</strong> window (as shown in the following screenshot), which contains groups and subgroups of tags that are currently supported. Also, from this window you can create new groups, subgroups,<br />
icons, and of course, tags—as you will see in a few moments.</p>
<p><center><a href="http://www.javabeat.net/wp-content/uploads/2009/10/3.jpg"><img class="aligncenter size-full wp-image-4327" title="1" src="http://www.javabeat.net/wp-content/uploads/2009/10/3.jpg" alt="" width="207" height="169" /></a></center>As you can see, this window contains two panels: one for listing groups of tag libraries (left side) and another that displays details about the selected tag and allows us to modify the default values (extreme right). Modifying a tag is a very simple operation that can be done like this:</p>
<ol>
<li>Select from the left panel the tag that you want to modify (for example, the <strong>&lt;div&gt;</strong> tag from the <strong>HTML | Block</strong> subgroup, as shown in the previous screenshot).</li>
<li>In the right panel, click on the row from the <strong>value</strong> column that corresponds to the property that you want to modify (the <strong>name</strong> column).</li>
<li>Make the desirable modification(s) and click the <strong>OK</strong> button for confirming it (them).</li>
</ol>
<h2>Creating a set of icons</h2>
<p>The <strong>Icons</strong> node from the left panel allows you to create sets of icons and import new icons for your tags. To start, you have to right-click on this node and select the <strong>Create | Create Set</strong> option from the contextual menu (as shown in the following screenshot).</p>
<p><center><a href="http://www.javabeat.net/wp-content/uploads/2009/10/4.jpg"><img class="aligncenter size-full wp-image-4327" title="1" src="http://www.javabeat.net/wp-content/uploads/2009/10/4.jpg" alt="" width="207" height="169" /></a></center>This action will open the <strong>Add Icon Set</strong> window where you have to specify a name for this new set. Once you&#8217;re done with the naming, click on the <strong>Finish </strong>button (as shown in the following screenshot). For example, we have created a set named <strong>eHTMLi</strong>:</p>
<p><center><a href="http://www.javabeat.net/wp-content/uploads/2009/10/5.jpg"><img class="aligncenter size-full wp-image-4327" title="1" src="http://www.javabeat.net/wp-content/uploads/2009/10/5.jpg" alt="" width="207" height="169" /></a></center></p>
<h2>Importing an icon</h2>
<p>You can import a new icon in any set of icons by right-clicking on the corresponding set and selecting the <strong>Create | Import Icon</strong> option from the contextual menu (as shown in the following screenshot):</p><div class="wpInsert wpInsertInPostAd wpInsertMiddle" style="margin: 5px; padding: 0px;"><script type="text/javascript"><!--
google_ad_client = "ca-pub-1490953723360528";
/* Article-Middle-Med-Rect */
google_ad_slot = "7805667846";
google_ad_width = 300;
google_ad_height = 250;
//-->
</script>
<script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script></div>
<p><center><a href="http://www.javabeat.net/wp-content/uploads/2009/10/6.jpg"><img class="aligncenter size-full wp-image-4327" title="1" src="http://www.javabeat.net/wp-content/uploads/2009/10/6.jpg" alt="" width="207" height="169" /></a></center>This action will open the <strong>Add Icon</strong> window, where you have to specify a name and a path for your icon, and then click on the <strong>Finish</strong> button (as shown in the following screenshot). Note that the image of the icon should be in GIF format.</p>
<p><center><a href="http://www.javabeat.net/wp-content/uploads/2009/10/7.jpg"><img class="aligncenter size-full wp-image-4327" title="1" src="http://www.javabeat.net/wp-content/uploads/2009/10/7.jpg" alt="" width="207" height="169" /></a></center></p>
<h2>Creating a group of tag libraries</h2>
<p>As you can see, the JBoss Tools Palette has a consistent default set of groups of tag libraries, like HTML, JSF, JSTL, Struts, XHTML, etc. If these groups are insufficient, then you can create new ones by right-clicking on the <strong>Palette</strong> node and selecting the <strong>Create | Create Group</strong> option from the contextual menu (as shown in the following screenshot).</p>
<p><center><a href="http://www.javabeat.net/wp-content/uploads/2009/10/8.jpg"><img class="aligncenter size-full wp-image-4327" title="1" src="http://www.javabeat.net/wp-content/uploads/2009/10/8.jpg" alt="" width="207" height="169" /></a></center>This action will open the <strong>Create Group</strong> window, where you have to specify a name for the new group, and then click on <strong>Finish</strong>. For example, we have created a group named <strong>mygroup</strong>:</p>
<p><center><a href="http://www.javabeat.net/wp-content/uploads/2009/10/9.jpg"><img class="aligncenter size-full wp-image-4327" title="1" src="http://www.javabeat.net/wp-content/uploads/2009/10/9.jpg" alt="" width="207" height="169" /></a></center>Note that you can delete (only groups created by the user) or edit groups (any group) by selecting the <strong>Delete</strong> or <strong>Edit</strong> options from the contextual menu that appears when you right-click on the chosen group.</p>
<h2>Creating a tag library</h2>
<p>Now that we have created a group, it&#8217;s time to create a library (or a subgroup). To do this, you have to right-click on the new group and select the <strong>Create Group</strong> option from the contextual menu (as shown in the following screenshot).</p>
<p><center><a href="http://www.javabeat.net/wp-content/uploads/2009/10/10.jpg"><img class="aligncenter size-full wp-image-4327" title="1" src="http://www.javabeat.net/wp-content/uploads/2009/10/10.jpg" alt="" width="207" height="169" /></a></center>This action will open the <strong>Add Palette Group</strong> window, where you have to specify a name and an icon for this library, and then click on the <strong>Finish</strong> button (as shown in the following screenshot). As an example, we have created a library named <strong>eHTML</strong> with an icon that we had imported in the <em>Importing an icon</em> section discussed earlier in this chapter:</p>
<p><center><a href="http://www.javabeat.net/wp-content/uploads/2009/10/11.jpg"><img class="aligncenter size-full wp-image-4327" title="1" src="http://www.javabeat.net/wp-content/uploads/2009/10/11.jpg" alt="" width="207" height="169" /></a></center>Note that you can delete a tag library (only tag libraries created by the user) by selecting the <strong>Delete</strong> option from the contextual menu that appears when you right-click on the chosen library.</p>
<h2>Creating a new tag</h2>
<p>After you have created a tag library, it is time to place your first tag in it. To do this, you have to right-click on the tag library and select the <strong>Create | Create Macro</strong> option from the contextual menu (as shown in the following screenshot).</p>
<p><center><a href="http://www.javabeat.net/wp-content/uploads/2009/10/12.jpg"><img class="aligncenter size-full wp-image-4327" title="1" src="http://www.javabeat.net/wp-content/uploads/2009/10/12.jpg" alt="" width="207" height="169" /></a></center>This action will open the <strong>Add Palette Macro</strong> window, where you can configure the new tag. In this window, you have to specify:</p>
<ul>
<li>The tag <strong>Name</strong> (mandatory)—it is displayed in Tools Palette</li>
<li>An <strong>Icon</strong> (optional)</li>
<li><strong>Start Text</strong> of the tag (optional)</li>
<li><strong>End Text</strong> of the tag (optional)</li>
<li><strong>Automatically Reformat Tag Body</strong> (mandatory).</li>
</ul>
<p><center><a href="http://www.javabeat.net/wp-content/uploads/2009/10/13.jpg"><img class="aligncenter size-full wp-image-4327" title="1" src="http://www.javabeat.net/wp-content/uploads/2009/10/13.jpg" alt="" width="207" height="169" /></a></center>For example, let&#8217;s create a tag for representing the following HTML code, which is a scrollable HTML table with a single column. We have named the tag &lt;mytable&gt;:</p>
<pre class="brush: java; title: ; notranslate">
&lt;div style=&quot;overflow: auto; width: 270px; height: 375px; padding: 0px; margin: 0px;&quot;&gt;
&lt;table cellspacing=&quot;0&quot; cellpadding=&quot;2&quot;&gt;&lt;colgroup&gt;&lt;col width=&quot;270&quot; /&gt;&lt;/colgroup&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td valign=&quot;top&quot; nowrap=&quot;nowrap&quot; width=&quot;270&quot;&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;/div&gt;

</pre>
<p>For this, we fill up the <strong>Add Palette Macro</strong> as seen in the previous screenshot.</p>
<p>Note that you can delete a tag (only tags created by the user) by selecting the <strong>Delete</strong> option from the contextual menu that appears when you right-click on the chosen tag.</p>
<p>As you can see in the previous screenshot, there is no section for describing your tag definition, syntax, attributes, etc. For that you can click on the tag name and modify the description row from the right panel of the <strong>Palette Editor</strong> or you can right-click on the tag name and select the <strong>Edit</strong> option from the contextual menu. This will open the <strong>Edit</strong> window that contains a <strong>Description</strong> section as you can see in the following screenshot:</p>
<p><center><a href="http://www.javabeat.net/wp-content/uploads/2009/10/14.jpg"><img class="aligncenter size-full wp-image-4327" title="1" src="http://www.javabeat.net/wp-content/uploads/2009/10/14.jpg" alt="" width="207" height="169" /></a></center><br />
In this section, we can write a tag description in HTML format. For example, for the &lt;mytable&gt; tag, we have created the following description:</p>
<pre class="brush: java; title: ; notranslate">

&lt;table width=&quot;300&quot;&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;&lt;span style=&quot;color: olive;&quot;&gt;
&lt;strong&gt;Name:&lt;/strong&gt; &lt;/span&gt; &lt;code&gt;
Scrollable table &lt;/code&gt;

&lt;span style=&quot;color: olive;&quot;&gt; &lt;strong&gt;Syntax:&lt;/strong&gt; &lt;/span&gt; &lt;code&gt;

 &lt;/code&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;span style=&quot;color: olive;&quot;&gt;&lt;strong&gt;Atributes:&lt;/strong&gt;&lt;/span&gt;
CSS and table specific attributes&lt;/code&gt;

</pre>
<p>Now, closing t he <strong>Palette Editor</strong> by clicking the <strong>OK</strong> button will automatically add the new group, the tag library, and the tag into the JBoss Tools Palette as shown in the following figure (note the description that appears on mouse over).</p>
<p><center><a href="http://www.javabeat.net/wp-content/uploads/2009/10/15.jpg"><img class="aligncenter size-full wp-image-4327" title="1" src="http://www.javabeat.net/wp-content/uploads/2009/10/15.jpg" alt="" width="207" height="169" /></a></center></p>
<h2>Show/Hide</h2>
<p>As the name sug gests, this feature allows us to customize the number of groups displayed in the palette. By default, the palette shows only five groups, but we can add or remove groups by clicking on this button, which displays the window as shown in the following screenshot.</p>
<p><center><a href="http://www.javabeat.net/wp-content/uploads/2009/10/16.jpg"><img class="aligncenter size-full wp-image-4327" title="1" src="http://www.javabeat.net/wp-content/uploads/2009/10/16.jpg" alt="" width="207" height="169" /></a></center>In this window, select the groups and/or tag libraries that you want to see in the palette and deselect the on es that you want to remove from the palette.</p>
<h2>Importing third-party tag libraries</h2>
<p>A great facility of JBoss Tools Palette is the ability to import third party tag libraries. This can be done using the <strong>Import</strong> button, which opens the <strong>Import Tags from TLD file</strong> window as shown in the following screenshot.</p>
<p><center><a href="http://www.javabeat.net/wp-content/uploads/2009/10/17.jpg"><img class="aligncenter size-full wp-image-4327" title="1" src="http://www.javabeat.net/wp-content/uploads/2009/10/17.jpg" alt="" width="207" height="169" /></a></center>Now, it is mandatory to set the TLD file, and a name for the new tag library. Optionally, we can specify a default prefix, a library URI, and a group that will host the tag library (this can be an existing group or a new one). For example, in the following screenshot you can see how we have imported the sql.tld library into a JSF project (for now, all you can do is imagine this case, but keeping this in mind<br />
will help you in the following chapters, where we will create real projects):</p>
<p><center><a href="http://www.javabeat.net/wp-content/uploads/2009/10/18.jpg"><img class="aligncenter size-full wp-image-4327" title="1" src="http://www.javabeat.net/wp-content/uploads/2009/10/18.jpg" alt="" width="207" height="169" /></a></center></p>
<h2>Using tags in text files</h2>
<p>In this section, w e will discuss inserting tags from the Palette into our text files. This is a very simple task that consists of the following steps:</p>
<ol>
<li>Navigate through the Palette until you see the tag that will be inserted.</li>
<li>Click on this tag as you click on any button.</li>
<li>If the tag has attributes, then you will see the <strong>Insert Tag</strong> window that allows you to customize the values of these attributes (the following screenshot represents the <strong>Insert Tag</strong> window for the &lt;table&gt; tag that can be found in <strong>HTML</strong> group, <strong>Table</strong> tag library). Note that if the selected tag doesn&#8217;t have any attributes to be set, then this step will be skipped and the tag will be<br />
inserted into your page.<center><a href="http://www.javabeat.net/wp-content/uploads/2009/10/19.jpg"><img class="aligncenter size-full wp-image-4327" title="1" src="http://www.javabeat.net/wp-content/uploads/2009/10/19.jpg" alt="" width="207" height="169" /></a></center></li>
<li>After you have set the values of the attributes, simply click the <strong>Finish</strong> button. This action will automatically insert the chosen tag into your page. For example, in the following screenshot you can see the effect of inserting the &lt;mytable&gt; tag, created in the <strong>Create a new tag</strong> section, into an empty HTML page.</li>
<li> <center><a href="http://www.javabeat.net/wp-content/uploads/2009/10/20.jpg"><img class="aligncenter size-full wp-image-4327" title="1" src="http://www.javabeat.net/wp-content/uploads/2009/10/20.jpg" alt="" width="207" height="169" /></a></center>If you followed Chap ter 2, then now you should have an empty project named test. Expand the <strong>test | WebContent</strong> node, right-click on it, and select <strong>New | Other </strong>option. In the <strong>New</strong> window, expand <strong>Web</strong> node and select <strong>HTML</strong> leaf. Type <em>example</em><br />
(without the .html extension) in the <strong>File name</strong> field and click on the <strong>Finish</strong> button. Now, you have the shown example.html page and you can try to add our tag to it. Also, you can play with other tags to get used to them! In the following chapters<br />
this will be no more a task, it will simply be routine.</li>
</ol>
<h2>Summary</h2>
<p>In this chapter, you have learnt how to use and customize the JBoss Tools Palette for speeding up the development process of different kinds of pages, like JSP, HTML, XHTML, etc. This will be an important skill to possess in the following chapters when we will develop projects that contain many such pages.</p>
<div class="wpInsert wpInsertInPostAd wpInsertBelow" style="margin: 5px; padding: 0px;"><script type="text/javascript"><!--
google_ad_client = "ca-pub-1490953723360528";
/* JB-Footer-LU 468x15 */
google_ad_slot = "8789107210";
google_ad_width = 468;
google_ad_height = 15;
//-->
</script>
<script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script></div>]]></content:encoded>
			<wfw:commentRss>http://www.javabeat.net/2009/10/jboss-tools-3-developers-guide/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>How to enable SSL on JBoss application server?</title>
		<link>http://www.javabeat.net/2008/09/how-to-enable-ssl-on-jboss-application-server/</link>
		<comments>http://www.javabeat.net/2008/09/how-to-enable-ssl-on-jboss-application-server/#comments</comments>
		<pubDate>Thu, 25 Sep 2008 13:23:57 +0000</pubDate>
		<dc:creator>JavaBeat</dc:creator>
				<category><![CDATA[JBoss]]></category>

		<guid isPermaLink="false">http://www.javabeat.net/examples/?p=260</guid>
		<description><![CDATA[<p>Connect to us ( <a href="https://twitter.com/javabeat">@twitter</a> | <a href="https://www.facebook.com/javabeat.net">@facebook )</p><p>To enable SSL on JBoss add the following segment to JBOSS_HOME/server/default/deploy/jbossweb-tomcatxx.sar/server.xml as a child of the jboss.web Service element. 1 2 3 4 5 maxThreads=&#34;100&#34; strategy=&#34;ms&#34; maxHttpHeaderSize=&#34;8192&#34; emptySessionPath=&#34;true&#34; scheme=&#34;https&#34; secure=&#34;true&#34; clientAuth=&#34;false&#34; keystoreFile=&#34;${jboss.server.home.dir}/tmp/wso2wsas/conf/wso2wsas.jks&#34; keystorePass=&#34;wso2wsas&#34; sslProtocol = &#34;TLS&#34; /&#38;gt; NOTE: You can use any keystoreFile of your preference instead of the wso2wsas.jks which is shipped with WSO2 [...]</p>]]></description>
				<content:encoded><![CDATA[<p>Connect to us ( <a href="https://twitter.com/javabeat">@twitter</a> | <a href="https://www.facebook.com/javabeat.net">@facebook )</p><div class="wpInsert wpInsertInPostAd wpInsertLeft" style="float: left; margin: 5px; padding: 0px;"><script type="text/javascript"><!--
google_ad_client = "ca-pub-1490953723360528";
/* Article-Rect */
google_ad_slot = "9976259118";
google_ad_width = 300;
google_ad_height = 250;
//-->
</script>
<script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script></div><p>
To enable SSL on JBoss add the following segment to JBOSS_HOME/server/default/deploy/jbossweb-tomcatxx.sar/server.xml as a child of the jboss.web Service element.
</p><div class="wpInsert wpInsertInPostAd wpInsertMiddle" style="margin: 5px; padding: 0px;"><script type="text/javascript"><!--
google_ad_client = "ca-pub-1490953723360528";
/* Article-Middle-Med-Rect */
google_ad_slot = "7805667846";
google_ad_width = 300;
google_ad_height = 250;
//-->
</script>
<script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script></div>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
</pre></td><td class="code"><pre class="language" style="font-family:monospace;">maxThreads=&quot;100&quot; strategy=&quot;ms&quot; maxHttpHeaderSize=&quot;8192&quot;
emptySessionPath=&quot;true&quot;
scheme=&quot;https&quot; secure=&quot;true&quot; clientAuth=&quot;false&quot;
keystoreFile=&quot;${jboss.server.home.dir}/tmp/wso2wsas/conf/wso2wsas.jks&quot;
keystorePass=&quot;wso2wsas&quot; sslProtocol = &quot;TLS&quot; /&amp;gt;</pre></td></tr></table></div>

<p>
NOTE: You can use any keystoreFile of your preference instead of the wso2wsas.jks which is shipped with WSO2 WSAS.</p>
<div class="wpInsert wpInsertInPostAd wpInsertBelow" style="margin: 5px; padding: 0px;"><script type="text/javascript"><!--
google_ad_client = "ca-pub-1490953723360528";
/* JB-Footer-LU 468x15 */
google_ad_slot = "8789107210";
google_ad_width = 468;
google_ad_height = 15;
//-->
</script>
<script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script></div>]]></content:encoded>
			<wfw:commentRss>http://www.javabeat.net/2008/09/how-to-enable-ssl-on-jboss-application-server/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>EJB Webservices in JBoss application server sample code</title>
		<link>http://www.javabeat.net/2008/09/ejb-webservices-in-jboss-application-server-sample-code/</link>
		<comments>http://www.javabeat.net/2008/09/ejb-webservices-in-jboss-application-server-sample-code/#comments</comments>
		<pubDate>Thu, 25 Sep 2008 00:52:37 +0000</pubDate>
		<dc:creator>JavaBeat</dc:creator>
				<category><![CDATA[EJB]]></category>
		<category><![CDATA[JBoss]]></category>
		<category><![CDATA[WebService]]></category>

		<guid isPermaLink="false">http://www.javabeat.net/examples/?p=354</guid>
		<description><![CDATA[<p>Connect to us ( <a href="https://twitter.com/javabeat">@twitter</a> | <a href="https://www.facebook.com/javabeat.net">@facebook )</p><p>1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 Employee Service.java ---------------------- package [...]</p>]]></description>
				<content:encoded><![CDATA[<p>Connect to us ( <a href="https://twitter.com/javabeat">@twitter</a> | <a href="https://www.facebook.com/javabeat.net">@facebook )</p><div class="wpInsert wpInsertInPostAd wpInsertLeft" style="float: left; margin: 5px; padding: 0px;"><script type="text/javascript"><!--
google_ad_client = "ca-pub-1490953723360528";
/* Article-Rect */
google_ad_slot = "9976259118";
google_ad_width = 300;
google_ad_height = 250;
//-->
</script>
<script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script></div>
<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
</pre></td><td class="code"><pre class="language" style="font-family:monospace;">Employee Service.java
----------------------
package com.crm.services;
import javax.jws.WebService;
import javax.jws.soap.SOAPBinding;
import com.crm.bean.Employee;
/**
* @author AnilKumar
*
*/
@WebService
@SOAPBinding(style = SOAPBinding.Style.RPC)
public interface EmployeeService {
public Employee getEmployee(long pin);
}
&nbsp;
EmployeeServiceImpl.java
-------------------------
package com.crm.services;
&nbsp;
import javax.ejb.Stateless;
import javax.jws.WebMethod;
import javax.jws.WebParam;
import javax.jws.WebService;
import javax.jws.soap.SOAPBinding;
&nbsp;
import com.crm.bean.Employee;
import com.crm.model.EmployeeDAO;
import com.crm.modelinterface.cmsEmployee;
/**
* @author AnilKumar
*
*/
@Stateless
@WebService(endpointInterface = &quot;com.crm.services.EmployeeService&quot;)
@SOAPBinding(style = SOAPBinding.Style.RPC)
public class EmployeeServiceImpl {
&nbsp;
@WebMethod(operationName = &quot;getEmployee&quot;)
public Employee getEmployee(@WebParam(name = &quot;pin&quot;)
long pin) {
cmsEmployee employee2 = new EmployeeDAO();
// Employee employee2 = employeeDAO.getEmployeebyemployee(pin);
&nbsp;
Employee employee = employee2.getEmployeebyemployee(pin);
&nbsp;
System.out.println(employee.getFirstname());
return employee;
}
&nbsp;
}</pre></td></tr></table></div>

<p>deploy above two classes by archieving in a jar and copy it to deploy folder of jboss<br />
then run ur jboss server with url http://localhost:8080/jbossws there u will get all ur<br />
web services running in your server. the client program will be like this</p><div class="wpInsert wpInsertInPostAd wpInsertMiddle" style="margin: 5px; padding: 0px;"><script type="text/javascript"><!--
google_ad_client = "ca-pub-1490953723360528";
/* Article-Middle-Med-Rect */
google_ad_slot = "7805667846";
google_ad_width = 300;
google_ad_height = 250;
//-->
</script>
<script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script></div>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
</pre></td><td class="code"><pre class="language" style="font-family:monospace;">package com.crm.serviceClient;
&nbsp;
import java.net.MalformedURLException;
import java.net.URL;
&nbsp;
import javax.xml.namespace.QName;
import javax.xml.ws.Service;
import javax.xml.ws.WebEndpoint;
import javax.xml.ws.WebServiceClient;
&nbsp;
import com.crm.bean.Employee;
import com.crm.services.EmployeeService;
/**
* @author AnilKumar
*
*/
@WebServiceClient(name = &quot;EmployeeServiceImplService&quot;, targetNamespace = &quot;http://services.crm.com/&quot;,
wsdlLocation = &quot;http://localhost:8080/jarfilename/EmployeeServiceImpl?wsdl&quot;)
public class EmployeeServiceClient extends Service {
protected EmployeeServiceClient(URL wsdlDocumentLocation,
QName serviceName) {
super(wsdlDocumentLocation, serviceName);
// TODO Auto-generated constructor stub
}
&nbsp;
public EmployeeServiceClient() throws MalformedURLException {
super(new URL(
&quot;http://localhost:8080/jarfilename/EmployeeServiceImpl?wsdl&quot;),
new QName(&quot;http://services.crm.com/&quot;,
&quot;EmployeeServiceImplService&quot;));
}
&nbsp;
@WebEndpoint
public EmployeeService getEmployeeServiceport() {
return (EmployeeService) super.getPort(new QName(
&quot;http://services.crm.com/&quot;, &quot;EmployeeServiceImplPort&quot;),
EmployeeService.class);
&nbsp;
}
&nbsp;
public static void main(String[] args) throws MalformedURLException {
&nbsp;
try {
EmployeeService service = new EmployeeServiceClient().getEmployeeServiceport();
&nbsp;
if (service != null) {
System.out.println(&quot;Serrvice not null&quot;);
Employee employee1 = service.getEmployee(18);
&nbsp;
System.out.println(employee1.getFirstname());
System.out.println(employee1.getLastname());
}
&nbsp;
} catch (Exception e) {
e.printStackTrace();
}
&nbsp;
}
&nbsp;
}</pre></td></tr></table></div>

<div class="wpInsert wpInsertInPostAd wpInsertBelow" style="margin: 5px; padding: 0px;"><script type="text/javascript"><!--
google_ad_client = "ca-pub-1490953723360528";
/* JB-Footer-LU 468x15 */
google_ad_slot = "8789107210";
google_ad_width = 468;
google_ad_height = 15;
//-->
</script>
<script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script></div>]]></content:encoded>
			<wfw:commentRss>http://www.javabeat.net/2008/09/ejb-webservices-in-jboss-application-server-sample-code/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>SAR (Service Archive) file in JBoss</title>
		<link>http://www.javabeat.net/2008/08/sar-service-archive-file-in-jboss/</link>
		<comments>http://www.javabeat.net/2008/08/sar-service-archive-file-in-jboss/#comments</comments>
		<pubDate>Fri, 01 Aug 2008 12:48:17 +0000</pubDate>
		<dc:creator>JavaBeat</dc:creator>
				<category><![CDATA[Java]]></category>
		<category><![CDATA[JBoss]]></category>

		<guid isPermaLink="false">http://www.javabeat.net/examples/?p=218</guid>
		<description><![CDATA[<p>Connect to us ( <a href="https://twitter.com/javabeat">@twitter</a> | <a href="https://www.facebook.com/javabeat.net">@facebook )</p><p>This tips explains how to create and deploy the SAR file in the JBoss application server. SAR files are only used in the JBoss application server. It cannot be used in the other application server environments. Before looking into creating a SAR file, first let you know what is SAR file. What is SAR file? [...]</p>]]></description>
				<content:encoded><![CDATA[<p>Connect to us ( <a href="https://twitter.com/javabeat">@twitter</a> | <a href="https://www.facebook.com/javabeat.net">@facebook )</p><div class="wpInsert wpInsertInPostAd wpInsertLeft" style="float: left; margin: 5px; padding: 0px;"><script type="text/javascript"><!--
google_ad_client = "ca-pub-1490953723360528";
/* Article-Rect */
google_ad_slot = "9976259118";
google_ad_width = 300;
google_ad_height = 250;
//-->
</script>
<script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script></div><p>This tips explains how to create and deploy the <strong><em>SAR file</em></strong> in the <strong><em>JBoss</em></strong> application server. <strong><em>SAR</em></strong> files are only used in the JBoss application server. It cannot be used in the other application server environments. Before looking into creating a <strong><em>SAR file</em></strong>, first let you know what is SAR file.</p>
<h4>What is SAR file?</h4>
<p><strong><em>SAR</em></strong> file is created with the <strong><em>.sar</em></strong> extenstion same like how other archive files (<strong><em>JAR</em></strong>, <strong><em>WAR</em></strong>, <strong><em>EAR</em></strong>) created. But the purpose of the SAR file is differenet from the other archive files. It is used for deploying a service component in the application server without  dependent on other components. You can create a seperate component as a SAR file and deploy it in the server. When application server starts, the component will be deployed and started running independently. Most of the times these <strong><em>SAR</em></strong> files are used for writing thread related components which has to be running independently.</p>
<p>JBoss&#8217;s service archive architecture is based on the <strong><em>Java Extension Management (JMX)</em></strong>. During the server bootup process, the service archive deployer (SARDeployer) instantiates the JBoss service classes and exposes them as manageable beans hrough JMX. You can view all of registered <strong><em>JBoss</em></strong> service components in the <strong><em>JBoss JMX Console</em></strong> web application.</p>
<h4>Create SAR file</h4>
<p>In this section we will see how to create the <strong><em>SAR</em></strong> file. The following are the steps required to create a SAR file:</p>
<p><strong><em>Add JAR Files</em></strong></p>
<p><em>Jakarta Commons IO, Jakarta Commons Logging, jboss-common.jar, jboss-jmx.jar<br />
,jboss-system.jar, jboss-xml-binding.jar</em></p>
<p><strong><em>Create MBean interface as Follows :</em></strong></p><div class="wpInsert wpInsertInPostAd wpInsertMiddle" style="margin: 5px; padding: 0px;"><script type="text/javascript"><!--
google_ad_client = "ca-pub-1490953723360528";
/* Article-Middle-Med-Rect */
google_ad_slot = "7805667846";
google_ad_width = 300;
google_ad_height = 250;
//-->
</script>
<script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script></div>

<div class="wp_syntax"><table><tr><td class="code"><pre class="language" style="font-family:monospace;">	public interface JavaBeatMBean implements ServiceMBean{
		public void start();
		public void stop();
	}</pre></td></tr></table></div>

<p><strong><em>Create MBean implementation class as Follows :</em></strong></p>

<div class="wp_syntax"><table><tr><td class="code"><pre class="language" style="font-family:monospace;">	public class JavaBeat{
		public void start(){
			System.out.println(&quot;Test Start&quot;);
		}
		public void stop(){
			System.out.println(&quot;Test Stop&quot;);
		}
	}</pre></td></tr></table></div>

<p>Create a new implementation class, JavaBeat, that implements JavaBeatMBean. As prescribed by the standard <strong><em>MBean</em></strong> specs, the implemented class must have the same name as the <strong><em>MBean</em></strong> interface minus the &#8220;MBean&#8221; suffix. Now we have created the service component, its time to package and deploy the component.</p>
<p><strong><em>Create jboss-service.xml as follows:</em></strong></p>

<div class="wp_syntax"><table><tr><td class="code"><pre class="language" style="font-family:monospace;"> </pre></td></tr></table></div>

<p>This file should be kept inside the <strong><em>META-INF</em></strong> folder.</p>
<p><strong><em>Build and create SAR file</em></strong></p>

<div class="wp_syntax"><table><tr><td class="code"><pre class="language" style="font-family:monospace;">When you build and creating the SAR file, it should be in the following package structure:
javabeat-service.sar-&amp;gt;META-INF/jboss-service.xml
javabeat-service.sar-&amp;gt;JavaBeat.class
javabeat-service.sar-&amp;gt;JavaBeatMBean.class
javabeat-service.sar-&amp;gt;JAR files</pre></td></tr></table></div>

<p>when you deploy this <strong><em>SAR</em></strong> file, application server will deploy the component and start the JavaBeat class&#8217;s start methods.<br />
start is a callback method in the <strong><em>MBean</em></strong> interfaces.</p>
<div class="wpInsert wpInsertInPostAd wpInsertBelow" style="margin: 5px; padding: 0px;"><script type="text/javascript"><!--
google_ad_client = "ca-pub-1490953723360528";
/* JB-Footer-LU 468x15 */
google_ad_slot = "8789107210";
google_ad_width = 468;
google_ad_height = 15;
//-->
</script>
<script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script></div>]]></content:encoded>
			<wfw:commentRss>http://www.javabeat.net/2008/08/sar-service-archive-file-in-jboss/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>How to use datasource in Hibernate application?</title>
		<link>http://www.javabeat.net/2008/07/how-to-use-datasource-in-hibernate-application/</link>
		<comments>http://www.javabeat.net/2008/07/how-to-use-datasource-in-hibernate-application/#comments</comments>
		<pubDate>Wed, 23 Jul 2008 10:51:25 +0000</pubDate>
		<dc:creator>JavaBeat</dc:creator>
				<category><![CDATA[Hibernate]]></category>
		<category><![CDATA[JBoss]]></category>
		<category><![CDATA[MYSQL]]></category>

		<guid isPermaLink="false">http://www.javabeat.net/examples/?p=180</guid>
		<description><![CDATA[<p>Connect to us ( <a href="https://twitter.com/javabeat">@twitter</a> | <a href="https://www.facebook.com/javabeat.net">@facebook )</p><p>This article explains how to configure datasource in the JBoss application server and how to use the same datasource in the hibernate configuration file.Before looking into the hibernate configuration, we will start with creating datasource inside JBoss application server. Create MySql datasource in JBoss To create datasource for the MySql database inside the JBoss application [...]</p>]]></description>
				<content:encoded><![CDATA[<p>Connect to us ( <a href="https://twitter.com/javabeat">@twitter</a> | <a href="https://www.facebook.com/javabeat.net">@facebook )</p><div class="wpInsert wpInsertInPostAd wpInsertLeft" style="float: left; margin: 5px; padding: 0px;"><script type="text/javascript"><!--
google_ad_client = "ca-pub-1490953723360528";
/* Article-Rect */
google_ad_slot = "9976259118";
google_ad_width = 300;
google_ad_height = 250;
//-->
</script>
<script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script></div><p>This article explains how to configure <b><i>datasource</i></b> in the <b><i>JBoss</i></b> application server and how to use the same datasource in the hibernate configuration file.Before looking into the hibernate configuration, we will start with creating datasource inside <b><i>JBoss application server</i></b>.</p>
<h1>Create MySql datasource in JBoss</h1>
<p>To create datasource for the <b><i>MySql</i></b> database inside the JBoss application server, you have to<br />
first create <b><i>mysql-ds.xml</i></b> file with the following entries:</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
</pre></td><td class="code"><pre class="language" style="font-family:monospace;">&lt;datasources&gt;
  &lt;local-tx-datasource&gt;
    &lt;jndi-name&gt;SampleDS&lt;/jndi-name&gt;
    &lt;connection-url&gt;jdbc:mysql://localhost:3306/SampleDB&lt;/connection-url&gt;
    &lt;driver-class&gt;com.mysql.jdbc.Driver&lt;/driver-class&gt;
     &lt;min-pool-size&gt;1&gt;/min-pool-size&gt;
      &lt;max-pool-size&gt;20&gt;/max-pool-size&gt;
      &lt;user-name&gt;root&gt;/user-name&lt;
      &lt;password&gt;root&lt;/password&gt;
     &lt;metadata&gt;
       &lt;type-mapping&amp;g;mySQL&lt;/type-mapping&gt;
    &lt;/metadata&gt;
  &lt;/local-tx-datasource&gt;
&lt;/datasource&gt;</pre></td></tr></table></div>

<p>Put <b><i>mysql-ds.xml</i></b> file under <b><i>jbossserverdefaultdeploy</i></b>. <b><i>JBoss</i></b> application server will<br />
automatically take this file and create the datasource for you. You need not restart the server. Creating datasource<br />
is completed. Next we will look into the hibernate configuration file for maping this datasource.
</p><div class="wpInsert wpInsertInPostAd wpInsertMiddle" style="margin: 5px; padding: 0px;"><script type="text/javascript"><!--
google_ad_client = "ca-pub-1490953723360528";
/* Article-Middle-Med-Rect */
google_ad_slot = "7805667846";
google_ad_width = 300;
google_ad_height = 250;
//-->
</script>
<script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script></div>
<h1>Use datasource in Hibernate configuration</h1>
<p>
	To map <b><i>datasource</i></b> in the <b><i>hibernate</i></b> configuration file is simple task and need not<br />
	specify anything other than the datasource name. You have to include the following two lines of code<br />
	in the configuration file to tell the <b><i>hibernate container</i></b> to use datasouce for retrieving the new<br />
	connection from the databse.</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
</pre></td><td class="code"><pre class="language" style="font-family:monospace;">&lt;property name=&quot;dialect&quot;&gt;
	org.hibernate.dialect.MySQLDialect
&lt;/property&gt;
&lt;property name=&quot;connection.datasource&quot;&gt;SampleDS&lt;/property&gt;</pre></td></tr></table></div>

<p>Now we have configured datasource and mapped to the hibernate configuration file. All the connection<br />
from the hibernate will be retrieved from datasource instead of directly from the database. This approach is<br />
most widely used for the application development.
</p>
<h4>mysql-ds.xml</h4>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
</pre></td><td class="code"><pre class="language" style="font-family:monospace;">&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?&gt;
&nbsp;
&lt;!-- $Id: mysql-ds.xml 63175 2007-05-21 16:26:06Z rrajesh $ --&gt;
&lt;!--  Datasource config for MySQL using 3.0.9 available from:
http://www.mysql.com/downloads/api-jdbc-stable.html
--&gt;
&nbsp;
&lt;datasources&gt;
  &lt;local-tx-datasource&gt;
    &lt;jndi-name&gt;SampleDS&lt;/jndi-name&gt;
    &lt;connection-url&gt;jdbc:mysql://localhost:3306/SimpleDB&lt;/connection-url&gt;
    &lt;driver-class&gt;com.mysql.jdbc.Driver&lt;/driver-class&gt;
     &lt;min-pool-size&gt;1&lt;/min-pool-size&gt;
      &lt;max-pool-size&gt;20&lt;/max-pool-size&gt;
      &lt;user-name&gt;root&lt;/user-name&gt;
    &lt;password&gt;root&lt;/password&gt;--&gt;
    &lt;metadata&gt;
       &lt;type-mapping&gt;mySQL&lt;/type-mapping&gt;
    &lt;/metadata&gt;
  &lt;/local-tx-datasource&gt;
&lt;/datasource&gt;</pre></td></tr></table></div>

<h4>hibernate.cfg.xml</h4>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
</pre></td><td class="code"><pre class="language" style="font-family:monospace;">&lt;?xml version='1.0' encoding='UTF-8'?&gt;
&lt;!DOCTYPE hibernate-configuration PUBLIC
          &quot;-//Hibernate/Hibernate Configuration DTD 3.0//EN&quot;
          &quot;http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd&quot;&gt;
&nbsp;
&lt;hibernate-configuration&gt;
    &lt;session-factory&gt;
            &lt;property name=&quot;dialect&quot;&gt;
            org.hibernate.dialect.MySQLDialect
        &lt;/property&gt;
        &lt;property name=&quot;connection.datasource&quot;&gt;SampleDS&lt;/property&gt;
    &lt;/session-factory&gt;
&nbsp;
&lt;/hibernate-configuration&gt;</pre></td></tr></table></div>

<div class="wpInsert wpInsertInPostAd wpInsertBelow" style="margin: 5px; padding: 0px;"><script type="text/javascript"><!--
google_ad_client = "ca-pub-1490953723360528";
/* JB-Footer-LU 468x15 */
google_ad_slot = "8789107210";
google_ad_width = 468;
google_ad_height = 15;
//-->
</script>
<script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script></div>]]></content:encoded>
			<wfw:commentRss>http://www.javabeat.net/2008/07/how-to-use-datasource-in-hibernate-application/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Publish and Subscribe messages using JMS Topic in JBoss Server</title>
		<link>http://www.javabeat.net/2008/07/publish-and-subscribe-messages-using-jms-topic-in-jboss-server/</link>
		<comments>http://www.javabeat.net/2008/07/publish-and-subscribe-messages-using-jms-topic-in-jboss-server/#comments</comments>
		<pubDate>Thu, 10 Jul 2008 10:29:08 +0000</pubDate>
		<dc:creator>JavaBeat</dc:creator>
				<category><![CDATA[JBoss]]></category>
		<category><![CDATA[JMS]]></category>

		<guid isPermaLink="false">http://www.javabeat.net/examples/?p=132</guid>
		<description><![CDATA[<p>Connect to us ( <a href="https://twitter.com/javabeat">@twitter</a> | <a href="https://www.facebook.com/javabeat.net">@facebook )</p><p>Publish and Subscribe using JMS Topic This tips gives overview on how to write Java Messaging Service(JMS) code for creating Topic in the Tomcat server. This is very basic example and only show how to get started instead of looking into the advanced concepts in JMS technology. In JMS, publish/subscribe messaging uses a JMS-managed object [...]</p>]]></description>
				<content:encoded><![CDATA[<p>Connect to us ( <a href="https://twitter.com/javabeat">@twitter</a> | <a href="https://www.facebook.com/javabeat.net">@facebook )</p><div class="wpInsert wpInsertInPostAd wpInsertLeft" style="float: left; margin: 5px; padding: 0px;"><script type="text/javascript"><!--
google_ad_client = "ca-pub-1490953723360528";
/* Article-Rect */
google_ad_slot = "9976259118";
google_ad_width = 300;
google_ad_height = 250;
//-->
</script>
<script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script></div><h2>Publish and Subscribe using JMS Topic</h2>
<p>This tips gives overview on how to write <b><i>Java Messaging Service(JMS)</i></b> code for creating Topic in the Tomcat server. This is very basic example and only show how to get started instead of looking into the advanced concepts in JMS technology.</p>
<p>In <b><i>JMS</i></b>, publish/subscribe messaging uses a JMS-managed object called a Topic to manage message flow from publishers to subscribers. <b><i>JMS</i></b> publishers are called message producers, and <b><i>JMS</i></b> subscribers are called message consumers. A message producer acquires a reference to a <b><i>JMS Topic</i></b> on a server, and sends messages to that Topic. When a message arrives, the <b><i>JMS provider</i></b> is responsible for notifying all message consumers subscribed to that Topic. The JMS provider (optionally) receives acknowledgment of the message receipt each time it sends the message. </p>
<p>This example is used <b><i>JBoss server</i></b> for the testing of application. Before run this example please start your <b><i>JBoss server</i></b> and put the following jar files in the classpath. JAR files are specific to the JBoss server MQ operations. It may not work with other vendor provided application servers.</p><div class="wpInsert wpInsertInPostAd wpInsertMiddle" style="margin: 5px; padding: 0px;"><script type="text/javascript"><!--
google_ad_client = "ca-pub-1490953723360528";
/* Article-Middle-Med-Rect */
google_ad_slot = "7805667846";
google_ad_width = 300;
google_ad_height = 250;
//-->
</script>
<script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script></div>
<p>The example program just simply add a message into the <b><i>JMS Topic</i></b> and subscribe to the topic.</p>
<h3>JAR files</h3>
<ul>
<h4>jms.jar</h4>
<h4>jnp-client.jar</h4>
<h4>jboss-common.jar</h4>
<h4>concurrent.jar</h4>
<h4>jbossmq-client.jar</h4>
<h3>JMSExample.java</h3>
</ul>
<h3>jbossmq-destinations-service.xml</h3>
<p>The following code needs to be added in the JBoss configuration xml file for creating the Topic while server<br />
is started.</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
</pre></td><td class="code"><pre class="language" style="font-family:monospace;"> &lt;mbean code=&quot;org.jboss.mq.server.jmx.Topic&quot;
     name=&quot;jboss.mq.destination:service=Topic,name=testTopic&quot;&gt;
    &lt;depends optional-attribute-name=&quot;DestinationManager&quot;&gt;jboss.mq:service=DestinationManager&lt;/depends&gt;
    &lt;depends optional-attribute-name=&quot;SecurityManager&quot;&gt;jboss.mq:service=SecurityManager&lt;/depends&gt;
    &lt;attribute name=&quot;SecurityConf&quot;&gt;
      &lt;security&gt;
        &lt;role name=&quot;guest&quot; read=&quot;true&quot; write=&quot;true&quot;/&gt;
        &lt;role name=&quot;publisher&quot; read=&quot;true&quot; write=&quot;true&quot; create=&quot;false&quot;/&gt;
        &lt;role name=&quot;durpublisher&quot; read=&quot;true&quot; write=&quot;true&quot; create=&quot;true&quot;/&gt;
      &lt;/security&gt;
    &lt;/attribute&gt;
  &lt;/mbean&gt;</pre></td></tr></table></div>

<h3>jbossmq-destinations-service.xml</h3>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
</pre></td><td class="code"><pre class="language" style="font-family:monospace;">package javabeat.net.jms;
&nbsp;
import java.util.Properties;
&nbsp;
import javax.jms.Message;
import javax.jms.MessageListener;
import javax.jms.TextMessage;
import javax.jms.Topic;
import javax.jms.TopicConnection;
import javax.jms.TopicConnectionFactory;
import javax.jms.TopicPublisher;
import javax.jms.TopicSession;
import javax.jms.TopicSubscriber;
import javax.naming.Context;
import javax.naming.InitialContext;
&nbsp;
public class JMSExample implements MessageListener {
&nbsp;
    public static void main(String argc[]) {
        new JMSExample().testMessage();
    }
&nbsp;
    public void testMessage() {
        TopicConnection conn = null;
        TopicSession session = null;
        Topic topic = null;
        try {
            Properties props = new Properties();
            props.setProperty(&quot;java.naming.factory.initial&quot;,
                    &quot;org.jnp.interfaces.NamingContextFactory&quot;);
            props.setProperty(&quot;java.naming.factory.url.pkgs&quot;,
                    &quot;org.jboss.naming&quot;);
            props.setProperty(&quot;java.naming.provider.url&quot;, &quot;localhost&quot;);
            Context context = new InitialContext(props);
            TopicConnectionFactory tcf = (TopicConnectionFactory) context.lookup(&quot;ConnectionFactory&quot;);
            conn = tcf.createTopicConnection();
            topic = (Topic) context.lookup(&quot;topic/testTopic&quot;);
            session = conn.createTopicSession(false,
                    TopicSession.AUTO_ACKNOWLEDGE);
            conn.start();
            TopicPublisher send = session.createPublisher(topic);
            TextMessage tm = session.createTextMessage(&quot;JavaBeat Test Message&quot;);
            send.publish(tm);
            send.close();
            TopicSubscriber topicSubscriber = session.createSubscriber(
                    topic);
            topicSubscriber.setMessageListener(this);
            while (true) {
                Message message = topicSubscriber.receive(1);
                if (message != null) {
                    if (message instanceof TextMessage) {
                        TextMessage textMessage = (TextMessage) message;
                        System.out.println(message);
                        System.out.println(
                                textMessage.getText());
                    } else {
                        break;
                    }
                }
            }
&nbsp;
        } catch (Exception e) {
            System.out.println(e.toString() + &quot; Does the queue exist?&quot;);
        }
    }
&nbsp;
    public void onMessage(Message message) {
        try {
            TextMessage textMessage = (TextMessage) message;
            String text = textMessage.getText();
            System.out.println(text);
        } catch (Exception jmse) {
            jmse.printStackTrace();
        }
    }
}</pre></td></tr></table></div>

<div class="wpInsert wpInsertInPostAd wpInsertBelow" style="margin: 5px; padding: 0px;"><script type="text/javascript"><!--
google_ad_client = "ca-pub-1490953723360528";
/* JB-Footer-LU 468x15 */
google_ad_slot = "8789107210";
google_ad_width = 468;
google_ad_height = 15;
//-->
</script>
<script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script></div>]]></content:encoded>
			<wfw:commentRss>http://www.javabeat.net/2008/07/publish-and-subscribe-messages-using-jms-topic-in-jboss-server/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Creating Webservice using JBoss and Eclipse Europa</title>
		<link>http://www.javabeat.net/2007/10/creating-webservice-using-jboss-and-eclipse-europa/</link>
		<comments>http://www.javabeat.net/2007/10/creating-webservice-using-jboss-and-eclipse-europa/#comments</comments>
		<pubDate>Fri, 12 Oct 2007 11:39:44 +0000</pubDate>
		<dc:creator>krishnas</dc:creator>
				<category><![CDATA[Eclipse]]></category>
		<category><![CDATA[JBoss]]></category>
		<category><![CDATA[Webservices]]></category>
		<category><![CDATA[Eclipse Europa]]></category>
		<category><![CDATA[Webservice]]></category>

		<guid isPermaLink="false">http://www.javabeat.net/?p=110</guid>
		<description><![CDATA[<p>Connect to us ( <a href="https://twitter.com/javabeat">@twitter</a> | <a href="https://www.facebook.com/javabeat.net">@facebook )</p><p>This article will introduce you to JBoss Webservice(JAX-WS). Here you will be knowing how to use the annotations and create a web service to deploy in JBoss. Since JBoss comes with JAX-WS jars inbuilt, we will not be adding any jars in addition for this article. This article will also give you a example code [...]</p>]]></description>
				<content:encoded><![CDATA[<p>Connect to us ( <a href="https://twitter.com/javabeat">@twitter</a> | <a href="https://www.facebook.com/javabeat.net">@facebook )</p><div class="wpInsert wpInsertInPostAd wpInsertLeft" style="float: left; margin: 5px; padding: 0px;"><script type="text/javascript"><!--
google_ad_client = "ca-pub-1490953723360528";
/* Article-Rect */
google_ad_slot = "9976259118";
google_ad_width = 300;
google_ad_height = 250;
//-->
</script>
<script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script></div><p><span style="font-size: 13px;">This article will introduce you to </span><strong style="font-size: 13px;"><em>JBoss Webservice</em></strong><strong style="font-size: 13px;"><em>(JAX-WS)</em></strong><span style="font-size: 13px;">. Here you will be knowing how to use the </span><strong style="font-size: 13px;"><em>annotations</em></strong><span style="font-size: 13px;"> and create a web service to deploy in JBoss. Since JBoss comes with </span><strong style="font-size: 13px;"><em>JAX-WS</em></strong><span style="font-size: 13px;"> jars inbuilt, we will not be adding any jars in addition for this article. This article will also give you a example code and walk you through the code. This will also explain creation of </span><strong style="font-size: 13px;"><em>dynamic web project</em></strong><span style="font-size: 13px;"> (not elaborated) and </span><strong style="font-size: 13px;"><em>configuration of JBoss server</em></strong><span style="font-size: 13px;"> to it.</span></p>
<p>You can also get <strong><em>JBossws</em></strong> download separately and create a webservice and deploy it in your preferred application server. Since we are using JBoss for this article we will not be covering this information here.</p>
<h2>Software Used in <strong><em>Configuring JBossws</em></strong></h2>
<ul>
<li><strong><em>JBoss Application Server 4.0.5.GA</em></strong>.</li>
<li><strong><em>Eclipse Europa</em></strong> (WTP all in one pack)</li>
<li><strong><em>JDK 1.5.x</em></strong></li>
</ul>
<h2>Pre-Requirements to Learn JBossWs and follow this article.</h2>
<ul>
<li>Should have <strong><em>Java</em></strong> knowledge.</li>
<li>Should know how to use <strong><em>Eclipse</em></strong>. (Creating web projects in Eclipse)</li>
<li>Should have basic knowledge of <strong><em>webservice</em></strong>.</li>
</ul>
<h2>Where to get the JBossWs from?</h2>
<p>You can download the software from the following URL:</p>
<ul>
<li><strong><em>JBoss Application Server 4.0.5.GA</em></strong>. == <a href="http://labs.jboss.com/" target="_blank">http://labs.jboss.com/</a></li>
<li><strong><em>Eclipse Europa</em></strong> (WTP all in one pack)== <a href="http://eclipse.org" target="_blank">http://eclipse.org</a></li>
<li><strong><em>JDK 1.5.x</em></strong> == <a href="http://java.sun.com" target="_blank">http://java.sun.com</a></li>
</ul>
<h2>Defining JBoss server in Eclipse</h2>
<p>First thing what you have to do is to <strong><em>define JBoss server in Eclipse</em></strong>. The steps below will explain how to define JBoss server in Eclipse.</p>
<ul>
<li>Step 1 : Open <strong><em>Eclipse WTP all in one pack</em></strong> in a new work space.</li>
<li>Step 2 : Change the perspective to <strong><em>J2EE Perspective</em></strong> if it is not currently in J2EE Perspective.</li>
<li>Step 3 : Once the Perspective is changed to <strong><em>J2EE</em></strong>, you can see a tab called <strong><em>Servers</em></strong> in the bottom right panel along with Problems, Tasks, Properties.</li>
<li>Step 4 : If the Servers tab is not found. Go to Eclipse <strong><em>menu : Windows &gt; Show view</em></strong> and click on Servers, so that Server tab will be displayed.</li>
<li>Step 5 : Go to Servers tab window and right click the mouse. You will get a pop up menu called &#8220;New&#8221;.</li>
<li>Step 6 : Clicking on the New menu you will get one more pop up called <strong><em>&#8220;Server&#8221;</em></strong>. Click on it.</li>
<li>Step 7 : Now you will get <strong><em>Define New Server Wizard</em></strong>.</li>
<li>Step 8 : In the wizard there are options to define many servers. One among them is <strong><em>JBoss</em></strong>. Click on JBoss and Expand the tree.</li>
<li>Step 9 : Select <strong><em>JBoss v 4.0</em></strong> and click next.</li>
<li>Step 10 : Now give the <strong><em>JDK</em></strong> directory and <strong><em>JBoss home</em></strong> directory. Click Next.</li>
<li>Step 11 : Now the wizard will show you the default Address, port, etc., Leave it as it is and click on Next.</li>
<li>Step 12 : Click on finish.</li>
<li>Step 13 : Now you can see the <strong><em>JBoss server</em></strong> listed in the Servers window and the status is Stopped.</li>
<li>Step 14 : JBoss server is now defined in Eclipse now and its ready to use from with in <strong><em>Eclipse IDE</em></strong>.</li>
</ul>
<h2>Creating a Dynamic Web Application Project</h2>
<p>Now it is time to <strong><em>create a web application</em></strong> in order to <strong><em>Expose a method as a Web service</em></strong>.</p>
<p>Create a <strong><em>Dynamic Web Application Project in eclipse</em></strong> by selecting the <strong><em>JBoss server</em></strong> what we have defined in the Eclipse IDE as the default server for the project. (We assume that who ever is reading this article knows how to create a dynamic web application in Eclipse, So that part is not detailed out here).</p>
<p>Once the <strong><em>JBoss server</em></strong> is selected as the server for the web applications. <strong><em>All the libraries existing in JBoss will be selected and used by eclipse in the Build Path</em></strong>. So no need to add any extra jar files for our work.</p>
<p>Now we will start with a <strong><em>Java code</em></strong>:</p>
<p>This is a simple <strong><em>Java code</em></strong> and does not have any thing to do with <strong><em>Webservices</em></strong>.</p>
<h3>JBossWs Code sample without annotations: (TestWs.java)</h3>
<p>Our Java code will have a single method called &#8220;greet&#8221;. Its functionality will be just to accept a string and return the same prefixed with &#8220;Hello&#8221;.</p>
<pre class="brush: java; title: ; notranslate">package com.test.dhanago;

public class TestWs
{
   /**
    * This method will accept a string and prefix with Hello.
    *
    * @param name
    * @return
    */
   public String greet( String name )
   {
      return &quot;Hello&quot; + name;
   }
}</pre>
<p>We will add <strong><em>annotations</em></strong> to the above code and modify the code like below:</p>
<h3>JBossWs Code sample with annotations: (TestWs.java)</h3>
<pre class="brush: java; title: ; notranslate">package com.test.dhanago;

import javax.jws.WebMethod;
import javax.jws.WebParam;
import javax.jws.WebService;
import javax.jws.soap.SOAPBinding;

/**
 * This is a webservice class exposing a method called greet which takes a
 * input parameter and greets the parameter with hello.
 *
 * @author dhanago
 */

/*
 * @WebService indicates that this is webservice interface and the name
 * indicates the webservice name.
 */
@WebService(name = &quot;TestWs&quot;)
/*
 * @SOAPBinding indicates binding information of soap messages. Here we have
 * document-literal style of webservice and the parameter style is wrapped.
 */
@SOAPBinding
   (
         style = SOAPBinding.Style.DOCUMENT,
         use = SOAPBinding.Use.LITERAL,
         parameterStyle = SOAPBinding.ParameterStyle.WRAPPED
    )
public class TestWs
{
   /**
    * This method takes a input parameter and appends &quot;Hello&quot; to it and
    * returns the same.
    *
    * @param name
    * @return
    */
   @WebMethod
   public String greet( @WebParam(name = &quot;name&quot;)
   String name )
   {
      return &quot;Hello&quot; + name;
   }

}</pre>
<h3>JBossWs annotations Walk Through</h3>
<pre class="brush: java; title: ; notranslate">@WebService(name = &quot;TestWs&quot;)</pre>
<p>Here, <strong><em>@WebService </em></strong>Indicates that this is a webservice class. <strong><em>name = &#8220;TestWs&#8221; </em></strong>Indicates the webservice name.</p>
<pre class="brush: java; title: ; notranslate">@SOAPBinding
   (
         style = SOAPBinding.Style.DOCUMENT,
         use = SOAPBinding.Use.LITERAL,
         parameterStyle = SOAPBinding.ParameterStyle.WRAPPED
    )</pre>
<p>Here, <strong><em>@SOAPBinding </em></strong>Indicates binding information of <strong><em>soap messages</em></strong>. The properties below them indicates the <strong><em>style of web service</em></strong>, Here it is <strong><em>document-literal style</em></strong>. And <strong><em>parameter style is Wrapped</em></strong>.</p>
<p>Here, <strong><em>@WebMethod </em></strong>Indicates this is a method <strong><em>exposed as web service</em></strong>. <strong><em>@WebParam </em></strong>Indicates the <strong><em>parameter name to be used in soap message</em></strong>.</p>
<h2>JBossWs Deployment Descriptor</h2>
<p>Once the code is ready and compiled. You have modify the web.xml file located in WEB-INF folder.</p><div class="wpInsert wpInsertInPostAd wpInsertMiddle" style="margin: 5px; padding: 0px;"><script type="text/javascript"><!--
google_ad_client = "ca-pub-1490953723360528";
/* Article-Middle-Med-Rect */
google_ad_slot = "7805667846";
google_ad_width = 300;
google_ad_height = 250;
//-->
</script>
<script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script></div>
<p>Modify the <strong><em>web.xml</em></strong> file like below. (web.xml)</p>
<pre class="brush: java; title: ; notranslate">
&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?&gt;
&lt;web-app xmlns:xsi=&quot;http://www.w3.org/2001/XMLSchema-instance&quot;
    xmlns=&quot;http://java.sun.com/xml/ns/javaee&quot;
    xmlns:web=&quot;http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd&quot;
    xsi:schemaLocation=&quot;http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd&quot;
    id=&quot;WebApp_ID&quot; version=&quot;2.5&quot;&gt;
    &lt;display-name&gt;TestWS&lt;/display-name&gt;
    &lt;servlet&gt;
        &lt;servlet-name&gt;TestWs&lt;/servlet-name&gt;
        &lt;servlet-class&gt;com.test.dhanago.TestWs&lt;/servlet-class&gt;
        &lt;load-on-startup&gt;1&lt;/load-on-startup&gt;
    &lt;/servlet&gt;
    &lt;servlet-mapping&gt;
        &lt;servlet-name&gt;TestWs&lt;/servlet-name&gt;
        &lt;url-pattern&gt;/TestWs&lt;/url-pattern&gt;
    &lt;/servlet-mapping&gt;
    &lt;session-config&gt;
        &lt;session-timeout&gt;30&lt;/session-timeout&gt;
    &lt;/session-config&gt;
    &lt;welcome-file-list&gt;
        &lt;welcome-file&gt;index.html&lt;/welcome-file&gt;
        &lt;welcome-file&gt;index.htm&lt;/welcome-file&gt;
        &lt;welcome-file&gt;index.jsp&lt;/welcome-file&gt;
        &lt;welcome-file&gt;default.html&lt;/welcome-file&gt;
        &lt;welcome-file&gt;default.htm&lt;/welcome-file&gt;
        &lt;welcome-file&gt;default.jsp&lt;/welcome-file&gt;
    &lt;/welcome-file-list&gt;
&lt;/web-app&gt;
</pre>
<h2><strong><em>Deploying the JBoss web service application</em></strong></h2>
<p>Once this is done, its time to build and deploy the application in <strong><em>JBoss Application server</em></strong>.<br />
Once every thing is compiled with out any errors. And if you have enabled the <strong><em>Auto build unctionality of the Eclipse IDE</em></strong>, You have already done with building the application. If the auto build functionality of eclipse is not enabled, then right click on the project and build the project using build option.</p>
<p>Go to Servers window and right click on the <strong><em>JBoss server</em></strong> listed over there and select Run.<br />
Wait for server to start. Once it starts, right click on the server listing. You can find a option called <strong><em>&#8220;Add and Remove Project&#8221;</em></strong>. Click on the option. You will get a wizard where you can select your projects to move to right and <strong><em>configure with server</em></strong>. Once you moved your project. Click on finish.</p>
<p>Once it is done, you can find that the project is again build and moved to server default deployment folder automatically.</p>
<p>Console will display you like below.</p>
<pre class="brush: java; title: ; notranslate">Buildfile: D:\ec2\eclipse\plugins\org.eclipse.jst.server.generic.jboss_1.5.102.v20070608\buildfiles\jboss323.xml
deploy.j2ee.web:
      [jar] Building jar: D:\validation\.metadata\.plugins\org.eclipse.wst.server.core\tmp0\Tws.war
     [move] Moving 1 file to D:\MyBoss\jboss-4.0.5.GA_ws121\server\default\deploy
BUILD SUCCESSFUL
Total time: 10 seconds</pre>
<p>The dynamic web application i created is with the name &#8220;Tws&#8221;. So the build has created Tws.war and moved it to the default deploy folder of the JBoss server.</p>
<p>To make sure web service is started once it is deployed in the JBoss console you can find the log like below.</p>
<pre class="brush: java; title: ; notranslate">13:57:52,306 INFO  [ServiceEndpointManager] WebService started: http://:8080/Tws/TestWs</pre>
<p>To view the WSDL follow the link http://&lt;machine name&gt;:8080/Tws/TestWs?wsdl</p>
<p>To see the list of webservices deployed in your JBoss Application server follow the link <a href="http://localhost:8080/jbossws">http://localhost:8080/jbossws</a>. This browser console will have link to see your deployed webservices and their <strong><em>WSDL</em></strong> files.</p>
<h3>JBossWs Browser Console.</h3>
<p><a href="http://www.javabeat.net/wp-content/uploads/2007/10/1.jpg"><img class="aligncenter size-medium wp-image-889" title="1" alt="" src="http://www.javabeat.net/wp-content/uploads/2007/10/1-300x178.jpg" width="300" height="178" /></a>Clicking on <strong><em>View a list of deployed services</em></strong> will list you the deployed web services. In our case we will get the following screen where we can see the registered service endpoints.</p>
<p><a href="http://www.javabeat.net/wp-content/uploads/2007/10/2.jpg"><img class="aligncenter size-medium wp-image-890" title="2" alt="" src="http://www.javabeat.net/wp-content/uploads/2007/10/2-300x190.jpg" width="300" height="190" /></a>Here in this screen you can see the <strong><em>ServiceEndpointAddress</em></strong> link which will take you to the <strong><em>WSDL</em></strong> file.</p>
<p>You can also find the <strong><em>WSDL</em></strong> file in the following path:<br />
&lt;jboss_path&gt;\server\default\data\wsdl\&lt;project_name&gt;.war\&lt;filename&gt;.wsdl</p>
<p>You can generate the <strong><em>client stubs</em></strong> using this file and access the web service. Creating the client stubs to access the web service is out of scope of this article.</p>
<h2>The WSDL file generated using JBossWs is shown below:</h2>
<pre class="brush: java; title: ; notranslate">
&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?&gt;
&lt;definitions name=&quot;TestWsService&quot; targetNamespace=&quot;http://dhanago.test.com/&quot; xmlns:tns=&quot;http://dhanago.test.com/&quot; xmlns:xsd=&quot;http://www.w3.org/2001/XMLSchema&quot; xmlns:soap=&quot;http://schemas.xmlsoap.org/wsdl/soap/&quot; xmlns=&quot;http://schemas.xmlsoap.org/wsdl/&quot;&gt;
  &lt;types&gt;
    &lt;xs:schema targetNamespace=&quot;http://dhanago.test.com/&quot; version=&quot;1.0&quot; xmlns:tns=&quot;http://dhanago.test.com/&quot; xmlns:xs=&quot;http://www.w3.org/2001/XMLSchema&quot;&gt;
   &lt;xs:element name=&quot;greet&quot; type=&quot;tns:greet&quot;/&gt;
   &lt;xs:element name=&quot;greetResponse&quot; type=&quot;tns:greetResponse&quot;/&gt;
   &lt;xs:complexType name=&quot;greet&quot;&gt;
    &lt;xs:sequence&gt;
     &lt;xs:element minOccurs=&quot;0&quot; name=&quot;name&quot; type=&quot;xs:string&quot;/&gt;
    &lt;/xs:sequence&gt;
   &lt;/xs:complexType&gt;
   &lt;xs:complexType name=&quot;greetResponse&quot;&gt;
    &lt;xs:sequence&gt;
     &lt;xs:element minOccurs=&quot;0&quot; name=&quot;return&quot; type=&quot;xs:string&quot;/&gt;
    &lt;/xs:sequence&gt;
   &lt;/xs:complexType&gt;
  &lt;/xs:schema&gt;
  &lt;/types&gt;
  &lt;message name=&quot;TestWs_greet&quot;&gt;
    &lt;part name=&quot;greet&quot; element=&quot;tns:greet&quot;/&gt;
  &lt;/message&gt;
  &lt;message name=&quot;TestWs_greetResponse&quot;&gt;
    &lt;part name=&quot;greetResponse&quot; element=&quot;tns:greetResponse&quot;/&gt;
  &lt;/message&gt;
  &lt;portType name=&quot;TestWs&quot;&gt;
    &lt;operation name=&quot;greet&quot; parameterOrder=&quot;greet&quot;&gt;
      &lt;input message=&quot;tns:TestWs_greet&quot;/&gt;
      &lt;output message=&quot;tns:TestWs_greetResponse&quot;/&gt;
    &lt;/operation&gt;
  &lt;/portType&gt;
  &lt;binding name=&quot;TestWsBinding&quot; type=&quot;tns:TestWs&quot;&gt;
    &lt;soap:binding style=&quot;document&quot; transport=&quot;http://schemas.xmlsoap.org/soap/http&quot;/&gt;
    &lt;operation name=&quot;greet&quot;&gt;
      &lt;soap:operation soapAction=&quot;&quot;/&gt;
      &lt;input&gt;
        &lt;soap:body use=&quot;literal&quot;/&gt;
      &lt;/input&gt;
      &lt;output&gt;
        &lt;soap:body use=&quot;literal&quot;/&gt;
      &lt;/output&gt;
    &lt;/operation&gt;
  &lt;/binding&gt;
  &lt;service name=&quot;TestWsService&quot;&gt;
    &lt;port name=&quot;TestWsPort&quot; binding=&quot;tns:TestWsBinding&quot;&gt;
      &lt;soap:address location=&quot;http://EC3-NOR-124251:8080/Tws/TestWs&quot;/&gt;
    &lt;/port&gt;
  &lt;/service&gt;
&lt;/definitions&gt;
</pre>
<h2>Summary</h2>
<p>This article is just a quick start to start with for developers who want to quickly proceed with <strong><em>JBoss web services</em></strong>. It is up to the developers interest to leverage on this and proceed further. This is not the only procedure to expose a web service in JBoss. There might be lot of ways to do that and this is one of the way. So don&#8217;t stop here and continue Exploring.</p>
<div class="wpInsert wpInsertInPostAd wpInsertBelow" style="margin: 5px; padding: 0px;"><script type="text/javascript"><!--
google_ad_client = "ca-pub-1490953723360528";
/* JB-Footer-LU 468x15 */
google_ad_slot = "8789107210";
google_ad_width = 468;
google_ad_height = 15;
//-->
</script>
<script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script></div>]]></content:encoded>
			<wfw:commentRss>http://www.javabeat.net/2007/10/creating-webservice-using-jboss-and-eclipse-europa/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>jUDDI and Configuration in jBoss and MySQL database</title>
		<link>http://www.javabeat.net/2007/09/juddi-and-configuration-in-jboss-and-mysql-database/</link>
		<comments>http://www.javabeat.net/2007/09/juddi-and-configuration-in-jboss-and-mysql-database/#comments</comments>
		<pubDate>Mon, 24 Sep 2007 11:32:05 +0000</pubDate>
		<dc:creator>krishnas</dc:creator>
				<category><![CDATA[JBoss]]></category>

		<guid isPermaLink="false">http://www.javabeat.net/?p=98</guid>
		<description><![CDATA[<p>Connect to us ( <a href="https://twitter.com/javabeat">@twitter</a> | <a href="https://www.facebook.com/javabeat.net">@facebook )</p><p>UDDI is one of the core Web Service standard. It provides access to Web Service Description anguage which provides binding information and message formats required to interact with the web services listed in its directory. Enterprises that seek to optimize software or service reuse subscribe to some form of service-oriented architecture (SOA), server programs or [...]</p>]]></description>
				<content:encoded><![CDATA[<p>Connect to us ( <a href="https://twitter.com/javabeat">@twitter</a> | <a href="https://www.facebook.com/javabeat.net">@facebook )</p><div class="wpInsert wpInsertInPostAd wpInsertLeft" style="float: left; margin: 5px; padding: 0px;"><script type="text/javascript"><!--
google_ad_client = "ca-pub-1490953723360528";
/* Article-Rect */
google_ad_slot = "9976259118";
google_ad_width = 300;
google_ad_height = 250;
//-->
</script>
<script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script></div><p><em style="font-size: 13px;">UDDI</em><span style="font-size: 13px;"> is one of the core Web Service standard. It provides access to </span><em style="font-size: 13px;">Web Service Description anguage</em><span style="font-size: 13px;"> which provides binding information and message formats required to interact with the </span><em style="font-size: 13px;">web services</em><span style="font-size: 13px;"> listed in its directory. Enterprises that seek to optimize software or service reuse subscribe to some form of </span><em style="font-size: 13px;">service-oriented architecture (SOA)</em><span style="font-size: 13px;">, server programs or database software licensed by some of the professed founders of the </span><em style="font-size: 13px;">UDDI.org and OASIS</em><span style="font-size: 13px;">.</span></p>
<p>In this article we will see some of the existing UDDI clients and UDDI servers. Then we will move a head with introduction about juddi also called as <em>judy</em>. JUDDI&#8217;s features, Configuration.</p>
<h2>UDDI clients</h2>
<ul>
<li>uddi4j: UDDI for Java</li>
<li>UDDI.NET SDK: UDDI for Microsoft .NET</li>
<li>uddi4r: UDDI for Ruby</li>
<li>uddi4py: UDDI for Python</li>
<li>UDDI::Lite: UDDI for Perl</li>
</ul>
<h2>UDDI servers</h2>
<ul>
<li>Apache jUDDI: Open-Source UDDI Server</li>
<li>BEA Aqualogic Service Registry</li>
<li>Novell nSure UDDI Server: Open-Source UDDI Server</li>
<li>Microsoft Enterprise UDDI Server: Part of Windows 2003 Server</li>
<li>Systinet Registry</li>
<li>Oracle Service Registry</li>
<li>Software AG CentraSite</li>
<li>SAP Enterprise SOA PI7.1</li>
</ul>
<h2>What is JUDDI ?</h2>
<p><em>jUDDI</em> is an open source Java implementation of the Universal Description, Discovery, and Integration (UDDI) specification for Web Services. jUDDI is a pure java web application which can be deployed on any application server or a servlet engine supporting version 2.1 and above. UDDI needs to persist the registry data it manages. jUDDI uses an external database for persistence. Some of the relational database management systems like MySQL, HSQL, Oracle or DB2.</p>
<h2>jUDDI Features</h2>
<ul>
<li>jUDDI is an <em>open source Java implementation</em></li>
<li>Plateform Independent</li>
<li>Supports JDK version 1.3.1 and above</li>
<li>UDDI version 2.0 compliant implementation</li>
<li>Use with external database for persistence (RDBMS like MySQL, HSQL, Oracle or DB2)</li>
<li>jUDDI is a pure java web application which can be deployed on any application server or a servlet engine version 2.1 and above (Jakarta Tomcat, JOnAS, WebSphere, WebLogic, Borland Enterprise Server, JRun, etc.)</li>
<li>jUDDI easily integrates with existing authentication systems</li>
<li>jUDDI registry supports a clustered deployment configuration</li>
</ul>
<h2>UDDI Specifications</h2>
<ul>
<li>UDDI.org(http://www.uddi.org/)</li>
<li>UDDI Version 1.0 Specification(http://www.oasis-open.org/committees/uddi-spec/doc/contribs.htm#uddiv1)</li>
<li>UDDI Version 2.0 Specification(http://www.oasis-open.org/committees/uddi-spec/doc/contribs.htm#uddiv2)</li>
<li>UDDI Version 3.0 Specification(http://www.oasis-open.org/committees/uddi-spec/doc/contribs.htm#uddiv3)</li>
</ul>
<h2>Prerequisite</h2>
<p>This document assumes the reader of this document already has some femiliarity about java web applications, and web application deployment. Also assumes that the user has some knowledge about database and datastore.</p>
<h2>Software used</h2>
<ul>
<li>jUDDI version 0.9rc4 (Release Candidate #4 for Version 0.9.)</li>
<li>MySQL for Persistence</li>
<li>JBOSS application server version 4.0.x</li>
<li>JDK 1.5.x</li>
</ul>
<h2>jUDDI Datastore</h2>
<p>jUDDI is pre-configured to use JDBC and any one of the several DBMS listed below. Setting up of the database is very easy. Once you download the package jUDDI version 0.9, Unzip it and inside the package you can find a folder by name &#8220;sql&#8221;. Inside that folder you can find support for the following database.</p>
<ul>
<li><em>MySQL</em></li>
<li><em>HSQLdb (HypersonicSQL)</em></li>
<li><em>PostreSQL</em></li>
<li><em>Oracle</em></li>
<li><em>Sybase</em></li>
<li><em>DB2</em></li>
<li><em>TotalXML</em></li>
<li><em>JDataStore</em></li>
</ul>
<p>To complete the DataStore set up you&#8217;ll need to configure a JNDI Datasource with a name of &#8216;jdbc/juddiDB&#8217; in the application server or servlet engine that you&#8217;re deploying to. we will see how to set this up with JBOSS application server later in this document.</p>
<h2>System / Sub-system Architecture</h2>
<p><a href="http://www.javabeat.net/wp-content/uploads/2007/09/Sub-systemArchitecture.png"><img class="aligncenter size-medium wp-image-1287" title="Sub-systemArchitecture" alt="" src="http://www.javabeat.net/wp-content/uploads/2007/09/Sub-systemArchitecture-300x188.png" width="300" height="188" /></a>The above diagram shows the logical architecture of the components. Any<br />
operating system (here we are using windows xp)along with Jboss application server forms the foundation. jUDDI web application is deployed in jBoss application server. Web Services are registered in the jUDDI web application.</p>
<h2>Configuring jUDDI with JBOSS and MySQL</h2>
<p>UDDI needs persistent storage as mentioned in above section. Here we use MySQL for persistents.</p>
<p><strong>Step 1:</strong></p><div class="wpInsert wpInsertInPostAd wpInsertMiddle" style="margin: 5px; padding: 0px;"><script type="text/javascript"><!--
google_ad_client = "ca-pub-1490953723360528";
/* Article-Middle-Med-Rect */
google_ad_slot = "7805667846";
google_ad_width = 300;
google_ad_height = 250;
//-->
</script>
<script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script></div>
<p>Download MySQL-5.0.26 and install MySQL. Set the root password to password.</p>
<p><strong>Step 2:</strong></p>
<p>Install Jboss application server. Jboss version 4.0.5 is used for investigation.</p>
<p><strong>Step 3:</strong></p>
<p>MySQL driver installation: Download the corresponding drivers from the Internet and place it in &lt;jboss_home&gt;\server\default\lib folder. Driver used here is mysql-connector-java-5.0.4-bin.jar.<br />
&lt;/jboss_home&gt;</p>
<p><strong>Step 4:</strong></p>
<p><em>jUDDI Deployment:</em></p>
<ul>
<li>Download JUDDI version 0.9rc4</li>
<li>Unzip the file to some folder, say JUDY. There will be a folder inside the unzipped package named juddi. This folder has the folder structure as of web applications. Copy the folder and place it inside<br />
&lt;JBOSS_HOME&gt;\server\default\deploy. Rename the folder to<br />
juddi.war.</li>
<li>Inside JUDY where we have unzipped juddi download there is a folder called “sql”. There we can find the sql scripts for many databases. In that we do have sql script for creating juddi schema for MySQL. Run that script in installed MySQL and create the database and the tables.</li>
<li>Create juddi.xml: Create a file named juddi.xml in the folder &lt;JBOSS_HOME&gt;\server\default\conf and with in that copy and past the following code. The password in the following code should be set to the MySQL database password.
<pre class="brush: java; title: ; notranslate">
&lt;? Xml version=&quot;1.0&quot; encoding=&quot;ISO-8859-1&quot;?&gt;
&lt;!DOCTYPE weblogic-web-app PUBLIC &quot;-//BEA Systems, Inc.//DTD Web Application
6.0//EN&quot;  &quot;http://www.bea.com/servers/wls600/dtd/weblogic-web-jar.dtd&quot;&gt;
&lt;Context path=&quot;/juddi&quot; docBase=&quot;juddi&quot; debug=&quot;5&quot; reloadable=&quot;true&quot;
crossContext=&quot;true&quot;&gt;
&lt;Logger className=&quot;org.apache.catalina.logger.FileLogger&quot;
prefix=&quot;localhost_juddiDB_log&quot; suffix=&quot;.txt&quot; timestamp=&quot;true&quot;/&gt;
&lt;Resource name=&quot;jdbc/juddiDB&quot; auth=&quot;Container&quot; type=&quot;javax.sql.DataSource&quot;
maxActive=&quot;100&quot; maxIdle=&quot;30&quot; maxWait=&quot;10000&quot; username=&quot;juddi&quot;
password=&quot;password&quot; driverClassName=&quot;org.gjt.mm.mysql.Driver&quot;
url=&quot;jdbc: mysql://localhost:3306/juddi?autoReconnect=true&quot; /&gt;
&lt;/Context&gt;
</pre>
</li>
<li>Edit juddi.properties file located at &lt;JBOSS_HOME&gt;\server\default\deploy\juddi.war\web-inf\juddi.properties. Match the email address used with in the insert-publisher.sql. This should match the domine name used for the email address with in JUDDI&#8217;s insert-publisher.sql file
<pre class="brush: java; title: ; notranslate">&lt;code&gt;juddi.operatorEmailAddress = yourEmail@aDomain.com&lt;/code&gt;</pre>
</li>
<li>Create juddi-da.xml and place it in &lt;JBOSS_HOME&gt;\server\default\deploy. Copy the following code to it and save the file.
<pre class="brush: java; title: ; notranslate">
&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?&gt;
&lt;datasources&gt;
&lt;local-tx-datasource&gt;
&lt;jndi-name&gt;juddiDB&lt;/jndi-name&gt;
&lt;connection-url&gt;jdbc:mysql://localhost:3306/juddi&lt;/connection-url&gt;
&lt;driver-class&gt;com.mysql.jdbc.Driver&lt;/driver-class&gt;
&lt;user-name&gt;root&lt;/user-name&gt;
&lt;password&gt;password&lt;/password&gt;
&lt;min-pool-size&gt;1&lt;/min-pool-size&gt;
&lt;max-pool-size&gt;50&lt;/max-pool-size&gt;
&lt;/local-tx-datasource&gt;
&lt;/datasources&gt;
</pre>
</li>
<li>Edit juddi-user.xml file located at &lt;JBOSS_HOME&gt;\server\default\deploy\juddi.war\web-inf\juddi-user.xml and change the password for the user juddi to MySQL root password (i.e., password)</li>
<li>Run Jboss. Enter the URL http://&lt;hostname&gt;:8080/juddi/. We will get the juddi home page.<br />
Click on validate link. If there are any errors found in the validation page, Please follow all the steps above and validate again. If there are no errors then it means juddi is configured successfully.</li>
</ul>
<p>Once jUDDI is configured, its time to publish Web Service Description Language(WSDL). To publish there are some ways to do so. One of the way is to use the jUDDI API&#8217;s and write a CLI application to register the service in the<br />
registory. We also have some GUI UDDI tools through which we can register the services. These informations are not in the scope of this document.</p>
<h2>References</h2>
<ul>
<li><a href="http://ws.apache.org/juddi/" target="_blank">http://ws.apache.org/juddi/</a></li>
<li><a href="http://www.uddi.org/" target="_blank">http://www.uddi.org/</a></li>
</ul>
<h2>Conclusion</h2>
<p>Though this document stops with jUDDI configuration, there is a lot to<br />
learn and not covered under this document. we will conclude this<br />
document saying UDDI registry will help the feature B2B Internet web<br />
applications to a great extent to solve most of their current problems.</p>
<div class="wpInsert wpInsertInPostAd wpInsertBelow" style="margin: 5px; padding: 0px;"><script type="text/javascript"><!--
google_ad_client = "ca-pub-1490953723360528";
/* JB-Footer-LU 468x15 */
google_ad_slot = "8789107210";
google_ad_width = 468;
google_ad_height = 15;
//-->
</script>
<script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script></div>]]></content:encoded>
			<wfw:commentRss>http://www.javabeat.net/2007/09/juddi-and-configuration-in-jboss-and-mysql-database/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
