Hello list!
I wrote a message about this problem yesterday, but did not receive
any reply. I can accept the fact that nobody faced this problem, but may
be somebody have done similar task before, and can share your experience
with me and others?
Lets describe the problem. I want to restrict access to some area at
my site using FORM authentication. I've added Realm definition in
config.xml:
<Realm className="org.apache.catalina.realm.DataSourceRealm"
dataSourceName="java:/comp/env/jdbc/esljsp"
debug="5"
userTable="T_USERS"
userNameCol="NAME"
userCredCol="PASSWORD"
userRolesTable="T_USERROLES"
roleNameCol="ROLENAME" />
...and security constraints in web.xml:
<security-constraint>
<web-resource-collection>
<web-resource-name>Administrator's interface</web-resource-name>
<url-pattern>/adm/*</url-pattern>
<http-method>GET</http-method>
<http-method>POST</http-method>
</web-resource-collection>
<auth-constraint>
<role-name>Administrator</role-name>
</auth-constraint>
</security-constraint>
<login-config>
<auth-method>FORM</auth-method>
<realm-name>Administrator's interface</realm-name>
<form-login-config>
<form-login-page>/login.jsp</form-login-page>
<form-error-page>/login_error.jsp</form-error-page>
</form-login-config>
</login-config>
<security-role>
<role-name>Administrator</role-name>
</security-role>
During Tomcat startup process, I see following in logs:
2003-01-16 12:56:19 DataSourceRealm[/esljsp]: Exception performing
authentication
javax.naming.NameNotFoundException: Name java: is not bound in this Context
at org.apache.naming.NamingContext.lookup(NamingContext.java:811)
at org.apache.naming.NamingContext.lookup(NamingContext.java:194)
at org.apache.catalina.realm.DataSourceRealm.open(DataSourceRealm.java:463)
at
org.apache.catalina.realm.DataSourceRealm.start(DataSourceRealm.java:582)
at
org.apache.catalina.core.StandardContext.start(StandardContext.java:3543)
at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1188)
at org.apache.catalina.core.StandardHost.start(StandardHost.java:738)
at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1188)
at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:347)
at org.apache.catalina.core.StandardService.start(StandardService.java:497)
at org.apache.catalina.core.StandardServer.start(StandardServer.java:2189)
at org.apache.catalina.startup.Catalina.start(Catalina.java:512)
at org.apache.catalina.startup.Catalina.execute(Catalina.java:400)
at org.apache.catalina.startup.Catalina.process(Catalina.java:180)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:324)
at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:203)
And these lines appears in logs _before_ configuring DataSource,
which completes fine. I've been told that this may be due to different
classloaders (Catalina level and WebApp level), but I'm not sure,
because it's strange -- to be unable to find java: name...
I can (or at least try to) use JDBCRealm to make it work, but as
soon as I have DataSource properly configured, I want to use it. I
tested it in a servlet, and it works.
--
Veniamin Fichin <[EMAIL PROTECTED]>
Programmer at http://www.rbcsoft.ru/
--
To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>