You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by LERBSCHER Jean-Pierre <je...@cofiroute.fr> on 2005/02/15 18:43:12 UTC

RE : RE : RE : RE : RE : Tomcat configuration

Check your configuration with
http://jakarta.apache.org/tomcat/tomcat-5.0-doc/realm-howto.html#JDBCRealm
(database configuration, driver, url access, user et password access, and
log files).
Try to setup Memory realm.
Try to validate database url connection with simple java class.

import java.sql.*; 
import <your driver>; 

class JDBCVersion 
{ 
	public static void main (String args []) 
	throws SQLException 
	{ 
		// Load the JDBC driver 
		DriverManager.registerDriver(new
com.microsoft.jdbc.sqlserver.SQLServerDriver()); 

// Something like this (probably)
		Connection conn =
DriverManager.getConnection("jdbc:microsoft:sqlserver://LDSERVER:1433;databa
sename=ldbugtracker", "abc","abc"); 
		
		// Create Oracle DatabaseMetaData object 
		DatabaseMetaData meta = conn.getMetaData (); 
		
		// get driver info: 
		System.out.println("JDBC driver version is " +
meta.getDriverVersion()); 
	} 
}


I assume that you have deployed your context configuration in :
- META-INF/context.xml directory of your WAR file
- $CATALINA_HOME/conf/[enginename]/[hostname]/ directory


-----Message d'origine-----
De : Curtis Nelson [mailto:Nelson@larsondavis.com] 
Envoyé : mardi 15 février 2005 18:14
À : tomcat-user@jakarta.apache.org
Objet : Re: RE : RE : RE : RE : Tomcat configuration

According to the tomcat docs, the preferred method of describing a context
realm is to place it in it's own xml file.
Here's what I have:

<!-- <Context docBase="${catalina.home}/server/webapps/manager"
         privileged="true" antiResourceLocking="false"
antiJARLocking="false"> -->

<Context reloadable="true" path="/ldsecure"
docbase="${catalina.home}/server/webapps/ldsecure">
	<Realm  className="org.apache.catalina.realm.JDBCRealm"
	
driverName="com.microsoft.jdbc.sqlserver.SQLServerDriver"
	
connectionURL="jdbc:microsoft:sqlserver://LDSERVER:1433;databasename=ldbugtr
acker;selectmethod=cursor"
		connectionName="abc" connectionPassword="abc"
					userTable="LDUsers"
userNameCol="username" userCredCol="password"
			userRoleTable="LDUserRoles" roleNameCol="role"
			debug="99"/>
</Context>


If I place this <context> statement in the server.xml file, under the
described host, I get the same problem.

Curtis



>>> jean-pierre.lerbscher@cofiroute.fr 02/15/05 10:09AM >>>
There is no realm describe into it!
Have you declared your realm in your META-INF/context.xml directory of your
WAR file?
Could you send us your context.xml file?

-----Message d'origine-----
De : Curtis Nelson [mailto:Nelson@larsondavis.com] 
Envoyé : mardi 15 février 2005 18:03
À : tomcat-user@jakarta.apache.org 
Objet : Re: RE : RE : RE : Tomcat configuration

With pleasure.  

<Server port="8005" shutdown="SHUTDOWN">
  <Listener className="org.apache.catalina.mbeans.ServerLifecycleListener"
/>
  <Listener
className="org.apache.catalina.mbeans.GlobalResourcesLifecycleListener" />

  <GlobalNamingResources>
    <Environment name="simpleValue" type="java.lang.Integer" value="30"/>

    <Resource name="UserDatabase" auth="Container"
              type="org.apache.catalina.UserDatabase"
       description="User database that can be updated and saved"
           factory="org.apache.catalina.users.MemoryUserDatabaseFactory"
          pathname="conf/tomcat-users.xml" />

  </GlobalNamingResources>


  <Service name="Catalina">
    <Connector port="8080" maxThreads="150" minSpareThreads="25"
maxSpareThreads="75"
               enableLookups="false" redirectPort="8443" acceptCount="100"
               connectionTimeout="20000" disableUploadTimeout="true" />
    <Connector port="8009" enableLookups="false" redirectPort="8443"
protocol="AJP/1.3" />
         
    <!-- Define the top level container in our container hierarchy -->
    <Engine name="Catalina" defaultHost="localhost">

      <Host name="localhost" appBase="webapps" unpackWARs="true" 
						autoDeploy="true"
xmlValidation="false" xmlNamespaceAware="false">
     </Host>

    </Engine>

  </Service>

</Server>



Thanks for you help.


>>> jean-pierre.lerbscher@cofiroute.fr 02/15/05 09:51AM >>>
JAASRealm is not a default!
Could you send us your server.xml?

-----Message d'origine-----
De : Curtis Nelson [mailto:Nelson@larsondavis.com] 
Envoyé : mardi 15 février 2005 17:43
À : tomcat-user@jakarta.apache.org 
Objet : Re: RE : RE : Tomcat configuration

How can I configure Tomcat to not use JAASRealm?  Like I said earlier, if my
JDBCRealm is associated with the <engine> or <host> element of server.xml,
the login forms work.  It's only when I move it into it's own .xml file or
add it as part of the <context> element that I run into problems.  Does
doing that automatically require JAASRealm?  

Thanks

>>> jean-pierre.lerbscher@cofiroute.fr 02/15/05 09:39AM >>>
If I look at this log, it seems that you are using JAAS Realm !
Feb 14, 2005 4:20:39 PM org.apache.catalina.realm.JAASRealm authenticate
SEVERE: Unexpected error
java.lang.SecurityException: Unable to locate a login configuration

-----Message d'origine-----
De : Curtis Nelson [mailto:Nelson@larsondavis.com] 
Envoyé : mardi 15 février 2005 17:15
À : tomcat-user@jakarta.apache.org 
Objet : Re: RE : Tomcat configuration

Thanks for the reply.

I'm not using (to the best of my knowledge) JAASRealm.  I just want to use
JdbcRealm, but define it at the <context> level.

Curtis


>>> jean-pierre.lerbscher@cofiroute.fr 02/15/05 09:08AM >>>
Hi,
Do you use JdbcRealm or JaasRealm ?
If you use JAASRealm you have to setup your jaas config file (for example
using java.security.auth.login.config system property. This file specifies
application by application your login module.
In your case, it seems that you have to declare Realm in your application
context.

-----Message d'origine-----
De : Curtis Nelson [mailto:Nelson@larsondavis.com] 
Envoyé : mardi 15 février 2005 16:41
À : tomcat-user@jakarta.apache.org 
Objet : Tomcat configuration

If I want to host several different web apps in Tomcat, each having it's own
user database & using FORM authentication, how would I configure Tomcat?  I
tried putting the jdbcRealm in the /engine/hostname/nnn.xml file, yet when I
try to log into one of my pages I get the error:

Feb 14, 2005 4:20:39 PM org.apache.catalina.realm.JAASRealm authenticate
SEVERE: Unexpected error
java.lang.SecurityException: Unable to locate a login configuration

Can anyone please help me with this?  I've spent about a week on it already.


Please note:  If I put the JdbcRealm in the <engine> or <host> element of
server.xml, everything works fine - except then I can't have a 1-to-1
mapping between webapp and login database.

Thanks,

Curtis



---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org 
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org 

---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org 
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org 



---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org 
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org 

---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org 
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org 



---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org 
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org 

---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org 
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org 


---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org 
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org 

---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org 
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org 


---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org

---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org