Discussion:
[jboss-user] [IronJacamar] - Trying to create datasource, delete and then create again with same name requires sever restart
Van Halbert
2013-08-12 13:42:59 UTC
Permalink
Van Halbert [https://community.jboss.org/people/van.halbert] created the discussion

"Trying to create datasource, delete and then create again with same name requires sever restart"

To view the discussion, visit: https://community.jboss.org/message/832328#832328

--------------------------------------------------------------
Referencing https://issues.jboss.org/browse/AS7-4776 https://issues.jboss.org/browse/AS7-4776

Teiid is having an issue with the usecase:    create, delete and create again with same name

The use case is driven from the Teiid Designer, which will create a datasource in order that the user can preview the data.    And there are cases when the datasource will need to be removed.  However, a subsequent call to recreate the datasource with the same name will be unsuccessfull unless the server is restarted.    It appears the server isn't cleaning up the connection factory after the delete, hence the issue with trying to readd with the same name.

Any possibility of a fix?
--------------------------------------------------------------

Reply to this message by going to Community
[https://community.jboss.org/message/832328#832328]

Start a new discussion in IronJacamar at Community
[https://community.jboss.org/choose-container!input.jspa?contentType=1&containerType=14&container=2098]
Barry LaFond
2013-08-12 13:47:51 UTC
Permalink
Barry LaFond [https://community.jboss.org/people/blafond] created the discussion

"Re: Trying to create datasource, delete and then create again with same name requires sever restart"

To view the discussion, visit: https://community.jboss.org/message/832329#832329

--------------------------------------------------------------
I think the primary issues is the inability to update a data source. Whether that's done at the Designer level via a new  Admin.updateDataSource() method or under the hood via the createDataSource() (check for existing, reconcile properties and update the configuration) doesn't matter.

So currently Designer has to remove/add to insure any new properties are attached to the updated data source.

Barry
--------------------------------------------------------------

Reply to this message by going to Community
[https://community.jboss.org/message/832329#832329]

Start a new discussion in IronJacamar at Community
[https://community.jboss.org/choose-container!input.jspa?contentType=1&containerType=14&container=2098]
Stefano Maestri
2013-08-12 15:07:09 UTC
Permalink
Stefano Maestri [https://community.jboss.org/people/maeste] created the discussion

"Re: Trying to create datasource, delete and then create again with same name requires sever restart"

To view the discussion, visit: https://community.jboss.org/message/832348#832348

--------------------------------------------------------------
The issue is about something else, and fixed a different problem generating an exception during :remove operation on RA, you are asking to remove and re-add subresources of resource-adapter w/o server reload.
It's not currently supported. You can't change the structure af an RA resource w/o a server reload.

What you can do (because supported) is to edit attributes marked as read-write. Of course you can't edit read-only attributes. In particular you can't add a connection-definition/config-property's value (if I well remember is one of few, if not the only one, attribute marked read only)
#Add resource-adapter
/subsystem=resource-adapters/resource-adapter=ws:add(module=org.jboss.teiid.resource-adapter.webservice, transaction-support=NoTransaction)
#Add a connection factory
/subsystem=resource-adapters/resource-adapter=ws/connection-definitions=wsDS:add(jndi-name=java:/wsDS, class-name=org.teiid.resource.adapter.ws.WSManagedConnectionFactory, enabled=true, use-java-context=true)
#remove the added connection factory
/subsystem=resource-adapters/resource-adapter=ws:remove
#Add the same *named* connection factory again to RA
/subsystem=resource-adapters/resource-adapter=ws/connection-definitions=wsDS:add(jndi-name=java:/wsDS, class-name=org.teiid.resource.adapter.ws.WSManagedConnectionFactory, enabled=true, use-java-context=true)
because it is changing structure of resource-adapter main resource removing and readding connection-definition.
/subsystem=resource-adapters/resource-adapter=ws/connection-definitions=wsDS:add(jndi-name=java:/wsDS, class-name=org.teiid.resource.adapter.ws.WSManagedConnectionFactory, enabled=true, use-java-context=true)
/subsystem=resource-adapters/resource-adapter=ws/connection-definitions=wsDS/config-properties=EndPoint:add(value= http://foo.com/ http://foo.com)
/subsystem=resource-adapters/resource-adapter=ws:activate
/subsystem=resource-adapters/resource-adapter=ws/connection-definitions=wsDS/config-properties=EndPoint:remove
/subsystem=resource-adapters/resource-adapter=ws/connection-definitions=wsDS/config-properties=EndPoint:add(value= http://foo1.com/ http://foo1.com)
What should work is
#Add resource-adapter
/subsystem=resource-adapters/resource-adapter=ws:add(module=org.jboss.teiid.resource-adapter.webservice, transaction-support=NoTransaction)
#Add a connection factory
/subsystem=resource-adapters/resource-adapter=ws/connection-definitions=wsDS:add(jndi-name=java:/wsDS, class-name=org.teiid.resource.adapter.ws.WSManagedConnectionFactory, enabled=true, use-java-context=true)
#Add a config-property if need
/subsystem=resource-adapters/resource-adapter=ws/connection-definitions=wsDS/config-properties=EndPoint:add(value= http://foo1.com/ http://foo1.com)
#Activate the resource-adapter to apply config
/subsystem=resource-adapters/resource-adapter=ws:activate
#remove complegtely  added Resource
/subsystem=resource-adapters/resource-adapter=ws:remove
#Add the same *named* resource-adapter again
/subsystem=resource-adapters/resource-adapter=ws:add(module=org.jboss.teiid.resource-adapter.webservice, transaction-support=NoTransaction)
#Add the same *named* connection factory again to RA
/subsystem=resource-adapters/resource-adapter=ws/connection-definitions=wsDS:add(jndi-name=java:/wsDS, class-name=org.teiid.resource.adapter.ws.WSManagedConnectionFactory, enabled=true, use-java-context=true)
#Add again aconfig-property if need
/subsystem=resource-adapters/resource-adapter=ws/connection-definitions=wsDS/config-properties=EndPoint:add(value= http://foo1.com/ http://MyNewfoo.com)
#Activate the resource-adapter to apply NEW config
/subsystem=resource-adapters/resource-adapter=ws:activate
And the issue fixed in jira linked is about a script like the last one, generating an error during resource-adapter:remove operation.

I hope it helps.

regards
S.
--------------------------------------------------------------

Reply to this message by going to Community
[https://community.jboss.org/message/832348#832348]

Start a new discussion in IronJacamar at Community
[https://community.jboss.org/choose-container!input.jspa?contentType=1&containerType=14&container=2098]
Ramesh Reddy
2013-08-12 15:17:31 UTC
Permalink
Ramesh Reddy [https://community.jboss.org/people/rareddy] created the discussion

"Re: Trying to create datasource, delete and then create again with same name requires sever restart"

To view the discussion, visit: https://community.jboss.org/message/832352#832352

--------------------------------------------------------------
The first script was little mis-leading my mistake, it should have read

/subsystem=resource-adapters/resource-adapter=ws/connection-definitions=wsDS:remove


Note that under every resource-adapter there can be more than one "connection-factory", it is connection factory that we are trying to replace. Your suggested method will remove all the connection factories underneath this "resource-adapter"
--------------------------------------------------------------

Reply to this message by going to Community
[https://community.jboss.org/message/832352#832352]

Start a new discussion in IronJacamar at Community
[https://community.jboss.org/choose-container!input.jspa?contentType=1&containerType=14&container=2098]
Stefano Maestri
2013-08-12 15:21:42 UTC
Permalink
Stefano Maestri [https://community.jboss.org/people/maeste] created the discussion

"Re: Trying to create datasource, delete and then create again with same name requires sever restart"

To view the discussion, visit: https://community.jboss.org/message/832353#832353

--------------------------------------------------------------
I understand your point, but if you want to act runtime, it's the only supported method until ironjacamar 2.0.

Anyway consider that resource-adapters resources are just configuration (to use more correct jca slang "activation"), so it's up to you how many cf you are configuring per activation.

regards
S.
--------------------------------------------------------------

Reply to this message by going to Community
[https://community.jboss.org/message/832353#832353]

Start a new discussion in IronJacamar at Community
[https://community.jboss.org/choose-container!input.jspa?contentType=1&containerType=14&container=2098]
Jesper Pedersen
2013-08-12 15:25:33 UTC
Permalink
Jesper Pedersen [https://community.jboss.org/people/jesper.pedersen] created the discussion

"Re: Trying to create datasource, delete and then create again with same name requires sever restart"

To view the discussion, visit: https://community.jboss.org/message/832355#832355

--------------------------------------------------------------
Yes, it is more likely that a single <connection-definition> per <resource-adapter> will suite your case better.

Some background on why IronJacamar 2.0 - connection definitions can have a ResourceAdapter instance associated, so in order to support adding or removing connection-definition from a specific deployment we need to do a lot more tracking of the resource adapter object that IronJacamar creates during deployment. That isn't possible in IronJacamar 1.x.

Hence 1 <connection-definition> (or 1 <admin-object>) per deployment is better atm.
--------------------------------------------------------------

Reply to this message by going to Community
[https://community.jboss.org/message/832355#832355]

Start a new discussion in IronJacamar at Community
[https://community.jboss.org/choose-container!input.jspa?contentType=1&containerType=14&container=2098]
Barry LaFond
2013-08-12 15:26:55 UTC
Permalink
Barry LaFond [https://community.jboss.org/people/blafond] created the discussion

"Re: Trying to create datasource, delete and then create again with same name requires sever restart"

To view the discussion, visit: https://community.jboss.org/message/832356#832356

--------------------------------------------------------------
Some of this explains some behavior we are seeing in Designer.  When previewing data for a model, we deploy both a preview VDB and a preview data source (connection-definiition). If user also Executes a VDB for that source a Data Source (connection-definition) is being created with that same resource-adapter.  We've seen behavior that indicates that a "remove" may have deleted both and we were not expecting that.

Barry
--------------------------------------------------------------

Reply to this message by going to Community
[https://community.jboss.org/message/832356#832356]

Start a new discussion in IronJacamar at Community
[https://community.jboss.org/choose-container!input.jspa?contentType=1&containerType=14&container=2098]
Ramesh Reddy
2013-08-12 15:34:04 UTC
Permalink
Ramesh Reddy [https://community.jboss.org/people/rareddy] created the discussion

"Re: Trying to create datasource, delete and then create again with same name requires sever restart"

To view the discussion, visit: https://community.jboss.org/message/832359#832359

--------------------------------------------------------------
Ok. The issue is Teiid has predefined "resource-adapters" that are loaded from "modules" so there is one "known" definition of it to be used by the tooling. By duplicating "resource-adapter" definition for each connection factory it obsuficates this "known" definitions, thus our usage the way it is currently.

In that case, I need to re-evaluate how we can redo logic on our side for supporting before IronJacmar 2.0

Thanks

Ramesh..
--------------------------------------------------------------

Reply to this message by going to Community
[https://community.jboss.org/message/832359#832359]

Start a new discussion in IronJacamar at Community
[https://community.jboss.org/choose-container!input.jspa?contentType=1&containerType=14&container=2098]
Jesper Pedersen
2013-08-12 15:44:05 UTC
Permalink
Jesper Pedersen [https://community.jboss.org/people/jesper.pedersen] created the discussion

"Re: Trying to create datasource, delete and then create again with same name requires sever restart"

To view the discussion, visit: https://community.jboss.org/message/832363#832363

--------------------------------------------------------------
If you know which connection definitions that belong together in your model then you could just have 1 <resource-adapter>. However, once 1 connection definition is removed, then all the bound connection-definitions are removed.

So it depends if that is acceptable or not.
--------------------------------------------------------------

Reply to this message by going to Community
[https://community.jboss.org/message/832363#832363]

Start a new discussion in IronJacamar at Community
[https://community.jboss.org/choose-container!input.jspa?contentType=1&containerType=14&container=2098]
Loading...