qpid-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From conflue...@apache.org
Subject [CONF] Apache Qpid > Qpid Java FAQ
Date Mon, 24 Aug 2009 02:45:00 GMT
<html>
<head>
    <base href="http://cwiki.apache.org/confluence">
            <link rel="stylesheet" href="/confluence/s/1519/1/1/_/styles/combined.css?spaceKey=qpid&amp;forWysiwyg=true"
type="text/css">
    </head>
<body style="background-color: white" bgcolor="white">
<div id="pageContent">
<div id="notificationFormat">
<div class="wiki-content">
<div class="email">
     <h2><a href="http://cwiki.apache.org/confluence/display/qpid/Qpid+Java+FAQ">Qpid
Java FAQ</a></h2>
     <h4>Page <b>edited</b> by             <a href="http://cwiki.apache.org/confluence/display/~robbie">Robbie
Gemmell</a>
    </h4>
     
          <br/>
     <div class="notificationGreySide">
         <h2><a name="QpidJavaFAQ-Purpose"></a>Purpose</h2>

<p>Here are a list of commonly asked questions and answers. Click on the the bolded
questions for the answer to unfold. If you have any questions which are not on this list,
please email our qpid-user list.</p>

<h2><a name="QpidJavaFAQ-Contents"></a>Contents</h2>

<div>
<ul>
    <li><a href='#QpidJavaFAQ-Purpose'>Purpose</a></li>
    <li><a href='#QpidJavaFAQ-Contents'>Contents</a></li>
    <li><a href='#QpidJavaFAQ-GettingStarted'>Getting Started</a></li>
<ul>
    <li><a href='#QpidJavaFAQ-WhatisQpid%3F'>What is Qpid ?</a></li>
    <li><a href='#QpidJavaFAQ-WhyamIgettingaConfigurationExceptionatbrokerstartup%3F'>Why
am I getting a ConfigurationException at broker startup ?</a></li>
<ul>
    <li><a href='#QpidJavaFAQ-InvocationTargetException'>InvocationTargetException</a></li>
    <li><a href='#QpidJavaFAQ-Cannotlocateconfigurationsourcenull%2Fvirtualhosts.xml'>Cannot
locate configuration source null/virtualhosts.xml</a></li>
</ul>
    <li><a href='#QpidJavaFAQ-HowdoIruntheQpidbroker%3F'>How do I run the Qpid
broker ?</a></li>
    <li><a href='#QpidJavaFAQ-HowcanIcreateaconnectionusingaURL%3F'>How can I
create a connection using a URL ?</a></li>
    <li><a href='#QpidJavaFAQ-HowdoIrepresentaJMSDestinationstringwithQPID%3F'>How
do I represent a JMS Destination string with QPID ?</a></li>
<ul>
    <li><a href='#QpidJavaFAQ-Queues'>Queues</a></li>
    <li><a href='#QpidJavaFAQ-Topics'>Topics</a></li>
</ul>
    <li><a href='#QpidJavaFAQ-HowdoIconnecttothebrokerusingJNDI%3F'>How do I connect
to the broker using JNDI ?</a></li>
    <li><a href='#QpidJavaFAQ-I%27musingSpringandWeblogiccanyouhelpmewiththeconfigurationformovingovertoQpid%3F'>I'm
using Spring and Weblogic - can you help me with the configuration for moving over to Qpid
?</a></li>
    <li><a href='#QpidJavaFAQ-HowdoIconfigurethelogginglevelforQpid%3F'>How do
I configure the logging level for Qpid ?</a></li>
    <li><a href='#QpidJavaFAQ-HowcanIconfiguremyapplicationtouseQpidclientlogging%3F'>How
can I configure my application to use Qpid client logging?</a></li>
    <li><a href='#QpidJavaFAQ-HowcanIconfigurethebroker%3F'>How can I configure
the broker ?</a></li>
    <li><a href='#QpidJavaFAQ-Whatportsdoesthebrokeruse%3F'>What ports does the
broker use?</a></li>
    <li><a href='#QpidJavaFAQ-HowcanIchangetheportthebrokerusesatruntime%3F'>How
can I change the port the broker uses at runtime ?</a></li>
    <li><a href='#QpidJavaFAQ-WhatcommandlineoptionscanIpassintotheqpidserverscript%3F'>What
command line options can I pass into the qpid-server script ?</a></li>
    <li><a href='#QpidJavaFAQ-CommandLineOptions'>Command Line Options</a></li>
    <li><a href='#QpidJavaFAQ-HowdoIauthenticatewiththebroker%3FWhatuserid%26passwordshouldIuse%3F'>How
do I authenticate with the broker ? What user id &amp; password should I use ?</a></li>
    <li><a href='#QpidJavaFAQ-HowdoIcreatequeuesthatwillalwaysbeinstantiatedatbrokerstartup%3F'>How
do I create queues that will always be instantiated at broker startup ?</a></li>
    <li><a href='#QpidJavaFAQ-HowdoIcreatequeuesatruntime%3F'>How do I create
queues at runtime?</a></li>
    <li><a href='#QpidJavaFAQ-HowdoItunethebroker%3F'>How do I tune the broker?</a></li>
    <li><a href='#QpidJavaFAQ-Wheredoundeliverablemessagesendup%3F'>Where do undeliverable
messages end up ?</a></li>
    <li><a href='#QpidJavaFAQ-CanIconfigurethenameoftheQpidbrokerlogfileatruntime%3F'>Can
I configure the name of the Qpid broker log file at runtime ?</a></li>
<ul>
    <li><a href='#QpidJavaFAQ-Settingaprefixorsuffix'>Setting a prefix or suffix</a></li>
    <li><a href='#QpidJavaFAQ-IncludingthePID'>Including the PID</a></li>
</ul>
    <li><a href='#QpidJavaFAQ-Myclientapplicationappearstohavehung%3F'>My client
application appears to have hung?</a></li>
    <li><a href='#QpidJavaFAQ-HowdoIcontacttheQpidteam%3F'>How do I contact the
Qpid team ?</a></li>
    <li><a href='#QpidJavaFAQ-HowcanIchangeauser%27spasswordwhilethebrokerisup%3F'>How
can I change a user's password while the broker is up ?</a></li>
    <li><a href='#QpidJavaFAQ-HowdoIknowifthereisaconsumerforamessageIamgoingtosend%3F'>How
do I know if there is a consumer for a message I am going to send?</a></li>
    <li><a href='#QpidJavaFAQ-HowdoIuseanInVMBrokerformyowntests%3F'>How do I
use an InVM Broker for my own tests?</a></li>
    <li><a href='#QpidJavaFAQ-HowcanIinspectthecontentsofmyMessageStore%3F'>How
can I inspect the contents of my MessageStore?</a></li>
    <li><a href='#QpidJavaFAQ-Whyaremytransientmessagesbeingsoslow%3F'>Why are
my transient messages being so slow?</a></li>
    <li><a href='#QpidJavaFAQ-Whydoesmyproducerfillupthebrokerwithmessages%3F'>Why
does my producer fill up the broker with messages?</a></li>
    <li><a href='#QpidJavaFAQ-ThebrokerkeepsthrowinganOutOfMemoryexception%3F'>The
broker keeps throwing an OutOfMemory exception?</a></li>
    <li><a href='#QpidJavaFAQ-WhyamIgettingabrokersideexceptionwhenItrytopublishtoaqueueoratopic%3F'>Why
am I getting a broker side exception when I try to publish to a queue or a topic ?</a></li>
    <li><a href='#QpidJavaFAQ-WhyistherealotofAnonymousIoServicethreads'>Why is
there a lot of AnonymousIoService threads</a></li>
    <li><a href='#QpidJavaFAQ-%22unabletocertifytheprovidedSSLcertificateusingthecurrentSSLtruststore%22whenconnectingtheManagementConsoletothebroker.'>"unable
to certify the provided SSL certificate using the current SSL trust store" when connecting
the Management Console to the broker.</a></li>
</ul>
</ul></div>

<h2><a name="QpidJavaFAQ-GettingStarted"></a>Getting Started</h2>

<ul>
	<li><a href="/confluence/display/qpid/Getting+Started+Guide" title="Getting Started
Guide">Can you help me get started with Qpid?</a></li>
	<li><a href="/confluence/display/qpid/Getting+Started+Guide" title="Getting Started
Guide">How do I install the Qpid broker ?</a></li>
	<li><a href="/confluence/display/qpid/Qpid+Java+How+To" title="Qpid Java How To">Where
can I find more information?</a></li>
	<li><a href="/confluence/display/qpid/Eclipse+Management+Console+FAQ" title="Eclipse
Management Console FAQ">Eclipse Management Console FAQ</a></li>
</ul>


<h3><a name="QpidJavaFAQ-WhatisQpid%3F"></a>What is Qpid ?</h3>

<p>The java implementation of Qpid is a pure Java message broker that implements the
AMQP protocol. Essentially, Qpid is a robust, performant middleware component that can handle
your messaging traffic.</p>

<p>It currently supports the following features:</p>
<ul>
	<li>High performance header-based routing for messages</li>
	<li>All features required by the JMS 1.1 specification. Qpid passes all tests in the
Sun JMS compliance test suite</li>
	<li>Transaction support</li>
	<li>Persistence using the high performance Berkeley DB Java Edition. The persistence
layer is also pluggable should an alternative implementation be required. The BDB store is
available from the <a href="/confluence/display/qpid/3rd+Party+Libraries" title="3rd Party
Libraries">3rd Party Libraries</a> page</li>
	<li>Pluggable security using SASL. Any Java SASL provider can be used</li>
	<li>Management using JMX and a custom management console built using Eclipse RCP</li>
	<li>Naturally, interoperability with other clients including the Qpid .NET, Python,
Ruby and C+&#43; implementations</li>
</ul>



<h3><a name="QpidJavaFAQ-WhyamIgettingaConfigurationExceptionatbrokerstartup%3F"></a>Why
am I getting a ConfigurationException at broker startup ?</h3>


<h4><a name="QpidJavaFAQ-InvocationTargetException"></a>InvocationTargetException</h4>
<p>If you get a java.lang.reflect.InvocationTargetException on startup, wrapped as ConfigurationException
like this:</p>
<div class="preformatted panel" style="border-width: 1px;"><div class="preformattedContent
panelContent">
<pre>Error configuring message broker: org.apache.commons.configuration.ConfigurationException:
java.lang.reflect.InvocationTargetException 
2008-09-26 15:14:56,529 ERROR [main] server.Main (Main.java:206) - Error configuring message
broker: org.apache.commons.configuration.ConfigurationException: java.lang.reflect.InvocationTargetException

org.apache.commons.configuration.ConfigurationException: java.lang.reflect.InvocationTargetException

at org.apache.qpid.server.security.auth.database.ConfigurationFilePrincipalDatabaseManager.initialisePrincipalDatabase(ConfigurationFilePrincipalDatabaseManager.java:158)

at org.apache.qpid.server.security.auth.database.ConfigurationFilePrincipalDatabaseManager.initialisePrincipalDatabases(ConfigurationFilePrincipalDatabaseManager.java:87)

at org.apache.qpid.server.security.auth.database.ConfigurationFilePrincipalDatabaseManager.&lt;init&gt;(ConfigurationFilePrincipalDatabaseManager.java:56)

at org.apache.qpid.server.registry.ConfigurationFileApplicationRegistry.initialise(ConfigurationFileApplicationRegistry.java:117)

at org.apache.qpid.server.registry.ApplicationRegistry.initialise(ApplicationRegistry.java:79)

at org.apache.qpid.server.registry.ApplicationRegistry.initialise(ApplicationRegistry.java:67)

at org.apache.qpid.server.Main.startup(Main.java:260) 
at org.apache.qpid.server.Main.execute(Main.java:196) 
at org.apache.qpid.server.Main.&lt;init&gt;(Main.java:96) 
at org.apache.qpid.server.Main.main(Main.java:454) 
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) 
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) 
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) 
at java.lang.reflect.Method.invoke(Method.java:597) 
at com.intellij.rt.execution.application.AppMain.main(AppMain.java:90) 
Caused by: java.lang.reflect.InvocationTargetException 
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) 
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) 
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) 
at java.lang.reflect.Method.invoke(Method.java:597) 
at org.apache.qpid.server.security.auth.database.ConfigurationFilePrincipalDatabaseManager.initialisePrincipalDatabase(ConfigurationFilePrincipalDatabaseManager.java:148)

</pre>
</div></div>

<p>.. then it means you have a missing password file. </p>

<p>You need to create a password file for your deployment and update your config.xml
to reflect the location of the password file for your instance.</p>

<p>The config.xml can be a little confusing in terms of element names and file names
for passwords.</p>

<p>To do this, you need to edit the passwordDir element for the broker, which may have
a comment to that effect: </p>
<div class="preformatted panel" style="border-width: 1px;"><div class="preformattedContent
panelContent">
<pre>&lt;passwordDir&gt;&lt;!-- Change to the location --&gt;&lt;/passwordDir&gt;
</pre>
</div></div>

<p>The file should be named passwd by default but if you want to you can change this
by editing this element:</p>
<div class="preformatted panel" style="border-width: 1px;"><div class="preformattedContent
panelContent">
<pre>&lt;value&gt;${passwordDir}/passwd&lt;/value&gt;
</pre>
</div></div>

<h4><a name="QpidJavaFAQ-Cannotlocateconfigurationsourcenull%2Fvirtualhosts.xml"></a>Cannot
locate configuration source null/virtualhosts.xml</h4>

<p>If you get this message, wrapped inside a ConfigurationException then you've come
across a known issue, see JIRA <a href="https://issues.apache.org/jira/browse/QPID-431"
rel="nofollow">QPID-431</a></p>

<p>The work around is to use a qualified path as the parameter value for your -c option,
rather than (as you migth be) starting the broker from your installed etc directory. Even
going up one level and using a path relative to your £QPID_HOME directory would sort this
e.g qpid-server -c ./etc/myconfig.xml</p>


<h3><a name="QpidJavaFAQ-HowdoIruntheQpidbroker%3F"></a>How do I run the
Qpid broker ?</h3>

<p>The broker comes with a script for unix/linux/cygwin called qpid-server, which can
be found in the bin directory of the installed package. This command can be executed without
any paramters and will then use the default configuration file provided on install.</p>

<p>For the Windows OS, please use qpid-server.bat.</p>

<p>There's no need to set your classpath for QPID as the scripts take care of that by
adding jar's with classpath defining manifest files to your classpath.</p>

<p>For more information on running the broker please see our <a href="/confluence/display/qpid/Getting+Started"
title="Getting Started">Getting Started</a> page.</p>


<h3><a name="QpidJavaFAQ-HowcanIcreateaconnectionusingaURL%3F"></a>How can
I create a connection using a URL ?</h3>


<p>Please see the <a href="/confluence/display/qpid/Connection+URL+Format" title="Connection
URL Format">Connection URL Format</a> documentation.</p>


<h3><a name="QpidJavaFAQ-HowdoIrepresentaJMSDestinationstringwithQPID%3F"></a>How
do I represent a JMS Destination string with QPID ?</h3>

<h4><a name="QpidJavaFAQ-Queues"></a>Queues</h4>

<p>A queue can be created in QPID using the following URL format.</p>

<p><tt>direct://amq.direct/&lt;Destination&gt;/&lt;Queue Name&gt;</tt></p>

<p>For example: <tt>direct://amq.direct/&lt;Destination&gt;/simpleQueue</tt></p>

<p>Queue names may consist of any mixture of digits, letters, and underscores.</p>

<p>The <a href="/confluence/display/qpid/BindingURLFormat" title="BindingURLFormat">BindingURLFormat</a>
is described in more detail on it's own page.</p>

<h4><a name="QpidJavaFAQ-Topics"></a>Topics</h4>

<p>A topic can be created in QPID using the following URL format.</p>

<p><tt>topic://amq.topic/&lt;Topic Subscription&gt;/</tt></p>

<p>The topic subscription may only contain the letters A-Z and a-z and digits 0-9.</p>

<p>The topic subscription is formed from a series of words that may only contain the
letters A-Z and a-z and digits 0-9.<br/>
The words are delimited by dots. Each dot represents a new level.</p>

<p>For example: <tt>stocks.nyse.ibm</tt></p>

<p>Wildcards can be used on subscription with the following meaning.</p>
<ul>
	<li>match a single level<br/>
<tt>&#35;</tt> match zero or more levels</li>
</ul>


<p>For example:<br/>
With two clients<br/>
1 - <tt>stocks.*.ibm</tt><br/>
2 - <tt>stocks.#.ibm</tt></p>

<p>Publishing <tt>stocks.nyse.ibm</tt> will be received by both clients
but <tt>stocks.ibm</tt> and <tt>stocks.world.us.ibm</tt> will only
be received by client 2.</p>

<p>The topic currently does not support wild cards.</p>


<h3><a name="QpidJavaFAQ-HowdoIconnecttothebrokerusingJNDI%3F"></a>How do
I connect to the broker using JNDI ?</h3>

<p>see <a href="/confluence/display/qpid/How+to+Use+JNDI" title="How to Use JNDI">How
to Use JNDI</a></p>


<h3><a name="QpidJavaFAQ-I%27musingSpringandWeblogiccanyouhelpmewiththeconfigurationformovingovertoQpid%3F"></a>I'm
using Spring and Weblogic - can you help me with the configuration for moving over to Qpid
?</h3>

<p>Here is a donated Spring configuration file <a href="/confluence/download/attachments/28400/appContext.zip?version=1">appContext.zip</a>
which shows the config for Qpid side by side with Weblogic. HtH &#33;</p>


<h3><a name="QpidJavaFAQ-HowdoIconfigurethelogginglevelforQpid%3F"></a>How
do I configure the logging level for Qpid ?</h3>

<p>The system property</p>
<div class="preformatted panel" style="border-width: 1px;"><div class="preformattedContent
panelContent">
<pre>amqj.logging.level
</pre>
</div></div>
<p> can be used to configure the logging level.<br/>
For the broker, you can use the environment variable AMQJ_LOGGING_LEVEL which is picked up
by the qpid-run script (called by qpid-server to start the broker) at runtime.</p>

<p>For client code that you've written, simply pass in a system property to your command
line to set it to the level you'd like i.e.</p>
<div class="preformatted panel" style="border-width: 1px;"><div class="preformattedContent
panelContent">
<pre>-Damqj.logging.level=INFO
</pre>
</div></div>
<p>The log level for the broker defaults to INFO if the env variable is not set, but
you may find that your log4j properties affect this. Setting the property noted above should
address this.</p>

<h3><a name="QpidJavaFAQ-HowcanIconfiguremyapplicationtouseQpidclientlogging%3F"></a>How
can I configure my application to use Qpid client logging?</h3>

<p>If you don't already have a logging implementation in your classpath you should add
slf4-log4j12-1.4.0.jar and log4j-1.2.12.jar.</p>

<h3><a name="QpidJavaFAQ-HowcanIconfigurethebroker%3F"></a>How can I configure
the broker ?</h3>

<p>The broker configuration is contained in the &lt;installed-dir&gt;/etc/config.xml
file. You can copy and edit this file and then specify your own configuration file as a parameter
to the startup script using the &#45;c flag i.e. qpid-server &#45;c &lt;your_config_file's_path&gt;</p>

<p>For more detailed information on configuration, please see <a href="/confluence/display/qpid/Qpid+Design+-+Configuration"
title="Qpid Design - Configuration">Qpid Design &#45; Configuration</a></p>

<p><a name="QpidJavaFAQ-Whatportsdoesthebrokeruse"></a></p>
<h3><a name="QpidJavaFAQ-Whatportsdoesthebrokeruse%3F"></a>What ports does
the broker use?</h3>

<p>The broker defaults to use port 5672 at startup for AMQP traffic.<br/>
If the management interface is enabled it starts on port 8999 by default.</p>

<p>The JMX management interface actually requires 2 ports to operate, the second of
which is indicated to the client application during connection initiation to the main (default:
8999) port. Previously this second port has been chosen at random during broker startup, however
since Qpid 0.5 this has been fixed to a port 100 higher than the main port(ie Default:9099)
in order to ease firewall navigation.</p>

<h3><a name="QpidJavaFAQ-HowcanIchangetheportthebrokerusesatruntime%3F"></a>How
can I change the port the broker uses at runtime ?</h3>

<p>The broker defaults to use port 5672 at startup for AMQP traffic.<br/>
The broker also uses port 8999 for the JMX Management interface.</p>

<p>To change the AMQP traffic port use the &#45;p flag at startup. To change the
management port use &#45;m<br/>
i.e. qpid-server &#45;p &lt;port_number_to_use&gt; &#45;m &lt;port_number_to_use&gt;</p>

<p>Use this to get round any issues on your host server with port 5672/8999 being in
use/unavailable.</p>

<p>For additional details on what ports the broker uses see <a href="#QpidJavaFAQ-Whatportsdoesthebrokeruse">this</a>
FAQ entry.<br/>
For more detailed information on configuration, please see <a href="/confluence/display/qpid/Qpid+Design+-+Configuration"
title="Qpid Design - Configuration">Qpid Design &#45; Configuration</a></p>


<h3><a name="QpidJavaFAQ-WhatcommandlineoptionscanIpassintotheqpidserverscript%3F"></a>What
command line options can I pass into the qpid-server script ?</h3>

<p>The following command line options are available:</p>
<h3><a name="QpidJavaFAQ-CommandLineOptions"></a>Command Line Options</h3>

<p>The following options are available:</p>

<table class='confluenceTable'><tbody>
<tr>
<th class='confluenceTh'>Option</th>
<th class='confluenceTh'>Long Option</th>
<th class='confluenceTh'>Description</th>
</tr>
<tr>
<td class='confluenceTd'>b</td>
<td class='confluenceTd'>bind</td>
<td class='confluenceTd'>Bind to the specified address overriding any value in the config
file</td>
</tr>
<tr>
<td class='confluenceTd'>c</td>
<td class='confluenceTd'>config</td>
<td class='confluenceTd'>Use the given configuration file</td>
</tr>
<tr>
<td class='confluenceTd'>h</td>
<td class='confluenceTd'>help</td>
<td class='confluenceTd'>Prints list of options</td>
</tr>
<tr>
<td class='confluenceTd'>l</td>
<td class='confluenceTd'>logconfig</td>
<td class='confluenceTd'>Use the specified log4j.xml file rather than that in the etc
directory</td>
</tr>
<tr>
<td class='confluenceTd'>m</td>
<td class='confluenceTd'>mport</td>
<td class='confluenceTd'>Specify port to listen on for the JMX Management. Overrides
value in config file</td>
</tr>
<tr>
<td class='confluenceTd'>p</td>
<td class='confluenceTd'>port</td>
<td class='confluenceTd'>Specify port to listen on. Overrides value in config file</td>
</tr>
<tr>
<td class='confluenceTd'>v</td>
<td class='confluenceTd'>version</td>
<td class='confluenceTd'>Print version information and exit</td>
</tr>
<tr>
<td class='confluenceTd'>w</td>
<td class='confluenceTd'>logwatch</td>
<td class='confluenceTd'>Specify interval for checking for logging config changes. Zero
means no checking</td>
</tr>
</tbody></table>


<h3><a name="QpidJavaFAQ-HowdoIauthenticatewiththebroker%3FWhatuserid%26passwordshouldIuse%3F"></a>How
do I authenticate with the broker ? What user id &amp; password should I use ?</h3>

<p>You should login as user guest with password guest</p>


<h3><a name="QpidJavaFAQ-HowdoIcreatequeuesthatwillalwaysbeinstantiatedatbrokerstartup%3F"></a>How
do I create queues that will always be instantiated at broker startup ?</h3>

<p>You can configure queues which will be created at broker startup by tailoring a copy
of the virtualhosts.xml file provided in the installed qpid-version/etc directory.</p>

<p>So, if you're using a queue called 'devqueue' you can ensure that it is created at
startup by using an entry something like this:</p>
<div class="preformatted panel" style="border-width: 1px;"><div class="preformattedContent
panelContent">
<pre>&lt;virtualhosts&gt;
  &lt;default&gt;test&lt;/default&gt;
  &lt;virtualhost&gt;
   &lt;name&gt;test&lt;/name&gt;
   &lt;test&gt;
   &lt;queue&gt;
      &lt;name&gt;devqueue&lt;/name&gt;
      &lt;devqueue&gt;
        &lt;exchange&gt;amq.direct&lt;/exchange&gt;
        &lt;maximumQueueDepth&gt;4235264&lt;/maximumQueueDepth&gt;  &lt;!--
4Mb --&gt;
        &lt;maximumMessageSize&gt;2117632&lt;/maximumMessageSize&gt; &lt;!--
2Mb --&gt;
        &lt;maximumMessageAge&gt;600000&lt;/maximumMessageAge&gt;  &lt;!--
10 mins --&gt;
      &lt;/devqueue&gt;
   &lt;/queue&gt;
   &lt;/test&gt;
  &lt;/virtualhost&gt;
&lt;/virtualhosts&gt;
</pre>
</div></div>
<p>Note that the name (in thie example above the name is 'test') element should match
the virtualhost that you're using to create connections to the broker. This is effectively
a namespace used to prevent queue name clashes etc. You can also see that we've set the 'test'
virtual host to be the default for any connections which do not specify a virtual host (in
the &lt;default&gt; tag).</p>

<p>You can amend the config.xml to point at a different virtualhosts.xml file by editing
the &lt;virtualhosts/&gt; element.</p>

<p>So, for example, you could tell the broker to use a file in your home directory by
creating a new config.xml file with the following entry:</p>

<p>&lt;virtualhosts&gt;/home/myhomedir/virtualhosts.xml&lt;/virtualhosts&gt;</p>

<p>You can then pass this amended config.xml into the broker at startup using the &#45;c
flag i.e.<br/>
qpid-server &#45;c &lt;path&gt;/config.xml</p>

<h3><a name="QpidJavaFAQ-HowdoIcreatequeuesatruntime%3F"></a>How do I create
queues at runtime?</h3>


<p>Queues can be dynamically created at runtime by creating a consumer for them. After
they have been created and bound (which happens automatically when a JMS Consumer is created)
a publisher can send messages to them.</p>


<h3><a name="QpidJavaFAQ-HowdoItunethebroker%3F"></a>How do I tune the broker?</h3>

<p>There are a number of tuning options available, please see the <a href="/confluence/display/qpid/How+to+Tune+M3+Java+Broker+Performance"
title="How to Tune M3 Java Broker Performance">How to Tune M3 Java Broker Performance</a>
page for more information.</p>


<h3><a name="QpidJavaFAQ-Wheredoundeliverablemessagesendup%3F"></a>Where
do undeliverable messages end up ?</h3>

<p>At present, messages with an invalid routing key will be returned to the sender.
If you register an exception listener for your publisher (easiest to do by making your publisher
implement the ExceptionListener interface and coding the onException method) you'll see that
you end up in onException in this case. You can expect to be catching a subclass of org.apache.qpid.AMQUndeliveredException.</p>

<h3><a name="QpidJavaFAQ-CanIconfigurethenameoftheQpidbrokerlogfileatruntime%3F"></a>Can
I configure the name of the Qpid broker log file at runtime ?</h3>

<p>If you simply start the Qpid broker using the default configuration, then the log
file is written to $QPID_WORK/log/qpid.log</p>

<p>This is not ideal if you want to run several instances from one install, or acrhive
logs to a shared drive from several hosts.</p>

<p>To make life easier, there are two optional ways to configure the naming convention
used for the broker log.</p>

<h4><a name="QpidJavaFAQ-Settingaprefixorsuffix"></a>Setting a prefix or
suffix</h4>

<p>Users should set the following environment variables before running qpid-server:</p>

<p>QPID_LOG_PREFIX - will prefix the log file name with the specified value e.g. if
you set this value to be the name of your host (for example) it could look something like
host123qpid.log</p>

<p>QPID_LOG_SUFFIX - will suffix the file name with the specified value e.g. if you
set this value to be the name of your application (for example) if could look something like
qpidMyApp.log</p>

<h4><a name="QpidJavaFAQ-IncludingthePID"></a>Including the PID</h4>

<p>Setting either of these variables to the special value PID will introduce the process
id of the java process into the file name as a prefix or suffix as specified*&#42;</p>
<div class="error"><span class="error">cloak: Please ensure that the composition-setup
macro is placed before this location.</span> </div>

<h3><a name="QpidJavaFAQ-Myclientapplicationappearstohavehung%3F"></a>My
client application appears to have hung?</h3>

<p>The client code currently has various timeouts scattered throughout the code. These
can cause your client to appear like it has hung when it is actually waiting for the timeout
ot compelete. One example is when the broker becomes non-responsive, the client code has a
hard coded 2 minute timeout that it will wait when closing a connection. These timeouts need
to be consolidated and exposed. see <a href="https://issues.apache.org/jira/browse/QPID-429"
rel="nofollow">QPID-429</a></p>

<h3><a name="QpidJavaFAQ-HowdoIcontacttheQpidteam%3F"></a>How do I contact
the Qpid team ?</h3>

<p>For general questions, please subscribe to the users@qpid.apache.org mailing list
(<a href="http://mail-archives.apache.org/mod_mbox/qpid-users/" rel="nofollow">archive</a>).</p>

<p>For development questions, please subscribe to the dev@qpid.apache.org mailing list
(<a href="http://mail-archives.apache.org/mod_mbox/qpid-dev/" rel="nofollow">archive</a>).</p>

<p>More details on these lists are available on our <a href="/confluence/display/qpid/Mailing+Lists"
title="Mailing Lists">Mailing Lists</a> page.</p>

<h3><a name="QpidJavaFAQ-HowcanIchangeauser%27spasswordwhilethebrokerisup%3F"></a>How
can I change a user's password while the broker is up ?</h3>

<p>You can do this via the <a href="/confluence/display/qpid/Qpid+JMX+Management+Console"
title="Qpid JMX Management Console">Qpid JMX Management Console</a>. To do this simply
log in to the management console as an admin user (you need to have created an admin account
in the jmxremote.access file first) and then select the 'UserManagement' mbean. Select the
user in the table and click the Set Password button. Alternatively, update the password file
and use the management console to reload the file with the button at the bottom of the 'UserManagement'
view. In both cases, this will take effect when the user next logs in i.e. will not cause
them to be disconnected if they are already connected.</p>

<p>For more information on the Management Console please see our <a href="/confluence/display/qpid/Qpid+JMX+Management+Console+User+Guide"
title="Qpid JMX Management Console User Guide">Qpid JMX Management Console User Guide</a></p>


<h3><a name="QpidJavaFAQ-HowdoIknowifthereisaconsumerforamessageIamgoingtosend%3F"></a>How
do I know if there is a consumer for a message I am going to send?</h3>

<p>Knowing that there is a consumer for a message is quite tricky. That said using the
qpid.jms.Session#createProducer with immediate and mandatory set to true will get you part
of the way there.</p>

<p>If you are publishing to a well known queue then immediate will let you know if there
is any consumer able to pre-fetch that message at the time you send it. If not it will be
returned to you on your connection listener.</p>

<p>If you are sending to a queue that the consumer creates then the mandatory flag will
let you know if they have not yet created that queue.</p>

<p>These flags will not be able to tell you if the consuming application has received
the message and is able to process it.</p>


<h3><a name="QpidJavaFAQ-HowdoIuseanInVMBrokerformyowntests%3F"></a>How
do I use an InVM Broker for my own tests?</h3>

<p>I would take a look at the testPassiveTTL in <a href="https://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/java/systests/src/main/java/org/apache/qpid/server/queue/TimeToLiveTest.java?revision=683950&amp;view=markup"
rel="nofollow">TimeToLiveTest</a></p>

<p>The setUp and tearDown methods show how to correctly start up a broker for InVM testing.
If you write your tests using a file for the JNDI you can then very easily swap between running
your tests InVM and against a real broker.</p>

<p>See our <a href="/confluence/display/qpid/How+to+Use+JNDI" title="How to Use JNDI">JNDI
How to page</a> on how to confgure it</p>

<p>Basically though you just need to set two System Properites:</p>

<p>java.naming.factory.initial = org.apache.qpid.jndi.PropertiesFileInitialContextFactory<br/>
java.naming.provider.url = &lt;your JNDI file&gt;</p>

<p>and call getInitialContext() in your code.</p>

<p>You will of course need to have the broker libraries on your class path for this
to run.</p>

<h3><a name="QpidJavaFAQ-HowcanIinspectthecontentsofmyMessageStore%3F"></a>How
can I inspect the contents of my MessageStore?</h3>

<p>There are two possibilities here:</p>

<p>1) The management console can be used to interogate an active broker and browse the
contents of a queue.See the <a href="/confluence/display/qpid/Qpid+JMX+Management+Console"
title="Qpid JMX Management Console">Qpid JMX Management Console</a> page for further
details.</p>

<p>2) The <a href="/confluence/display/qpid/MessageStore+Tool" title="MessageStore
Tool">MessageStore Tool</a> can be used to inspect the contents of a persistent message
store. Note: this can currently only be used when the broker is offline.</p>

<h3><a name="QpidJavaFAQ-Whyaremytransientmessagesbeingsoslow%3F"></a>Why
are my transient messages being so slow?</h3>

<p>You should check that you aren't sending persistent messages, this is the default.
If you want to send transient messages you must explicitly set this option when instantiating
your MessageProducer or on the send() method.</p>

<h3><a name="QpidJavaFAQ-Whydoesmyproducerfillupthebrokerwithmessages%3F"></a>Why
does my producer fill up the broker with messages?</h3>

<p>The Java broker does not currently implement producer flow control. Publishes are
currently asynchronous, so there is no ability to rate limit this automatically. While this
is something which will be addressed in the future, it is currently up to applications to
ensure that they do not publish faster than the messages are being consumed for signifcant
periods of time.</p>

<h3><a name="QpidJavaFAQ-ThebrokerkeepsthrowinganOutOfMemoryexception%3F"></a>The
broker keeps throwing an OutOfMemory exception?</h3>

<p>The broker can no longer store any more messages in memory. This is particular evident
if you are using the MemoryMessageStore. To alleviate this issue you should ensure that your
clients are consuming all the messages from the broker.</p>

<p>You may also want to increase the memory allowance to the broker though this will
only delay the exception if you are publishing messages faster than you are consuming. See
<a href="/confluence/display/qpid/Java+Environment+Variables" title="Java Environment Variables">Java
Environment Variables</a> for details of changing the memory settings.</p>


<h3><a name="QpidJavaFAQ-WhyamIgettingabrokersideexceptionwhenItrytopublishtoaqueueoratopic%3F"></a>Why
am I getting a broker side exception when I try to publish to a queue or a topic ?</h3>

<p>If you get a stack trace like this when you try to publish, then you may have typo'd
the exchange type in your queue or topic declaration. Open your virtualhosts.xml and check
that the <div class="preformatted panel" style="border-width: 1px;"><div class="preformattedContent
panelContent">
<pre>&lt;exchange&gt;amq.direct&lt;/exchange&gt;</pre>
</div></div> is set to amq.direct for the &lt;queue/&gt; element you're
trying to publish to.</p>


<div class="preformatted panel" style="border-width: 1px;"><div class="preformattedContent
panelContent">
<pre>2009-01-12 15:26:27,957 ERROR [pool-11-thread-2] protocol.AMQMinaProtocolSession
(AMQMinaProtocolSession.java:365) - Unexpected exception while processing frame. Closing connection.

java.lang.NullPointerException 
        at org.apache.qpid.server.security.access.PrincipalPermissions.authorise(PrincipalPermissions.java:398)

        at org.apache.qpid.server.security.access.plugins.SimpleXML.authorise(SimpleXML.java:302)

        at org.apache.qpid.server.handler.QueueBindHandler.methodReceived(QueueBindHandler.java:111)

        at org.apache.qpid.server.handler.ServerMethodDispatcherImpl.dispatchQueueBind(ServerMethodDispatcherImpl.java:498)

        at org.apache.qpid.framing.amqp_8_0.QueueBindBodyImpl.execute(QueueBindBodyImpl.java:167)

        at org.apache.qpid.server.state.AMQStateManager.methodReceived(AMQStateManager.java:204)

        at org.apache.qpid.server.protocol.AMQMinaProtocolSession.methodFrameReceived(AMQMinaProtocolSession.java:295)

        at org.apache.qpid.framing.AMQMethodBodyImpl.handle(AMQMethodBodyImpl.java:93) 
        at org.apache.qpid.server.protocol.AMQMinaProtocolSession.frameReceived(AMQMinaProtocolSession.java:235)

        at org.apache.qpid.server.protocol.AMQMinaProtocolSession.dataBlockReceived(AMQMinaProtocolSession.java:191)

        at org.apache.qpid.server.protocol.AMQPFastProtocolHandler.messageReceived(AMQPFastProtocolHandler.java:244)

        at org.apache.mina.common.support.AbstractIoFilterChain$TailFilter.messageReceived(AbstractIoFilterChain.java:703)

        at org.apache.mina.common.support.AbstractIoFilterChain.callNextMessageReceived(AbstractIoFilterChain.java:362)

        at org.apache.mina.common.support.AbstractIoFilterChain.access$1200(AbstractIoFilterChain.java:54)

        at org.apache.mina.common.support.AbstractIoFilterChain$EntryImpl$1.messageReceived(AbstractIoFilterChain.java:800)

        at org.apache.qpid.pool.PoolingFilter.messageReceived(PoolingFilter.java:371) 
        at org.apache.mina.filter.ReferenceCountingIoFilter.messageReceived(ReferenceCountingIoFilter.java:96)

        at org.apache.mina.common.support.AbstractIoFilterChain.callNextMessageReceived(AbstractIoFilterChain.java:362)

        at org.apache.mina.common.support.AbstractIoFilterChain.access$1200(AbstractIoFilterChain.java:54)

        at org.apache.mina.common.support.AbstractIoFilterChain$EntryImpl$1.messageReceived(AbstractIoFilterChain.java:800)

        at org.apache.mina.filter.codec.support.SimpleProtocolDecoderOutput.flush(SimpleProtocolDecoderOutput.java:60)

        at org.apache.mina.filter.codec.QpidProtocolCodecFilter.messageReceived(QpidProtocolCodecFilter.java:174)

        at org.apache.mina.common.support.AbstractIoFilterChain.callNextMessageReceived(AbstractIoFilterChain.java:362)

        at org.apache.mina.common.support.AbstractIoFilterChain.access$1200(AbstractIoFilterChain.java:54)

        at org.apache.mina.common.support.AbstractIoFilterChain$EntryImpl$1.messageReceived(AbstractIoFilterChain.java:800)

        at org.apache.qpid.pool.Event$ReceivedEvent.process(Event.java:86) 
        at org.apache.qpid.pool.Job.processAll(Job.java:110) 
        at org.apache.qpid.pool.Job.run(Job.java:149) 
        at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:885)

        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:907)

        at java.lang.Thread.run(Thread.java:619) 
</pre>
</div></div>



<h3><a name="QpidJavaFAQ-WhyistherealotofAnonymousIoServicethreads"></a>Why
is there a lot of AnonymousIoService threads</h3>

<p>These threads are part of the thread pool used by Mina to process the socket. In
the future we may provide tuning guidelines but at this point we have seen no performance
implications from the current configuration. As the threads are part of a pool they should
remain inactive until required.</p>

<h3><a name="QpidJavaFAQ-%22unabletocertifytheprovidedSSLcertificateusingthecurrentSSLtruststore%22whenconnectingtheManagementConsoletothebroker."></a>"unable
to certify the provided SSL certificate using the current SSL trust store" when connecting
the Management Console to the broker.</h3>
<p>You have not configured the console's SSL trust store properly, see <a href="/confluence/display/qpid/Management+Console+Security"
title="Management Console Security">Management Console Security</a> for more details.
</p>
     </div>
     <div id="commentsSection" class="wiki-content pageSection">
       <div style="float: right;">
            <a href="http://cwiki.apache.org/confluence/users/viewnotifications.action"
class="grey">Change Notification Preferences</a>
       </div>

       <a href="http://cwiki.apache.org/confluence/display/qpid/Qpid+Java+FAQ">View
Online</a>
       |
       <a href="http://cwiki.apache.org/confluence/pages/diffpagesbyversion.action?pageId=28400&revisedVersion=65&originalVersion=64">View
Change</a>
              |
       <a href="http://cwiki.apache.org/confluence/display/qpid/Qpid+Java+FAQ?showComments=true&amp;showCommentArea=true#addcomment">Add
Comment</a>
            </div>
</div>
</div>
</div>
</div>
</body>
</html>

---------------------------------------------------------------------
Apache Qpid - AMQP Messaging Implementation
Project:      http://qpid.apache.org
Use/Interact: mailto:commits-subscribe@qpid.apache.org


Mime
View raw message