I'm not possitive this is what I need to do but it makes sense.  I'm 
dynamically creating a topic at runtime.  It shows up in the jmx-console and is 
started however when I try to connect to it I get an Exception that states its 
unable to authenticate.  So I added some additonal code that I thought should 
work, since i cannot find any examples.  But now I get and Exception at 
creation time that  states "no protocol : <The contents of my Security node I 
added>"

The code is listed below that I used trying to attempt the adding of the 
SecurityConf Element attribute.  i'm adding the code for the complete creation 
of the topic as well.


  |     private void registerTopic(String topicname)
  |                     throws MalformedObjectNameException, Exception {
  |             createDestination("org.jboss.mq.server.jmx.Topic",
  |                             getTopicObjectName(topicname), "topic/" + 
topicname);
  |     }
  | 
  |     private ObjectName getTopicObjectName(String name)
  |                     throws MalformedObjectNameException {
  | 
  |             return new 
ObjectName("jboss.mq.destination:service=Topic,name=" + name);
  |     }
  | 
  |     protected void createDestination(String type, ObjectName name,
  |                     String jndiName) throws Exception {
  | 
  |             if (logger.isDebugEnabled()) {
  |                     logger.debug("Attempting to create destination: " + name
  |                                     + "; type=" + type);
  |             }
  |             MBeanServer server = MBeanServerLocator.locateJBoss();
  |             server.createMBean(type, name);
  |             server.setAttribute(name, new Attribute("DestinationManager",
  |                             new 
ObjectName("jboss.mq:service=DestinationManager")));
  |             
  |             server.setAttribute(name, new Attribute("SecurityManager",
  |                             new 
ObjectName("jboss.mq:service=SecurityManager")));
  |             
  |             server.setAttribute(name, new Attribute("SecurityConf", 
getSecurityconf()));
  |             server.setAttribute(name, new Attribute("JNDIName", jndiName));
  |             
  |             TopicMBean tmb = 
(TopicMBean)MBeanServerInvocationHandler.newProxyInstance(server, 
name,TopicMBean.class,false);
  |             tmb.start();
  |     }
  |     
  | 
  |     private Element getSecurityconf() throws SAXException, IOException{
  |             Element el = null;
  |             StringBuffer securityConfStr = new StringBuffer();
  |             securityConfStr.append("<security>");
  |             securityConfStr.append("  <role name=\"publisher\" 
read=\"true\" write=\"true\" create=\"false\"/>");
  |             securityConfStr.append("  <role name=\"durpublisher\" 
read=\"true\" write=\"true\" create=\"true\"/>");
  |             securityConfStr.append("</security>");
  | 
  |             DOMParser parser = new DOMParser(); 
  |             parser.parse(securityConfStr.toString());
  |             Document doc = parser.getDocument();
  |             el = doc.getDocumentElement();
  |             return el;
  |     }
  | 
  | 

Thanks in advance,
Michael

PS I am aware I have a similar post in JMS forum, I realized that I should have 
probably posted it here.  sorry for the cross post.


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

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


-------------------------------------------------------
SF.Net email is sponsored by: Discover Easy Linux Migration Strategies
from IBM. Find simple to follow Roadmaps, straightforward articles,
informative Webcasts and more! Get everything you need to get up to
speed, fast. http://ads.osdn.com/?ad_id=7477&alloc_id=16492&op=click
_______________________________________________
JBoss-user mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/jboss-user

Reply via email to