[jboss-as7-dev] problem creating datasources

Stefano Maestri smaestri at redhat.com
Fri Apr 8 05:58:21 EDT 2011


Answer below
On 04/08/2011 09:32 AM, Heiko Braun wrote:
> comments below
>
> On Apr 7, 2011, at 8:23 PM, Brian Stansberry wrote:
>
>>> [localhost:9999 /]
>>> */profile=default/subsystem=datasources/jdbc-driver=hypersonic:add(driver="com.h2database.h2")*
>>> {
>>> "outcome" =>  "*failed*",
>>> "result" =>  {"server-groups" =>  {"main-server-group" =>  {
>>> "server-one" =>  {
>>> "host" =>  "local",
>>> "response" =>  {
>>> "outcome" =>  "failed",
>>> "failure-description" =>
>>> "org.jboss.msc.service.DuplicateServiceException: Service
>>> jboss.jdbc-driver.\"org.h2.Driver\".1.2 is already registered"
>>> }
>>> },
>>> "server-two" =>  {
>>> "host" =>  "local",
>>> "response" =>  {
>>> "outcome" =>  "failed",
>>> "failure-description" =>
>>> "org.jboss.msc.service.DuplicateServiceException: Service
>>> jboss.jdbc-driver.\"org.h2.Driver\".1.2 is already registered"
>>> }
>>> }
>>> }}},
>>> "failure-description" =>  "Operation was not applied successfully to any
>>> servers"
>>> }
>>>
>> This I understand. There's already this installed:
>>
>> <driver module="com.h2database.h2"/>
>>
>> and that results in the driver service already being present. I'll let
>> Jesper, Stefano or John Bailey comment on whether there's any reason to
>> have the 'driver="com.h2database.h2"' parameter to that operation,
>> rather than just requiring the name of the resource to be the name of
>> the module:
>>
>> /profile=default/subsystem=datasources/jdbc-driver=com.h2database.h2:add
>>
>> You still wouldn't be able to add the module twice, but at least the
>> reason why not would be clear.
> Isn't it that "jdbc-driver=hypersonic:add(driver="com.h2database.h2")" means i am adding a new
> jdbc driver "hypersonic" that references "com.h2database.h2" ?
>
> shouldn't this result in:
> [localhost:9999 /] /profile=default/subsystem=datasources/jdbc-driver=hypersonic:read-resource
> {
>      "outcome" =>  "success",
>      "result" =>  {
>          "name" =>  "hypersonic",
>          "driver" =>  "com.h2database.h2"
>      },
>      "compensating-operation" =>  undefined
> }
>
> but maybe I am confused by the API
>
Well, what you are doing here is to add a new driver you call 
"hypersonic" that refer in fact on the same java.sql.Driver 
implementation (com.h2database.h2). The point is that the name is not 
important in the current implementation because we are creating a 
service for each Driver implementation and version and not for each 
name. What's happen here is that we are trying to create the same 
driver/version service 2 times, getting an MSC error of course.
The question is: does it make sense to have 2 different name for the 
same driver? Or we just need to have a better message to the user saying 
he can't do that because the same driver is already installed with a 
different name?
I'm for the second option, but I'm open to the first one if there is a 
use case to do that.

bye
S.



More information about the jboss-as7-dev mailing list