Liferay Services Utils

Hi All;

i am tring to get UserCount from Liferay services util in my vaadin portlet. i am using Liferay6 and Vaadin 6.4.2. For Example ;


UserLocalService userService = UserLocalServiceUtil.getService();

List users = null;
try {
users = userService.getUsers(0, userService.getUsersCount());

} catch (SystemException e) {
e.printStackTrace();
}


This code working for IceFaces portlet but not for Vaadin. Can anybody help me ? Any idea?


This is my Application Class ;

public class TestportletApplication extends Application implements PortletListener,PortletRequestListener {
@Override
public void init() {
Window mainWindow = new Window(“Testportlet Application”);
Label label = new Label(“Hello Vaadin user”);
mainWindow.addComponent(label);

	if (getContext() instanceof PortletApplicationContext2) {
		PortletApplicationContext2 portletContext = (PortletApplicationContext2) getContext();
		portletContext.addPortletListener(this, this);

	}
	

	UserLocalService userService = UserLocalServiceUtil.getService();

            List<User> users = null;
             try {
             users = userService.getUsers(0, userService.getUsersCount());

             } catch (SystemException e) {
                   e.printStackTrace();
             }
	
	
	setMainWindow(mainWindow);

	
} ...

I also tried ;

@Override
public void onRequestStart(PortletRequest request, PortletResponse response) {
if (getUser() == null) {
try {
User user = PortalUtil.getUser(request);
setUser(user);
} catch (PortalException e) {
e.printStackTrace();
} catch (SystemException e) {
e.printStackTrace();
}
}
}

i am gettin same exception ;

Caused by: java.lang.NoSuchMethodError : com.liferay.portal.kernel.util.PortalClassInvoker.invoke(Ljava/lang/String;Ljava/lang/String;Ljava/lang/Object;)Ljava/lang/Object;…


But it is working for Liferay 5.

IIRC, some Liferay utility classes and methods moved to a different package in Liferay 6. The class PortalClassInvoker tries to call some of these (determined by the parameters from the method calling it - probably a long chain of invocations starting from the Liferay utility class you are using) using the reflection API, and the classes or methods are not found.

Your classpath probably contains the old Liferay classes before the new ones, or you are deploying some old Liferay JARs. Try to add the Liferay JARs on your IDE classpath and, if necessary, to your portlet properties file, so that they are used first.

Note that some portlet related classes are also included in the Vaadin JAR - I cannot recall if there is anything apart from portlet specification interfaces, but you could put the new Liferay JARs before your Vaadin JAR to be sure.

Thanks for reply Henri,
i am adding externally last liferay api to my project. i created vaadin portlet and deployed, its working well but when i used Liferay services, i have trouble with vaadin. if i add liferay last api to my project lib, i am gettin exception also it is not good liferay jars in my project lib.
i created a icefaces portlet and add liferay api extanally. Services working well. Maybe portlet related classes are included in the Vaadin JAR can be update. Do you know there are any think about this.