Fóruns

Início » Liferay Portal » English » 3. Development

Visualização combinada Visão plana Exibição em árvore
Tópicos [ Anterior | Próximo ]
toggle
Swetha Surendran
Portlet.xml shows Exception
28 de Março de 2013 00:31
Resposta

Swetha Surendran

Ranking: Junior Member

Mensagens: 32

Data de entrada: 1 de Março de 2013

Mensagens recentes

Hello
I have used 3 portlets and these are the contents in my portlet.xml:


<?xml version="1.0"?>

<portlet-app xmlns="http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd" version="2.0">
<portlet>
<portlet-name>interpc</portlet-name>
<display-name>Interpc</display-name>
<portlet-class>com.liferay.util.bridges.mvc.MVCPortlet</portlet-class>
<init-param>
<name>view-template</name>
<value>/view.jsp</value>
</init-param>
<expiration-cache>0</expiration-cache>
<supports>
<mime-type>text/html</mime-type>
</supports>
<portlet-info>
<title>Interpc</title>
<short-title>Interpc</short-title>
<keywords>Interpc</keywords>
</portlet-info>
<security-role-ref>
<role-name>administrator</role-name>
</security-role-ref>
<security-role-ref>
<role-name>guest</role-name>
</security-role-ref>
<security-role-ref>
<role-name>power-user</role-name>
</security-role-ref>
<security-role-ref>
<role-name>user</role-name>
</security-role-ref>
</portlet>

<portlet>
<portlet-name>ipcsender</portlet-name>
<display-name>Ipcsender Portlet</display-name>
<portlet-class>com.test.IpcsenderPortlet</portlet-class>
<init-param>
<name>view-template</name>
<value>/html/ipcsender/view.jsp</value>
</init-param>
<expiration-cache>0</expiration-cache>
<supports>
<mime-type>text/html</mime-type>
<portlet-mode>view</portlet-mode>
</supports>
<resource-bundle>content/Language</resource-bundle>
<portlet-info>
<title>Ipcsender Portlet</title>
<short-title>Ipcsender Portlet</short-title>
<keywords></keywords>
</portlet-info>
<security-role-ref>
<role-name>administrator</role-name>
</security-role-ref>
<security-role-ref>
<role-name>guest</role-name>
</security-role-ref>
<security-role-ref>
<role-name>power-user</role-name>
</security-role-ref>
<security-role-ref>
<role-name>user</role-name>
</security-role-ref>
<supported-publishing-event>
<qname xmlns:x="http:abc.com/events">x:StringChange</qname>
</supported-publishing-event>

<supported-public-render-parameter>
public-render-MyId
</supported-public-render-parameter>
</portlet>
<event-definition>
<qname xmlns:x="http:abc.com/events">x:StringChange</qname>
<value-type>java.lang.String</value-type>
</event-definition>
<public-render-parameter>
<identifier>public-render-MyId</identifier>
<qname xmlns:x="http:abc.com/public-render-parameters">x:public-render-MyId</qname>
</public-render-parameter>


<portlet> Exception marked here
<portlet-name>ipcreceiver</portlet-name>
<display-name>Ipcreceiver Portlet</display-name>
<portlet-class>com.test.IpcreceiverPortlet</portlet-class>
<init-param>
<name>view-template</name>
<value>/html/ipcreceiver/view.jsp</value>
</init-param>
<expiration-cache>0</expiration-cache>
<supports>
<mime-type>text/html</mime-type>
<portlet-mode>view</portlet-mode>
</supports>
<resource-bundle>content/Language</resource-bundle>
<portlet-info>
<title>Ipcreceiver Portlet</title>
<short-title>Ipcreceiver Portlet</short-title>
<keywords></keywords>
</portlet-info>
<security-role-ref>
<role-name>administrator</role-name>
</security-role-ref>
<security-role-ref>
<role-name>guest</role-name>
</security-role-ref>
<security-role-ref>
<role-name>power-user</role-name>
</security-role-ref>
<security-role-ref>
<role-name>user</role-name>
</security-role-ref>
<supported-processing-event>
<qname xmlns:x="http:abc.com/events">x:StringChange</qname>
</supported-processing-event>
</portlet>
<event-definition>
<qname xmlns:x="http:abc.com/events">x:StringChange</qname>
<value-type>java.lang.String</value-type>
</event-definition>
</portlet-app>

Now I get an exception which is:
cvc-complex-type.2.4.a: Invalid content was found starting with element 'portlet'. One of '{"http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd":public-render-parameter, "http:// java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd":listener, "http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd":container-runtime-option}' is expected.

What should be done???
Please help...



Regards,
Swetha
Jitendra Rajput
RE: Portlet.xml shows Exception
28 de Março de 2013 00:43
Resposta

Jitendra Rajput

Ranking: Liferay Master

Mensagens: 647

Data de entrada: 7 de Janeiro de 2011

Mensagens recentes



<event-definition>
<qname xmlns:x="http:abc.com/events">x:StringChange</qname>
<value-type>java.lang.String</value-type>
</event-definition>
<event-definition>
<identifier>public-render-MyId</identifier>
<qname xmlns:x="http:abc.com/public-render-parameters">x:public-render-MyId</qname>
</public-render-parameter>


<portlet> Exception marked here


<event-definition> and </public-render-parameter> should be inside <portlet> tag
Subhash Pavuskar
RE: Portlet.xml shows Exception
28 de Março de 2013 00:45
Resposta

Subhash Pavuskar

Ranking: Regular Member

Mensagens: 234

Data de entrada: 12 de Março de 2012

Mensagens recentes

Hi,

<supported-processing-event> should be placed before <supported-publishing-event>

For example:

<supported-processing-event>
<qname xmlns:x="http:abc.com/events">x:StringChange</qname>
</supported-processing-event>
<supported-publishing-event>
<qname xmlns:x="http:abc.com/events">x:StringChange</qname>
</supported-publishing-event>
Swetha Surendran
RE: Portlet.xml shows Exception
28 de Março de 2013 00:46
Resposta

Swetha Surendran

Ranking: Junior Member

Mensagens: 32

Data de entrada: 1 de Março de 2013

Mensagens recentes

No its not working.. Then Event-definition shows exception..
Jitendra Rajput
RE: Portlet.xml shows Exception
28 de Março de 2013 00:48
Resposta

Jitendra Rajput

Ranking: Liferay Master

Mensagens: 647

Data de entrada: 7 de Janeiro de 2011

Mensagens recentes

As suggested by Subhash try to change order supported-processing-event and supported-publishing-event inside portlet tag only.
Subhash Pavuskar
RE: Portlet.xml shows Exception
28 de Março de 2013 00:49
Resposta

Subhash Pavuskar

Ranking: Regular Member

Mensagens: 234

Data de entrada: 12 de Março de 2012

Mensagens recentes

For Reference:
portal-impl/src/com/liferay/portal/service/impl/PortletLocalServiceImpl.java
Swetha Surendran
RE: Portlet.xml shows Exception
28 de Março de 2013 00:50
Resposta

Swetha Surendran

Ranking: Junior Member

Mensagens: 32

Data de entrada: 1 de Março de 2013

Mensagens recentes

Hi Subhash,
But i haven't used <supported- processing event> in my second portlet.. Thats in my 3rd portlet which works fine..
Jitendra Rajput
RE: Portlet.xml shows Exception
28 de Março de 2013 00:54
Resposta

Jitendra Rajput

Ranking: Liferay Master

Mensagens: 647

Data de entrada: 7 de Janeiro de 2011

Mensagens recentes

Please find modified portlet.xml without any error

  1
  2
  3<?xml version="1.0"?>
  4
  5<portlet-app xmlns="http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd"
  6    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  7    xsi:schemaLocation="http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd"
  8    version="2.0">
  9    <portlet>
 10        <portlet-name>interpc</portlet-name>
 11        <display-name>Interpc</display-name>
 12        <portlet-class>com.liferay.util.bridges.mvc.MVCPortlet</portlet-class>
 13        <init-param>
 14            <name>view-template</name>
 15            <value>/view.jsp</value>
 16        </init-param>
 17        <expiration-cache>0</expiration-cache>
 18        <supports>
 19            <mime-type>text/html</mime-type>
 20        </supports>
 21        <portlet-info>
 22            <title>Interpc</title>
 23            <short-title>Interpc</short-title>
 24            <keywords>Interpc</keywords>
 25        </portlet-info>
 26        <security-role-ref>
 27            <role-name>administrator</role-name>
 28        </security-role-ref>
 29        <security-role-ref>
 30            <role-name>guest</role-name>
 31        </security-role-ref>
 32        <security-role-ref>
 33            <role-name>power-user</role-name>
 34        </security-role-ref>
 35        <security-role-ref>
 36            <role-name>user</role-name>
 37        </security-role-ref>
 38    </portlet>
 39
 40    <portlet>
 41        <portlet-name>ipcsender</portlet-name>
 42        <display-name>Ipcsender Portlet</display-name>
 43        <portlet-class>com.test.IpcsenderPortlet</portlet-class>
 44        <init-param>
 45            <name>view-template</name>
 46            <value>/html/ipcsender/view.jsp</value>
 47        </init-param>
 48        <expiration-cache>0</expiration-cache>
 49        <supports>
 50            <mime-type>text/html</mime-type>
 51            <portlet-mode>view</portlet-mode>
 52        </supports>
 53        <resource-bundle>content/Language</resource-bundle>
 54        <portlet-info>
 55            <title>Ipcsender Portlet</title>
 56            <short-title>Ipcsender Portlet</short-title>
 57            <keywords></keywords>
 58        </portlet-info>
 59        <security-role-ref>
 60            <role-name>administrator</role-name>
 61        </security-role-ref>
 62        <security-role-ref>
 63            <role-name>guest</role-name>
 64        </security-role-ref>
 65        <security-role-ref>
 66            <role-name>power-user</role-name>
 67        </security-role-ref>
 68        <security-role-ref>
 69            <role-name>user</role-name>
 70        </security-role-ref>
 71        <supported-publishing-event>
 72            <qname xmlns:x="http:abc.com/events">x:StringChange</qname>
 73        </supported-publishing-event>
 74
 75        <supported-public-render-parameter>public-render-MyId</supported-public-render-parameter>
 76    </portlet>
 77
 78
 79    <portlet>
 80        <portlet-name>ipcreceiver</portlet-name>
 81        <display-name>Ipcreceiver Portlet</display-name>
 82        <portlet-class>com.test.IpcreceiverPortlet</portlet-class>
 83        <init-param>
 84            <name>view-template</name>
 85            <value>/html/ipcreceiver/view.jsp</value>
 86        </init-param>
 87        <expiration-cache>0</expiration-cache>
 88        <supports>
 89            <mime-type>text/html</mime-type>
 90            <portlet-mode>view</portlet-mode>
 91        </supports>
 92        <resource-bundle>content/Language</resource-bundle>
 93        <portlet-info>
 94            <title>Ipcreceiver Portlet</title>
 95            <short-title>Ipcreceiver Portlet</short-title>
 96            <keywords></keywords>
 97        </portlet-info>
 98        <security-role-ref>
 99            <role-name>administrator</role-name>
100        </security-role-ref>
101        <security-role-ref>
102            <role-name>guest</role-name>
103        </security-role-ref>
104        <security-role-ref>
105            <role-name>power-user</role-name>
106        </security-role-ref>
107        <security-role-ref>
108            <role-name>user</role-name>
109        </security-role-ref>
110        <supported-processing-event>
111            <qname xmlns:x="http:abc.com/events">x:StringChange</qname>
112        </supported-processing-event>
113    </portlet>
114    <event-definition>
115        <qname xmlns:x="http:abc.com/events">x:StringChange</qname>
116        <value-type>java.lang.String</value-type>
117    </event-definition>
118        <event-definition>
119        <qname xmlns:x="http:abc.com/events">x:StringChange</qname>
120        <value-type>java.lang.String</value-type>
121    </event-definition>
122    <public-render-parameter>
123        <identifier>public-render-MyId</identifier>
124        <qname xmlns:x="http:abc.com/public-render-parameters">x:public-render-MyId</qname>
125    </public-render-parameter>
126   
127</portlet-app>
Subhash Pavuskar
RE: Portlet.xml shows Exception
28 de Março de 2013 02:16
Resposta

Subhash Pavuskar

Ranking: Regular Member

Mensagens: 234

Data de entrada: 12 de Março de 2012

Mensagens recentes

Hi,
XML processing instruction(invariably it is the first element) has to be on the first line & there should't be any space..Any deviation can trigger an exception.
1<?xml version="1.0"?>
Jitendra Rajput
RE: Portlet.xml shows Exception
28 de Março de 2013 02:19
Resposta

Jitendra Rajput

Ranking: Liferay Master

Mensagens: 647

Data de entrada: 7 de Janeiro de 2011

Mensagens recentes

Now it is working after applying change suggested in above post ?
Swetha Surendran
RE: Portlet.xml shows Exception
28 de Março de 2013 02:22
Resposta

Swetha Surendran

Ranking: Junior Member

Mensagens: 32

Data de entrada: 1 de Março de 2013

Mensagens recentes

Yes yes, now its working fine.. Thank you so much Jitendra ans subhash...