users@glassfish.java.net

Re: Problems creating JDBC connection pool programmatically on Glassfish V3.1

From: Alexis Moussine-Pouchkine <alexis.moussine-pouchkine_at_oracle.com>
Date: Fri, 22 Jul 2011 18:39:25 +0200

Right, I think that's overall a good idea in the future to consider the RESTful API, glassfish-resources.xml or @DataSourcDefinition (JavaEE6)
-Alexis

On 22 juil. 2011, at 18:35, Nazrul Islam wrote:

> Here is an example using RESTful API: http://blogs.steeplesoft.com/2011/03/managing-glassfish-jdbc-resources-via-rest/
>
> --
> Nazrul Islam - (408) 276-6468 - Oracle
>
>
> forums_at_java.net wrote:
>> I have been trying to programmatically create a JDBC connection pool in
>> Glassfish V3.1 using AMX. The code we used for Glassfish V2 does not work
>> under V3.1 and I can't seem to find any material that is helpful. Any
>> advise/hints/tips would be most welcome. I understand that there have been
>> changes in AMX for V3 and I've read the /GlassFish V3 AMX SPI/ [1] but that
>> still didn't resolve my problem.
>>
>> The code that works under Glassfish V2 is:
>> AppserverConnectionSource appserver =
>> new
>> AppserverConnectionSource(AppserverConnectionSource.PROTOCOL_RMI,
>> GLASSFISH_HOSTNAME, GLASSFISH_JMX_PORT, GLASSFISH_USER, GLASSFISH_PASSWORD,
>> null);
>>
>> DomainRoot domainRoot = appserver.getDomainRoot();
>>
>> domainRoot.getDomainConfig().createJDBCConnectionPoolConfig(connPoolName,
>> "com.mysql.jdbc.jdbc2.optional.MysqlConnectionPoolDataSource", map);
>>
>>
>> But under Glassfish V3.1 this throws the following exception:
>>
>> java.lang.RuntimeException: java.io.IOException: Failed to retrieve
>> RMIServer stub: javax.naming.NameNotFoundException:
>> management/rmi-jmx-connector
>>
>>
>> [1] http://glassfish.java.net/nonav/v3/admin/planning/V3Changes/V3_AMX_SPI.html
>>
>> --
>>
>> [Message sent by forum member 'lostvicking']
>>
>> View Post: http://forums.java.net/node/822398
>>
>>
>