Attempting to Pause JMS Queue Consumption from MessageBean fails to establish JMX Connection in WebLogic -


i trying pause jms queue message driven bean on weblogic server using jmx. idea if message fails execute set number of times pauses queues consumption. when attempt connect via jmx failing, though running within weblogic container.

following code using, fails on call jmsruntimehelper.getjmsdestinationruntimembean( ctx, queue );

the code below works fine if run within session facade bean called via business delegate (i.e. t3/rmi connection).

category access = opentwinsclientproperties.getinstance().getcategory( opentwinsclientproperties.category_access ); string destinationaddresses = access.getvalue( opentwinsclientproperties.access_provider_url ); final string protocol = stringutils.substringbefore( destinationaddresses, "://" ); destinationaddresses = stringutils.removestart( destinationaddresses, protocol ); final string[] destinations = stringutils.split( destinationaddresses, ',' ); string[] hostandport = null; ( string destination : destinations ) {     hostandport = destination.split( ":" ); } jmxserviceurl serviceurl; jmxconnector jmxconnection = null; string jndiname = null; try {     serviceurl = new jmxserviceurl( protocol, hostandport[1].split( "//" )[1], integer.parseint( hostandport[2] ), "/jndi/" + domainruntimeservicembean.mbeanserver_jndi_name );     hashtable<string, string> h = new hashtable<string, string>();     h.put( context.security_principal, "weblogic" );     h.put( context.security_credentials, "password1" );     h.put( jmxconnectorfactory.protocol_provider_packages, "weblogic.management.remote" );     mbeanserverconnection bco;     jmxconnection = jmxconnectorfactory.connect( serviceurl, h );     bco = jmxconnection.getmbeanserverconnection();      initialcontext ctx = opentwinsfrontendutilities.getinitialcontext( false );     //ctx.addtoenvironment( context.security_principal, "weblogic" );     //ctx.addtoenvironment( context.security_credentials, "password1" );     destination queue = (destination) ctx.lookup( "jms/jmsaccessnotificationqueue" );      jmsdestinationruntimembean destmbean = jmsruntimehelper.getjmsdestinationruntimembean( ctx, queue );     destmbean.pauseproduction();     destmbean.pauseconsumption(); } catch(namenotfoundexception ex){     ex.printstacktrace(); } catch(throwable ex){     ex.printstacktrace(); } {     if ( jmxconnection != null ) {         try {             jmxconnection.close();         } catch ( ioexception ex1 ) {     } } 

following exception message get:

caused by: javax.naming.nopermissionexception: user <anonymous> not have permission on weblogic.management.mbeanservers perform lookup operation.     @ weblogic.jndi.internal.servernamingnode.checkpermission(servernamingnode.java:449)     @ weblogic.jndi.internal.servernamingnode.checklookup(servernamingnode.java:429)     @ weblogic.jndi.internal.servernamingnode.lookuphere(servernamingnode.java:180)     @ weblogic.jndi.internal.basicnamingnode.lookup(basicnamingnode.java:206)     @ weblogic.jndi.internal.basicnamingnode.lookup(basicnamingnode.java:220)     @ weblogic.jndi.internal.basicnamingnode.lookup(basicnamingnode.java:220)     @ weblogic.jndi.internal.wleventcontextimpl.lookup(wleventcontextimpl.java:254)     @ weblogic.jndi.internal.wlcontextimpl.lookup(wlcontextimpl.java:413)     @ javax.naming.initialcontext.lookup(initialcontext.java:392)     @ weblogic.management.remote.wlx.clientprovider.findrmiserver(clientprovider.java:131)     @ weblogic.management.remote.wlx.clientprovider.newjmxconnector(clientprovider.java:98)     @ javax.management.remote.jmxconnectorfactory.newjmxconnector(jmxconnectorfactory.java:339)     @ javax.management.remote.jmxconnectorfactory.connect(jmxconnectorfactory.java:248)     @ weblogic.jms.common.jmsedithelper.lookupmbeanserverconnection(jmsedithelper.java:79)     @ weblogic.jms.common.jmsedithelper.getruntimeservice(jmsedithelper.java:137)     @ weblogic.jms.common.jmsedithelper.getdomainruntimeservice(jmsedithelper.java:165) 
  • i have tried provide credentials in initial context, made no difference.
  • i have tried tick anonymous admin lookup enabled in weblogic console, made no difference.

how can gain trust of weblogic container within message driven bean can pause queue?


Comments

Popular posts from this blog

How has firefox/gecko HTML+CSS rendering changed in version 38? -

javascript - Complex json ng-repeat -

jquery - Cloning of rows and columns from the old table into the new with colSpan and rowSpan -