Page 2 of 2 FirstFirst 12
Results 11 to 13 of 13

Thread: message-driven-channel-adapter + (weblogic).jms.common.JMSSecurityException

  1. #11
    Join Date
    Oct 2011
    Location
    Mumbai, India
    Posts
    213

    Default

    You are sending a message from your standalone client. Can you try creating a javax.jms.MessageConsumer from your standalone app and then try receiving messages from your queue? Does that work?
    Just trying to eliminate the fact that you just have access to send messages to the queue, that is create a javax.jms.MessageProducer and not consume by creating a javax.jms.MessageConsumer for this queue.
    Last edited by Amol Nayak; May 8th, 2012 at 12:45 PM.

  2. #12

    Default

    I did also that, I mean a classic java client with QueueReceiver and it works as expected:

    Code:
    public class JMSReceiver {
    ...	  
    	  private static final String QCF_NAME   = "WL.mb0_sb.CF";
    	  private static final String QUEUE_NAME = "WL.mb0_sb.BU";
    	  private static final String WLS_URL    = "t3://bsrpdev0012.dev.b-source.net:7841";
    	  private static final String WLS_USER   = "WLS_USER";
    	  private static final String WLS_PWD    = "WLS_USER";
      
    	  private static final int TIMEOUT = 10*1000;
    
    	  public static void main(String[] args) {
    		    retrieveMessage();
    		  }
    
    	  public static void retrieveMessage()   {
    	    Hashtable<String, String> properties = new Hashtable<String, String>();
    	    properties.put(Context.INITIAL_CONTEXT_FACTORY, "weblogic.jndi.WLInitialContextFactory");
    	    properties.put(Context.PROVIDER_URL, WLS_URL);
    	    properties.put(Context.SECURITY_PRINCIPAL, WLS_USER);
    	    properties.put(Context.SECURITY_CREDENTIALS, WLS_PWD);
    		
    		try {
    			ctx = new InitialContext(properties);
    		} catch (Exception e) {
    			System.out.println(e.getMessage());
    		}
    	    
    	    try {
                          qcf = (QueueConnectionFactory) ctx.lookup(QCF_NAME);
    	      qc = qcf.createQueueConnection();
    	      qsess = qc.createQueueSession(false, 0);
    	      q = (Queue)ctx.lookup(QUEUE_NAME);
                          qrcvr = qsess.createReceiver(q);
                          qc.start();
                          message = qrcvr.receive(TIMEOUT);
    	      System.out.println("received: " + message.toString());
    	    } catch(Throwable e) {
    	    	System.out.println(e.getMessage());
    	    } finally {
    	    	try {
    	    		qrcvr.close();
    		    	qsess.close();
    		    	qc.close();
    	    	} catch (Exception e2) {
    	    		e2.printStackTrace();
    	    	}
    	    }
    	  }
    }
    In order to find out a solution some days ago I posted the same issue on OTN Discussion Forum and today I've just got:

    Code:
    Spring JMS and WebLogic JMS have given a tough time to lot of us. 
    
    When Spring looks up the connection factory & queue, it does so using the proper credentials, but since the actual publish/consume takes place in a different thread, the security information doesn't get passed on to that new thread.
    
    There is apparently a flag called "exposeAccessContext" that you can set on the connection factory & queue in Spring to ensure that the security credentials are available to other threads.
    I will try with that. Do you know that flag ?

  3. #13

    Default

    So I've added the flag expose-access-context on the connection factory & queue in Spring:

    Code:
        <jee:jndi-lookup id="connectionFactory" jndi-name="WL.mb0_sb.CF" expose-access-context="true">
            <jee:environment>
                java.naming.factory.initial=weblogic.jndi.WLInitialContextFactory
                java.naming.provider.url=t3://bsrpdev0012.dev.b-source.net:7841
                java.naming.security.principal=...
                java.naming.security.credentials=...
            </jee:environment>
        </jee:jndi-lookup>
        <jee:jndi-lookup id="signbookFLQueue" jndi-name="WL.mb0_sb.BU" expose-access-context="true">
            <jee:environment>
                java.naming.factory.initial=weblogic.jndi.WLInitialContextFactory
                java.naming.provider.url=t3://bsrpdev0012.dev.b-source.net:7841
                java.naming.security.principal=...
                java.naming.security.credentials=...
            </jee:environment>
        </jee:jndi-lookup>
    But now I got that error:

    Code:
    09.mag.2012 09:59:14,020 - (LISTENER SERVICE) (org.springframework.jms.listener.DefaultMessageListenerContainer#0-1) [WARN  ]-
    [DefaultMessageListenerContainer    (819 )] - Setup of JMS message listener invoker failed for destination 'mb0_sb!WL.mb0_sb.BU' - 
    trying to recover. Cause: [JMSClientExceptions:055142]Foreign destination, mb0_sb!WL.mb0_sb.BU
    weblogic.jms.common.InvalidDestinationException: [JMSClientExceptions:055142]Foreign destination, mb0_sb!WL.mb0_sb.BU
            at weblogic.jms.common.Destination.checkDestinationType(Destination.java:105)
            at weblogic.jms.client.JMSSession.setupConsumer(JMSSession.java:2657)
            at weblogic.jms.client.JMSSession.createConsumer(JMSSession.java:2628)
            at weblogic.jms.client.JMSSession.createConsumer(JMSSession.java:2608)
            at weblogic.jms.client.WLSessionImpl.createConsumer(WLSessionImpl.java:880)
            at org.springframework.jms.listener.AbstractPollingMessageListenerContainer.createConsumer(AbstractPollingMessageListenerContainer.java:501)
            at org.springframework.jms.listener.AbstractPollingMessageListenerContainer.createListenerConsumer(AbstractPollingMessageListenerContainer.java:223)
            at org.springframework.jms.listener.DefaultMessageListenerContainer$AsyncMessageListenerInvoker.initResourcesIfNecessary(DefaultMessageListenerContainer.java:1082)
            at org.springframework.jms.listener.DefaultMessageListenerContainer$AsyncMessageListenerInvoker.invokeListener(DefaultMessageListenerContainer.java:1058)
            at org.springframework.jms.listener.DefaultMessageListenerContainer$AsyncMessageListenerInvoker.executeOngoingLoop(DefaultMessageListenerContainer.java:1051)
            at org.springframework.jms.listener.DefaultMessageListenerContainer$AsyncMessageListenerInvoker.run(DefaultMessageListenerContainer.java:948)
            at java.lang.Thread.run(Thread.java:619)
    09.mag.2012 09:59:14,036 - (LISTENER SERVICE) (org.springframework.jms.listener.DefaultMessageListenerContainer#0-1) [DEBUG ]-[DefaultMessageListenerContainer$AsyncMessageListenerInvoker(997)] - Lowered scheduled invoker count: 0

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •