activemq-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Joe Fernandez <joe.fernan...@ttmsolutions.com>
Subject Re: Trouble configuring attribute for LDAPAuthorizationMap
Date Fri, 25 Jul 2008 15:27:28 GMT

I am no Spring guru, but it appears to me that MessageFormat is treated as a
complex type and thus needs a custom property editor?

http://static.springframework.org/spring/docs/2.0.x/reference/validation.html

Anyway, I think you can work around the problem as follows

<beans>
  
  <!-- Allows us to use system properties as variables in this configuration
file -->
  <bean
class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer"/>
  
  <!-- <broker brokerName="broker0" xmlns="http://activemq.org/config/1.0">
-->
  <broker brokerName="broker0" xmlns="http://activemq.org/config/1.0">     
    
    ...
 
    <plugins>    
    
    <jaasAuthenticationPlugin configuration="LdapConfiguration"/>          
    
    <authorizationPlugin>
        <map>
	  <bean xmlns="http://www.springframework.org/schema/beans"
id="lDAPAuthorizationMap" 
                  
class="org.apache.activemq.security.LDAPAuthorizationMap">
			
 	                      ...
		  <property name="queueSearchMatchingFormat"
ref="myQSearchMatchingFormat"/>
                              ...				
	 </bean>
        </map>
      </authorizationPlugin>    
  </plugins>
 ...  
  </broker> 
  
  <bean xmlns="http://www.springframework.org/schema/beans" 
    id="myQSearchMatchingFormat" class="java.text.MessageFormat">
  <constructor-arg
value="cn={0},ou=Queue,ou=Destination,ou=amq,ou=systems,dc=foo,dc=com"/>
  </bean>
  
</beans>


Joe
http://www.ttmsolutions.com



fredrick255 wrote:
> 
> I'm trying to set the queueSearchMessageFormat and
> topicSearchMessageFormat but when I have these properties I get a spring
> error to the tune of:
> 
> Caused by: org.springframework.beans.TypeMismatchException: Failed to
> convert property value of type [java.lang.String] to required type
> [java.text.MessageFormat] for property 'queueSearchMatchingFormat'; nested
> exception is java.lang.IllegalArgumentException: Cannot convert value of
> type [java.lang.String] to requiredtype [java.text.MessageFormat] for
> property 'queueSearchMatchingFormat': no matching editors or conversion
> strategy found
> 
> I do not understand where MessageFormat is coming from. I do not see this
> anywhere in the activemq-core.xsd. It is used in the LDAPAuthorizationMap
> class but judging from the constructor this conversion is not a problem as
> the MessageFormat member variables are initialized with strings.
> 
>  topicSearchMatchingFormat = new
> MessageFormat("uid={0},ou=topics,ou=destinations,o=ActiveMQ,dc=example,dc=com");
>         queueSearchMatchingFormat = new
> MessageFormat("uid={0},ou=queues,ou=destinations,o=ActiveMQ,dc=example,dc=com");
> 
> If I run the broker without the SeachMessageFormat I can see authorization
> failing due to the fact it is searching in these default locations.
> 
> I thought it was odd that the messageFormat properties are defined as both
> a <spring:bean/> element and an attribute in the XSD for
> LDAPAuthorizationMap. I tried removing the element definition and pointing
> to the modified XSD in the xsi:schemaLocation but I still received the
> same error.
> 
> Any ideas?
> 
> 
> Thanks,
> Fredrick
> 

-- 
View this message in context: http://www.nabble.com/Trouble-configuring-attribute-for-LDAPAuthorizationMap-tp18641870p18653938.html
Sent from the ActiveMQ - User mailing list archive at Nabble.com.


Mime
View raw message