Hi Glen,

I compared your configuration with the standard configuration
mentioned 
http://tomcat.apache.org/tomcat-5.5-doc/jndi-datasource-examples-howto.html
and found a few differences.

Please see my replies to your post below:

On 4/20/07, Glen Vermeylen <[EMAIL PROTECTED]> wrote:
Hello everybody,

I'm trying to move a global jdbc resource out of server.xml so it is
application specific. Following is the server.xml (which works fine)
.................................

What I did was remove the the <GlobalNamingResources> and <Realm > elements
from server.xml and put them inside
$CATALINA_HOME/conf/Catalina/localhost/esandwich.xml (don't mind the weird
name :) ), but I keep getting the error
"javax.naming.NameNotFoundException: Name jdbc is not bound in this Context"

esandwich.xml:
<Context docBase="c:/workspace/esandwich/WebContent/" reloadable="true"
crosscontext="true">

crossContext attribute's case needs to be crossContext , but it is
specified as crosscontext.

One question, though a little irrelevant is -- do you really need
crossContext="true" ? Just because it is specified in the sample on
the JDBC Datasource HowTo page, doesn't mean you would need it - this
is just a thought. If you don't need it, please set it to false or
remove the attribute.

    <Resource name="jdbc/sandwiches" auth="Container" driverClassName="
com.mysql.jdbc.Driver"
        password="tomcat" type="javax.sql.DataSource"
        url="jdbc:mysql://192.168.16.39:3306/sandwiches?autoReconnect=true"
        username="tomcat" />


    <Realm className="org.apache.catalina.realm.DataSourceRealm"
        dataSourceName="jdbc/sandwiches" debug="99" roleNameCol="role"
        userCredCol="password" userNameCol="user" userRoleTable="userroles"
        userTable="users" />
</Context>

I believe the problem lies witht he <Resource> element

No the problem is in web.xml , I don't see any definition for:

<resource-ref>

please see under "3. web.xml configuration" at
http://tomcat.apache.org/tomcat-5.5-doc/jndi-datasource-examples-howto.html
for the details on web.xml entries.

because if only move
the <realm> element to the esandwich.xml and leave the
<GlobalNamingResources><Resource.....></...> in server.xml everything still
works. We've been searching for a few hours now and can't find the solution.
Any help would be highly appreciated.

web.xml:
<?xml version="1.0" encoding="UTF-8"?>
<web-app id="WebApp_ID" version="2.4"
    xmlns="http://java.sun.com/xml/ns/j2ee";
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
    xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee
http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd";>
    <display-name>esandwich</display-name>
    <listener>
        <listener-class>
            org.springframework.web.context.ContextLoaderListener
        </listener-class>
    </listener>
    <servlet>
        <servlet-name>dispatcher</servlet-name>
        <servlet-class>
            org.springframework.web.servlet.DispatcherServlet
        </servlet-class>
    </servlet>
    <servlet-mapping>
        <servlet-name>dispatcher</servlet-name>
        <url-pattern>/app/*</url-pattern>
    </servlet-mapping>
    <welcome-file-list>
        <welcome-file>index.jsp</welcome-file>
    </welcome-file-list>
    <login-config>
        <auth-method>FORM</auth-method>
        <form-login-config>
            <form-login-page>/login.html</form-login-page>
            <form-error-page>/loginError.html</form-error-page>
        </form-login-config>
    </login-config>

    <security-constraint>
        <web-resource-collection>
            <web-resource-name>default</web-resource-name>
            <url-pattern>/app/*</url-pattern>
            <http-method>POST</http-method>
            <http-method>GET</http-method>
        </web-resource-collection>
        <auth-constraint>
            <description>everyone can log in</description>
            <role-name>*</role-name>
        </auth-constraint>
    </security-constraint>

    <security-role>
        <description>The Only Secure Role</description>
        <role-name>admin</role-name>
    </security-role>

</web-app>


Many thanks in advance,
Glen.


-Regards
Rashmi

---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to