We have to deploy two instances of same application (.ear files) running in a single jboss server (so that we can use virtual hosting later). We are using jboss 4.0.3 sp1.
Our application has:
. Local EJBs
. Struts accessing the EJBs
. JSPs
using Database authentication.
Each application has its own database, data sources and unique jndi names configured to be accessed properly by the respective application war. Each application is deployed using its own context root. (
http://localhost:8080/first and
http://localhost:8080/second). If we deploy application "first" only, it works fine (using say, first.ear). If we deploy application "second" (using say, second.ear) only, it works fine. If we deploy both, then "first" only works. We get a "No username found in principals" exception for second.
We stopped jboss server and renamed "first.ear" to "xyz.ear". Now when we restarted jboss, now "second.ear" works fine. and we get the "no username found in principals" error for the xyz.ear.
We googled and identified that the client login module of Jboss caches user credentials and use it on subsequent invokations of EJB. And both of our deployments use the client login module.
Code snippet from login.conf for one application is below:
-- login-conf.xml start here..
<application-policy name="first">
<authentication>
<login-module code="org.jboss.security.ClientLoginModule" flag="required" />
<login-module code="org.jboss.security.auth.spi.DatabaseServerLoginModule" flag="required">
<module-option name="dsJndiName">
java:/firstDS
</module-option>
<module-option name="principalsQuery">
SELECT iu.hash FROM users iu WHERE IsActive=1 and iu.EmailID=?
</module-option>
<module-option name="rolesQuery">
<!-- query trimmed here.. assume it returns a valid set of roles -->
SELECT baa.Roles,'Roles' FROM OurRoles baa
WHERE baa.IsActive=1 and baa.EmailID=?
</module-option>
</login-module>
</authentication>
</application-policy>
-- login-conf.xml ends here..
Configuration code snippet for the other application will be similar to the one above with changes in dsName and policy name.
Is it like client-login is hard-coded in jboss and only one instance of application (first-come-first-served logic) applied ?
Can someone let us know if there are any pointers for us to proceed ?
Thanks in advance