Hello All<div><br></div><div>I have created a custom site "XXX" as  /sites/XXX</div><div><br></div><div>My Code Follows:-</div><div><br></div><div><ul><li>Site and Group Creation.</li></ul><div>                       final String resourceName = "/sites/"+ "XXX";</div>
<div><span class="Apple-tab-span" style="white-space:pre">                      </span>if (!cmsObject.existsResource(resourceName)) {</div><div><span class="Apple-tab-span" style="white-space:pre">                               </span>cmsObject.createResource(resourceName, CmsResourceTypeFolder.RESOURCE_TYPE_ID);</div>
<div><span class="Apple-tab-span" style="white-space:pre">                              </span>cmsObject.unlockResource(resourceName);</div><div><span class="Apple-tab-span" style="white-space:pre">                              </span>cmsObject.publishResource(resourceName);</div>
<div><span class="Apple-tab-span" style="white-space:pre">                      </span>}</div><div><span class="Apple-tab-span" style="white-space:pre">                    </span>CmsOrgUnitManager orgUnitManager = OpenCms.getOrgUnitManager();</div><div><span class="Apple-tab-span" style="white-space:pre">                      </span>CmsOrganizationalUnit readiOneOU = orgUnitManager.createOrganizationalUnit(cmsObject, "XXX"+"OU/", "XXX"+" Organization Unit", 0, "/sites/"+"XXX"+"/");</div>
<div><span class="Apple-tab-span" style="white-space:pre">                      </span>cmsObject.createGroup(readiOneOU.getName()+"XXX"+"Group", "XXX"+" Group", CmsGroup.FLAG_ENABLED, "XXX"+"OU/"+"Users");</div>
<div><br></div><div><ul><li>    Create User.<br></li></ul><div>                        String siteName = "XXX";</div><div><span class="Apple-tab-span" style="white-space:pre">                     </span>String OUName =  siteName  +"OU/";</div>
<div><span class="Apple-tab-span" style="white-space:pre">                      </span>Map propMap =  new HashMap();</div><div><span class="Apple-tab-span" style="white-space:pre">                        </span>propMap.put("USERPREFERENCES_workplace-startupsettingssite", "sites/"+"siteName +"/");</div>
<div><span class="Apple-tab-span" style="white-space:pre">                      </span>cmsObject.createUser(OUName+"abc", "abc", description, propMap);</div><div><span class="Apple-tab-span" style="white-space:pre">                 </span>cmsObject.addUserToGroup(OUName+"abc", OUName+ siteName+"Group");                         // Creates Successfully.</div>
<div><br></div><div><ul><li>     Login User<br></li></ul><div>                        String OUName = "XXX"+"OU/";</div><div><span class="Apple-tab-span" style="white-space:pre">                        </span>cmsObject.loginUser(OUName+"abc", "abc");</div>
<div><span class="Apple-tab-span" style="white-space:pre">                      </span>cmsObject.getRequestContext().setCurrentProject(cmsObject.readProject("Offline"));</div><div><br></div><div>                    This Gives Exception :- User Doesn't Exists. There is an entry in user table with name "abc"</div>
<div><br></div><div>Please help..its urgent</div><div><br></div><div>Regards</div><div><br></div><div>Govind R .</div></div><div><span class="Apple-tab-span" style="white-space:pre">                  </span></div><div><span class="Apple-tab-span" style="white-space:pre">                     </span></div>
</div><div><br></div><div><br></div></div>