Hello guys,

there is a bug in JCAConnectionFactory undeployment (I guess in all
3.0 branches). Here are the details (I played with MySQL). When it is created the
J2EEManagedObject is created with a name like:
J2EEServer=Local,JCAResource=JCA,j2eeType=JCAConnectionFactory,name=MySqlDS-LocalTxCM

But when it is undeployed, this object isn't removed and remains
registered. Thus redeployment will fail.

The JCAConnectionFactory.destroy() method searches with criteria:
J2EEManagedObject.getDomainName() + ":" +
J2EEManagedObject.TYPE + "=" + JCAConnectionFactory.J2EE_TYPE + "," +
"name=" + pName + "," +
"*"
which results in
jboss.management.local:j2eeType=JCAConnectionFactory,name=MySqlDS-LocalTxCM,*

Id it correct? I am still not good at it but it doesn't work.

I changed the criteria to:
ObjectName lServer = null;
try {
   lServer = (ObjectName) pServer.queryNames(
      new ObjectName(
         J2EEManagedObject.getDomainName() + ":" +
         J2EEManagedObject.TYPE + "=" + J2EEServer.J2EE_TYPE + "," +
         "*"
      ),
      null
   ).iterator().next();
}
catch( Exception e ) {
   lLog.error( "Could not locate JSR-77 Server: " + pName, e );
}

ObjectName lJCAResource = null;
try {
   // Check if the JCA Resource exists and if not create one
   Set lNames = pServer.queryNames(
      new ObjectName(
         J2EEManagedObject.getDomainName() + ":" +
         J2EEManagedObject.TYPE + "=" + JCAResource.J2EE_TYPE + "," +
         "*"
      ),
      null
   );
   if( lNames.isEmpty() ) {
      // Now create the JCA resource
      lJCAResource = JCAResource.create( pServer, "JCA" );
   } else {
      lJCAResource = (ObjectName) lNames.iterator().next();
   }
}
catch( Exception e ) {
   lLog.error( "Could not create JSR-77 JCA resource", e );
}

String searchCriteria =
   J2EEManagedObject.getDomainName() + ":" +
   J2EEServer.J2EE_TYPE + "=" +
   lServer.getKeyProperty( "name" ) + "," +
   JCAResource.J2EE_TYPE + "=" +
   lJCAResource.getKeyProperty( "name" ) + "," +
   J2EEManagedObject.TYPE + "=" + JCAConnectionFactory.J2EE_TYPE + "," +
   "name=" + pName + "," +
   "*";

This criteria is:
J2EEServer=Local,JCAResource=JCA,j2eeType=JCAConnectionFactory,name=MySqlDS-LocalTxCM,*

And it works. I guess it's a weird way. Please, comment it.

TIA!

-- 
Best regards,
 Alex Loubyansky




-------------------------------------------------------
This sf.net email is sponsored by: OSDN - Tired of that same old
cell phone?  Get a new here for FREE!
https://www.inphonic.com/r.asp?r=sourceforge1&refcode1=vs3390
_______________________________________________
Jboss-development mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/jboss-development

Reply via email to