Fórum

Exception calling simple portlet using portletfaces bridge

Mark Wilson, modificado 13 Anos atrás.

Exception calling simple portlet using portletfaces bridge

New Member Postagens: 4 Data de Entrada: 06/01/11 Postagens Recentes
Hi,
I´m new to liferay...

Trying to get a simple jsf 2.0 app working in a portlet using the portletfaces bridge.

I get the following exception when I try to add the portlet to the liferay sample site:

An Error Occurred:

Das FacesServlet kann kein url-pattern von /* haben. Geben Sie ein anderes url-pattern an.

-> english:
FacesServlet is not allowed to have /* as an url-pattern. Please use a different pattern.

Stacktrace:

javax.faces.FacesException: Das FacesServlet kann kein url-pattern von /* haben.  Geben Sie ein anderes url-pattern an.
	at com.sun.faces.application.view.JspViewHandlingStrategy.executePageToBuildView(JspViewHandlingStrategy.java:325)
	at com.sun.faces.application.view.JspViewHandlingStrategy.buildView(JspViewHandlingStrategy.java:150)
	at com.sun.faces.lifecycle.RenderResponsePhase.execute(RenderResponsePhase.java:96)
	at com.sun.faces.lifecycle.Phase.doPhase(Phase.java:97)
	at com.sun.faces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:135)
	at org.portletfaces.bridge.BridgeImpl.doFacesRequest(BridgeImpl.java:241)
	at org.portletfaces.bridge.GenericFacesPortlet.doView(GenericFacesPortlet.java:194)
	at javax.portlet.GenericPortlet.doDispatch(GenericPortlet.java:328)
	at javax.portlet.GenericPortlet.render(GenericPortlet.java:233)
.....


web.xml:

<!--?xml version="1.0" encoding="UTF-8"?-->
<web-app version="3.0" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemalocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd">
    <!-- Set the JSF 2 PROJECT_STAGE to Development so that the JSF implementation will do the following at runtime: -->
    <!-- 1. Log more verbose messages. -->
    <!-- 2. Render tips and/or warnings in the view markup. -->
    <!-- 3. Cause the default ExceptionHandler to display a developer-friendly error page. -->
    <context-param>
        <param-name>javax.faces.PROJECT_STAGE</param-name>
        <param-value>Development</param-value>
    </context-param>
    <servlet>
        <servlet-name>Faces Servlet</servlet-name>
        <servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
        <load-on-startup>1</load-on-startup>
    </servlet>

    <servlet-mapping>
        <servlet-name>Faces Servlet</servlet-name>
        <url-pattern>*.jsf</url-pattern>
    </servlet-mapping>

	<!-- Prevent direct access to Facelet view XHTML by the userAgent (browser). -->
    <security-constraint>
        <web-resource-collection>
            <web-resource-name>Facelet View XHTML</web-resource-name>
            <url-pattern>*.xhtml</url-pattern>
        </web-resource-collection>
        <auth-constraint>
            <role-name>nobody</role-name>
        </auth-constraint>
    </security-constraint>
    <security-role>
        <role-name>nobody</role-name>
    </security-role>
</web-app>


I´ve tried all kinds of url-patterns (/faces, /faces/*) and as in the examples from portletfaces bridge I left out the servlet-mapping tag.

portlet.xml:

<!--?xml version="1.0" encoding="UTF-8"?-->
<portlet-app xmlns="http://java.sun.com/xml/ns/portlet/portlet-app_1_0.xsd" version="1.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemalocation="http://java.sun.com/xml/ns/portlet/portlet-app_1_0.xsd http://java.sun.com/xml/ns/portlet/portlet-app_1_0.xsd">
  <portlet>
    <portlet-name>WeightlessRegistration</portlet-name>
    <portlet-class>org.portletfaces.bridge.GenericFacesPortlet</portlet-class>
    <init-param>
      <name>javax.portlet.faces.defaultViewId.view</name>
      <value>/index.xhtml</value>
    </init-param>
    <supports>
      <mime-type>text/html</mime-type>
      <portlet-mode>edit</portlet-mode>
      <portlet-mode>view</portlet-mode>
      <portlet-mode>help</portlet-mode>
    </supports>
    <supported-locale>en</supported-locale>
    <portlet-info>
      <title>WeightlessRegistration</title>
      <short-title>WeightlessRegistration</short-title>
    </portlet-info>
  </portlet>
</portlet-app>


I would be really grateful for any help - just need a kick-off..

Thanks for any help.
Greetings from Germany,
Mark
Mark Wilson, modificado 13 Anos atrás.

RE: Exception calling simple portlet

New Member Postagens: 4 Data de Entrada: 06/01/11 Postagens Recentes
Hi,
hmm - seems as if portletfaces bridge requires a faces-config.xml.
The simple JSF 2.0 app I implemented uses the return value of the action method from the backing bean for page navigation.

I assumed JSF 2.0 does not need a faces-config.xml - is that correct?

Greetings,
Mark
Mark Wilson, modificado 13 Anos atrás.

RE: Exception calling simple portlet

New Member Postagens: 4 Data de Entrada: 06/01/11 Postagens Recentes
Hi,
this is a bug in the portletfaces bridge:
Link to forum message on portletfaces.org

Hope this is of help to someone...

Greetings,
Mark