You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@geronimo.apache.org by Oli Kessler <ok...@ncode.ch> on 2006/09/01 21:45:44 UTC

GBean referencing ManagedConnectionFactoryWrapper

Hi,

We are trying to reference a JMS resource as well as a database pool
from our custom gbean. They are both declared as references in the
GBEAN_INFO:

infoFactory.addReference("managedConnectionFactoryWrapper",
   ManagedConnectionFactoryWrapper.class,
   NameFactory.JCA_MANAGED_CONNECTION_FACTORY);
infoFactory.addReference("managedDBConnectionFactoryWrapper",
   ManagedConnectionFactoryWrapper.class,
   NameFactory.JCA_MANAGED_CONNECTION_FACTORY);


The deployment plan includes

..
<!--reference the JMS here-->
<reference name="managedConnectionFactoryWrapper">
   <name>myTopicConnectionFactory</name>
</reference>

<!--reference the DB connection -->
<reference name="managedDBConnectionFactoryWrapper">
  <name>myDBConnection</name>
</reference>
..

The name "myTopicConnectionFactory" ist listed in the console as a
server-wide Connection Factory, while "myDBConnection" is the name of a
server-wide Database Pool.

When deploying, the JMS reference is resolved and attached, while the
database reference fails with:  Unable to resolve reference
"managedDBConnectionFactoryWrapper"

Is a DB pool not accessible with a ManagedConnectionFactoryWrapper?
I tried using  groupId and artifactId as well but no success.

Cheers
-ok

Re: GBean referencing ManagedConnectionFactoryWrapper

Posted by Oli Kessler <ok...@ncode.ch>.
Works perfect!

Thanks a lot, Aaron!
-ko

Aaron Mulder wrote:
> Your GBean deployment plan should declare dependencies on the JMS and
> DB pool modules.  It's not obvious why the JMS reference is working
> without this, but perhaps one of the dependencies you do list has a
> dependency on the JMS resource group.  Anyway, for the DB pool, it
> would look like this:
> 
>     <dependency>
>       <groupId>ncode</groupId>
>       <artifactId>ncodeLogDB</artifactId>
>       <version>1.0</version>
>       <type>rar</type>
>     </dependency>
> 
> Thanks,
>      Aaron
> 
> On 9/3/06, Oli Kessler <ok...@ncode.ch> wrote:
> 
>> Sure, here they are
>>
>> thanks,
>> -ok
>>
>>
>> GBean deployment plan:
>>
>> <module xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
>>  xsi:schemaLocation="http://geronimo.apache.org/xml/ns/deployment-1.1
>> /opt/geronimo-1.1/schema/geronimo-module-1.1.xsd"
>>  xmlns="http://geronimo.apache.org/xml/ns/deployment-1.1">
>>   <environment>
>>     <moduleId>
>>       <groupId>ncode</groupId>
>>       <artifactId>ncode-Test-DBWriter</artifactId>
>>       <version>1</version>
>>       <type>car</type>
>>     </moduleId>
>>     <dependencies>
>>       <dependency>
>>         <groupId>ncode</groupId>
>>         <artifactId>LogServer-DBWriter-GBean</artifactId>
>>         <version>0.0.1</version>
>>         <type>jar</type>
>>       </dependency>
>>       <dependency>
>>         <groupId>commons-lang</groupId>
>>         <artifactId>commons-lang</artifactId>
>>         <version>2.1</version>
>>         <type>jar</type>
>>       </dependency>
>>     </dependencies>
>>     <hidden-classes/>
>>     <non-overridable-classes/>
>>   </environment>
>>   <gbean name="ncode.DBWriter"
>>      class="ch.ncode.logquest.db.DBWriterGBean">
>>
>>     <!--reference the JMS here-->
>>     <reference name="managedConnectionFactoryWrapper">
>>       <name>ncodeTopicConnectionFactory</name>
>>     </reference>
>>
>>     <!--reference the DB connection -->
>>     <reference name="managedDBConnectionFactoryWrapper">
>>           <name>ncodeLogDB</name>
>>     </reference>
>>
>>     <!--attribute values-->
>>     <attribute name="workerCount">1</attribute>
>>   </gbean>
>> </module>
>>
>>
>>
>> Database deployment plan:
>>
>> <?xml version="1.0" encoding="UTF-8"?>
>> <connector xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
>>        
>> xsi:schemaLocation="http://geronimo.apache.org/xml/ns/j2ee/connector-1.1
>> /opt/geronimo-1.1/schema/geronimo-connector-1.1.xsd"
>>         xmlns="http://geronimo.apache.org/xml/ns/j2ee/connector-1.1">
>>         <dep:environment
>> xmlns:dep="http://geronimo.apache.org/xml/ns/deployment-1.1">
>>                 <dep:moduleId>
>>                         <dep:groupId>ncode</dep:groupId>
>>                         <dep:artifactId>ncodeLogDB</dep:artifactId>
>>                         <dep:version>1.0</dep:version>
>>                         <dep:type>rar</dep:type>
>>                 </dep:moduleId>
>>                 <dep:dependencies>
>>                         <dep:dependency>
>>                                 <dep:groupId>postgresql</dep:groupId>
>> <dep:artifactId>postgresql-8.0</dep:artifactId>
>>                                 <dep:version>314.jdbc3</dep:version>
>>                                 <dep:type>jar</dep:type>
>>                         </dep:dependency>
>>                 </dep:dependencies>
>>         </dep:environment>
>>         <resourceadapter>
>>                 <resourceadapter-instance>
>>                        
>> <resourceadapter-name>ncodeLogDB</resourceadapter-name>
>>                         <workmanager
>> xmlns="http://geronimo.apache.org/xml/ns/naming-1.1">
>>                                
>> <gbean-link>DefaultWorkManager</gbean-link>
>>                         </workmanager>
>>                 </resourceadapter-instance>
>>                 <outbound-resourceadapter>
>>                         <connection-definition>
>>
>> <connectionfactory-interface>javax.sql.DataSource</connectionfactory-interface>
>>
>>                                 <connectiondefinition-instance>
>>                                         <name>ncodeLogDB</name>
>>                                         <config-property-setting
>> name="Password">aaa</config-property-setting>
>>                                         <config-property-setting
>> name="Driver">org.postgresql.Driver</config-property-setting>
>>                                         <config-property-setting
>> name="UserName">logtest</config-property-setting>
>>                                         <config-property-setting
>> name="ConnectionURL">jdbc:postgresql://dbserv:5432/logtest</config-property-setting>
>>
>>                                         <connectionmanager>
>>                                                 <local-transaction />
>>                                                 <single-pool>
>>                                                        
>> <max-size>10</max-size>
>>                                                        
>> <min-size>0</min-size>
>>                                                         <match-one />
>>                                                 </single-pool>
>>                                         </connectionmanager>
>>                                 </connectiondefinition-instance>
>>                         </connection-definition>
>>                 </outbound-resourceadapter>
>>         </resourceadapter>
>> </connector>
>>
>> Aaron Mulder wrote:
>> > Can you post your GBean plan and the deployment plan for the database
>> > connection pool you're trying to reference?  (If you just created and
>> > deployed the pool the first time you can go through the whole thing
>> > except hit "Show Plan" rather than "Deploy" to generate the plan.)
>> >
>> > Thanks,
>> >     Aaron
>> >
>>


Re: GBean referencing ManagedConnectionFactoryWrapper

Posted by Aaron Mulder <am...@alumni.princeton.edu>.
Your GBean deployment plan should declare dependencies on the JMS and
DB pool modules.  It's not obvious why the JMS reference is working
without this, but perhaps one of the dependencies you do list has a
dependency on the JMS resource group.  Anyway, for the DB pool, it
would look like this:

     <dependency>
       <groupId>ncode</groupId>
       <artifactId>ncodeLogDB</artifactId>
       <version>1.0</version>
       <type>rar</type>
     </dependency>

Thanks,
      Aaron

On 9/3/06, Oli Kessler <ok...@ncode.ch> wrote:
> Sure, here they are
>
> thanks,
> -ok
>
>
> GBean deployment plan:
>
> <module xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
>  xsi:schemaLocation="http://geronimo.apache.org/xml/ns/deployment-1.1
> /opt/geronimo-1.1/schema/geronimo-module-1.1.xsd"
>  xmlns="http://geronimo.apache.org/xml/ns/deployment-1.1">
>   <environment>
>     <moduleId>
>       <groupId>ncode</groupId>
>       <artifactId>ncode-Test-DBWriter</artifactId>
>       <version>1</version>
>       <type>car</type>
>     </moduleId>
>     <dependencies>
>       <dependency>
>         <groupId>ncode</groupId>
>         <artifactId>LogServer-DBWriter-GBean</artifactId>
>         <version>0.0.1</version>
>         <type>jar</type>
>       </dependency>
>       <dependency>
>         <groupId>commons-lang</groupId>
>         <artifactId>commons-lang</artifactId>
>         <version>2.1</version>
>         <type>jar</type>
>       </dependency>
>     </dependencies>
>     <hidden-classes/>
>     <non-overridable-classes/>
>   </environment>
>   <gbean name="ncode.DBWriter"
>      class="ch.ncode.logquest.db.DBWriterGBean">
>
>     <!--reference the JMS here-->
>     <reference name="managedConnectionFactoryWrapper">
>       <name>ncodeTopicConnectionFactory</name>
>     </reference>
>
>     <!--reference the DB connection -->
>     <reference name="managedDBConnectionFactoryWrapper">
>           <name>ncodeLogDB</name>
>     </reference>
>
>     <!--attribute values-->
>     <attribute name="workerCount">1</attribute>
>   </gbean>
> </module>
>
>
>
> Database deployment plan:
>
> <?xml version="1.0" encoding="UTF-8"?>
> <connector xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
>         xsi:schemaLocation="http://geronimo.apache.org/xml/ns/j2ee/connector-1.1
> /opt/geronimo-1.1/schema/geronimo-connector-1.1.xsd"
>         xmlns="http://geronimo.apache.org/xml/ns/j2ee/connector-1.1">
>         <dep:environment
> xmlns:dep="http://geronimo.apache.org/xml/ns/deployment-1.1">
>                 <dep:moduleId>
>                         <dep:groupId>ncode</dep:groupId>
>                         <dep:artifactId>ncodeLogDB</dep:artifactId>
>                         <dep:version>1.0</dep:version>
>                         <dep:type>rar</dep:type>
>                 </dep:moduleId>
>                 <dep:dependencies>
>                         <dep:dependency>
>                                 <dep:groupId>postgresql</dep:groupId>
> <dep:artifactId>postgresql-8.0</dep:artifactId>
>                                 <dep:version>314.jdbc3</dep:version>
>                                 <dep:type>jar</dep:type>
>                         </dep:dependency>
>                 </dep:dependencies>
>         </dep:environment>
>         <resourceadapter>
>                 <resourceadapter-instance>
>                         <resourceadapter-name>ncodeLogDB</resourceadapter-name>
>                         <workmanager xmlns="http://geronimo.apache.org/xml/ns/naming-1.1">
>                                 <gbean-link>DefaultWorkManager</gbean-link>
>                         </workmanager>
>                 </resourceadapter-instance>
>                 <outbound-resourceadapter>
>                         <connection-definition>
>
> <connectionfactory-interface>javax.sql.DataSource</connectionfactory-interface>
>                                 <connectiondefinition-instance>
>                                         <name>ncodeLogDB</name>
>                                         <config-property-setting name="Password">aaa</config-property-setting>
>                                         <config-property-setting
> name="Driver">org.postgresql.Driver</config-property-setting>
>                                         <config-property-setting
> name="UserName">logtest</config-property-setting>
>                                         <config-property-setting
> name="ConnectionURL">jdbc:postgresql://dbserv:5432/logtest</config-property-setting>
>                                         <connectionmanager>
>                                                 <local-transaction />
>                                                 <single-pool>
>                                                         <max-size>10</max-size>
>                                                         <min-size>0</min-size>
>                                                         <match-one />
>                                                 </single-pool>
>                                         </connectionmanager>
>                                 </connectiondefinition-instance>
>                         </connection-definition>
>                 </outbound-resourceadapter>
>         </resourceadapter>
> </connector>
>
> Aaron Mulder wrote:
> > Can you post your GBean plan and the deployment plan for the database
> > connection pool you're trying to reference?  (If you just created and
> > deployed the pool the first time you can go through the whole thing
> > except hit "Show Plan" rather than "Deploy" to generate the plan.)
> >
> > Thanks,
> >     Aaron
> >
>

Re: GBean referencing ManagedConnectionFactoryWrapper

Posted by Oli Kessler <ok...@ncode.ch>.
Sure, here they are

thanks,
-ok


GBean deployment plan:

<module xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
 xsi:schemaLocation="http://geronimo.apache.org/xml/ns/deployment-1.1
/opt/geronimo-1.1/schema/geronimo-module-1.1.xsd"
 xmlns="http://geronimo.apache.org/xml/ns/deployment-1.1">
  <environment>
    <moduleId>
      <groupId>ncode</groupId>
      <artifactId>ncode-Test-DBWriter</artifactId>
      <version>1</version>
      <type>car</type>
    </moduleId>
    <dependencies>
      <dependency>
        <groupId>ncode</groupId>
        <artifactId>LogServer-DBWriter-GBean</artifactId>
        <version>0.0.1</version>
        <type>jar</type>
      </dependency>
      <dependency>
        <groupId>commons-lang</groupId>
        <artifactId>commons-lang</artifactId>
        <version>2.1</version>
        <type>jar</type>
      </dependency>
    </dependencies>
    <hidden-classes/>
    <non-overridable-classes/>
  </environment>
  <gbean name="ncode.DBWriter"
     class="ch.ncode.logquest.db.DBWriterGBean">

    <!--reference the JMS here-->
    <reference name="managedConnectionFactoryWrapper">
      <name>ncodeTopicConnectionFactory</name>
    </reference>

    <!--reference the DB connection -->
    <reference name="managedDBConnectionFactoryWrapper">
          <name>ncodeLogDB</name>
    </reference>

    <!--attribute values-->
    <attribute name="workerCount">1</attribute>
  </gbean>
</module>



Database deployment plan:

<?xml version="1.0" encoding="UTF-8"?>
<connector xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
	xsi:schemaLocation="http://geronimo.apache.org/xml/ns/j2ee/connector-1.1
/opt/geronimo-1.1/schema/geronimo-connector-1.1.xsd"
	xmlns="http://geronimo.apache.org/xml/ns/j2ee/connector-1.1">
	<dep:environment
xmlns:dep="http://geronimo.apache.org/xml/ns/deployment-1.1">
		<dep:moduleId>
			<dep:groupId>ncode</dep:groupId>
			<dep:artifactId>ncodeLogDB</dep:artifactId>
			<dep:version>1.0</dep:version>
			<dep:type>rar</dep:type>
		</dep:moduleId>
		<dep:dependencies>
			<dep:dependency>
				<dep:groupId>postgresql</dep:groupId>			
<dep:artifactId>postgresql-8.0</dep:artifactId>
				<dep:version>314.jdbc3</dep:version>
				<dep:type>jar</dep:type>
			</dep:dependency>
		</dep:dependencies>
	</dep:environment>
	<resourceadapter>
		<resourceadapter-instance>
			<resourceadapter-name>ncodeLogDB</resourceadapter-name>
			<workmanager xmlns="http://geronimo.apache.org/xml/ns/naming-1.1">
				<gbean-link>DefaultWorkManager</gbean-link>
			</workmanager>
		</resourceadapter-instance>
		<outbound-resourceadapter>
			<connection-definition>
			
<connectionfactory-interface>javax.sql.DataSource</connectionfactory-interface>
				<connectiondefinition-instance>
					<name>ncodeLogDB</name>
					<config-property-setting name="Password">aaa</config-property-setting>
					<config-property-setting
name="Driver">org.postgresql.Driver</config-property-setting>
					<config-property-setting
name="UserName">logtest</config-property-setting>
					<config-property-setting
name="ConnectionURL">jdbc:postgresql://dbserv:5432/logtest</config-property-setting>
					<connectionmanager>
						<local-transaction />
						<single-pool>
							<max-size>10</max-size>
							<min-size>0</min-size>
							<match-one />
						</single-pool>
					</connectionmanager>
				</connectiondefinition-instance>
			</connection-definition>
		</outbound-resourceadapter>
	</resourceadapter>
</connector>

Aaron Mulder wrote:
> Can you post your GBean plan and the deployment plan for the database
> connection pool you're trying to reference?  (If you just created and
> deployed the pool the first time you can go through the whole thing
> except hit "Show Plan" rather than "Deploy" to generate the plan.)
> 
> Thanks,
>     Aaron
> 

Re: GBean referencing ManagedConnectionFactoryWrapper

Posted by Aaron Mulder <am...@alumni.princeton.edu>.
Can you post your GBean plan and the deployment plan for the database
connection pool you're trying to reference?  (If you just created and
deployed the pool the first time you can go through the whole thing
except hit "Show Plan" rather than "Deploy" to generate the plan.)

Thanks,
     Aaron

On 9/1/06, Oli Kessler <ok...@ncode.ch> wrote:
> Hi,
>
> We are trying to reference a JMS resource as well as a database pool
> from our custom gbean. They are both declared as references in the
> GBEAN_INFO:
>
> infoFactory.addReference("managedConnectionFactoryWrapper",
>    ManagedConnectionFactoryWrapper.class,
>    NameFactory.JCA_MANAGED_CONNECTION_FACTORY);
> infoFactory.addReference("managedDBConnectionFactoryWrapper",
>    ManagedConnectionFactoryWrapper.class,
>    NameFactory.JCA_MANAGED_CONNECTION_FACTORY);
>
>
> The deployment plan includes
>
> ..
> <!--reference the JMS here-->
> <reference name="managedConnectionFactoryWrapper">
>    <name>myTopicConnectionFactory</name>
> </reference>
>
> <!--reference the DB connection -->
> <reference name="managedDBConnectionFactoryWrapper">
>   <name>myDBConnection</name>
> </reference>
> ..
>
> The name "myTopicConnectionFactory" ist listed in the console as a
> server-wide Connection Factory, while "myDBConnection" is the name of a
> server-wide Database Pool.
>
> When deploying, the JMS reference is resolved and attached, while the
> database reference fails with:  Unable to resolve reference
> "managedDBConnectionFactoryWrapper"
>
> Is a DB pool not accessible with a ManagedConnectionFactoryWrapper?
> I tried using  groupId and artifactId as well but no success.
>
> Cheers
> -ok
>