掲示板
PermissionChecker not initialized exception while invoking remote services
11年前 に Gopinath BR によって更新されました。
PermissionChecker not initialized exception while invoking remote services
Junior Member 投稿: 25 参加年月日: 10/08/10 最新の投稿
Hi,
I am facing a problem while invoking webservice methods remotely. I get the below error while using the "Portlet_Journal_JournalArticleService" on Liferay 6.1 community. Can someone provide me pointers on how to solve this problem?
05:58:16,183 ERROR [JournalArticleServiceSoap:171] com.liferay.portal.security.auth.PrincipalException: PermissionChecker not initialized
com.liferay.portal.security.auth.PrincipalException: PermissionChecker not initialized
at com.liferay.portal.service.base.PrincipalBean.getPermissionChecker(PrincipalBean.java:81)
at com.liferay.portlet.journal.service.impl.JournalArticleServiceImpl.getArticle(JournalArticleServiceImpl.java:183)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
Regards,
I am facing a problem while invoking webservice methods remotely. I get the below error while using the "Portlet_Journal_JournalArticleService" on Liferay 6.1 community. Can someone provide me pointers on how to solve this problem?
05:58:16,183 ERROR [JournalArticleServiceSoap:171] com.liferay.portal.security.auth.PrincipalException: PermissionChecker not initialized
com.liferay.portal.security.auth.PrincipalException: PermissionChecker not initialized
at com.liferay.portal.service.base.PrincipalBean.getPermissionChecker(PrincipalBean.java:81)
at com.liferay.portlet.journal.service.impl.JournalArticleServiceImpl.getArticle(JournalArticleServiceImpl.java:183)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
Regards,
11年前 に Nagendra Kumar Busam によって更新されました。
RE: PermissionChecker not initialized exception while invoking remote servi
Liferay Master 投稿: 678 参加年月日: 09/07/07 最新の投稿
How you are trying to access? Brief about what you did exactly
11年前 に Gopinath Guptha によって更新されました。
RE: PermissionChecker not initialized exception while invoking remote servi
Junior Member 投稿: 25 参加年月日: 10/08/10 最新の投稿
Hello Nagendra,
I first added the below two lines in the portal-ext.properties file to allow my ip.
axis.servlet.hosts.allowed=127.0.0.1,192.168.1.88
axis.servlet.https.required=false
In some posts, It is mentioned that the user needs to be provided permissions to invoke the webservices. I searched a bit, but could not find how to do that. So I used the credentials bruno/ bruno as the username (screenname) and password to invoke the webservices (assuming the user has complete privileges and permissions). Below is the code which I found in one of the blogs and I modified it a bit to invoke the webservices.
Regards,
Gopinath
----------------------------------------------------------------------------------
package example;
import mypackage.JournalArticleServiceSoap;
import mypackage.JournalArticleServiceSoapServiceLocator;
import mypackage.JournalArticleSoap;
import java.net.MalformedURLException;
import java.net.URL;
public class HelloJournal
{
public static void main(String[] args)
{
try
{
JournalArticleServiceSoapServiceLocator service = new JournalArticleServiceSoapServiceLocator();
JournalArticleServiceSoap journalService = service.getPortlet_Journal_JournalArticleService(getURL("Portlet_Journal_JournalArticleService"));
JournalArticleSoap journal = journalService.getArticle(19, "10864");
}
catch (Exception e)
{
e.printStackTrace();
}
}
private static URL getURL(String serviceName) throws MalformedURLException
{
String url = "http://192.168.1.5:8080";
String screenName = "bruno";
String password = "bruno";
int pos = url.indexOf("://");
String protocol = url.substring(0, pos + 3);
String host = url.substring(pos + 3, url.length());
StringBuilder sb = new StringBuilder();
sb.append(protocol);
sb.append(screenName);
sb.append(":");
sb.append(password);
sb.append("@");
sb.append(host);
sb.append("/api/axis/");
sb.append(serviceName);
return new URL(sb.toString());
}
}
I first added the below two lines in the portal-ext.properties file to allow my ip.
axis.servlet.hosts.allowed=127.0.0.1,192.168.1.88
axis.servlet.https.required=false
In some posts, It is mentioned that the user needs to be provided permissions to invoke the webservices. I searched a bit, but could not find how to do that. So I used the credentials bruno/ bruno as the username (screenname) and password to invoke the webservices (assuming the user has complete privileges and permissions). Below is the code which I found in one of the blogs and I modified it a bit to invoke the webservices.
Regards,
Gopinath
----------------------------------------------------------------------------------
package example;
import mypackage.JournalArticleServiceSoap;
import mypackage.JournalArticleServiceSoapServiceLocator;
import mypackage.JournalArticleSoap;
import java.net.MalformedURLException;
import java.net.URL;
public class HelloJournal
{
public static void main(String[] args)
{
try
{
JournalArticleServiceSoapServiceLocator service = new JournalArticleServiceSoapServiceLocator();
JournalArticleServiceSoap journalService = service.getPortlet_Journal_JournalArticleService(getURL("Portlet_Journal_JournalArticleService"));
JournalArticleSoap journal = journalService.getArticle(19, "10864");
}
catch (Exception e)
{
e.printStackTrace();
}
}
private static URL getURL(String serviceName) throws MalformedURLException
{
String url = "http://192.168.1.5:8080";
String screenName = "bruno";
String password = "bruno";
int pos = url.indexOf("://");
String protocol = url.substring(0, pos + 3);
String host = url.substring(pos + 3, url.length());
StringBuilder sb = new StringBuilder();
sb.append(protocol);
sb.append(screenName);
sb.append(":");
sb.append(password);
sb.append("@");
sb.append(host);
sb.append("/api/axis/");
sb.append(serviceName);
return new URL(sb.toString());
}
}
11年前 に Gopinath Guptha によって更新されました。
RE: PermissionChecker not initialized exception while invoking remote servi
Junior Member 投稿: 25 参加年月日: 10/08/10 最新の投稿
Hi,
I was able to solve this. Below were the changes I did.
1. The path to the service was wrong. The correct one is /api/secure/axis/...
2. The webservice required me to use basic authentication. Below is the code I used -
JournalArticleServiceSoapServiceLocator service = new JournalArticleServiceSoapServiceLocator();
JournalArticleServiceSoap journalService = service.getPortlet_Journal_JournalArticleService(getURL("Portlet_Journal_JournalArticleService"));
((Stub)journalService)._setProperty(Call.USERNAME_PROPERTY, "bruno@7cogs.com");
((Stub)journalService)._setProperty(Call.PASSWORD_PROPERTY, "bruno");
JournalArticleSoap journal = journalService.getArticle(19, "10864");
System.out.println(journal.getContent());
3. The username is in fact the email of the user and not the screen name as suggested in other posts.
Whatever I did, invoking the services using the below url never worked -
http://<usrename>:<password>@<host>:<port>/api/secure/axis/Portlet_Journal_JournalArticleService
Regards,
Gopinath
I was able to solve this. Below were the changes I did.
1. The path to the service was wrong. The correct one is /api/secure/axis/...
2. The webservice required me to use basic authentication. Below is the code I used -
JournalArticleServiceSoapServiceLocator service = new JournalArticleServiceSoapServiceLocator();
JournalArticleServiceSoap journalService = service.getPortlet_Journal_JournalArticleService(getURL("Portlet_Journal_JournalArticleService"));
((Stub)journalService)._setProperty(Call.USERNAME_PROPERTY, "bruno@7cogs.com");
((Stub)journalService)._setProperty(Call.PASSWORD_PROPERTY, "bruno");
JournalArticleSoap journal = journalService.getArticle(19, "10864");
System.out.println(journal.getContent());
3. The username is in fact the email of the user and not the screen name as suggested in other posts.
Whatever I did, invoking the services using the below url never worked -
http://<usrename>:<password>@<host>:<port>/api/secure/axis/Portlet_Journal_JournalArticleService
Regards,
Gopinath
11年前 に Nagendra Kumar Busam によって更新されました。
RE: PermissionChecker not initialized exception while invoking remote servi
Liferay Master 投稿: 678 参加年月日: 09/07/07 最新の投稿
Thank you very much for sharing
11年前 に latha l によって更新されました。
RE: PermissionChecker not initialized exception while invoking remote servi
New Member 投稿: 1 参加年月日: 13/02/11 最新の投稿
Hi Gopinath,
Thank you for sharing Gopinath.
I was struggling with this for 3 days!!!...
Regards
Latha
Thank you for sharing Gopinath.
I was struggling with this for 3 days!!!...
Regards
Latha
11年前 に Oliver Bayer によって更新されました。
RE: PermissionChecker not initialized exception while invoking remote servi
Liferay Master 投稿: 894 参加年月日: 09/02/18 最新の投稿
Hi Gopinath,
afaik PrincipalException means that you're trying to access a secured service without being authenticated. I would guess you have to check your login.
HTH Oli
afaik PrincipalException means that you're trying to access a secured service without being authenticated. I would guess you have to check your login.
HTH Oli