Tomcat does not pick up the OSUser authenticator

"Phylina Ying Jing Zhang" <[email protected]> Thu, 11 Mar 2004 15:01:38 +1100
Newsgroups gmane.comp.java.open-symphony.devel
Message-ID <[email protected]>
Hey,

I figured out the previous problem with the datasource. All I needed to do
is to change the datasource in 'osuser.xml' to
'java:comp/env/jdbc/osmanager'.

However, I am still having problems in getting the authentication to work.
Now I can get a list of users and groups fine, but when cant get myself
authenticated. When I try to go to the /test section, it pops up a windows
authentication box with user name and password. I typed in the user name and
password but it didnt work. There is no log, even though I have put debug
codes in every single authenticate methods in catalina.OSUserRealm and
JDBCCredentialsProvider and also in SmartAuthenticator.login().

I think the problem is that tomcat is not picking up the Authenticator.  In
the web.xml, I set the authentication method to be 'BASIC', and in the log
it says:

2004-03-11 12:57:23 ContextConfig[/osmanager]: Configured an authenticator
for method BASIC
2004-03-11 12:57:23 ContextConfig[/osmanager]: Pipline Configuration:
2004-03-11 12:57:23 ContextConfig[/osmanager]:
org.apache.catalina.authenticator.BasicAuthenticator/1.0

So I think I need to tell tomcat somehow to use the SmartAuthenticator
rather than the BasicAuthenticator. I have searched on google and it is said
that i need to change the authentication.properties file in the
catalina.jar. Did you guys configure an easier way for this to work? Just so
that I dont have to fiddle with the standard tomcat stuff?

Your help will be highly appreciated.

Thanks.

Phylina

-----Original Message-----
From: Phylina Ying Jing Zhang [mailto:[email protected]]
Sent: Wednesday, 10 March 2004 3:39 PM
To: [email protected]
Subject: Problem in configure JDBC datasource for OSUser



Hey,

I am trying to use OSUser for the authentication of my web application which
runs on standalone tomcat. I tried to use the example application in tomcat
by ant-build with target 'example' and then copy the
'osuser\tmp\example\manager' directory to my 'Tomcat\webapps' directory and
changed the name to 'osmanager' so that it doesnt conflict with the tomcat
default 'manager' webapp. I also moved all the JAR files under
'osuser\tmp\example' and 'osuser\tmp\example\lib' to 'Tomcat\common\lib'.

I then changed the osuser.xml file to use the JDBC provider. The file now
looks like:

<opensymphony-user>
    <authenticator
class="com.opensymphony.user.authenticator.SmartAuthenticator" />

    <!-- JDBC providers -->
    <provider
class="com.opensymphony.user.provider.jdbc.JDBCAccessProvider">
        <property name="datasource">jdbc/OsmanagerDS</property>
        <property name="user.table">userbase</property>
        <property name="group.table">groupbase</property>
        <property name="membership.table">membershipbase</property>
        <property name="user.name">username</property>
        <property name="user.password">password_hash</property>
        <property name="group.name">groupname</property>
        <property name="membership.userName">user_name</property>
        <property name="membership.groupName">group_name</property>
    </provider>
    <provider
class="com.opensymphony.user.provider.jdbc.JDBCCredentialsProvider">
        <property name="datasource">jdbc/OsmanagerDS</property>
        <property name="user.table">userbase</property>
        <property name="group.table">groupbase</property>
        <property name="membership.table">membershipbase</property>
        <property name="user.name">username</property>
        <property name="user.password">password_hash</property>
        <property name="group.name">groupname</property>
        <property name="membership.userName">user_name</property>
        <property name="membership.groupName">group_name</property>
    </provider>
</opensymphony-user>

I realised that I need to define the datasource, however I dont know where
should I define it. I have tried to put in as another 'Resource' entry in
'Tomcat\conf\server.xml' but it didn't work. I tried to put it in as a
'Resource' entry in
'Tomcat\webapps\osmanager\WEB-INF\classes\osmanager.xml', but it didn't work
either. Also tried to make a 'OsmanagerDS.properties' and put it under
'Tomcat\webapps\osmanager\WEB-INF\classes\config\jdbc' or
'Tomcat\webapps\osmanager\WEB-INF\classes\jdbc' but neither method worked.
And I'm out of ideas now.

The error I got starts with:

[debug] UserProvider class =
com.opensymphony.user.provider.jdbc.JDBCAccessProvider
{datasource=jdbc/OsmanagerDS, membership.userName=user_name,
membership.table=membershipbase, group.table=groupbase, user.table=userbase,
group.name=groupname, membership.groupName=group_name,
user.password=password_hash, user.name=username}
10/03/2004 12:44:14 com.opensymphony.user.provider.jdbc.BaseJDBCProvider
init
SEVERE: Could not look up DataSource using JNDI location: jdbc/OsmanagerDS
javax.naming.NameNotFoundException: Name jdbc is not bound in this Context
        at org.apache.naming.NamingContext.lookup(NamingContext.java:811)
	  ...


BTW, I couldn't run 'ant test' either. Got an error saying:

java.lang.LinkageError: loader constraints violated when linking
org/w3c/dom/Document class
        at
org.apache.crimson.jaxp.DocumentBuilderFactoryImpl.newDocumentBuilder(Docume
ntBuilderFactoryImpl.java:82)
        at
org.apache.tools.ant.taskdefs.optional.junit.XMLJUnitResultFormatter.getDocu
mentBuilder(XMLJUnitResultFormatter.java:93)
        at
org.apache.tools.ant.taskdefs.optional.junit.XMLJUnitResultFormatter.startTe
stSuite(XMLJUnitResultFormatter.java:138)
	  ...

If anyone could give me a hand on solving these problems, it will be greatly
appreciated. And super sorry if they are really stupid and easy
questions...I'm new in this.

Thanks heaps in advance.

Phylina




-------------------------------------------------------
This SF.Net email is sponsored by: IBM Linux Tutorials
Free Linux tutorial presented by Daniel Robbins, President and CEO of
GenToo technologies. Learn everything from fundamentals to system
administration.http://ads.osdn.com/?ad_id=1470&alloc_id=3638&op=click