Radek Kraus created AMQ-6900:
--------------------------------

             Summary: ActiveMQConnectionFactory - trustedPackages cannot be 
configured in JNDI resource definition
                 Key: AMQ-6900
                 URL: https://issues.apache.org/jira/browse/AMQ-6900
             Project: ActiveMQ
          Issue Type: Bug
    Affects Versions: 5.15.3
            Reporter: Radek Kraus
         Attachments: AMQConnectionFactoryTrustedPackagesJndiTest.java, 
ActiveMQConnectionFactory.patch

It seems, there is a problem in {{ActiveMQConnectionFactory}}, when 
"trustedPackages" is configured in JNDI resource definition.

Let suppose following JNDI resource definition in Tomcat container
{code:java}
<Resource
  name="jms/ConnectionFactory"
  auth="Container"
  type="org.apache.activemq.ActiveMQConnectionFactory"
  factory="org.apache.activemq.jndi.JNDIReferenceFactory"
  brokerURL="tcp://localhost:61616"
  trustAllPackages="false"
  trustedPackages="java.lang,java.util"
/>
{code}
The final {{ConnectionFactory}} (and {{Connection}}) acquired by 
"web-application" (via {{javax.naming.Context}}) does not contains 
{{trustedPackages}} configuration.  As workaround can be used 
{{trustAllPackages=true}}, which is set up via common {{IntrospectionSupport}} 
at {{ActiveMQConnectionFactory.buildFromMap(Map<String, Object>)}}.

But I think that configuration of {{trustedPackages}} should work too. I 
attached my fix proposal and simple test case. IMHO it should be enough to 
handle/add {{trustAllPackages}} and {{trustedPackages}} in 
{{ActiveMQConnectionFactory.buildFromProperties(Properties}} and 
{{ActiveMQConnectionFactory.populateProperties(Properties)}} methods.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Reply via email to