I'm having problems getting this to work in practice. I deployed
a connector for PostgreSQL with the configId "PostgresDatabase" and name
"PostgresDatasource". If I look in the DebugConsole, I see:
#
J2EEApplication=null,J2EEServer=geronimo,j2eeType=ResourceAdapterModule,name=PostgresDatabase
[running]
# J2EEServer=geronimo,j2eeType=ConnectionManager,name=PostgresDatasource
[running]
#
J2EEServer=geronimo,j2eeType=JCAManagedConnectionFactory,name=PostgresDatasource
[running]
#
J2EEServer=geronimo,JCAResource=null,j2eeType=JCAConnectionFactory,name=PostgresDatasource
[running]
However, at runtime, I get:
javax.management.InstanceNotFoundException: MBeanServer cannot find MBean
with ObjectName
geronimo.server:J2EEServer=geronimo,j2eeType=JCAAdminObject,name=PostgresDatasource
In other words, the ObjectNames don't match. Perhaps this is due
to me trying to use a resource-env-ref? I'll try the resource-ref.
Aaron
On Sat, 2 Oct 2004, Jeremy Boynes wrote:
> Aaron Mulder wrote:
> > I'm trying to set up a data source and access it from a web app.
> > I guess I need to somehow deploy a tranql service? If there's an example
> > somewhere it would be helpful. I think if I get the database in the
> > global JNDI space then I can use a resource-env-ref in web.xml and a
> > naming:resource-env-ref in geronimo-jetty.xml and that should put it in my
> > web app's local JNDI space.
> >
> > Thanks,
> > Aaron
>
> There is an example system-database-plan.xml that defines a DataSource
> for accessing the embedded Derby database. This uses the generic JDBC
> connector from TranQL and can be adapted to other vendor's drivers as
> needed. You use the same RAR file, just different deployment plans.
>
> To access from a web app you need a <resource-ref> not a
> <resource-env-ref> - the Jetty plan looks like:
>
> <web-app
> xmlns="http://geronimo.apache.org/xml/ns/web/jetty"
> configId="my_wars_config_id">
>
> <context-priority-classloader>false</context-priority-classloader>
> <resource-ref>
> <ref-name>jdbc/myDB</ref-name>
> <target-name>myDatasource</target-name>
> </resource-ref>
> </web-app>
>
> where <target-name> is the name of your datasource.
>
> If you don't want an additional RAR config, I think you can actually
> embed its plan inside your geronimo-jetty.xml definition. Basically copy
> the <resource> element from the RAR plan and put it at the end of your
> web-app element (I know this works for app-clients).
>
> --
> Jeremy
>