Forums

Home » Liferay Portal » English » 3. Development

Combination View Flat View Tree View
Threads [ Previous | Next ]
toggle
Christine Karman
You do not have the roles required to access this portlet.
July 30, 2009 4:44 AM
Answer

Christine Karman

Rank: New Member

Posts: 15

Join Date: July 14, 2009

Recent Posts

Hi,
I have set up the ext environment in Eclipse, I have used the plugin to create a portlet, I've made it almost an exact copy of the EXT_1 reports example. However, I get a "You do not have the roles required to access this portlet. " error. I have checked and double checked and re-checked the struts paths, to no avail. The user trying to access the portlet has all rights that I can give them in the Configuration panel.

This is what my log file says:
[Jul 30 10:27:00] [http-8080-Processor24] WARN - The struts path ext/test does not belong to portlet EXT_BID_PORTLET_01. Check the definition in liferay-portlet.xml

How do I make a struts path belong to a portlet?
Carlos Rivera
RE: You do not have the roles required to access this portlet.
July 30, 2009 7:17 AM
Answer

Carlos Rivera

Rank: New Member

Posts: 18

Join Date: July 21, 2009

Recent Posts

Bump. I'm having the same issue when trying to add a new StrutsPortlet in ext.
Jonas Yuan
RE: You do not have the roles required to access this portlet.
July 30, 2009 7:38 AM
Answer

Jonas Yuan

Rank: Liferay Master

Posts: 993

Join Date: April 26, 2007

Recent Posts

Hi Christine Karman and Carlos Rivera,

Double check the portlet name in portlet(-ext).xml, liferay-portlet(-ext).xml.
and struts path definition in liferay-portlet(-ext).xml and struts-config.xml.

Make sure that portlet name and struts path matched.

1<portlet>
2        <portlet-name>EXT_1</portlet-name>
3        <struts-path>ext/reports</struts-path>
4        <use-default-template>false</use-default-template>
5</portlet>


1<action path="/ext/reports/view_reports" type="com.ext.portlet.reports.action.ViewReportsAction">
2        <forward name="portlet.ext.reports.view" path="portlet.ext.reports.view" />
3        <forward name="portlet.ext.reports.view_reports" path="portlet.ext.reports.view_reports" />
4</action>


Hope that it helps

Thanks

Jonas Yuan

-----------------
Liferay Books

Liferay Portal 5.2/5.3 Systems Development
Liferay Portal 4.4/5.0 Enterprise Intranets
Carlos Rivera
RE: You do not have the roles required to access this portlet.
August 3, 2009 7:09 AM
Answer

Carlos Rivera

Rank: New Member

Posts: 18

Join Date: July 21, 2009

Recent Posts

I'm getting this now when I try to reference a struts_action of a different portlet. Is this not allowed?

I.e. in my PortletA, i have a renderURL to "/PortletB/view"
Christine Karman
RE: You do not have the roles required to access this portlet.
August 3, 2009 7:15 AM
Answer

Christine Karman

Rank: New Member

Posts: 15

Join Date: July 14, 2009

Recent Posts

Thanks for the reply. I'm not sure I understand, though. The portlet name in your example is "EXT_1" which is the demo portlet that comes with Liferay. This name is specified in portlet-ext.xml and in liferay-portlet-ext.xml. So with what item in the struts-config.xml should it match?

I have no clue what everything else in the xml file means. Is there documentation that explains what a struts path is and what a forward does? I was hoping to use Liferay without having to learn Struts.


The error I now get is

[Aug 03 13:55:09] [http-8080-Processor21] ERROR - Forward does not exist
[Aug 03 13:55:10] [http-8080-Processor21] ERROR - No action instance for path /ext/myportlet/view could be
created
java.lang.ClassNotFoundException: com.ext.portlet.myportlet.action.ViewAction
at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1386)
at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1232)
.....

My struts-config.xml contains
<action path="/ext/test/view" type="com.ext.portlet.test.action.ViewAction">
<forward name="portlet.ext.test.view" path="portlet.ext.test.view"/>
</action>

liferay-portlet-ext.xml is
<portlet>
<portlet-name>EXT_BID_PORTLET_01</portlet-name>
<struts-path>ext/test</struts-path>
<use-default-template>false</use-default-template>
</portlet>

and portlet-ext.xml is
<portlet>
<portlet-name>EXT_BID_PORTLET_01</portlet-name>
<display-name>BiD Eval</display-name>
<portlet-class>org.bidnetwork.portlet.TestPortlet</portlet-class>
<init-param>
<name>view-action</name>
<value>/ext/test/view</value>
</init-param>
<expiration-cache>0</expiration-cache>
<supports>
<mime-type>text/html</mime-type>
</supports>
<resource-bundle>com.liferay.portlet.StrutsResourceBundle</resource-bundle>
<portlet-preferences>
<preference>
<name>test</name>
<value>Test Portlet 123</value>
</preference>
</portlet-preferences>
<security-role-ref>
<role-name>power-user</role-name>
</security-role-ref>
<security-role-ref>
<role-name>user</role-name>
</security-role-ref>
</portlet>

I have created view.jsp in ext-web/docroot/html/portlet/ext/test/ and view.java in src/com/ext/portlet/test/action.

Basically, what I've done is create a portlet with the eclipse plugin, then add .jsp and .java files similar to the ones in the EXT_1 sample. I started out reading the portlet development guide but that was written for liferay 4, it doesn't seem to be adequate for liferay 5.
Petros Giakouvakis
RE: You do not have the roles required to access this portlet.
August 3, 2009 7:20 AM
Answer

Petros Giakouvakis

Rank: Junior Member

Posts: 33

Join Date: August 3, 2009

Recent Posts


I have no clue what everything else in the xml file means. Is there documentation that explains what a struts path is and what a forward does? I was hoping to use Liferay without having to learn Struts.


You need some wiring the link the action to your view etc. If you use the genericcstrutsportlet you will need to learn at least the basics of struts. Otherwise use a different wiring techique...

There's a sample struts porlet that you can download. Just have a look at that...
Christine Karman
RE: You do not have the roles required to access this portlet.
August 6, 2009 1:44 AM
Answer

Christine Karman

Rank: New Member

Posts: 15

Join Date: July 14, 2009

Recent Posts

I decided to use the PluginSDK, that seems to be much easier. I now have a working Eclipse project from which I can deploy portlets into the portal. It should be possible to run the whole thing in something like runjettyrun so I can even test and debug in Eclipse :-)
Kolja Köster
RE: You do not have the roles required to access this portlet.
August 6, 2009 2:13 AM
Answer

Kolja Köster

Rank: Regular Member

Posts: 164

Join Date: May 11, 2009

Recent Posts


I have no clue what everything else in the xml file means. Is there documentation that explains what a struts path is and what a forward does? I was hoping to use Liferay without having to learn Struts.

I do not know, if that helps you, but you do not have to look into Struts Portlets. I was stuck in that jungle too, before a had a look at simple JSR compliant portlets.

Regards
Kolja
Petros Giakouvakis
RE: You do not have the roles required to access this portlet.
August 7, 2009 2:28 AM
Answer

Petros Giakouvakis

Rank: Junior Member

Posts: 33

Join Date: August 3, 2009

Recent Posts

"Simple" JSR compliant actually require a lot more boilerplate code. I prefer Struts. This handles a lot of the overhead. Yes, you need some extra skills, but it is a skill worth acquiring I believe.
Kolja Köster
RE: You do not have the roles required to access this portlet.
August 7, 2009 2:44 AM
Answer

Kolja Köster

Rank: Regular Member

Posts: 164

Join Date: May 11, 2009

Recent Posts

Petros Giakouvakis:
"Simple" JSR compliant actually require a lot more boilerplate code. I prefer Struts. This handles a lot of the overhead. Yes, you need some extra skills, but it is a skill worth acquiring I believe.

You are right. But to have a first look at portlets, how communication between them and between JAVA and JSP work, JSR portlets are much simpler in my opinion. And this is what this thread is about, I think.

Regards
Kolja
Petros Giakouvakis
RE: You do not have the roles required to access this portlet.
August 7, 2009 7:07 AM
Answer

Petros Giakouvakis

Rank: Junior Member

Posts: 33

Join Date: August 3, 2009

Recent Posts

Very true!
KK rajput
RE: You do not have the roles required to access this portlet.
August 10, 2009 4:09 AM
Answer

KK rajput

Rank: Expert

Posts: 266

Join Date: April 10, 2008

Recent Posts

Carlos Rivera:
I'm getting this now when I try to reference a struts_action of a different portlet. Is this not allowed?

I.e. in my PortletA, i have a renderURL to "/PortletB/view"


In case of different portlet there are 2 cases
1.both portlets are on same layout.
2.portlet A is on layout A and portlet B on layout B.

In case 1.
PortletURL url = new PortletURLImpl(request, "PortletB_name", plid , PortletRequest.RENDER_PHASE);
url.setParameter("struts_action", "portletB_action_path");
url.setWindowState(WindowState.NORMAL);

In case 2:
First you need to findout layoutId of portletB after that you can use case 1 code

Thanks
KamalKant
HTH