How to add a new user to a realm programmatically?
I'm running my web application on Sun Java Application Server 8. Using Admin Console or asadmin doesn't solve the problem. I need to add a new user to a realm called "file" and I need to do that using method. I named this method "addNewUser(user,password)" and it looks as follows:
publicvoid addNewUser(String user, String password){
final AppserverConnectionSource src =
new AppserverConnectionSource("localhost", 8686,"admin","adminadmin",null);
try{
final DomainRoot domainRoot = src.getDomainRoot();
System.out.println(domainRoot.getDomainConfig().getApplicationRoot());
}catch (IOException ex){
ex.printStackTrace();
}
//...and what then?
}
The method above doesn't throw any exceptions so far. Whether I'm on right or wrong way, I got stuck. There must be simple way to solve the problem by writing few lines of code. Thanks in advance for any solutions.

