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.