updating user with LDAPS protocol

thumbnail
Vitor Manuel Lopes, modified 7 Years ago. New Member Posts: 17 Join Date: 5/10/13 Recent Posts

Hi Guys

 

Im trying to add and update users on liferay and sync with LDAP... Problem is whe i create user it works fine. But when i'm trying to update user i have this error.

11:19:11,873 DEBUG [http-nio-8080-exec-3][DefaultPortalLDAP:525] No LDAP server configuration available for LDAP server 30232 and company 20116<br> 11:19:11,875 DEBUG [http-nio-8080-exec-3][DefaultPortalLDAP:144] {java.naming.provider.url=ldaps://ldap.polarising.com:636, java.naming.factory.initial=com.sun.jndi.ldap.LdapCtxFactory, com.sun.jndi.ldap.connect.timeout=500, com.sun.jndi.ldap.connect.pool=true, java.naming.security.principal=uid=liferay-admin,ou=applications,ou=users,dc=polarising,dc=com, java.naming.security.credentials=********, java.naming.referral=follow, com.sun.jndi.ldap.read.timeout=15000}<br> 11:19:11,875 WARN &nbsp;[http-nio-8080-exec-3][DefaultPortalLDAP:156] Unable to bind to the LDAP server<br> 11:19:11,877 DEBUG [http-nio-8080-exec-3][DefaultPortalLDAP:160] javax.naming.CommunicationException: ldap.polarising.com:636 [Root exception is java.lang.ClassNotFoundException: javax.net.ssl.SSLSocketFactory cannot be found by com.polarising.intranet.portlets.employees_3.4.0]<br> javax.naming.CommunicationException: ldap.polarising.com:636 [Root exception is java.lang.ClassNotFoundException: javax.net.ssl.SSLSocketFactory cannot be found by com.polarising.intranet.portlets.employees_3.4.0]

 

Is something regarding SSLSocketFactory.

 

to add user i'm using:

ServiceContext serviceContext = ServiceContextFactory.getInstance(User.class.getName(), request);

&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;Long companyId = CompanyThreadLocal.getCompanyId();<br> &nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;UserGroup userGroup = UserGroupLocalServiceUtil.getUserGroup(companyId, "Pre-Employee");<br> &nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;<br> &nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;long[] userGroupIds = new long[1];<br> &nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;userGroupIds[0] = userGroup.getUserGroupId();

&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;User user = UserLocalServiceUtil.addUser(adminUser.getUserId(), themeDisplay.getCompanyId(), true,<br> &nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;null, null, false, ParamUtil.getString(request, "username"), ParamUtil.getString(request, "email"), 0,<br> &nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;"", themeDisplay.getLocale(), ParamUtil.getString(request, "firstname"),<br> &nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;ParamUtil.getString(request, "middlename"), ParamUtil.getString(request, "lastname"), 0, 0, true, 0, 1,<br> &nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;1970, "", null, null, null, userGroupIds, true, serviceContext);

&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;return user;

and to update email an usergroup (this one give error)    

update email: 

User user = UserLocalServiceUtil.getUser(Long.valueOf(userId));

&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;if (!user.getEmailAddress().equals(ParamUtil.getString(request, "email"))) {<br> &nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;user.setEmailAddress(ParamUtil.getString(request, "email"));<br> &nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;user.setModifiedDate(new Date());<br> &nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;UserLocalServiceUtil.updateUser(user);<br> &nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;}

update usergroup:

UserGroupLocalServiceUtil.deleteUserUserGroup(employee.getInternalUserId(), preemployeeUserGroup.getUserGroupId());<br> UserGroupLocalServiceUtil.addUserUserGroup(employee.getInternalUserId(), colaboradorUserGroup.getUserGroupId());

 

Thanks for help

 


        

thumbnail
Minhchau Dang, modified 7 Years ago. Liferay Master Posts: 598 Join Date: 10/22/07 Recent Posts
Vitor Manuel Lopes:
[Root exception is java.lang.ClassNotFoundException: javax.net.ssl.SSLSocketFactory cannot be found by com.polarising.intranet.portlets.employees_3.4.0]

Liferay ran into the same problem in its My Account portlet, as reported in LPS-69168. You can fix it by adding Import-Package: javax.net.ssl,* to the bnd.bnd for your module. An example of the change is inside the commit for LPS-69168.

thumbnail
Vitor Manuel Lopes, modified 7 Years ago. New Member Posts: 17 Join Date: 5/10/13 Recent Posts

I will try it... thanks