问题
I am new to JBoss JMS queue service.
Currently, I am working in a production code using JBosss Messaging Server, where several queues have been configured in a separate example-service.xml file
All queues are working fine and each queue has it own separate MDB listeners which will consumes all the messages from Queue.
However, I am getting following issues:
- I am not able to browse any of the Queue values using QueueBrowser, even if the queue has some values before it is being consumed by the MDB listeners.
However, I have stopped the MDB listeners, now all the messages I am sending to queue is still available in queue and I am able to browse all the queue values
I don't know why I am not able to browse the Queue values while MDB listeners are enabled? I have also attached My configuration files here:
My current Queue configuration files are as follows:
example-service.xml
<?xml version="1.0" encoding="UTF-8"?>
<server>
<mbean code="org.jboss.jms.server.destination.QueueService"
name="jboss.messaging.destination:service=Queue,name=sampleQueue_1" xmbean-dd="xmdesc/Queue-xmbean.xml">
<depends optional-attribute-name="ServerPeer">jboss.messaging:service=ServerPeer</depends>
<depends>jboss.messaging:service=PostOffice</depends>
<attribute name="MaxDeliveryAttempts">4</attribute>
<attribute name="RedeliveryDelay">10000</attribute>
</mbean>
<mbean code="org.jboss.jms.server.destination.QueueService"
name="jboss.messaging.destination:service=Queue,name=sampleQueue_2" xmbean-dd="xmdesc/Queue-xmbean.xml">
<depends optional-attribute-name="ServerPeer">jboss.messaging:service=ServerPeer</depends>
<depends>jboss.messaging:service=PostOffice</depends>
<attribute name="MaxDeliveryAttempts">4</attribute>
<attribute name="RedeliveryDelay">10000</attribute>
</mbean>
<mbean code="org.jboss.jms.server.destination.QueueService"
name="jboss.messaging.destination:service=Queue,name=sampleQueue_3" xmbean-dd="xmdesc/Queue-xmbean.xml">
<depends optional-attribute-name="ServerPeer">jboss.messaging:service=ServerPeer</depends>
<depends>jboss.messaging:service=PostOffice</depends>
<attribute name="MaxDeliveryAttempts">4</attribute>
<attribute name="RedeliveryDelay">10000</attribute>
</mbean>
<mbean code="org.jboss.jms.server.destination.QueueService"
name="jboss.messaging.destination:service=Queue,name=sampleQueue_4" xmbean-dd="xmdesc/Queue-xmbean.xml">
<depends optional-attribute-name="ServerPeer">jboss.messaging:service=ServerPeer</depends>
<depends>jboss.messaging:service=PostOffice</depends>
<attribute name="MaxDeliveryAttempts">1</attribute>
</mbean>
</server>
jboss.xml
<jboss>
<enterprise-beans>
<message-driven>
<ejb-name>update/sample1MDB</ejb-name>
<destination-jndi-name>queue/sampleQueue_1</destination-jndi-name>
<configuration-name>Singleton Message Driven Bean</configuration-name>
</message-driven>
<message-driven>
<ejb-name>update/sample2MDB</ejb-name>
<destination-jndi-name>queue/sampleQueue_2</destination-jndi-name>
<configuration-name>Singleton Message Driven Bean</configuration-name>
</message-driven>
<message-driven>
<ejb-name>update/sample3MDB</ejb-name>
<destination-jndi-name>queue/sampleQueue_3</destination-jndi-name>
<configuration-name>Singleton Message Driven Bean</configuration-name>
</message-driven>
<message-driven>
<ejb-name>update/sample4MDB</ejb-name>
<destination-jndi-name>queue/sampleQueue_4</destination-jndi-name>
<configuration-name>Singleton Message Driven Bean</configuration-name>
</message-driven>
</enterprise-beans>
<resource-managers>
</resource-managers>
<!--
| for container settings, you can merge in jboss-container.xml
| this can contain <invoker-proxy-bindings/> and <container-configurations/>
-->
</jboss>
standardjboss.xml
<container-configuration>
<container-name>Singleton Message Driven Bean</container-name>
<call-logging>false</call-logging>
<invoker-proxy-binding-name>singleton-message-driven-bean</invoker-proxy-binding-name>
<container-interceptors>
<interceptor>org.jboss.ejb.plugins.ProxyFactoryFinderInterceptor</interceptor>
<!-- CMT -->
<interceptor transaction="Container">org.jboss.ejb.plugins.TxInterceptorCMT</interceptor>
<interceptor transaction="Container">org.jboss.ejb.plugins.CallValidationInterceptor</interceptor>
<interceptor transaction="Container">org.jboss.ejb.plugins.MessageDrivenInstanceInterceptor</interceptor>
<!-- BMT -->
<interceptor transaction="Bean">org.jboss.ejb.plugins.MessageDrivenInstanceInterceptor</interceptor>
<interceptor transaction="Bean">org.jboss.ejb.plugins.MessageDrivenTxInterceptorBMT</interceptor>
<interceptor transaction="Bean">org.jboss.ejb.plugins.CallValidationInterceptor</interceptor>
<interceptor>org.jboss.resource.connectionmanager.CachedConnectionInterceptor</interceptor>
</container-interceptors>
<instance-pool>org.jboss.ejb.plugins.MessageDrivenInstancePool</instance-pool>
<instance-cache></instance-cache>
<persistence-manager></persistence-manager>
<container-pool-conf>
<MaximumSize>1</MaximumSize>
<strictMaximumSize/>
</container-pool-conf>
</container-configuration>
weblogic-ejb-jar.xml
<weblogic-enterprise-bean>
<ejb-name>update/sampleMDB</ejb-name>
<message-driven-descriptor>
<pool>
<max-beans-in-free-pool>1</max-beans-in-free-pool>
<initial-beans-in-free-pool>1</initial-beans-in-free-pool>
</pool>
<destination-jndi-name>queue/sampleQueue_1</destination-jndi-name>
</message-driven-descriptor>
<transaction-descriptor>
<trans-timeout-seconds>36000</trans-timeout-seconds>
</transaction-descriptor>
<reference-descriptor>
</reference-descriptor>
</weblogic-enterprise-bean>
And, Iam using the following code to browse the values from the Queue
public static void main(String[] args) {
QueueConnectionFactory queueConnectionFactory;
QueueConnection queueConnection = null;
try {
queueConnectionFactory = (QueueConnectionFactory)BrowseQueue.getInitialContext().lookup("ConnectionFactory");
queueConnection = queueConnectionFactory.createQueueConnection();
queueConnection.start();
String queueName = "sampleQueue_1";
Queue queueToExamine = (Queue)BrowseQueue.getInitialContext().lookup("queue/"+queueName);
QueueSession queueSession = queueConnection.createQueueSession(false, Session.AUTO_ACKNOWLEDGE);
QueueBrowser queueBrowser = queueSession.createBrowser(queueToExamine);
Enumeration<?> enumeration = queueBrowser.getEnumeration();
while (enumeration.hasMoreElements()) {
Object object = (Object) enumeration.nextElement();
if(object instanceof ObjectMessage) {
ObjectMessage objectMessage = (ObjectMessage)object;
System.out.println(objectMessage);
}
}
queueConnection.close();
System.exit(0);
} catch (NamingException e) {
e.printStackTrace();
} catch (JMSException e) {
e.printStackTrace();
}
}
public static Context getInitialContext() throws NamingException {
Properties properties = new Properties();
properties.setProperty(Context.INITIAL_CONTEXT_FACTORY, "org.jboss.iiop.naming.ORBInitialContextFactory");
properties.setProperty(Context.URL_PKG_PREFIXES, "org.jboss.naming:org.jnp.interfaces");
properties.setProperty(Context.PROVIDER_URL, "localhost:4557");
return new InitialContext(properties);
}
Is there any configuration I am missing? or anything wrong I am doing?
Please help me, on why I am not able to browse the queue values before its being consumed?
Thanks in advance..
来源:https://stackoverflow.com/questions/28473761/jboss-server-error-while-adding-jms-queue-service