Foren
Add User with UserLocalService
Greg Dillier, geändert vor 13 Jahren.
Add User with UserLocalService
Junior Member Beiträge: 34 Beitrittsdatum: 01.11.10 Neueste Beiträge
Hello all
I'm new to LR and should add a basic registration portlet.
But addUser won't work:
UserLocalServiceUtil userServ = new UserLocalServiceUtil();
User user1 = userServ.createUser(50000);
user1.setCompanyId(10131);
user1.setFirstName("firstName");
user1.setLastName("lastName");
user1.setEmailAddress("email@"));
userServ.addUser(user1);
The user is created and its values can be displayed. But the addUser method creates errors.
What am I missing here?
A second problem: How I add users with automatically created user-id's?
Regards,
Greg
I'm new to LR and should add a basic registration portlet.
But addUser won't work:
UserLocalServiceUtil userServ = new UserLocalServiceUtil();
User user1 = userServ.createUser(50000);
user1.setCompanyId(10131);
user1.setFirstName("firstName");
user1.setLastName("lastName");
user1.setEmailAddress("email@"));
userServ.addUser(user1);
The user is created and its values can be displayed. But the addUser method creates errors.
What am I missing here?
A second problem: How I add users with automatically created user-id's?
Regards,
Greg
Abdelrahman Mohamed El Ghanam, geändert vor 13 Jahren.
RE: Add User with UserLocalService
Junior Member Beiträge: 41 Beitrittsdatum: 30.09.10 Neueste Beiträge
Hello Greg,
First of all "UserLocalServiceUtil" should be used without the need for instantiating it. just use it as a Static call.
Regarding your Second question, there is a method called "CounterLocalServiceUtil.increment();" which automatically gets you a new Userid for you to use.
Hope this helps.
First of all "UserLocalServiceUtil" should be used without the need for instantiating it. just use it as a Static call.
Regarding your Second question, there is a method called "CounterLocalServiceUtil.increment();" which automatically gets you a new Userid for you to use.
Hope this helps.
Greg Dillier, geändert vor 13 Jahren.
RE: Add User with UserLocalService
Junior Member Beiträge: 34 Beitrittsdatum: 01.11.10 Neueste Beiträge
Hi
The "CounterLocalServiceUtil.increment()" method works fine, thanks a lot.
UserLocalServiceUtil.addUser(user1) still provokes errors:
Regards,
Greg
The "CounterLocalServiceUtil.increment()" method works fine, thanks a lot.
UserLocalServiceUtil.addUser(user1) still provokes errors:
User user1 = UserLocalServiceUtil.createUser(CounterLocalServiceUtil.increment());
user1.setCompanyId(10131);
user1.setFirstName("firstName");
user1.setLastName("lastName");
user1.setEmailAddress("email@"));
UserLocalServiceUtil.addUser(user1);
Regards,
Greg
Abdelrahman Mohamed El Ghanam, geändert vor 13 Jahren.
RE: Add User with UserLocalService
Junior Member Beiträge: 41 Beitrittsdatum: 30.09.10 Neueste Beiträge
What is your error ??
Greg Dillier, geändert vor 13 Jahren.
RE: Add User with UserLocalService
Junior Member Beiträge: 34 Beitrittsdatum: 01.11.10 Neueste Beiträge
javax.portlet.PortletException: org.apache.jasper.JasperException
Caused by: java.sql.BatchUpdateException: Duplicate entry '0' for key 'IX_5ADBE171'
Caused by: org.hibernate.exception.ConstraintViolationException: Could not execute JDBC batch update
Do I need to add more attributes to the User before performing addUser?
Regards,
Greg
Caused by: java.sql.BatchUpdateException: Duplicate entry '0' for key 'IX_5ADBE171'
Caused by: org.hibernate.exception.ConstraintViolationException: Could not execute JDBC batch update
Do I need to add more attributes to the User before performing addUser?
Regards,
Greg
Abdelrahman Mohamed El Ghanam, geändert vor 13 Jahren.
RE: Add User with UserLocalService
Junior Member Beiträge: 41 Beitrittsdatum: 30.09.10 Neueste Beiträge
You already inserted the user you are trying to add. Just check the DB under table "user_"
Greg Dillier, geändert vor 13 Jahren.
RE: Add User with UserLocalService
Junior Member Beiträge: 34 Beitrittsdatum: 01.11.10 Neueste Beiträge
Nothing in the DB neither in the contact_ nor in the user_ tables. I can't get the new users into the DB. Been trying this ...
Greg Dillier, geändert vor 13 Jahren.
RE: Add User with UserLocalService
Junior Member Beiträge: 34 Beitrittsdatum: 01.11.10 Neueste Beiträge
Btw, contacts make it to the database without any problem:
But this still doesn't work:
What is going on here?
Regards,
Greg
Contact contact1 = ContactLocalServiceUtil.createContact(contactId);
contact1.setCompanyId(10131);
contact1.setUserId(userId);
contact1.setFirstName(ParamUtil.getString(renderRequest, "firstName"));
contact1.setLastName(ParamUtil.getString(renderRequest, "lastName"));
ContactLocalServiceUtil.addContact(contact1);
But this still doesn't work:
User user1 = UserLocalServiceUtil.createUser(userId);
user1.setCompanyId(10131);
user1.setFirstName(ParamUtil.getString(renderRequest, "firstName"));
user1.setLastName(ParamUtil.getString(renderRequest, "lastName"));
user1.setEmailAddress(ParamUtil.getString(renderRequest, "email"));
user1.setPassword(ParamUtil.getString(renderRequest, "password2"));
UserLocalServiceUtil.addUser(user1);
What is going on here?
Regards,
Greg
jelmer kuperus, geändert vor 13 Jahren.
RE: Add User with UserLocalService
Liferay Legend Beiträge: 1191 Beitrittsdatum: 10.03.10 Neueste Beiträge
Liferay developers seem to favour the gazillion parameters methods over the ones that accept objects and consequently do not test those, many are broken
You'd probably be better of using this method
For an example*
http://svn.liferay.com/repos/public/portal/tags/6.0.5/portal-impl/src/com/liferay/portlet/enterpriseadmin/action/EditUserAction.java
*Use username guest and an empty password
You'd probably be better of using this method
ThemeDisplay themeDisplay = (ThemeDisplay)actionRequest.getAttribute(WebKeys.THEME_DISPLAY);
ServiceContext serviceContext = ServiceContextFactory.getInstance(User.class.getName(), actionRequest);
UserServiceUtil.addUser(
themeDisplay.getCompanyId(), autoPassword, password1, password2,
autoScreenName, screenName, emailAddress, facebookId, openId,
LocaleUtil.getDefault(), firstName, middleName, lastName, prefixId,
suffixId, male, birthdayMonth, birthdayDay, birthdayYear, jobTitle,
groupIds, organizationIds, roleIds, userGroupIds, sendEmail,
addresses, emailAddresses, phones, websites,
announcementsDeliveries, serviceContext);
For an example*
http://svn.liferay.com/repos/public/portal/tags/6.0.5/portal-impl/src/com/liferay/portlet/enterpriseadmin/action/EditUserAction.java
*Use username guest and an empty password
Abdelrahman Mohamed El Ghanam, geändert vor 13 Jahren.
RE: Add User with UserLocalService
Junior Member Beiträge: 41 Beitrittsdatum: 30.09.10 Neueste Beiträge
Hey jelmer, do you have any idea the tables i need to add the user in (other than the users & contacts tables) for the user to be viewed in the users portlet ?? and did you have a way for logging the user in, because i tried using
but i get an exception :S .... because i dont know where to include my portal-impl.jar & my portal-service.jar .. any idea ??
Thanks in advance ..
LoginUtil.login(servletRequest, servletResponse, liferayUser.getLogin(), liferayUser.getPassword(), rememberMe, authType)
but i get an exception :S .... because i dont know where to include my portal-impl.jar & my portal-service.jar .. any idea ??
Thanks in advance ..
jelmer kuperus, geändert vor 13 Jahren.
RE: Add User with UserLocalService
Liferay Legend Beiträge: 1191 Beitrittsdatum: 10.03.10 Neueste Beiträge
The add user call adds a bunch of objects, you can see what it does here
http://svn.liferay.com/repos/public/portal/tags/6.0.5/portal-impl/src/com/liferay/portal/service/impl/UserLocalServiceImpl.java
It would probably be a bad idea to insert the user's directly into the database without going through the service layer, as you are, I think suggesting. Also keep in mind that Liferay caches database data in memory. So anything you write to the database directly might not show up for a while. You can clear the cache in the control panel
You cannot call LoginUtil because it resides in portal-impl, classes there are internal to liferay and not part of the public API
http://svn.liferay.com/repos/public/portal/tags/6.0.5/portal-impl/src/com/liferay/portal/service/impl/UserLocalServiceImpl.java
It would probably be a bad idea to insert the user's directly into the database without going through the service layer, as you are, I think suggesting. Also keep in mind that Liferay caches database data in memory. So anything you write to the database directly might not show up for a while. You can clear the cache in the control panel
You cannot call LoginUtil because it resides in portal-impl, classes there are internal to liferay and not part of the public API
Abdelrahman Mohamed El Ghanam, geändert vor 13 Jahren.
RE: Add User with UserLocalService
Junior Member Beiträge: 41 Beitrittsdatum: 30.09.10 Neueste Beiträge
Thanks alot, but does that mean that there is no way to use the LoginUtil other that inside a hook ??
jelmer kuperus, geändert vor 13 Jahren.
RE: Add User with UserLocalService
Liferay Legend Beiträge: 1191 Beitrittsdatum: 10.03.10 Neueste Beiträge
Only the ext plugin can access classes from impl, hooks cannot
Abdelrahman Mohamed El Ghanam, geändert vor 13 Jahren.
RE: Add User with UserLocalService
Junior Member Beiträge: 41 Beitrittsdatum: 30.09.10 Neueste Beiträge
then how can i develop a portlet or a hook for the readymade login portlet to add a login mechanism to it, like if i want to add a linked in login (like the facebook login) ?? do u have any idea ??
Thanks Alot ...
Thanks Alot ...
jelmer kuperus, geändert vor 13 Jahren.
RE: Add User with UserLocalService
Liferay Legend Beiträge: 1191 Beitrittsdatum: 10.03.10 Neueste Beiträge
I am not sure I understand what you mean. Can you elaborate ?
Abdelrahman Mohamed El Ghanam, geändert vor 13 Jahren.
RE: Add User with UserLocalService
Junior Member Beiträge: 41 Beitrittsdatum: 30.09.10 Neueste Beiträge
Sorry if i wasnt descriptive enough, i want to use a persons Facebook credentials to allow him to login in the liferay portal (Using Oauth, or something similar). But i need to have access to add new users and Login the users from this custom portlet. So normally i need to have access to the LoginUtil, which is only found in the portal-impl.jar.
So to summarize, is there any way to login a user in a custom made portlet OR a hook in the liferay portal? Or do i have to use the Ext plugin enviroment ?
Because the problem is, if you ever worked with Ext plugins in Liferay 6.0.5, its not really well developed, and has alot of problems in regard to deployment.
I know i talk to much, but i am trying to be as descriptive as possible .
Thanks jelmer, really appreciate it....
So to summarize, is there any way to login a user in a custom made portlet OR a hook in the liferay portal? Or do i have to use the Ext plugin enviroment ?
Because the problem is, if you ever worked with Ext plugins in Liferay 6.0.5, its not really well developed, and has alot of problems in regard to deployment.
I know i talk to much, but i am trying to be as descriptive as possible .
Thanks jelmer, really appreciate it....
Greg Dillier, geändert vor 13 Jahren.
RE: Add User with UserLocalService
Junior Member Beiträge: 34 Beitrittsdatum: 01.11.10 Neueste Beiträgejelmer kuperus:
The add user call adds a bunch of objects, you can see what it does here
http://svn.liferay.com/repos/public/portal/tags/6.0.5/portal-impl/src/com/liferay/portal/service/impl/UserLocalServiceImpl.java
It would probably be a bad idea to insert the user's directly into the database without going through the service layer, as you are, I think suggesting. Also keep in mind that Liferay caches database data in memory. So anything you write to the database directly might not show up for a while. You can clear the cache in the control panel
You cannot call LoginUtil because it resides in portal-impl, classes there are internal to liferay and not part of the public API
Hi Jelmer and Abdelrahman,
thank you. I found another way to add the users: The UserLocalServiceUtil.updateUser() Method works. The code below adds the users to the database:
User user1 = UserLocalServiceUtil.createUser(userId);
user1.setCompanyId(10131);
user1.setContactId(contactId);
user1.setFirstName(ParamUtil.getString(renderRequest, "firstName"));
user1.setLastName(ParamUtil.getString(renderRequest, "lastName"));
user1.setEmailAddress(ParamUtil.getString(renderRequest, "email"));
user1.setPassword(ParamUtil.getString(renderRequest, "password1"));
user1.setScreenName(ParamUtil.getString(renderRequest, "email"));
user1.setCreateDate(date1);
user1.setModifiedDate(date1);
user1.setActive(true);
UserLocalServiceUtil.updateUser(user1);
They still do not show up in the LR control panel.
So is there no easy way to make the new users accepted by the system?
Regards,
Greg
jelmer kuperus, geändert vor 13 Jahren.
RE: Add User with UserLocalService
Liferay Legend Beiträge: 1191 Beitrittsdatum: 10.03.10 Neueste Beiträge
see my first post, using that call will work for sure
Path Finder LifeRay, geändert vor 12 Jahren.
RE: Add User with UserLocalService
Expert Beiträge: 262 Beitrittsdatum: 18.09.09 Neueste Beiträge
Hi Jelmer,
I created an LR6 Spring application, in which i have to create users and want to use LR default signin portlet. I have seen this thread. But it is all based on struts and JSF it seems. Can i have the same for spring also?
Thanks in advance,
Path Finder
I created an LR6 Spring application, in which i have to create users and want to use LR default signin portlet. I have seen this thread. But it is all based on struts and JSF it seems. Can i have the same for spring also?
Thanks in advance,
Path Finder
Danial Habibi, geändert vor 12 Jahren.
RE: Add User with UserLocalService
Regular Member Beiträge: 141 Beitrittsdatum: 01.11.11 Neueste Beiträgejelmer kuperus:
see my first post, using that call will work for sure
Hi There I've Tried The Code u post on first post....but i got error
like this
20:31:40,202 ERROR [PortletServlet:96] javax.portlet.PortletException: java.lang.NullPointerException
javax.portlet.PortletException: java.lang.NullPointerException
at com.liferay.portal.kernel.portlet.LiferayPortlet.callActionMethod(LiferayPortlet.java:156)
at com.liferay.util.bridges.mvc.MVCPortlet.callActionMethod(MVCPortlet.java:227)
at com.liferay.portal.kernel.portlet.LiferayPortlet.processAction(LiferayPortlet.java:69)
at com.liferay.util.bridges.mvc.MVCPortlet.processAction(MVCPortlet.java:199)
at com.liferay.portlet.FilterChainImpl.doFilter(FilterChainImpl.java:70)
at com.liferay.portal.kernel.portlet.PortletFilterUtil.doFilter(PortletFilterUtil.java:48)
at com.liferay.portal.kernel.servlet.PortletServlet.service(PortletServlet.java:92)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:646)
at org.apache.catalina.core.ApplicationDispatcher.doInclude(ApplicationDispatcher.java:551)
at org.apache.catalina.core.ApplicationDispatcher.include(ApplicationDispatcher.java:488)
at com.liferay.portlet.InvokerPortletImpl.invoke(InvokerPortletImpl.java:638)
at com.liferay.portlet.InvokerPortletImpl.invokeAction(InvokerPortletImpl.java:687)
at com.liferay.portlet.InvokerPortletImpl.processAction(InvokerPortletImpl.java:360)
at com.liferay.portal.action.LayoutAction.processPortletRequest(LayoutAction.java:784)
at com.liferay.portal.action.LayoutAction.processLayout(LayoutAction.java:582)
at com.liferay.portal.action.LayoutAction.execute(LayoutAction.java:232)
at org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java:431)
at org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:236)
at com.liferay.portal.struts.PortalRequestProcessor.process(PortalRequestProcessor.java:153)
at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1196)
at org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:432)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:637)
at com.liferay.portal.servlet.MainServlet.callParentService(MainServlet.java:508)
at com.liferay.portal.servlet.MainServlet.service(MainServlet.java:485)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at com.liferay.portal.kernel.servlet.BaseFilter.processFilter(BaseFilter.java:196)
at com.liferay.portal.kernel.servlet.BaseFilter.doFilter(BaseFilter.java:126)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at com.liferay.portal.kernel.servlet.BaseFilter.processFilter(BaseFilter.java:196)
at com.liferay.portal.kernel.servlet.BaseFilter.doFilter(BaseFilter.java:126)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at com.liferay.portal.kernel.servlet.BaseFilter.processFilter(BaseFilter.java:196)
at com.liferay.portal.servlet.filters.strip.StripFilter.processFilter(StripFilter.java:309)
at com.liferay.portal.kernel.servlet.BaseFilter.doFilter(BaseFilter.java:123)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at com.liferay.portal.kernel.servlet.BaseFilter.processFilter(BaseFilter.java:196)
at com.liferay.portal.kernel.servlet.BaseFilter.doFilter(BaseFilter.java:126)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at com.liferay.portal.kernel.servlet.BaseFilter.processFilter(BaseFilter.java:196)
at com.liferay.portal.servlet.filters.gzip.GZipFilter.processFilter(GZipFilter.java:121)
at com.liferay.portal.kernel.servlet.BaseFilter.doFilter(BaseFilter.java:123)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at com.liferay.portal.kernel.servlet.BaseFilter.processFilter(BaseFilter.java:196)
at com.liferay.portal.servlet.filters.secure.SecureFilter.processFilter(SecureFilter.java:182)
at com.liferay.portal.kernel.servlet.BaseFilter.doFilter(BaseFilter.java:123)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at com.liferay.portal.kernel.servlet.BaseFilter.processFilter(BaseFilter.java:196)
at com.liferay.portal.servlet.filters.autologin.AutoLoginFilter.processFilter(AutoLoginFilter.java:254)
at com.liferay.portal.kernel.servlet.BaseFilter.doFilter(BaseFilter.java:123)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:646)
at org.apache.catalina.core.ApplicationDispatcher.processRequest(ApplicationDispatcher.java:436)
at org.apache.catalina.core.ApplicationDispatcher.doForward(ApplicationDispatcher.java:374)
at org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispatcher.java:302)
at com.liferay.portal.servlet.FriendlyURLServlet.service(FriendlyURLServlet.java:134)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at com.liferay.portal.kernel.servlet.BaseFilter.processFilter(BaseFilter.java:196)
at com.liferay.portal.kernel.servlet.BaseFilter.doFilter(BaseFilter.java:126)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at com.liferay.portal.kernel.servlet.BaseFilter.processFilter(BaseFilter.java:196)
at com.liferay.portal.kernel.servlet.BaseFilter.doFilter(BaseFilter.java:126)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at com.liferay.portal.kernel.servlet.BaseFilter.processFilter(BaseFilter.java:196)
at com.liferay.portal.servlet.filters.strip.StripFilter.processFilter(StripFilter.java:261)
at com.liferay.portal.kernel.servlet.BaseFilter.doFilter(BaseFilter.java:123)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at com.liferay.portal.kernel.servlet.BaseFilter.processFilter(BaseFilter.java:196)
at com.liferay.portal.kernel.servlet.BaseFilter.doFilter(BaseFilter.java:126)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at com.liferay.portal.kernel.servlet.BaseFilter.processFilter(BaseFilter.java:196)
at com.liferay.portal.servlet.filters.gzip.GZipFilter.processFilter(GZipFilter.java:110)
at com.liferay.portal.kernel.servlet.BaseFilter.doFilter(BaseFilter.java:123)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at com.liferay.portal.kernel.servlet.BaseFilter.processFilter(BaseFilter.java:196)
at com.liferay.portal.servlet.filters.secure.SecureFilter.processFilter(SecureFilter.java:182)
at com.liferay.portal.kernel.servlet.BaseFilter.doFilter(BaseFilter.java:123)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at com.liferay.portal.kernel.servlet.BaseFilter.processFilter(BaseFilter.java:196)
at com.liferay.portal.servlet.filters.i18n.I18nFilter.processFilter(I18nFilter.java:222)
at com.liferay.portal.kernel.servlet.BaseFilter.doFilter(BaseFilter.java:123)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at com.liferay.portal.kernel.servlet.BaseFilter.processFilter(BaseFilter.java:196)
at com.liferay.portal.kernel.servlet.BaseFilter.doFilter(BaseFilter.java:126)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at com.liferay.portal.kernel.servlet.BaseFilter.processFilter(BaseFilter.java:196)
at com.liferay.portal.servlet.filters.cache.CacheFilter.processFilter(CacheFilter.java:442)
at com.liferay.portal.kernel.servlet.BaseFilter.doFilter(BaseFilter.java:123)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at com.liferay.portal.kernel.servlet.BaseFilter.processFilter(BaseFilter.java:196)
at com.liferay.portal.servlet.filters.etag.ETagFilter.processFilter(ETagFilter.java:45)
at com.liferay.portal.kernel.servlet.BaseFilter.doFilter(BaseFilter.java:123)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at com.liferay.portal.kernel.servlet.BaseFilter.processFilter(BaseFilter.java:196)
at com.liferay.portal.servlet.filters.autologin.AutoLoginFilter.processFilter(AutoLoginFilter.java:254)
at com.liferay.portal.kernel.servlet.BaseFilter.doFilter(BaseFilter.java:123)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at com.liferay.portal.kernel.servlet.BaseFilter.processFilter(BaseFilter.java:196)
at com.liferay.portal.servlet.filters.sso.ntlm.NtlmPostFilter.processFilter(NtlmPostFilter.java:81)
at com.liferay.portal.kernel.servlet.BaseFilter.doFilter(BaseFilter.java:123)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at com.liferay.portal.kernel.servlet.BaseFilter.processFilter(BaseFilter.java:196)
at com.liferay.portal.sharepoint.SharepointFilter.processFilter(SharepointFilter.java:179)
at com.liferay.portal.kernel.servlet.BaseFilter.doFilter(BaseFilter.java:123)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at com.liferay.portal.kernel.servlet.BaseFilter.processFilter(BaseFilter.java:196)
at com.liferay.portal.servlet.filters.virtualhost.VirtualHostFilter.processFilter(VirtualHostFilter.java:240)
at com.liferay.portal.kernel.servlet.BaseFilter.doFilter(BaseFilter.java:123)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at com.liferay.portal.kernel.servlet.BaseFilter.processFilter(BaseFilter.java:196)
at com.liferay.portal.kernel.servlet.BaseFilter.doFilter(BaseFilter.java:126)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at com.liferay.portal.kernel.servlet.BaseFilter.processFilter(BaseFilter.java:196)
at com.liferay.portal.kernel.servlet.BaseFilter.doFilter(BaseFilter.java:126)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.tuckey.web.filters.urlrewrite.UrlRewriteFilter.doFilter(UrlRewriteFilter.java:738)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at com.liferay.portal.kernel.servlet.BaseFilter.processFilter(BaseFilter.java:196)
at com.liferay.portal.servlet.filters.threadlocal.ThreadLocalFilter.processFilter(ThreadLocalFilter.java:35)
at com.liferay.portal.kernel.servlet.BaseFilter.doFilter(BaseFilter.java:123)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:470)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:298)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:857)
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:588)
at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:489)
at java.lang.Thread.run(Thread.java:619)
Caused by: java.lang.NullPointerException
at com.liferay.portal.service.impl.UserLocalServiceImpl.addUser(UserLocalServiceImpl.java:320)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:309)
This Is my code
//liferayCodeCreateUser
Date dateLahir = pendaftar.getTglLahir();
Calendar cal = Calendar.getInstance();
cal.setTime(dateLahir);
int day=cal.get(Calendar.DAY_OF_MONTH);
int month=cal.get(Calendar.MONTH);
int year=cal.get(Calendar.YEAR);
UserServiceUtil.addUser(pendaftar.getCompanyId(), false, pendaftaran.getNim(), pendaftaran.getNim(), true, pendaftaran.getEmail(), pendaftar.getEmail(), 0, null, null, pendaftar.getNamaLengkap(), null, pendaftar.getNamaLengkap(), 0, 0, genders, month, day, year, null, null, null, null, null, true, serviceContext);
//endCreateCodeCreateUser
Any Idea why error? Thank's
jelmer kuperus, geändert vor 12 Jahren.
RE: Add User with UserLocalService
Liferay Legend Beiträge: 1191 Beitrittsdatum: 10.03.10 Neueste Beiträge
Your openid field is null. Pass in empty strings instead of nulls everywhere you want to leave something out (yes aint liferay a monument to great software design)
Danial Habibi, geändert vor 12 Jahren.
RE: Add User with UserLocalService
Regular Member Beiträge: 141 Beitrittsdatum: 01.11.11 Neueste Beiträgejelmer kuperus:
Your openid field is null. Pass in empty strings instead of nulls everywhere you want to leave something out (yes aint liferay a monument to great software design)
IT's Work now Jelmer..Thank's!!! Thank's Very Much
Regards
Danial
Puneet Upadhyay, geändert vor 12 Jahren.
RE: Add User with UserLocalService
Regular Member Beiträge: 234 Beitrittsdatum: 22.10.11 Neueste Beiträge
You should follow jelmer's suggestion.