Vinutha Shreyas |
: |
Calling Liferay Services from Standalone java |
|
|
|
|
|
Hi,
|
|
|
|
|
|
I am attempting to call a LiferayService from a Standalone java program. |
|
|
|
|
|
In calling the service I am trying to add a portal user |
|
|
The codes are as below |
|
|
|
|
|
The standalone java program is |
|
|
|
|
|
|
|
|
|
|
|
I have included all the Liferay related jars in my classpath. |
|
|
But still faced with the following error |
|
|
|
|
|
Caused by: java.lang.RuntimeException: UserLocalService is not set |
|
|
at com.liferay.portal.service.UserLocalServiceUtil.getService(UserLocalServiceUtil.java:871) |
|
|
at com.liferay.portal.service.UserLocalServiceUtil.addUser(UserLocalServiceUtil.java:143) |
|
|
|
|
|
Can someone suggest if I need to configure or enable this service in any of the Liferay related files. |
|
|
|
|
|
Appreciate for the help seeked. |
|
|
|
Mazhar Anwar |
: |
Hi |
|
|
|
|
|
It is not possible to use Liferay Service in standalone java classes like this since there are many Spring and hibernate configurations. |
|
|
|
|
|
Possible option are |
|
|
|
|
|
1- Create a new web-application under the same server and you can call Liferay's global APIs (i.e classes in portal-service.jar and portal-kernal.jar) |
|
|
|
|
|
2- Write code to connect with Liferay Database via JDBC/Hibernate and perform all database operation. |
|
|
|
|
|
Regards, |
|
|
|
Thiago Leão Moreira |
: |
Hi Vinutha,
|
|
|
|
|
|
Use the portal-client.jar, it is a SOAP client to access your Liferay server. |
|
|
|
|
|
Hope this helps. |
|
|
|
Vinutha Shreyas |
: |
I have tried through web-application and am able to do it successfully through portlets. |
|
|
But that is not my requirement. I need to call it through a standalone program for my application requirement. |
|
|
|
|
|
What I have given the code template in my previous post was a simple template for understanding purpose. |
|
|
|
|
|
Actually I am connecting to the Database through Hibernate. |
|
|
|
|
|
Any feedback would be appreciated. |
|
|
|
|
|
Thank you |
|
|
|
Vinutha Shreyas |
: |
As there is a suggestion to use the poratl-client.jar, a SOAP based access layer, |
|
|
|
|
|
Can you give me a reference to the beginning point of the code to use SOAP as I am a newbie to SOAP. |
|
|
|
|
|
Thank you |
No comments:
Post a Comment