-
1. Re: look Database not effect (Urgent). Please!
jaikiran Feb 7, 2007 11:31 PM (in response to changemylife)But, on the other machine, I lookup:
You mean, you have deployed the datasource on one machine and looking it up from another(remote) machine? -
2. Re: look Database not effect (Urgent). Please!
changemylife Feb 8, 2007 8:49 PM (in response to changemylife)Hi all !
Yes! And it's wrong (I read some documents today). The main problem is inside my jboss.xml, all things not effect (and DatabaseServerLoginModule not effect).
JBoss server and mySql installed on the same machine (ex: hostname is "violon"), on the other machine (ex: hostname is "abc"). And on the "abc", I write the client app to transfer username and password to server. (I deployed my bean on "violon").
Please guide to me !
Thanks. -
3. Re: look Database not effect (Urgent). Please!
changemylife Feb 9, 2007 2:23 AM (in response to changemylife)Hello world !
Today, I try all things again but I also failure.
When I install JBoss server, I selected mysql and DataSource name is: DefaultDS, and I created "mydatabase" that include Users and Roles. My code on the client have contents:
-----
LoginContext lc = new LoginContext("userTest", new MyCallbackHandler());
lc.login();
.....
props.put("java.naming.provider.url","jnp://violon:1099");
InitialContext ctx = new InitialContext(props);
Operates obj = (Operates)ctx.lookup("OperatesBean/remote");
...... and here, I do two methods that correlative each role
-----
But after I enter username and passwd, on the server don't check informations of the specify person that I entered (username and passwd). This is mean, the DatabaseServerLoginModule that I declare inside file "login-config.xml" not effect. And when, any informations that I enter can call two methods ! I am sure that JBoss server bound DataSource beacause when I run Server, I saw the fragment message:
-----
11:15:39,632 INFO [WrapperDataSourceService] Bound ConnectionManager 'jboss.jca:service=DataSourceBinding,name=DefaultDS' to JNDI name 'java:DefaultDS '
-----
My auth.config on the client has contents:
-----
userTest {
org.jboss.security.ClientLoginModule required;
};
-----
My ejb-jar.xml has contents:
-----
<enterprise-beans>
<ejb-name>Operates</ejb-name>
<resource-ref>
<res-ref-name>DefaultDS</res-ref-name>
<res-type>javax.sql.DataSource</res-type>
<res-auth>Container</res-auth>
</resource-ref>
</enterprise-beans>
.....here, I declared roles and permissions
-----
My jboss.xml has:
-----
<security-domain>DB-Domain</security-domain>
<enterprise-beans>
<ejb-name>Operates</ejb-name>
<resource-ref>
<res-ref-name>DefaultDS</res-ref-name>
<jndi-name>java:/DefaultDS</jndi-name>
</resource-ref>
</enterprise-beans>
-----
And the login-config.xml:
-----
<application-policy name="DB-Domain">
<login-module code="org.jboss.security.auth.spi.DatabaseServerLoginModule" flag="required">
<module-option name="dsJndiName">java:/DefaultDS</module-option>
<module-option name="principalsQuery">
select passwd from Users where username=?</module-option>
<module-option name="rolesQuery">
select Role, 'Roles' from Roles where username=?</module-option>
</login-module>
</application-policy>
-----
I don't know that why server not recognize all things that I declare inside jboss.xml and login-config.xml ? -
4. Re: look Database not effect (Urgent). Please!
peterj Feb 9, 2007 10:31 AM (in response to changemylife)In jboss-web.xml, the security domain entry should read:
<security-domain>java:/jaas/DB-Domian</security-domain>
By the way, your posts would be easier to read if code was offset using the [ code ] tags. -
5. Re: look Database not effect (Urgent). Please!
changemylife Feb 9, 2007 9:47 PM (in response to changemylife)Hi!
Previous, I tested the UsersRolesLoginModule inside the jboss.xml. I also<security-domain>java:/jaas/DB-Domian</security-domain>
but not effect. Then, I try usedDB-Domain
, all things ok.
Now, I also by your way is<security-domain>java:/jaas/DB-Domian</security-domain>
and<security-domain>DB-Domain</security-domain>
but not effect !
I don't use web server. I write a simple bean and deploy it on the "Violon"(hostname) machine. And write the client on the "abc" machine. I am using Eclipse to edit my project. When I use Eclipse to packing my bean to .jar file. Have two cases:
1. File ejb-jar.xml inside META-INF, two files "jboss.xml" and "login-config.xml" outside META-INF. Any informations (username and passwd) that I enter can able call any method on the my bean.
2. Three file: "ejb-jar.xml", "jboss.xml" and "login.config.xml" inside META-INF, I received some messages:Exception in thread "main" javax.ejb.EJBAccessException: Authentication failure
.....Caused by: javax.security.auth.login.LoginException: Missing users.properties file.
....
althought I entered username and passwd correct with my database (Users and Roles tables).
have any ideals ? Thanks.