Hello,

I think this should be a simple one:  
Details: Jboss 3.2.3, Windows XP
I have the following client which complies and runs ( I got it from the JBoss docs),  
however when I try to use a queue (queue/A) I get a JMSSecurityException more 
specifically:

07:55:28,966 DEBUG [ChannelSocket] Accepted socket 
Socket[addr=/10.1.1.125,port=4235,localport=8009]
07:55:28,997 DEBUG [ChannelSocket] receive() 
07:55:28,997 DEBUG [ChannelSocket] read() [EMAIL PROTECTED] 8192 0 4 = 4
07:55:28,997 DEBUG [MsgAjp] Received 188 18
07:55:28,997 DEBUG [ChannelSocket] read() [EMAIL PROTECTED] 8192 4 188 = 188
07:55:28,997 DEBUG [ChannelSocket] Call next 0 [EMAIL PROTECTED]
07:55:28,997 DEBUG [HandlerRequest] Handling 2
07:55:28,997 DEBUG [HandlerRequest] R( /invoker/JNDIFactory)
07:55:28,997 DEBUG [HandlerRequest] Calling next container 
org.apache.jk.server.JkCoyoteHandler
07:55:28,997 DEBUG [JkCoyoteHandler] Invoke R( /invoker/JNDIFactory) [EMAIL PROTECTED] 
/invoker/JNDIFactory
07:55:29,028 INFO  [JaasSecurityManagerService] Created [EMAIL PROTECTED]
07:55:29,028 INFO  [JaasSecurityManagerService] setCachePolicy, [EMAIL PROTECTED]
07:55:29,028 INFO  [JaasSecurityManagerService] Added http-invoker, [EMAIL PROTECTED] 
to map
07:55:29,028 DEBUG [JkCoyoteHandler] ACK 
07:55:29,122 DEBUG [JkCoyoteHandler] COMMIT 
07:55:29,122 DEBUG [JkCoyoteHandler] COMMIT sending headers [EMAIL PROTECTED] === 
MimeHeaders ===

07:55:29,153 DEBUG [ChannelSocket] send() 112 4
07:55:29,153 DEBUG [JkCoyoteHandler] doWrite 0 1386 0
07:55:29,153 DEBUG [ChannelSocket] send() 1394 3
07:55:29,169 DEBUG [JkCoyoteHandler] CLIENT_FLUSH 
07:55:29,169 DEBUG [JkCoyoteHandler] CLIENT_FLUSH 
07:55:29,169 DEBUG [JkCoyoteHandler] CLIENT_FLUSH 
07:55:29,169 DEBUG [JkCoyoteHandler] CLOSE 
07:55:29,169 DEBUG [ChannelSocket] send() 6 5
07:55:29,169 DEBUG [REQ_TIME] Time pre=0/ service=172 -1 /invoker/JNDIFactory
07:55:29,169 DEBUG [HandlerRequest] Invoke returned 0
07:55:29,169 DEBUG [ChannelSocket] receive() 
07:55:29,747 WARN  [OILServerILService] Client request resulted in a server exception: 
javax.jms.JMSSecurityException: User: null is NOT authenticated
        at org.jboss.mq.security.SecurityManager.authenticate(SecurityManager.java:232)
        at 
org.jboss.mq.security.ServerSecurityInterceptor.authenticate(ServerSecurityInterceptor.java:51)
        at 
org.jboss.mq.server.TracingInterceptor.authenticate(TracingInterceptor.java:781)
        at org.jboss.mq.server.JMSServerInvoker.authenticate(JMSServerInvoker.java:287)
        at 
org.jboss.mq.il.oil.OILServerILService$Client.run(OILServerILService.java:329)
        at java.lang.Thread.run(Thread.java:534)
07:55:49,700 INFO  [ChannelSocket] connection timeout reached

Looking at the jbossmq-destinations-service.xml:

Queue A appears to have no security manager.

Here is my Client:

package intuinet.messenger;

import java.util.Properties;

import javax.jms.JMSException;
import javax.jms.Message;
import javax.jms.MessageListener;
import javax.jms.Queue;
import javax.jms.QueueConnection;
import javax.jms.QueueConnectionFactory;
import javax.jms.QueueReceiver;
import javax.jms.QueueSender;
import javax.jms.QueueSession;
import javax.jms.TextMessage;
import javax.naming.Context;
import javax.naming.InitialContext;
import javax.naming.NamingException;

import EDU.oswego.cs.dl.util.concurrent.CountDown;


/** A complete JMS client example program that sends a
 TextMessage to a Queue and asynchronously receives the
 message from the same Queue.
 @author [EMAIL PROTECTED]
 @version $Revision:$
 */

public class SendRecvClient
{
        static CountDown done = new CountDown(1);
        QueueConnection conn;
        QueueSession session;
        Queue que;
        public static class ExListener implements MessageListener
        {
                public void onMessage(Message msg)
                {
                        done.release();
                        TextMessage tm = (TextMessage) msg;
                        try
                        {
                                System.out.println("onMessage, recv text="
                                                + tm.getText());
                        }
                        catch(Throwable t)
                        {
                                t.printStackTrace();
                        }
                }
        }
        
        public static InitialContext getInitialContext() throws NamingException {
                Properties env = new Properties();
                env.put(Context.SECURITY_PRINCIPAL, "guest");
                env.put(Context.SECURITY_CREDENTIALS, "guest");
                
env.put(Context.INITIAL_CONTEXT_FACTORY,"org.jboss.naming.HttpNamingContextFactory");
                env.put(Context.PROVIDER_URL, "http://server/invoker/JNDIFactory";);
                return new InitialContext(env);
        }

        
        
        public void setupPTP()
        throws JMSException, NamingException
        {
                InitialContext iniCtx = getInitialContext();
                Object tmp = iniCtx.lookup("ConnectionFactory");
                QueueConnectionFactory qcf = (QueueConnectionFactory) tmp;
                conn = qcf.createQueueConnection();
                que = (Queue) iniCtx.lookup("queue/A");
                session = conn.createQueueSession(false,QueueSession.AUTO_ACKNOWLEDGE);
                conn.start();
        }
        public void sendRecvAsync(String text)
        throws JMSException, NamingException
        {
                System.out.println("Begin sendRecvAsync");
// Setup the PTP connection, session
                setupPTP();
// Set the async listener
                QueueReceiver recv = session.createReceiver(que);
                recv.setMessageListener(new ExListener());
// Send a text msg
                QueueSender send = session.createSender(que);
                TextMessage tm = session.createTextMessage(text);
                send.send(tm);
                System.out.println("sendRecvAsync, sent text="
                                + tm.getText());
                send.close();
                System.out.println("End sendRecvAsync");

        }
        public void stop() throws JMSException {  
                conn.stop();
                session.close();
                conn.close();
        }
        public static void main(String args[]) throws Exception {
                
                
                SendRecvClient client = new SendRecvClient();
                client.sendRecvAsync("A text msg");
                client.done.acquire();
                client.stop();
                System.exit(0);
        }
}


View the original post : 
http://www.jboss.org/index.html?module=bb&op=viewtopic&p=3829795#3829795

Reply to the post : 
http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=3829795


-------------------------------------------------------
This SF.Net email is sponsored by: IBM Linux Tutorials
Free Linux tutorial presented by Daniel Robbins, President and CEO of
GenToo technologies. Learn everything from fundamentals to system
administration.http://ads.osdn.com/?ad_id=1470&alloc_id=3638&op=click
_______________________________________________
JBoss-user mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/jboss-user

Reply via email to