Problem in configure JDBC datasource for OSUser
"Phylina Ying Jing Zhang" <[email protected]> Wed, 10 Mar 2004 15:39:05 +1100
| Newsgroups | gmane.comp.java.open-symphony.devel |
|---|---|
| Message-ID | <[email protected]> |
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