I was loading the datasource using Spring <jee:jndi-lookup id="websecurDataSource" jndi-name="foo/bar" />
In order for it to work it must be <jee:jndi-lookup id="websecurDataSource" jndi-name="java:comp/env/foo/bar" /> Also the Realm definition was not correct. The name of the JAAS class should be in a jaas.conf file, not in the Realm definition. Hope that helps someone else running into similar issues. Thanks "whartung" for the help. ~Justin -----Original Message----- From: Justin Rosenberg [mailto:rosenbe...@crlcorp.com] Sent: Wednesday, January 23, 2013 7:06 PM To: users@tomcat.apache.org Subject: JAAS Module Tomcat 7 (Bundling and JNDI Datasource access) I'm running into issues accessing a JNDI datasource in a JAAS module. Can I bundle a JAAS module in my war file? When I try to do this by defining the Realm in the context.xml of the web application I get a java.lang.ClassNotFoundException. The documentation specifies I must put the module in the lib directory. Can someone confirm this? When I deploy all the JAAS module and all required dependencies in a directory listed under "common.loader", I run into the following two issue. The JAAS module cannot seem to load the JNDI datasource "javax.naming.NameNotFoundException: Name [foo/bar] is not bound in this Context. Unable to find [foo]." Is there a way to expose a JNDI datasource to a JAAS module? Tomcat Version: 7.0.34 Datasource is defined in conf/server.xml as: <GlobalNamingResources> <Resource auth="Container" name="foo/bar" type="javax.sql.DataSource" driverClassName="oracle.jdbc.OracleDriver" url="jdbc:oracle:thin:@..." username="user" password="password" /> </GlobalNamingResources> The datasource is exposed in conf/context.xml as: <ResourceLink name="foo/bar" global="foo/bar" type="javax.sql.DataSource"/> The JAAS module is defined at either the server.xml or context.xml of the web application as: <Realm className="com.example.JAASModule" appName="auth-login" userClassNames="com.example.SimplePrincipal" roleClassNames="com.example.SimplePrincipal" /> If defined in the server.xml the server fails to start. If it's in the application context.xml it fails when the application tries to load. Thank you, Justin CONFIDENTIALITY NOTICE: The information in this message, and any attachment, is intended for the sole use of the individual and entity to whom it is addressed. This information may be privileged, confidential, and protected from disclosure. If you are not the intended recipient you are hereby notified that you have received this communication in error and that any review, disclosure, dissemination, distribution or copying of it, or its contents, is strictly prohibited. If you think that you have received this message in error please notify the sender and destroy all copies of this communication and any attachments. Thank you. CONFIDENTIALITY NOTICE: The information in this message, and any attachment, is intended for the sole use of the individual and entity to whom it is addressed. This information may be privileged, confidential, and protected from disclosure. If you are not the intended recipient you are hereby notified that you have received this communication in error and that any review, disclosure, dissemination, distribution or copying of it, or its contents, is strictly prohibited. If you think that you have received this message in error please notify the sender and destroy all copies of this communication and any attachments. Thank you. --------------------------------------------------------------------- To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org