[jboss-jira] [JBoss JIRA] (AS7-5648) Unwanted system properties in a connectiondefinition/adminobject from another connectiondefinition/adminobject in the same resource adapter

Simone Gotti (JIRA) jira-events at lists.jboss.org
Fri Sep 28 04:38:03 EDT 2012


    [ https://issues.jboss.org/browse/AS7-5648?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12722487#comment-12722487 ] 

Simone Gotti commented on AS7-5648:
-----------------------------------

Hi Stefano,

you're right that merging ijcmd doesn't make sense (as also in my tests it was always null) and so the patch is not right as it has the same effect of removing the operation.

After your explanation I think that there's a broader problem with the logic of merging. Let me explain:

Inside mergeConnectorWithCommonIronJacamar the common config properties are merged (So if I define something in /subsystem=resource-adapters/resource-adapter=ra.rar/config-properties= they are merged with the ones defined in the connector's metadatas in META-INF/ra.xml). I think this is ok.

BUT then also the config-properties of every connection-definition/admin-object specified in standalone.xml/domain.xml are merged with the metadatas for the connection-definitions/admin-objects.
Plus they are only merged if these config-properties are define inside the META-INF/ra.xml (<outbound-resourceadapter><connection-definition><managedconnectionfactory-class><config-property>) (see org.jboss.jca.common.metadata.merge.Merger:mergeConfigProperties)

For example I cannot reproduce it with the activemq ra as it doesn't define any config-property inside the outbound-resourceadapter connection-definition but I can reproduce it with the websphere mq adapter as it defines all the available config-properties for the various provided outbound connection definitions.

Assuming that its ra.xml is correct this is a clear example of what I think is a problem:

*) I deploy the resource adapter and then define 2 connection definitions. I'm not going to write every cli command but this is the final xml:


{noformat}
                    <resource-adapter>
                        <archive>
                            wmq.jmsra.rar
                        </archive>
                        <connection-definitions>
                            <connection-definition class-name="com.ibm.mq.connector.outbound.ManagedQueueConnectionFactoryImpl" jndi-name="mq1" enabled="true" use-java-context="true" pool-name="mq1">
                                <config-property name="hostName">
                                    hostname1
                                </config-property>
                                <config-property name="username">
                                    username1
                                </config-property>
                                <config-property name="password">
                                    password1
                                </config-property>
                            </connection-definition>
                            <connection-definition class-name="com.ibm.mq.connector.outbound.ManagedQueueConnectionFactoryImpl" jndi-name="mq2" enabled="true" use-java-context="true" pool-name="mq2">
                                <config-property name="hostName">
                                    hostname2
                                </config-property>
                            </connection-definition>
                        </connection-definitions>
                    </resource-adapter>
{noformat}

The first connection definition has defined 3 config properties while the second one has defined only one config property (hostName). I'm expecting that the created ManagedQueueConnectionFactoryImpl for the second connection definition will contain only this config property. Instead it contains also other config properties defaults took from a (not predictable) merge of the other connection definitions.

Here is the polluted cdMeta for the class ManagedQueueConnectionFactoryImpl (i formatted it for readability):

{noformat}
DEBUG [org.jboss.as.connector.deployers.RaXmlDeployer] (MSC service thread 1-4) CdMeta: <connection-definition>
	<managedconnectionfactory-class>com.ibm.mq.connector.outbound.ManagedQueueConnectionFactoryImpl
	</managedconnectionfactory-class>
	<config-property>
		<config-property-name>arbitraryProperties</config-property-name>
		<config-property-type>java.lang.String</config-property-type>
	</config-property>
	<config-property>
		<config-property-name>ccdtURL</config-property-name>
		<config-property-type>java.lang.String</config-property-type>
	</config-property>
	<config-property>
		<config-property-name>CCSID</config-property-name>
		<config-property-type>java.lang.String</config-property-type>
	</config-property>
	<config-property>
		<config-property-name>channel</config-property-name>
		<config-property-type>java.lang.String</config-property-type>
	</config-property>
	<config-property>
		<config-property-name>clientID</config-property-name>
		<config-property-type>java.lang.String</config-property-type>
	</config-property>
	<config-property>
		<config-property-name>failIfQuiesce</config-property-name>
		<config-property-type>java.lang.String</config-property-type>
	</config-property>
	<config-property>
		<config-property-name>headerCompression</config-property-name>
		<config-property-type>java.lang.String</config-property-type>
	</config-property>
	<config-property>
		<config-property-name>hostName</config-property-name>
		<config-property-type>java.lang.String</config-property-type>
		<config-property-value>hostname2</config-property-value>
	</config-property>
	<config-property>
		<config-property-name>localAddress</config-property-name>
		<config-property-type>java.lang.String</config-property-type>
	</config-property>
	<config-property>
		<config-property-name>messageCompression</config-property-name>
		<config-property-type>java.lang.String</config-property-type>
	</config-property>
	<config-property>
		<config-property-name>password</config-property-name>
		<config-property-type>java.lang.String</config-property-type>
		<config-property-value>password1</config-property-value>
	</config-property>
	<config-property>
		<config-property-name>pollingInterval</config-property-name>
		<config-property-type>java.lang.String</config-property-type>
	</config-property>
	<config-property>
		<config-property-name>port</config-property-name>
		<config-property-type>java.lang.String</config-property-type>
	</config-property>
	<config-property>
		<config-property-name>providerVersion</config-property-name>
		<config-property-type>java.lang.String</config-property-type>
	</config-property>
	<config-property>
		<config-property-name>putAsyncAllowed</config-property-name>
		<config-property-type>java.lang.String</config-property-type>
	</config-property>
	<config-property>
		<config-property-name>queueManager</config-property-name>
		<config-property-type>java.lang.String</config-property-type>
	</config-property>
	<config-property>
		<config-property-name>rescanInterval</config-property-name>
		<config-property-type>java.lang.String</config-property-type>
	</config-property>
	<config-property>
		<config-property-name>readAheadAllowed</config-property-name>
		<config-property-type>java.lang.String</config-property-type>
	</config-property>
	<config-property>
		<config-property-name>readAheadClosePolicy</config-property-name>
		<config-property-type>java.lang.String</config-property-type>
	</config-property>
	<config-property>
		<config-property-name>receiveExit</config-property-name>
		<config-property-type>java.lang.String</config-property-type>
	</config-property>
	<config-property>
		<config-property-name>receiveExitInit</config-property-name>
		<config-property-type>java.lang.String</config-property-type>
	</config-property>
	<config-property>
		<config-property-name>securityExit</config-property-name>
		<config-property-type>java.lang.String</config-property-type>
	</config-property>
	<config-property>
		<config-property-name>securityExitInit</config-property-name>
		<config-property-type>java.lang.String</config-property-type>
	</config-property>
	<config-property>
		<config-property-name>sendCheckCount</config-property-name>
		<config-property-type>java.lang.String</config-property-type>
	</config-property>
	<config-property>
		<config-property-name>sendExit</config-property-name>
		<config-property-type>java.lang.String</config-property-type>
	</config-property>
	<config-property>
		<config-property-name>sendExitInit</config-property-name>
		<config-property-type>java.lang.String</config-property-type>
	</config-property>
	<config-property>
		<config-property-name>shareConvCount</config-property-name>
		<config-property-type>java.lang.String</config-property-type>
	</config-property>
	<config-property>
		<config-property-name>sslCertStores</config-property-name>
		<config-property-type>java.lang.String</config-property-type>
	</config-property>
	<config-property>
		<config-property-name>sslCipherSuite</config-property-name>
		<config-property-type>java.lang.String</config-property-type>
	</config-property>
	<config-property>
		<config-property-name>sslFipsRequired</config-property-name>
		<config-property-type>java.lang.String</config-property-type>
	</config-property>
	<config-property>
		<config-property-name>sslPeerName</config-property-name>
		<config-property-type>java.lang.String</config-property-type>
	</config-property>
	<config-property>
		<config-property-name>sslResetCount</config-property-name>
		<config-property-type>java.lang.String</config-property-type>
	</config-property>
	<config-property>
		<config-property-name>sslSocketFactory</config-property-name>
		<config-property-type>java.lang.String</config-property-type>
	</config-property>
	<config-property>
		<config-property-name>targetClientMatching</config-property-name>
		<config-property-type>java.lang.String</config-property-type>
	</config-property>
	<config-property>
		<config-property-name>temporaryModel</config-property-name>
		<config-property-type>java.lang.String</config-property-type>
	</config-property>
	<config-property>
		<config-property-name>tempQPrefix</config-property-name>
		<config-property-type>java.lang.String</config-property-type>
	</config-property>
	<config-property>
		<config-property-name>transportType</config-property-name>
		<config-property-type>java.lang.String</config-property-type>
	</config-property>
	<config-property>
		<config-property-name>username</config-property-name>
		<config-property-type>java.lang.String</config-property-type>
		<config-property-value>username1</config-property-value>
	</config-property>
	<config-property>
		<config-property-name>xaEnabled</config-property-name>
		<config-property-type>java.lang.String</config-property-type>
	</config-property>
	<connectionfactory-interface>javax.jms.QueueConnectionFactory
	</connectionfactory-interface>
	<connectionfactory-impl-class>com.ibm.mq.connector.outbound.QueueConnectionFactoryImpl
	</connectionfactory-impl-class>
	<connection-interface>javax.jms.QueueConnection</connection-interface>
	<connection-impl-class>com.ibm.mq.connector.outbound.QueueConnectionWrapper
	</connection-impl-class>
</connection-definition>
{noformat}

As you can see the properties hostName, username and password have a defined value. hostName is the value from the second conndef (but in another run it can be from the first as it depends on the last concurrent model operation that added a connection definition) while username and password are from the first (as it's the only one defining them).

These are used as default for the creation of the ManagedQueueConnectionFactoryImpl for mq1 and mq2 and so also mq2 will get username=username1 and password=password1.


Thanks!



                
> Unwanted system properties in a connectiondefinition/adminobject from another connectiondefinition/adminobject in the same resource adapter
> -------------------------------------------------------------------------------------------------------------------------------------------
>
>                 Key: AS7-5648
>                 URL: https://issues.jboss.org/browse/AS7-5648
>             Project: Application Server 7
>          Issue Type: Bug
>          Components: JCA
>    Affects Versions: 7.1.3.Final (EAP), 7.2.0.Alpha1
>            Reporter: Simone Gotti
>            Assignee: Stefano Maestri
>
> With the effects of issue AS7-5644 I noticed that the connection definition with missing system properties, instead of failing, was using properties from another connection definition (with a lot of consequent problems)
> After a lot of analysis the problem is that the org.jboss.jca.common.api.metadata.ra.Connector's system properties are polluted with the merged values of the user specified connectiondefinitions/adminobjects and these system properties's defaults are inserted in the user defined connectiondefinition/adminobject that don't define them.
> I think that the wrong operation is in the start method of org.jboss.as.connector.services.resourceadapters.deployment.ResourceAdapterXmlDeploymentService.java:
> cmd = (new Merger()).mergeConnectorWithCommonIronJacamar(raxml, cmd);
> I think that merging should be between IronJacamar -> Connector and not raxml -> Connector:
> cmd = (new Merger()).mergeConnectorWithCommonIronJacamar(ijmd, cmd);
> After this change I see that the Connector is clean and no unwanted default are added inside my connectiondefinitions/adminobjects
> I'll attach the possible pull request.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira


More information about the jboss-jira mailing list