-
1. Re: Tips on interacting with JBoss Mail Server Message Queue
gohip Jun 13, 2006 12:15 AM (in response to gohip)Okay, figured out Hermes issue, it required no extra configuration, just do as stated, copying the file to the env var it creates, i.e. on windows root of partition ".hermes" dir, then upon first launch of app, click file->open config-> and select "jboss-hermes-config.xml"
it browsed directly to queues, showing my newly created queue, it also showed messages on queue. When it tried to display message though, I began to get classdefnotfound errors, so I added all the jars it wanted, one after other, till errors cleared up
Now hermes, can show "header", "to string", "hex", and "xml" views, but errors with following message on "payload" view "Unable to display message: null"
andrew or anyone, is this cus it states in jboss-service.xml that for the JMSMailListener mBean that:
"JMS is used to asynchronously process mails, however the bodies are not stored via JMS as JBossMQ, the present
JBosss messaging solution, doesn't do this efficiently. This is used for normal mail processing."
If this is true, and the root cause, is there something I can tweak, in my newly created/custom MailListener, or in the config, that could also add the message body to the mail object, since it seems to be lacking, it appears that this is whAt "payload" possibly refers to.
It seems that if hermes was able to latch onto the JBoss MQ's so readily, then it should be a problem plugging in the sample code I referred to earlier, will let you all know how it goes
Any help insight, or comments are greatly appreciated -
2. Re: Tips on interacting with JBoss Mail Server Message Queue
gohip Jun 13, 2006 12:55 PM (in response to gohip)okay, getting there...
I changed the MailBodyManger mBean UseStore attribute to false in jboss-service.xml.
This caused numerous things to happen, many apparently bad, but one good, i.e. in hermes, i could now see the payload!
Previously, when trying to view the payload in Hermes, it stated the following "Unable to display message: null", it now showed all sorts of interesting "stuff".
I also found that by doing this, in the hex, i could see the Email's Message Body!
The bad things that happened were...
The mail never got delivered to user
I began to get the "unknown user" error again
And I think, the mailbodymanger, had issues finding the body, but cant recall.
So it seems, setting this attribute partially helped, I wonder if it needs to be set before install/running of app. Or is there another setting, that goes hand in hand with this guys?
I understand, that it's stated that the JBoss MQ doesnt handle efficiently, but ATM, neither is our mySQL install, and we had hoped to read full email messages from the queue.
I know you guys are away...so I guess I'll need to just keep plugging along, i guess I'll comare the system.outs from when server runs with attribute set to true, and then false. I guess I could construct my own message, and stick that on queue, but hate to duplicate work... -
3. Re: Tips on interacting with JBoss Mail Server Message Queue
gohip Jun 15, 2006 1:01 PM (in response to gohip)I am still having issues, with trying to get JBoss Mail server to put the full messages body on the queue also, when I set the MBean usestore to false, even from beginning, I.e. post running for first time, it is still throwing this error....
looking at deliverymdb and its associated classes and workers, trying to figure out
anyone have any ideas....yet?09:59:52,718 INFO [ConnectionHandler] connected: /192.168.69.1 to: /192.168.69.1 until: 11503909127 03 09:59:53,265 INFO [Mail] all headers after loading: Return-Path: <jasong@192.168.69.1> Received: from AZCP02 (AZ-CP-02 192.168.69.1) by AZ-CP-02/JBossMail 1.0M4 (192.168.69.1) with SMTP id 1150390793265583.4862634119211; Thu, 15 Jun 2006 09:59:53 -0700 (MST) Message-ID: <001901c6909d$1ee272a0$6501180a@AZCP02> From: <jasong@192.168.69.1> To: <jasong@192.168.69.1> Subject: test Date: Thu, 15 Jun 2006 09:59:52 -0700 MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="----=_NextPart_000_0016_01C69062.725D7500" X-Priority: 3 X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook Express 6.00.2900.2869 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2869 09:59:53,296 INFO [JMSMailListener] PUT MESSAGE ON QUEUE:org.jboss.mail.message.Mail@10697e2 09:59:53,453 INFO [ConnectionHandler] ConnectionHandler finished 09:59:54,031 ERROR [LocalDelivery] Could not deliver local mail java.lang.NullPointerException at org.jboss.mail.mailbox.MessageData.<init>(MessageData.java:117) at org.jboss.mail.mailhandler.localmailbox.LocalDelivery.org$jboss$mail$mailhandler$localmai lbox$LocalDelivery$deliver$aop(LocalDelivery.java:101) at org.jboss.mail.mailhandler.localmailbox.LocalDelivery.access$1(LocalDelivery.java) at org.jboss.mail.mailhandler.localmailbox.LocalDelivery$deliver_7597238674321613949.invokeN ext(LocalDelivery$deliver_7597238674321613949.java) at org.jboss.aspects.tx.TxPolicy.invokeInOurTx(TxPolicy.java:79) at org.jboss.aspects.tx.TxInterceptor$RequiresNew.invoke(TxInterceptor.java:253) at org.jboss.mail.mailhandler.localmailbox.LocalDelivery$deliver_7597238674321613949.invokeN ext(LocalDelivery$deliver_7597238674321613949.java) at org.jboss.mail.mailhandler.localmailbox.LocalDelivery.deliver(LocalDelivery.java) at org.jboss.mail.mailhandler.localmailbox.LocalDelivery.send(LocalDelivery.java:43) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) at java.lang.reflect.Method.invoke(Unknown Source) at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:141) at org.jboss.mx.server.Invocation.dispatch(Invocation.java:80) at org.jboss.mx.server.Invocation.invoke(Invocation.java:72) at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:245) at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:644) at javax.management.MBeanServerInvocationHandler.invoke(Unknown Source) at $Proxy57.send(Unknown Source) at org.jboss.mail.MailListenerChainService.processMail(MailListenerChainService.java:166) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) at java.lang.reflect.Method.invoke(Unknown Source) at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:141) at org.jboss.mx.server.Invocation.dispatch(Invocation.java:80) at org.jboss.mx.interceptor.AbstractInterceptor.invoke(AbstractInterceptor.java:118) at org.jboss.mx.server.Invocation.invoke(Invocation.java:74) at org.jboss.mx.interceptor.ModelMBeanOperationInterceptor.invoke(ModelMBeanOperationInterce ptor.java:127) at org.jboss.mx.server.Invocation.invoke(Invocation.java:74) at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:245) at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:644) at javax.management.MBeanServerInvocationHandler.invoke(Unknown Source) at $Proxy96.processMail(Unknown Source) at org.jboss.mail.delivery.DeliveryMDB.onMessage(DeliveryMDB.java:72) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) at java.lang.reflect.Method.invoke(Unknown Source) at org.jboss.invocation.Invocation.performCall(Invocation.java:345) at org.jboss.ejb.MessageDrivenContainer$ContainerInterceptor.invoke(MessageDrivenContainer.j ava:475) at org.jboss.resource.connectionmanager.CachedConnectionInterceptor.invoke(CachedConnectionI nterceptor.java:149) at org.jboss.ejb.plugins.MessageDrivenInstanceInterceptor.invoke(MessageDrivenInstanceInterc eptor.java:101) at org.jboss.ejb.plugins.CallValidationInterceptor.invoke(CallValidationInterceptor.java:48) at org.jboss.ejb.plugins.AbstractTxInterceptor.invokeNext(AbstractTxInterceptor.java:106) at org.jboss.ejb.plugins.TxInterceptorCMT.runWithTransactions(TxInterceptorCMT.java:335) at org.jboss.ejb.plugins.TxInterceptorCMT.invoke(TxInterceptorCMT.java:166) at org.jboss.ejb.plugins.RunAsSecurityInterceptor.invoke(RunAsSecurityInterceptor.java:94) at org.jboss.ejb.plugins.LogInterceptor.invoke(LogInterceptor.java:192) at org.jboss.ejb.plugins.ProxyFactoryFinderInterceptor.invoke(ProxyFactoryFinderInterceptor. java:122) at org.jboss.ejb.MessageDrivenContainer.internalInvoke(MessageDrivenContainer.java:389) at org.jboss.ejb.Container.invoke(Container.java:873) at org.jboss.ejb.plugins.jms.JMSContainerInvoker.invoke(JMSContainerInvoker.java:1077) at org.jboss.ejb.plugins.jms.JMSContainerInvoker$MessageListenerImpl.onMessage(JMSContainerI nvoker.java:1379) at org.jboss.jms.asf.StdServerSession.onMessage(StdServerSession.java:256) at org.jboss.mq.SpyMessageConsumer.sessionConsumerProcessMessage(SpyMessageConsumer.java:904 ) at org.jboss.mq.SpyMessageConsumer.addMessage(SpyMessageConsumer.java:160) at org.jboss.mq.SpySession.run(SpySession.java:333) at org.jboss.jms.asf.StdServerSession.run(StdServerSession.java:180) at EDU.oswego.cs.dl.util.concurrent.PooledExecutor$Worker.run(PooledExecutor.java:743) at java.lang.Thread.run(Unknown Source) 09:59:54,171 ERROR [LocalDelivery] Unable to deliver message to local user: jasong@192.168.69.1. Un known user. 09:59:54,218 INFO [JMSMailListener] PUT MESSAGE ON QUEUE:org.jboss.mail.message.MailRetryWrapper@78 8a7b
it seems if i set that mBean to false, it can no longer figure out if theres a user by that name or not, even though it does accept the mail. -
4. Re: Tips on interacting with JBoss Mail Server Message Queue
gohip Jun 16, 2006 4:35 PM (in response to gohip)Okay, set the MailBodyManger mBean UseStore attribute back to true, as it seems it can't tell if a user is local, and has a mailbox, unless set to true.
You'd think there wpuld be a setting, or a couple settings, to allow a messages body to be NOT stored, and instead put on the queue.
Whe you guys get back, if you notice this thread, will you let me know if this is true?
Until then, this is what I did...
In my mailListener, I create a new mail message, based on the "real" message. the new mail message, get's all the values from the "real" message, but instead of using a storedMailBody, it uses a simpleMialBody. So I read the "real" messages mail body from the store, piping it into the new messages simpleMailBody.
I then take this new message, and stick it on my custom queue, instaed of the "real"/original mail message.
As i said, there must be a better way of doing this, but until found, this works for now!
If anyone needs an example of how it was done, feel free to post here! -
5. Re: Tips on interacting with JBoss Mail Server Message Queue
gohip Jul 7, 2006 12:15 PM (in response to gohip)Hi all,
I posted this in the other JBoss MQ forum, but no one has responded, and it relates to this thread...does anyone have knowledge of this aspect...Andrew, I saw your post, I believe, dealing with an issue you had with MQ and userrolesconfig...
Locking down message queues:
http://www.jboss.com/index.html?module=bb&op=viewtopic&t=85722 -
6. Re: Tips on interacting with JBoss Mail Server Message Queue
gohip Jul 12, 2006 7:37 PM (in response to gohip)Does anyone have any suggestions?
-
7. Re: Tips on interacting with JBoss Mail Server Message Queue
acoliver Jul 17, 2006 2:53 PM (in response to gohip)Really the non-store functionality is deprecated. Its not really a great idea frankly.
-
8. Re: Tips on interacting with JBoss Mail Server Message Queue
sappenin Jul 18, 2006 10:33 AM (in response to gohip)In response to "locking down the JBCS message queue's"...(Assuming you still haven't gotten an answer on that)...here's how I locked down mine.
<mbean code="org.jboss.mq.server.jmx.Queue" name="jboss.mq.destination:service=Queue,name=myQueue"> <attribute name="SecurityConf"> <security> <role name="guest" read="false" write="false" create="false" /> <!-- Be sure to change the 'system' password in the DB JMS_USERS table --> <role name="system" read="true" write="true" create="true" /> <role name="noacc" read="false" write="false" create="false" /> </security> </attribute> <depends optional-attribute-name="DestinationManager"> jboss.mq:service=DestinationManager </depends> <depends optional-attribute-name="SecurityManager"> jboss.mq:service=SecurityManager </depends> </mbean>
1.) I believe that if a role name is not specified in the security attributes, then the permissions for that role defaults to everything=false (i.e., no read, no write, no create).
2.) Just in case, you should remove any default/un-needed JMS Roles in JBOSS_HOME/server/default/deploy/jms/mysql-jdbc-state-service.xml (and from the JMS_ROLES database table). You have to play around with which roles to keep, and which to get rid of, but (I'm pretty sure) #1 above holds true.
3.) If you lock down all of the roles in JBCS, then I'm not sure how JBCS will behave. For example, the you need to tweak the code that tries to connect to the queue (and place a message on the queue) by giving it credentials (username/password). This happens (generally) in org.jboss.mail.maillistener.JMSMailListener with the QueueConnectionFactory. The current JBCS code does the following (at least in the JMSMailListener.sendMessageQueue:... PreparedMail preparedMail = prepareMail(mail); QueueConnection qc = qcf.createQueueConnection(); ...
The "createQueueConnection()" function can take a username/password to authenticate to a JMS queue. I'm not certain how to best change the JBCS code to make this easily configurable. I'm not sure how smart it would be to place passwords in the xml config files. In my case, I have a custom JMSListener, and the password is indeed in the xml configuration file.
For even higher security, you may want to consider forcing JMS to connect over SSL. I haven't gotten that far yet.
Here's the code that I use in my own Listener.final InitialContext ctx = new InitialContext(properties); String sQueueName = "myQueue"; final Queue queue = (Queue) ctx.lookup(sQueueName); final QueueConnectionFactory factory = (QueueConnectionFactory) ctx.lookup("ConnectionFactory"); cnn = factory.createQueueConnection(sUserId, sPassword); sess = cnn.createQueueSession(false, QueueSession.AUTO_ACKNOWLEDGE); final ObjectMessage objMessage = sess.createObjectMessage(msgObject); sender = sess.createSender(queue);
-
9. Re: Tips on interacting with JBoss Mail Server Message Queue
gohip Jul 19, 2006 4:05 PM (in response to gohip)great sappenin, I will try that, much thanks...
andrew, only reason, I was trying to use "non-store", was because, as is, a message going onto the queue, has no body, as it is a store item. But I would like a separate java app, to be able to access this data (body) without having to go through mySQL, i.e. just wanted it to be able to get it from MQ.
Someone had mentioned, this was fixed in M5, is this true? I.e. I think if I tell it not to use a store, it still put a message on queue, with a stored mail body. But it's been a week or two, so can't remember. -
10. Re: Tips on interacting with JBoss Mail Server Message Queue
osterday Jul 26, 2006 10:37 AM (in response to gohip)I'm pretty sure the body isn't put in the queue - I think Andrew said something about the current JBoss JMS not handling the blob efficiently.
Actually, we like having the original email being stored in JBCS as a backup in case something happens in our handler and our app's process fails for some reason.
-Pat