You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Maximilian Krickl <ma...@gmx.de> on 2010/05/08 18:41:44 UTC
Configured JDBCRealm, but is not used
Hello,
I installed Tomcat 6.0.26 and PostgreSQL 8.3 on my PC (win) and a
server (ubuntu). On both's machines the databases are similar.
I use Eclipse 3.5 Java EE (Dynamic Web Project). My project uses
"Form based authentication".
The META-INF folder contains a context.xml:
---
<Context docBase="game" path="/game" debug="0" reloadable="true">
<Realm className="org.apache.catalina.realm.JDBCRealm"
connectionName="user" connectionPassword="password"
connectionURL="jdbc:postgresql:game"
driverName="org.postgresql.Driver"
roleNameCol="role" userCredCol="password" userNameCol="loginname"
userRoleTable="player" userTable="player" />
</Context>
---
Everything works fine in Eclipse on the PC. When I export it as a WAR
and copy it the the server, putting it to the "webapps" folder I do
get the login screen, but trying to log in fails.
---
May 7 10:54:02 h1643987 jsvc.exec[5191]: 07.05.2010 10:54:02
org.apache.catalina.realm.JAASRealm authenticate SEVERE: Unexpected
error java.lang.SecurityException: Anmeldekonfiguration kann nicht
gefunden werden.
at com.sun.security.auth.login.ConfigFile.<init>(ConfigFile.java:93)
at sun.reflect.GeneratedConstructorAccessor5.newInstance(Unknown
Source)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance
(DelegatingConstructorAccessorImpl.java:27)
at java.lang.reflect.Constructor.newInstance(Constructor.java:513)
at java.lang.Class.newInstance0(Class.java:355)
at java.lang.Class.newInstance(Class.java:308)
at javax.security.auth.login.Configuration$3.run
(Configuration.java:246)
at java.security.AccessController.doPrivileged(Native Method)
at javax.security.auth.login.Configuration.getConfiguration
(Configuration.java:241)
at javax.security.auth.login.LoginContext$1.run(LoginContext.java:
237)
at java.security.AccessController.doPrivileged(Native Method)
at javax.security.auth.login.Log
May 7 10:54:02 h1643987 jsvc.exec
[5191]: .security.auth.login.LoginContext.<init>(LoginContext.java:403)
at org.apache.catalina.realm.JAASRealm.authenticate(JAASRealm.java:
345)
at org.apache.catalina.authenticator.FormAuthenticator.authenticate
(FormAuthenticator.java:258)
at org.apache.catalina.authenticator.AuthenticatorBase.invoke
(AuthenticatorBase.java:417)
at org.apache.catalina.core.StandardHostValve.invoke
(StandardHostValve.java:128)
at org.apache.catalina.valves.ErrorReportValve.invoke
(ErrorReportValve.java:102)
at org.apache.catalina.core.StandardEngineValve.invoke
(StandardEngineValve.java:109)
at org.apache.catalina.connector.CoyoteAdapter.service
(CoyoteAdapter.java:286)
at org.apache.coyote.http11.Http11Processor.process
(Http11Processor.java:845)
at org.apache.coyote.http11.Http11Protocol
$Http11ConnectionHandler.process(Http11Protocol.java:583)
at org.apache.tomcat.util.net.JIoEndpoint$Worker.run
(JIoEndpoint.java:447)
at java.lang.Thread.run(Thread.java:619) Caused by: java.io.IOExc
May 7 10:54:02 h1643987 jsvc.exec[5191]: en werden.
at com.sun.security.auth.login.ConfigFile.init(ConfigFile.java:250)
at com.sun.security.auth.login.ConfigFile.<init>(ConfigFile.java:91)
... 23 more
07.05.2010 10:54:02 org.apache.catalina.realm.JAASRealm authenticate
SEVERE: Unexpected error java.lang.SecurityException:
Anmeldekonfiguration kann nicht gefunden werden.
at com.sun.security.auth.login.ConfigFile.<init>(ConfigFile.java:93)
at sun.reflect.GeneratedConstructorAccessor5.newInstance(Unknown
Source)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance
(DelegatingConstructorAccessorImpl.java:27)
at java.lang.reflect.Constructor.newInstance(Constructor.java:513)
at java.lang.Class.newInstance0(Class.java:355)
at java.lang.Class.newInstance(Class.java:308)
at javax.security.auth.login.Configuration$3.run
(Configuration.java:246)
at java.security.AccessController.doPrivileged(Native Method)
at javax.security.auth.login.Configuration.getConfiguration
(Configuration.java:241)
at
May 7 10:54:02 h1643987 jsvc.exec[5191]: inContext.java:237)
at java.security.AccessController.doPrivileged(Native Method)
at javax.security.auth.login.LoginContext.init(LoginContext.java:234)
at javax.security.auth.login.LoginContext.<init>(LoginContext.java:
403)
at org.apache.catalina.realm.JAASRealm.authenticate(JAASRealm.java:
345)
at org.apache.catalina.authenticator.FormAuthenticator.authenticate
(FormAuthenticator.java:258)
at org.apache.catalina.authenticator.AuthenticatorBase.invoke
(AuthenticatorBase.java:417)
at org.apache.catalina.core.StandardHostValve.invoke
(StandardHostValve.java:128)
at org.apache.catalina.valves.ErrorReportValve.invoke
(ErrorReportValve.java:102)
at org.apache.catalina.core.StandardEngineValve.invoke
(StandardEngineValve.java:109)
at org.apache.catalina.connector.CoyoteAdapter.service
(CoyoteAdapter.java:286)
at org.apache.coyote.http11.Http11Processor.process
(Http11Processor.java:845)
at org.apache.coyote.http11.Http11Protocol
$Http11ConnectionHandler.process(Htt
---
Why is the JAASRealm throwing an exception, if I never configured it?
Thanks and regards
- MaxX
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org
Re: Configured JDBCRealm, but is not used
Posted by Pid <pi...@pidster.com>.
On 09/05/2010 12:04, Martin Gainty wrote:
>
> <Context docBase="game" path="/game" debug="0" reloadable="true">
>>
>> The above is wrong. Remove docBase and path, they are illegal in
>> context.xml.
>
> mg>
>
> what do you mean by the term illegal..please be more descriptive in your terminology
If I'd said "... they are bearnaise in context.xml" your question might
have made sense, but I didn't. The meaning is clear, especially when
considered in context*.
p
* you see what I did there?
> docBase
>
> The Document Base (also known as the Context Root) directory for this web application, or the pathname to the web application archive file (if this web application is being executed directly from the WAR file). You may specify an absolute pathname for this directory or WAR file, or a pathname that is relative to the appBase directory of the owning Host.
>
> The value of this field must not be set when the Context is configured using a META-INF/context.xml file as it will be inferred by the automatic deployment process.
>
> if META-INF/context.xml Context element is present then leave it be
>
> the exception is NOT when META-INF/context.xml is present
>
> mg>
>
> mg>
>
> path
>
> The context path of this web application, which is matched against the beginning of each request URI to select the appropriate web application for processing. All of the context paths within a particular Host must be unique. If you specify a context path of an empty string (""), you are defining the default web application for this Host, which will process all requests not assigned to other Contexts.
>
> The value of this field must not be set except when statically defining a Context in server.xml, as it will be inferred from the filenames used for either the .xml context file or the docBase.
>
> ok to set as Context attribute in server.xml
>
> </mg>
>>
>>> <Realm className="org.apache.catalina.realm.JDBCRealm"
>>> connectionName="user" connectionPassword="password"
>>> connectionURL="jdbc:postgresql:game"
>>> driverName="org.postgresql.Driver"
>>> roleNameCol="role" userCredCol="password" userNameCol="loginname"
>>> userRoleTable="player" userTable="player" />
>>
>> Ew. Don't use a JDBCRealm (it's synchronised etc), use a
>> DataSourceRealm with an appropriately configured DataSource.
>
>
>
> <mg>
> use DatasourceRealm for JNDI lookups...its not a hard thing to setup but you will need JNDI provider such as ldap.jar
>
>
>
> DataSourceRealm is an implementation of the Tomcat 6 Realm interface that looks up users in a relational database accessed via a JNDI named JDBC DataSource. There is substantial configuration flexibility that lets you adapt to existing table and column names, as long as your database structure conforms to the following requirements:
>
> http://tomcat.apache.org/tomcat-5.5-doc/realm-howto.html#DataSourceRealm
>
> http://tomcat.apache.org/tomcat-5.5-doc/jndi-datasource-examples-howto.html
>
> </mg>
>
> <mg>
>
> JDBCRealm operates according to the following rules:
>
>
> When a user attempts to access a protected resource for the first time, Tomcat 6 will call the authenticate() method of this Realm. Thus, any changes you have made to the database directly (new users, changed passwords or roles, etc.) will be immediately reflected.
> Once a user has been authenticated, the user (and his or her associated roles) are cached within Tomcat for the duration of the user's login. (For FORM-based authentication, that means until the session times out or is invalidated; for BASIC authentication, that means until the user closes their browser).
> The cached user is not saved and restored across sessions serialisations. Any changes to the database information for an already authenticated user will not be reflected until the next time that user logs on again.
> Administering the information in the users and user roles table is the responsibility of your own applications. Tomcat does not provide any built-in capabilities to maintain users and roles.
> </mg>
>>
>>> </Context>
>>> ---
>>>
>>> Everything works fine in Eclipse on the PC. When I export it as a WAR
>>> and copy it the the server, putting it to the "webapps" folder I do get
>>> the login screen, but trying to log in fails.
>>>
>>> ---
>>> May 7 10:54:02 h1643987 jsvc.exec[5191]: 07.05.2010 10:54:02
>>> org.apache.catalina.realm.JAASRealm authenticate SEVERE: Unexpected
>>> error java.lang.SecurityException: Anmeldekonfiguration kann nicht
>>> gefunden werden.
>>> at com.sun.security.auth.login.ConfigFile.<init>(ConfigFile.java:93)
>>> at sun.reflect.GeneratedConstructorAccessor5.newInstance(Unknown Source)
>>> at
>>> sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
>>>
>>> at java.lang.reflect.Constructor.newInstance(Constructor.java:513)
>>> at java.lang.Class.newInstance0(Class.java:355)
>>> at java.lang.Class.newInstance(Class.java:308)
>>> at javax.security.auth.login.Configuration$3.run(Configuration.java:246)
>>> at java.security.AccessController.doPrivileged(Native Method)
>>> at
>>> javax.security.auth.login.Configuration.getConfiguration(Configuration.java:241)
>>>
>>> at javax.security.auth.login.LoginContext$1.run(LoginContext.java:237)
>>> at java.security.AccessController.doPrivileged(Native Method)
>>> at javax.security.auth.login.Log
>>> May 7 10:54:02 h1643987 jsvc.exec[5191]:
>>> .security.auth.login.LoginContext.<init>(LoginContext.java:403)
>>> at org.apache.catalina.realm.JAASRealm.authenticate(JAASRealm.java:345)
>>> at
>>> org.apache.catalina.authenticator.FormAuthenticator.authenticate(FormAuthenticator.java:258)
>>>
>>> at
>>> org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:417)
>>>
>>> at
>>> org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128)
>>>
>>> at
>>> org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
>>>
>>> at
>>> org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
>>>
>>> at
>>> org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:286)
>>> at
>>> org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:845)
>>> at
>>> org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:583)
>>>
>>> at
>>> org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)
>>> at java.lang.Thread.run(Thread.java:619) Caused by: java.io.IOExc
>>> May 7 10:54:02 h1643987 jsvc.exec[5191]: en werden.
>>> at com.sun.security.auth.login.ConfigFile.init(ConfigFile.java:250)
>>> at com.sun.security.auth.login.ConfigFile.<init>(ConfigFile.java:91)
>>> ... 23 more
>>> 07.05.2010 10:54:02 org.apache.catalina.realm.JAASRealm authenticate
>>> SEVERE: Unexpected error java.lang.SecurityException:
>>> Anmeldekonfiguration kann nicht gefunden werden.
>>> at com.sun.security.auth.login.ConfigFile.<init>(ConfigFile.java:93)
>>> at sun.reflect.GeneratedConstructorAccessor5.newInstance(Unknown Source)
>>> at
>>> sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
>>>
>>> at java.lang.reflect.Constructor.newInstance(Constructor.java:513)
>>> at java.lang.Class.newInstance0(Class.java:355)
>>> at java.lang.Class.newInstance(Class.java:308)
>>> at javax.security.auth.login.Configuration$3.run(Configuration.java:246)
>>> at java.security.AccessController.doPrivileged(Native Method)
>>> at
>>> javax.security.auth.login.Configuration.getConfiguration(Configuration.java:241)
>>>
>>> at
>>> May 7 10:54:02 h1643987 jsvc.exec[5191]: inContext.java:237)
>>> at java.security.AccessController.doPrivileged(Native Method)
>>> at javax.security.auth.login.LoginContext.init(LoginContext.java:234)
>>> at javax.security.auth.login.LoginContext.<init>(LoginContext.java:403)
>>> at org.apache.catalina.realm.JAASRealm.authenticate(JAASRealm.java:345)
>>> at
>>> org.apache.catalina.authenticator.FormAuthenticator.authenticate(FormAuthenticator.java:258)
>>>
>>> at
>>> org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:417)
>>>
>>> at
>>> org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128)
>>>
>>> at
>>> org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
>>>
>>> at
>>> org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
>>>
>>> at
>>> org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:286)
>>> at
>>> org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:845)
>>> at
>>> org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Htt
>>> ---
>>>
>>> Why is the JAASRealm throwing an exception, if I never configured it?
>>
>> Try it with the Security Manager disabled. I'll assume you've installed
>> a repackaged version of Tomcat, rather than a download from
>> http://tomcat.apache.org/
>>
>> Edit the /etc/default/tomcat6 file to disable the Security Manager.
>>
>> If it works then we know where the problem is and can work a solution,
>>
>>
>> p
>>
>>> Thanks and regards
>>> - MaxX
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
>>> For additional commands, e-mail: users-help@tomcat.apache.org
>>>
>>
>>
>
>
> _________________________________________________________________
> The New Busy is not the old busy. Search, chat and e-mail from your inbox.
> http://www.windowslive.com/campaign/thenewbusy?ocid=PID28326::T:WLMTAGL:ON:WL:en-US:WM_HMP:042010_3
RE: Configured JDBCRealm, but is not used
Posted by Martin Gainty <mg...@hotmail.com>.
<Context docBase="game" path="/game" debug="0" reloadable="true">
>
> The above is wrong. Remove docBase and path, they are illegal in
> context.xml.
mg>
what do you mean by the term illegal..please be more descriptive in your terminology
docBase
The Document Base (also known as the Context Root) directory for this web application, or the pathname to the web application archive file (if this web application is being executed directly from the WAR file). You may specify an absolute pathname for this directory or WAR file, or a pathname that is relative to the appBase directory of the owning Host.
The value of this field must not be set when the Context is configured using a META-INF/context.xml file as it will be inferred by the automatic deployment process.
if META-INF/context.xml Context element is present then leave it be
the exception is NOT when META-INF/context.xml is present
mg>
mg>
path
The context path of this web application, which is matched against the beginning of each request URI to select the appropriate web application for processing. All of the context paths within a particular Host must be unique. If you specify a context path of an empty string (""), you are defining the default web application for this Host, which will process all requests not assigned to other Contexts.
The value of this field must not be set except when statically defining a Context in server.xml, as it will be inferred from the filenames used for either the .xml context file or the docBase.
ok to set as Context attribute in server.xml
</mg>
>
> > <Realm className="org.apache.catalina.realm.JDBCRealm"
> > connectionName="user" connectionPassword="password"
> > connectionURL="jdbc:postgresql:game"
> > driverName="org.postgresql.Driver"
> > roleNameCol="role" userCredCol="password" userNameCol="loginname"
> > userRoleTable="player" userTable="player" />
>
> Ew. Don't use a JDBCRealm (it's synchronised etc), use a
> DataSourceRealm with an appropriately configured DataSource.
<mg>
use DatasourceRealm for JNDI lookups...its not a hard thing to setup but you will need JNDI provider such as ldap.jar
DataSourceRealm is an implementation of the Tomcat 6 Realm interface that looks up users in a relational database accessed via a JNDI named JDBC DataSource. There is substantial configuration flexibility that lets you adapt to existing table and column names, as long as your database structure conforms to the following requirements:
http://tomcat.apache.org/tomcat-5.5-doc/realm-howto.html#DataSourceRealm
http://tomcat.apache.org/tomcat-5.5-doc/jndi-datasource-examples-howto.html
</mg>
<mg>
JDBCRealm operates according to the following rules:
When a user attempts to access a protected resource for the first time, Tomcat 6 will call the authenticate() method of this Realm. Thus, any changes you have made to the database directly (new users, changed passwords or roles, etc.) will be immediately reflected.
Once a user has been authenticated, the user (and his or her associated roles) are cached within Tomcat for the duration of the user's login. (For FORM-based authentication, that means until the session times out or is invalidated; for BASIC authentication, that means until the user closes their browser).
The cached user is not saved and restored across sessions serialisations. Any changes to the database information for an already authenticated user will not be reflected until the next time that user logs on again.
Administering the information in the users and user roles table is the responsibility of your own applications. Tomcat does not provide any built-in capabilities to maintain users and roles.
</mg>
>
> > </Context>
> > ---
> >
> > Everything works fine in Eclipse on the PC. When I export it as a WAR
> > and copy it the the server, putting it to the "webapps" folder I do get
> > the login screen, but trying to log in fails.
> >
> > ---
> > May 7 10:54:02 h1643987 jsvc.exec[5191]: 07.05.2010 10:54:02
> > org.apache.catalina.realm.JAASRealm authenticate SEVERE: Unexpected
> > error java.lang.SecurityException: Anmeldekonfiguration kann nicht
> > gefunden werden.
> > at com.sun.security.auth.login.ConfigFile.<init>(ConfigFile.java:93)
> > at sun.reflect.GeneratedConstructorAccessor5.newInstance(Unknown Source)
> > at
> > sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
> >
> > at java.lang.reflect.Constructor.newInstance(Constructor.java:513)
> > at java.lang.Class.newInstance0(Class.java:355)
> > at java.lang.Class.newInstance(Class.java:308)
> > at javax.security.auth.login.Configuration$3.run(Configuration.java:246)
> > at java.security.AccessController.doPrivileged(Native Method)
> > at
> > javax.security.auth.login.Configuration.getConfiguration(Configuration.java:241)
> >
> > at javax.security.auth.login.LoginContext$1.run(LoginContext.java:237)
> > at java.security.AccessController.doPrivileged(Native Method)
> > at javax.security.auth.login.Log
> > May 7 10:54:02 h1643987 jsvc.exec[5191]:
> > .security.auth.login.LoginContext.<init>(LoginContext.java:403)
> > at org.apache.catalina.realm.JAASRealm.authenticate(JAASRealm.java:345)
> > at
> > org.apache.catalina.authenticator.FormAuthenticator.authenticate(FormAuthenticator.java:258)
> >
> > at
> > org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:417)
> >
> > at
> > org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128)
> >
> > at
> > org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
> >
> > at
> > org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
> >
> > at
> > org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:286)
> > at
> > org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:845)
> > at
> > org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:583)
> >
> > at
> > org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)
> > at java.lang.Thread.run(Thread.java:619) Caused by: java.io.IOExc
> > May 7 10:54:02 h1643987 jsvc.exec[5191]: en werden.
> > at com.sun.security.auth.login.ConfigFile.init(ConfigFile.java:250)
> > at com.sun.security.auth.login.ConfigFile.<init>(ConfigFile.java:91)
> > ... 23 more
> > 07.05.2010 10:54:02 org.apache.catalina.realm.JAASRealm authenticate
> > SEVERE: Unexpected error java.lang.SecurityException:
> > Anmeldekonfiguration kann nicht gefunden werden.
> > at com.sun.security.auth.login.ConfigFile.<init>(ConfigFile.java:93)
> > at sun.reflect.GeneratedConstructorAccessor5.newInstance(Unknown Source)
> > at
> > sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
> >
> > at java.lang.reflect.Constructor.newInstance(Constructor.java:513)
> > at java.lang.Class.newInstance0(Class.java:355)
> > at java.lang.Class.newInstance(Class.java:308)
> > at javax.security.auth.login.Configuration$3.run(Configuration.java:246)
> > at java.security.AccessController.doPrivileged(Native Method)
> > at
> > javax.security.auth.login.Configuration.getConfiguration(Configuration.java:241)
> >
> > at
> > May 7 10:54:02 h1643987 jsvc.exec[5191]: inContext.java:237)
> > at java.security.AccessController.doPrivileged(Native Method)
> > at javax.security.auth.login.LoginContext.init(LoginContext.java:234)
> > at javax.security.auth.login.LoginContext.<init>(LoginContext.java:403)
> > at org.apache.catalina.realm.JAASRealm.authenticate(JAASRealm.java:345)
> > at
> > org.apache.catalina.authenticator.FormAuthenticator.authenticate(FormAuthenticator.java:258)
> >
> > at
> > org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:417)
> >
> > at
> > org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128)
> >
> > at
> > org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
> >
> > at
> > org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
> >
> > at
> > org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:286)
> > at
> > org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:845)
> > at
> > org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Htt
> > ---
> >
> > Why is the JAASRealm throwing an exception, if I never configured it?
>
> Try it with the Security Manager disabled. I'll assume you've installed
> a repackaged version of Tomcat, rather than a download from
> http://tomcat.apache.org/
>
> Edit the /etc/default/tomcat6 file to disable the Security Manager.
>
> If it works then we know where the problem is and can work a solution,
>
>
> p
>
> > Thanks and regards
> > - MaxX
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> > For additional commands, e-mail: users-help@tomcat.apache.org
> >
>
>
_________________________________________________________________
The New Busy is not the old busy. Search, chat and e-mail from your inbox.
http://www.windowslive.com/campaign/thenewbusy?ocid=PID28326::T:WLMTAGL:ON:WL:en-US:WM_HMP:042010_3
Re: Configured JDBCRealm, but is not used
Posted by Maximilian Krickl <ma...@gmx.de>.
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
> I'm not positive about this, but I think your <Resource>
> declaration will need to be in server.xml in order to be used for a
> <Realm> (even though the <Realm> is specific to just one
> <Context>). The authentication is done by Tomcat, not the webapp,
> so it's Tomcat that has to have the database declaration available,
> not the webapp.
Well, yes.. that is logic. ;-)
> Likewise, the driver jar for the database needs to be in Tomcat's
> lib directory, not the webapp's. And, the <resource-ref> isn't
> needed, since the <Resource> is not being used by the webapp itself.
>
> - Chuck
Well, yes I do need it, so I moved the <Resource> to the server.xml
AND added
- ---
<ResourceLink auth="Container" name="jdbc/pgsql"
type="javax.sql.DataSource" global="jdbc/pgsql" />
- ---
to the context.xml
And it works :-)
Thanks a lot
MaxX
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (Darwin)
iEYEARECAAYFAkvsZDEACgkQ/6VVXRqA3ifBugCfaIk7+qOMj/Tmo1Urf6BLzvsY
G/AAoNmDOAuunBhKV1TwLkHVXAsTrlby
=g7Tt
-----END PGP SIGNATURE-----
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org
Re: Configured JDBCRealm, but is not used
Posted by Maximilian Krickl <ma...@gmx.de>.
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
> You need to use localDataSource="true" so the Realm looks locally
> for the DataSource.
Great, that is even better (and it also works) :-)
Thanks again.
MaxX
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (Darwin)
iEYEARECAAYFAkvsZgwACgkQ/6VVXRqA3icnogCfQBSrHDd9tiU1GEA9yL/6TQvW
bOEAnAhMB3tjpg7Ck0tKpvi4MCFlnSlW
=otZT
-----END PGP SIGNATURE-----
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org
RE: Configured JDBCRealm, but is not used
Posted by "Caldarale, Charles R" <Ch...@unisys.com>.
> From: Mark Thomas [mailto:markt@apache.org]
> Subject: Re: Configured JDBCRealm, but is not used
>
> No, you can have the resource at the context level.
>
> > The authentication is done by Tomcat, not the webapp, so
> > it's Tomcat that has to have the database declaration
> > available, not the webapp.
>
> You need to use localDataSource="true" so the Realm looks locally for
> the DataSource.
That's the key - thanks for the reminder. I knew something had to be done for a context-specific <Realm>.
- Chuck
THIS COMMUNICATION MAY CONTAIN CONFIDENTIAL AND/OR OTHERWISE PROPRIETARY MATERIAL and is thus for use only by the intended recipient. If you received this in error, please contact the sender and delete the e-mail and its attachments from all computers.
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org
Re: Configured JDBCRealm, but is not used
Posted by Mark Thomas <ma...@apache.org>.
On 13/05/2010 21:29, Caldarale, Charles R wrote:
>> From: Maximilian Krickl [mailto:maxkrickl@gmx.de]
>> Subject: Re: Configured JDBCRealm, but is not used
>>
>> when I try to login via the login form of tomcat I get this:
>> 13.05.2010 21:59:07 org.apache.catalina.realm.DataSourceRealm open
>> SCHWERWIEGEND: Exception performing authentication
>> javax.naming.NameNotFoundException: Name jdbc is not bound in this
>> Context
>
> I'm not positive about this, but I think your<Resource> declaration will need to be in server.xml in order to be used for a<Realm>
No, you can have the resource at the context level.
> The authentication is done by Tomcat, not the webapp, so it's Tomcat
that has to have the database declaration available, not the webapp.
You need to use localDataSource="true" so the Realm looks locally for
the DataSource.
> Likewise, the driver jar for the database needs to be in Tomcat's lib directory, not the webapp's.
I believe this part is correct.
> And, the<resource-ref> isn't needed, since the<Resource> is not being used by the webapp itself.
Correct.
It is a while since I tested this but I am sure it has at least worked
in the past. I don't recall any changes that might have broken it.
Mark
>
> - Chuck
>
>
> THIS COMMUNICATION MAY CONTAIN CONFIDENTIAL AND/OR OTHERWISE PROPRIETARY MATERIAL and is thus for use only by the intended recipient. If you received this in error, please contact the sender and delete the e-mail and its attachments from all computers.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
>
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org
RE: Configured JDBCRealm, but is not used
Posted by "Caldarale, Charles R" <Ch...@unisys.com>.
> From: Maximilian Krickl [mailto:maxkrickl@gmx.de]
> Subject: Re: Configured JDBCRealm, but is not used
>
> when I try to login via the login form of tomcat I get this:
> 13.05.2010 21:59:07 org.apache.catalina.realm.DataSourceRealm open
> SCHWERWIEGEND: Exception performing authentication
> javax.naming.NameNotFoundException: Name jdbc is not bound in this
> Context
I'm not positive about this, but I think your <Resource> declaration will need to be in server.xml in order to be used for a <Realm> (even though the <Realm> is specific to just one <Context>). The authentication is done by Tomcat, not the webapp, so it's Tomcat that has to have the database declaration available, not the webapp. Likewise, the driver jar for the database needs to be in Tomcat's lib directory, not the webapp's. And, the <resource-ref> isn't needed, since the <Resource> is not being used by the webapp itself.
- Chuck
THIS COMMUNICATION MAY CONTAIN CONFIDENTIAL AND/OR OTHERWISE PROPRIETARY MATERIAL and is thus for use only by the intended recipient. If you received this in error, please contact the sender and delete the e-mail and its attachments from all computers.
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org
Re: Configured JDBCRealm, but is not used
Posted by Maximilian Krickl <ma...@gmx.de>.
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Hi everybody,
> Ew. Don't use a JDBCRealm (it's synchronised etc), use a
> DataSourceRealm with an appropriately configured DataSource.
so I changed my META-INF/context.xml to:
- ---
<Context reloadable="true">
<Resource name="jdbc/pgsql" global="jdbc/game" auth="Container"
type="javax.sql.DataSource" driverClassName="org.postgresql.Driver"
url="jdbc:postgresql:game" username="username" password="password"
maxActive="20" maxIdle="10" />
<Realm className="org.apache.catalina.realm.DataSourceRealm"
dataSourceName="jdbc/pgsql"
userTable="player" userNameCol="loginname" userCredCol="password"
userRoleTable="player" roleNameCol="role" />
</Context>
- ---
and added some lines to the WEB-INF/web.xml
- ---
...
<resource-ref>
<res-ref-name>jdbc/pgsql</res-ref-name>
<res-type>javax.sql.DataSource</res-type>
<res-auth>Container</res-auth>
</resource-ref>
...
- ---
Now, when I try to login via the login form of tomcat I get this:
- ---
13.05.2010 21:59:07 org.apache.catalina.realm.DataSourceRealm open
SCHWERWIEGEND: Exception performing authentication
javax.naming.NameNotFoundException: Name jdbc is not bound in this
Context
at org.apache.naming.NamingContext.lookup(NamingContext.java:770)
at org.apache.naming.NamingContext.lookup(NamingContext.java:153)
at org.apache.catalina.realm.DataSourceRealm.open
(DataSourceRealm.java:415)
at org.apache.catalina.realm.DataSourceRealm.authenticate
(DataSourceRealm.java:296)
at org.apache.catalina.authenticator.FormAuthenticator.authenticate
(FormAuthenticator.java:259)
at org.apache.catalina.authenticator.AuthenticatorBase.invoke
(AuthenticatorBase.java:449)
at org.apache.catalina.core.StandardHostValve.invoke
(StandardHostValve.java:127)
at org.apache.catalina.valves.ErrorReportValve.invoke
(ErrorReportValve.java:102)
at org.apache.catalina.core.StandardEngineValve.invoke
(StandardEngineValve.java:109)
at org.apache.catalina.connector.CoyoteAdapter.service
(CoyoteAdapter.java:298)
at org.apache.coyote.http11.Http11Processor.process
(Http11Processor.java:852)
at org.apache.coyote.http11.Http11Protocol
$Http11ConnectionHandler.process(Http11Protocol.java:588)
at org.apache.tomcat.util.net.JIoEndpoint$Worker.run
(JIoEndpoint.java:489)
at java.lang.Thread.run(Unknown Source)
- ---
And this is even before hibernate tries to access the DB.
I asked the tomcat documentation and google, but I think I know too
less of this to get the right answer.
Thanks for helping so far.
Regards
MaxX
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (Darwin)
iEYEARECAAYFAkvsXkUACgkQ/6VVXRqA3iefYwCgu8j1MHRDnBO7NYOwTIj8ZZ4J
Pe0Ani+hgm3JWgn61JJeF2hv3Fck75rT
=OA9Z
-----END PGP SIGNATURE-----
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org
RE: Configured JDBCRealm, but is not used
Posted by "Caldarale, Charles R" <Ch...@unisys.com>.
> From: Pid [mailto:pid@pidster.com]
> Subject: Re: Configured JDBCRealm, but is not used
>
> > <Context docBase="game" path="/game" debug="0" reloadable="true">
>
> The above is wrong. Remove docBase and path, they are illegal in
> context.xml.
Also get rid of the debug attribute - it hasn't been used in years.
- Chuck
THIS COMMUNICATION MAY CONTAIN CONFIDENTIAL AND/OR OTHERWISE PROPRIETARY MATERIAL and is thus for use only by the intended recipient. If you received this in error, please contact the sender and delete the e-mail and its attachments from all computers.
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org
Re: Configured JDBCRealm, but is not used
Posted by Pid <pi...@pidster.com>.
On 08/05/2010 17:41, Maximilian Krickl wrote:
> Hello,
>
> I installed Tomcat 6.0.26 and PostgreSQL 8.3 on my PC (win) and a server
> (ubuntu). On both's machines the databases are similar.
> I use Eclipse 3.5 Java EE (Dynamic Web Project). My project uses "Form
> based authentication".
>
> The META-INF folder contains a context.xml:
>
> ---
> <Context docBase="game" path="/game" debug="0" reloadable="true">
The above is wrong. Remove docBase and path, they are illegal in
context.xml.
> <Realm className="org.apache.catalina.realm.JDBCRealm"
> connectionName="user" connectionPassword="password"
> connectionURL="jdbc:postgresql:game"
> driverName="org.postgresql.Driver"
> roleNameCol="role" userCredCol="password" userNameCol="loginname"
> userRoleTable="player" userTable="player" />
Ew. Don't use a JDBCRealm (it's synchronised etc), use a
DataSourceRealm with an appropriately configured DataSource.
> </Context>
> ---
>
> Everything works fine in Eclipse on the PC. When I export it as a WAR
> and copy it the the server, putting it to the "webapps" folder I do get
> the login screen, but trying to log in fails.
>
> ---
> May 7 10:54:02 h1643987 jsvc.exec[5191]: 07.05.2010 10:54:02
> org.apache.catalina.realm.JAASRealm authenticate SEVERE: Unexpected
> error java.lang.SecurityException: Anmeldekonfiguration kann nicht
> gefunden werden.
> at com.sun.security.auth.login.ConfigFile.<init>(ConfigFile.java:93)
> at sun.reflect.GeneratedConstructorAccessor5.newInstance(Unknown Source)
> at
> sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
>
> at java.lang.reflect.Constructor.newInstance(Constructor.java:513)
> at java.lang.Class.newInstance0(Class.java:355)
> at java.lang.Class.newInstance(Class.java:308)
> at javax.security.auth.login.Configuration$3.run(Configuration.java:246)
> at java.security.AccessController.doPrivileged(Native Method)
> at
> javax.security.auth.login.Configuration.getConfiguration(Configuration.java:241)
>
> at javax.security.auth.login.LoginContext$1.run(LoginContext.java:237)
> at java.security.AccessController.doPrivileged(Native Method)
> at javax.security.auth.login.Log
> May 7 10:54:02 h1643987 jsvc.exec[5191]:
> .security.auth.login.LoginContext.<init>(LoginContext.java:403)
> at org.apache.catalina.realm.JAASRealm.authenticate(JAASRealm.java:345)
> at
> org.apache.catalina.authenticator.FormAuthenticator.authenticate(FormAuthenticator.java:258)
>
> at
> org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:417)
>
> at
> org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128)
>
> at
> org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
>
> at
> org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
>
> at
> org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:286)
> at
> org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:845)
> at
> org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:583)
>
> at
> org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)
> at java.lang.Thread.run(Thread.java:619) Caused by: java.io.IOExc
> May 7 10:54:02 h1643987 jsvc.exec[5191]: en werden.
> at com.sun.security.auth.login.ConfigFile.init(ConfigFile.java:250)
> at com.sun.security.auth.login.ConfigFile.<init>(ConfigFile.java:91)
> ... 23 more
> 07.05.2010 10:54:02 org.apache.catalina.realm.JAASRealm authenticate
> SEVERE: Unexpected error java.lang.SecurityException:
> Anmeldekonfiguration kann nicht gefunden werden.
> at com.sun.security.auth.login.ConfigFile.<init>(ConfigFile.java:93)
> at sun.reflect.GeneratedConstructorAccessor5.newInstance(Unknown Source)
> at
> sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
>
> at java.lang.reflect.Constructor.newInstance(Constructor.java:513)
> at java.lang.Class.newInstance0(Class.java:355)
> at java.lang.Class.newInstance(Class.java:308)
> at javax.security.auth.login.Configuration$3.run(Configuration.java:246)
> at java.security.AccessController.doPrivileged(Native Method)
> at
> javax.security.auth.login.Configuration.getConfiguration(Configuration.java:241)
>
> at
> May 7 10:54:02 h1643987 jsvc.exec[5191]: inContext.java:237)
> at java.security.AccessController.doPrivileged(Native Method)
> at javax.security.auth.login.LoginContext.init(LoginContext.java:234)
> at javax.security.auth.login.LoginContext.<init>(LoginContext.java:403)
> at org.apache.catalina.realm.JAASRealm.authenticate(JAASRealm.java:345)
> at
> org.apache.catalina.authenticator.FormAuthenticator.authenticate(FormAuthenticator.java:258)
>
> at
> org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:417)
>
> at
> org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128)
>
> at
> org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
>
> at
> org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
>
> at
> org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:286)
> at
> org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:845)
> at
> org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Htt
> ---
>
> Why is the JAASRealm throwing an exception, if I never configured it?
Try it with the Security Manager disabled. I'll assume you've installed
a repackaged version of Tomcat, rather than a download from
http://tomcat.apache.org/
Edit the /etc/default/tomcat6 file to disable the Security Manager.
If it works then we know where the problem is and can work a solution,
p
> Thanks and regards
> - MaxX
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
>