Getting "Name jdbc is not bound in this Context" when using cargo-maven2-plugin to define a datasource for Tomcat5x container

View: New views
6 Messages — Rating Filter:   Alert me  

Getting "Name jdbc is not bound in this Context" when using cargo-maven2-plugin to define a datasource for Tomcat5x container

by Paul Spencer-3 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

I have configured the cargo plugin v0.3.1 to created an datasource
inside a Tomcat 5.5.23 standalone container, but I am getting the
following error message:
    javax.naming.NameNotFoundException: Name jdbc is not bound in this
Context

Any ideas why I am getting this error message?

Is their a way to see the JNDI configuration added by Cargo and the plugin?

I have include parts of the configuration for review.

***
* From the cargo configuration in POM.XML
***
    <cargo.datasource.datasource>
      cargo.datasource.url=jdbc:edbc://testsvr.foo.com:II7/termite_dev|
      cargo.datasource.driver=ca.edbc.jdbc.EdbcDriver|
      cargo.datasource.username=username|
      cargo.datasource.password=password|
      cargo.datasource.type=javax.sql.DataSource|
      cargo.datasource.jndi=jdbc/Termite
    </cargo.datasource.datasource>

***
* From context.xml
***
<?xml version='1.0' encoding='utf-8'?>
<Context reloadable="true">
   <Realm className="org.apache.catalina.realm.DataSourceRealm"
     dataSourceName="jdbc/Termite" debug="99" roleNameCol="role"
     userCredCol="password" userNameCol="username"
     userRoleTable="web_user_roles" userTable="web_users" />
   <ResourceLink name="datasource.name" global="jdbc/Termite"
     type="javax.sql.DataSource" />
</Context>

Paul Spencer

---------------------------------------------------------------------
To unsubscribe from this list please visit:

    http://xircles.codehaus.org/manage_email


Re: Getting "Name jdbc is not bound in this Context" when using cargo-maven2-plugin to define a datasource for Tomcat5x container

by Paul Spencer-3 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

More info:
conf/server.xml is not populated with the data source. If I change
<containerId> from tomcat5x to tomcat4x, I see the datasource
configuration written into server.xml

This looks like a bug in the Tomcat5x container, is it?

Paul Spencer


Paul Spencer wrote:

> I have configured the cargo plugin v0.3.1 to created an datasource
> inside a Tomcat 5.5.23 standalone container, but I am getting the
> following error message:
>    javax.naming.NameNotFoundException: Name jdbc is not bound in this
> Context
>
> Any ideas why I am getting this error message?
>
> Is their a way to see the JNDI configuration added by Cargo and the plugin?
>
> I have include parts of the configuration for review.
>
> ***
> * From the cargo configuration in POM.XML
> ***
>    <cargo.datasource.datasource>
>      cargo.datasource.url=jdbc:edbc://testsvr.foo.com:II7/termite_dev|
>      cargo.datasource.driver=ca.edbc.jdbc.EdbcDriver|
>      cargo.datasource.username=username|
>      cargo.datasource.password=password|
>      cargo.datasource.type=javax.sql.DataSource|
>      cargo.datasource.jndi=jdbc/Termite
>    </cargo.datasource.datasource>
>
> ***
> * From context.xml
> ***
> <?xml version='1.0' encoding='utf-8'?>
> <Context reloadable="true">
>   <Realm className="org.apache.catalina.realm.DataSourceRealm"
>     dataSourceName="jdbc/Termite" debug="99" roleNameCol="role"
>     userCredCol="password" userNameCol="username"
>     userRoleTable="web_user_roles" userTable="web_users" />
>   <ResourceLink name="datasource.name" global="jdbc/Termite"
>     type="javax.sql.DataSource" />
> </Context>
>
> Paul Spencer
>
> ---------------------------------------------------------------------
> To unsubscribe from this list please visit:
>
>    http://xircles.codehaus.org/manage_email
>
>



---------------------------------------------------------------------
To unsubscribe from this list please visit:

    http://xircles.codehaus.org/manage_email


Re: Getting "Name jdbc is not bound in this Context" when using cargo-maven2-plugin to define a datasource for Tomcat5x container

by Wendy Smoak-3 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On 6/1/07, Paul Spencer <paulsp@...> wrote:
> I have configured the cargo plugin v0.3.1 to created an datasource
> inside a Tomcat 5.5.23 standalone container, but I am getting the
> following error message:
>     javax.naming.NameNotFoundException: Name jdbc is not bound in this
> Context

I ran into the same thing for Maven Archiva, where I need *three* data
sources.  I didn't even try configuring that.

Any reason you're using an old release?  I think 0.9 is the latest version.

--
Wendy

---------------------------------------------------------------------
To unsubscribe from this list please visit:

    http://xircles.codehaus.org/manage_email


Re: Getting "Name jdbc is not bound in this Context" when using cargo-maven2-plugin to define a datasource for Tomcat5x container

by Paul Spencer-3 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Wendy,
The plugin is 0.3.1.  The plugin uses Cargo version 0.9.

How did you resolve the issue with Archiva and three datasources?

Paul Spencer


Wendy Smoak wrote:

> On 6/1/07, Paul Spencer <paulsp@...> wrote:
>> I have configured the cargo plugin v0.3.1 to created an datasource
>> inside a Tomcat 5.5.23 standalone container, but I am getting the
>> following error message:
>>     javax.naming.NameNotFoundException: Name jdbc is not bound in this
>> Context
>
> I ran into the same thing for Maven Archiva, where I need *three* data
> sources.  I didn't even try configuring that.
>
> Any reason you're using an old release?  I think 0.9 is the latest version.
>


---------------------------------------------------------------------
To unsubscribe from this list please visit:

    http://xircles.codehaus.org/manage_email


Re: Getting "Name jdbc is not bound in this Context" when using cargo-maven2-plugin to define a datasource for Tomcat5x container

by Wendy Smoak-3 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On 6/2/07, Paul Spencer <paulsp@...> wrote:

> The plugin is 0.3.1.  The plugin uses Cargo version 0.9.

Thanks, I forgot that the plugin is versioned independently.

> How did you resolve the issue with Archiva and three datasources?

In the email you replied to, I wrote, "I didn't even try to configure
that."  A trip through the archives indicates that there's limited
support for data sources, and the docs seem to imply that there can be
only one.

My guess is that it's going to require some additional work in Cargo,
which I'd like to do but am having trouble finding time for at the
moment.  We do need to make it easy to test Archiva on Tomcat, though,
so maybe it will float up the priority list.

--
Wendy

---------------------------------------------------------------------
To unsubscribe from this list please visit:

    http://xircles.codehaus.org/manage_email


Re: Getting "Name jdbc is not bound in this Context" when using cargo-maven2-plugin to define a datasource for Tomcat5x container

by Paul Spencer-3 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Wendy,
I have gotten it working using the configuration described below.  This
might also work for Archiva

1) Create context.xml and copy it into META-INF using the webResource
configuration of the war plugin for this.
           <plugin>
             <groupId>org.apache.maven.plugins</groupId>
             <artifactId>maven-war-plugin</artifactId>
             <configuration>
               <webResources>
                 <resource>
                   <directory>src/test/resources</directory>
                   <targetPath>META-INF</targetPath>
                   <includes>
                     <include>context.xml</include>
                   </includes>
                 </resource>
               </webResources>
             </configuration>
           </plugin>

2) Place the datasource definition(s) and the realm definition in
context.xml.  Note: The realm definition is limited to the MemoryRealm
because resouces can not be configured in server.xml :(  Also their is
no datasource configuration in the cargo plugin.

    <?xml version='1.0' encoding='utf-8'?>
    <Context reloadable="true">
      <Realm className="org.apache.catalina.realm.MemoryRealm" />
      <Resource name='datasource.name' auth='Container'
        type='javax.sql.DataSource' username='foo'
        password='bar driverClassName='ca.edbc.jdbc.EdbcDriver'
        url='jdbc:edbc://testsvr.foo.com/db_dev' />
    </Context>

3) Add the user configuration to the cargo plugin.  This configuration
may need to mimic any user and role configuration stored the the database.



***
* Complete Plugin configuration
***
           <plugin>
             <groupId>org.codehaus.cargo</groupId>
             <artifactId>cargo-maven2-plugin</artifactId>
             <version>0.3.1</version>
             <configuration>
               <container>
                 <containerId>tomcat5x</containerId>
                 <home>${cargo.tomcat5x.home}</home>
                 <log>${project.build.directory}/tomcat5x.log</log>
                 <output>${project.build.directory}/tomcat5x.out</output>
                 <logLevel>debug</logLevel>
               </container>
               <configuration>
                 <deployables>
                   <deployable>
                     <properties>
                       <context>myApp</context>
                     </properties>
                   </deployable>
                 </deployables>
                 <home>${project.build.directory}/tomcat5x</home>
                 <properties>
                   <cargo.logging>high</cargo.logging>
                   <cargo.servlet.users>
                     manager:manager:manager,employee|
                     employee:employee:employee
                   </cargo.servlet.users>
                   <cargo.servlet.port>8080</cargo.servlet.port>
                 </properties>
               </configuration>
               <wait>false</wait>
             </configuration>
             <executions>
               <execution>
                 <id>start-container</id>
                 <phase>pre-integration-test</phase>
                 <goals>
                   <goal>start</goal>
                 </goals>
               </execution>
               <execution>
                 <id>stop-container</id>
                 <phase>post-integration-test</phase>
                 <goals>
                   <goal>stop</goal>
                 </goals>
               </execution>
             </executions>
           </plugin>


I see <Resouurce> configuration in server.xml as an enhancement for
Cargo and the Maven plugin for the following reasons:
1) This will allow the configuration of a Realm that is backed by a
database.
2) Allow the application's context.xml use <ResourceLink>
3) Minimize the need, if not remove the need, for maintaining production
and testing version of context.xml

Paul Spencer



Wendy Smoak wrote:

> On 6/2/07, Paul Spencer <paulsp@...> wrote:
>
>> The plugin is 0.3.1.  The plugin uses Cargo version 0.9.
>
> Thanks, I forgot that the plugin is versioned independently.
>
>> How did you resolve the issue with Archiva and three datasources?
>
> In the email you replied to, I wrote, "I didn't even try to configure
> that."  A trip through the archives indicates that there's limited
> support for data sources, and the docs seem to imply that there can be
> only one.
>
> My guess is that it's going to require some additional work in Cargo,
> which I'd like to do but am having trouble finding time for at the
> moment.  We do need to make it easy to test Archiva on Tomcat, though,
> so maybe it will float up the priority list.
>


---------------------------------------------------------------------
To unsubscribe from this list please visit:

    http://xircles.codehaus.org/manage_email