留言板

JSF portlet - /*. Please define a different url-pattern.

thumbnail
ilke Muhtaroglu,修改在13 年前。

JSF portlet - /*. Please define a different url-pattern.

Regular Member 帖子: 226 加入日期: 09-5-12 最近的帖子
Hi,

after generating a JSF portlet, I can view a page, but when I am about to go to a next page. I get this error." /*. Please define a different url-pattern."

this is what I have at deployed portlets web.xml :


	<servlet>
		<servlet-name>Faces Servlet</servlet-name>
		<servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
		<load-on-startup>1</load-on-startup>
	</servlet>
	<servlet>
		<servlet-name>phoneBookAdmin</servlet-name>
		<servlet-class>com.liferay.portal.kernel.servlet.PortletServlet</servlet-class>
		<init-param>
			<param-name>portlet-class</param-name>
			<param-value>org.portletfaces.bridge.GenericFacesPortlet</param-value>
		</init-param>
		<load-on-startup>0</load-on-startup>
	</servlet>
	<servlet-mapping>
		<servlet-name>phoneBookAdmin</servlet-name>
		<url-pattern>/phoneBookAdmin/*</url-pattern>
	</servlet-mapping>










06:00:45,422 ERROR [jsp:154] javax.faces.FacesException: The FacesServlet cannot have a url-pattern of /*.  Please define a different url-pattern.
	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)
	at com.liferay.portlet.FilterChainImpl.doFilter(FilterChainImpl.java:101)
	at com.liferay.portal.kernel.portlet.PortletFilterUtil.doFilter(PortletFilterUtil.java:64)
	at com.liferay.portal.kernel.servlet.PortletServlet.service(PortletServlet.java:92)
	at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
	at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:646)
	at org.apache.catalina.core.ApplicationDispatcher.doInclude(ApplicationDispatcher.java:551)
	at org.apache.catalina.core.ApplicationDispatcher.include(ApplicationDispatcher.java:488)
	at com.liferay.portlet.InvokerPortletImpl.invoke(InvokerPortletImpl.java:638)
	at com.liferay.portlet.InvokerPortletImpl.invokeRender(InvokerPortletImpl.java:723)

thumbnail
Gregory Amerson,修改在13 年前。

RE: JSF portlet - /*. Please define a different url-pattern.

Liferay Legend 帖子: 1123 加入日期: 10-2-16 最近的帖子
Hi ilke,

I'm going to ask our resident JSF expert, Neil, on this one. I'll let you know. *Update* Neil responded below.
thumbnail
Neil Griffin,修改在13 年前。

RE: JSF portlet - /*. Please define a different url-pattern.

Liferay Legend 帖子: 2655 加入日期: 05-7-27 最近的帖子
I've seen this problem reported before but I've never been able to reproduce it. Have you tried restarting your Liferay+Tomcat bundle?
thumbnail
Neil Griffin,修改在13 年前。

RE: JSF portlet - /*. Please define a different url-pattern.

Liferay Legend 帖子: 2655 加入日期: 05-7-27 最近的帖子
A colleague of mine happened to run into this very same error today. It was caused by the absence of a basic WEB-INF/faces-config.xml file in the portlet, like this:


<!--?xml version="1.0" encoding="UTF-8"?-->
<faces-config 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-facesconfig_2_0.xsd" version="2.0">

</faces-config>


One might think that this file is optional with JSF 2.0, but apparently Mojarra has a dependency on the existence of this file for the FaceletViewHandlingStrategy to get instantiated properly.
thumbnail
ilke Muhtaroglu,修改在13 年前。

RE: JSF portlet - /*. Please define a different url-pattern.

Regular Member 帖子: 226 加入日期: 09-5-12 最近的帖子
Hi Neil,

I didnt test properly what you have said but here what is written at the default generated faces-config.xml






<!--?xml version="1.0"?-->
<faces-config version="2.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-facesconfig_2_0.xsd">

</faces-config>




This is very same wtih what you have posted only, <... encoding="UTF-8"?> is missing.

...so faces-config.xml is already available inside the portlet and the header is similar. I will debug more and let you know if I can find anything valuable.

for your information

ilke
thumbnail
Neil Griffin,修改在13 年前。

RE: JSF portlet - /*. Please define a different url-pattern.

Liferay Legend 帖子: 2655 加入日期: 05-7-27 最近的帖子
Are your Facelet views using the .xhtml extension or the .jspx extension? Someone at the portletfaces.org forums recently reported that they were using .jspx and seeing the problem. I think adding the following to web.xml would fix it:

<context-param>
<param-name>javax.faces.FACELETS_VIEW_MAPPINGS</param-name>
<param-value>*.jspx</param-value>
</context-param>


For reference, see:

http://www.portletfaces.org/community/forums/-/message_boards/message/52573#_19_message_52684
fastbob fastbob,修改在12 年前。

RE: JSF portlet - /*. Please define a different url-pattern.

Regular Member 帖子: 221 加入日期: 05-5-16 最近的帖子
I've run into the same exception during the call to "facesLifecycle.render(facesContext);" Unfortunately, adding FACELETS_VIEW_MAPPINGS did not fix things. I am using .xhtml files, not .jspx, but changed the extension in the directive.

Suggestions? Thanks.
thumbnail
Neil Griffin,修改在12 年前。

RE: JSF portlet - /*. Please define a different url-pattern.

Liferay Legend 帖子: 2655 加入日期: 05-7-27 最近的帖子
The only suggestion I can make is that you start with the Example JSF portlet, and then slowly make changes to it, testing often, until it contains the functionality of the portlet you're trying to develop:
http://www.portletfaces.org/projects/portletfaces-bridge/examples/jsf2-portlet
fastbob fastbob,修改在12 年前。

RE: JSF portlet - /*. Please define a different url-pattern.

Regular Member 帖子: 221 加入日期: 05-5-16 最近的帖子
I am starting from a different point. I have a working portlet using ICEFaces 1.8.2 and LR 6.0.6, and trying to make modifications to upgrade to ICEFaces 2.0. It's code that's already been deployed.
thumbnail
Neil Griffin,修改在12 年前。

RE: JSF portlet - /*. Please define a different url-pattern.

Liferay Legend 帖子: 2655 加入日期: 05-7-27 最近的帖子
In that case I would recommend that you checkout the web.xml file from the Example ICEfaces2 compatibility portlet and compare it with the one you're migrating:
http://www.portletfaces.org/projects/portletfaces-bridge/examples/icefaces2-compat-portlet
fastbob fastbob,修改在12 年前。

RE: JSF portlet - /*. Please define a different url-pattern.

Regular Member 帖子: 221 加入日期: 05-5-16 最近的帖子
Thanks, good suggestion. The only problem was that the example had some JBoss-specific configuration, but I worked around that when replacing both web.xml and faces-config.xml with the copies from the example.

Unfortunately, I still get the same exception (in a slightly different place), so I'm unclear what to change in this pretty minimal configuration. Here's the exception:
javax.faces.FacesException: The FacesServlet cannot have a url-pattern of /*.  Please define a different url-pattern.
	at com.sun.faces.application.view.JspViewHandlingStrategy.executePageToBuildView(JspViewHandlingStrategy.java:330)
	at com.sun.faces.application.view.JspViewHandlingStrategy.buildView(JspViewHandlingStrategy.java:154)
	at com.sun.faces.lifecycle.RenderResponsePhase.execute(RenderResponsePhase.java:100)
	at com.sun.faces.lifecycle.Phase.doPhase(Phase.java:101)
	at com.sun.faces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:139)
	at org.portletfaces.bridge.BridgeImpl.doFacesRequest(BridgeImpl.java:327)
	at org.portletfaces.bridge.GenericFacesPortlet.doView(GenericFacesPortlet.java:181)
	at javax.portlet.GenericPortlet.doDispatch(GenericPortlet.java:328)
	at javax.portlet.GenericPortlet.render(GenericPortlet.java:233)
	at com.liferay.portlet.FilterChainImpl.doFilter(FilterChainImpl.java:101)
...

I'm still open to suggestions, since these configuration files are about as simple or as unchanged as I can make them.

web.xml:
<!--?xml version="1.0" encoding="UTF-8"?-->

<web-app xmlns="http://java.sun.com/xml/ns/j2ee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemalocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd" version="2.4">

	<!-- Instruct JBoss AS to look for the JSF implementation within the portlet WAR. -->
	<context-param>
		<param-name>org.jboss.jbossfaces.WAR_BUNDLES_JSF_IMPL</param-name>
		<param-value>true</param-value>
	</context-param>
	<!-- 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>
	<!-- Instruct Mojarra to utilize JBoss-EL instead of the EL implementation provided by the servlet container. -->
	<!-- COMMENTED OUT
	<context-param>
		<param-name>com.sun.faces.expressionFactory</param-name>
		<param-value>org.jboss.el.ExpressionFactoryImpl</param-value>
	</context-param>
	-->
	<!-- Instruct ICEfaces to abstain from adding a random query parameter to resource URLs (which it does by default -->
	<!-- in order to prevent caching of JavaScript resources like bridge.js in a servlet-based webapp). -->
	<context-param>
		<param-name>org.icefaces.uniqueResourceURLs</param-name>
		<param-value>false</param-value>
	</context-param>
	<!-- The following listener is required for deployment on JBoss AS. See BRIDGE-183 for more info. -->
	<listener>
		<listener-class>com.sun.faces.config.ConfigureListener</listener-class>
	</listener>
	<!-- Although the FacesServlet will not be invoked by any portlet requests, it is required to initialize JSF. -->
	<servlet>
		<servlet-name>Faces Servlet</servlet-name>
		<servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
		<load-on-startup>1</load-on-startup>
	</servlet>
	<!-- BEGIN: Compatibility with ICEfaces 1.8 components -->
	<servlet>
		<servlet-name>Resource Servlet</servlet-name>
		<servlet-class>com.icesoft.faces.webapp.CompatResourceServlet</servlet-class>
		<load-on-startup>1</load-on-startup>
	</servlet>
	<servlet-mapping>
		<servlet-name>Resource Servlet</servlet-name>
		<url-pattern>/xmlhttp/*</url-pattern>
	</servlet-mapping>
	<servlet-mapping>
		<servlet-name>Faces Servlet</servlet-name>
		<url-pattern>/icefaces/*</url-pattern>
	</servlet-mapping>
	<!-- END: Compatibility with ICEfaces 1.8 components -->
	<!-- Setup the mail session so that it can be shared by the portlet WAR. -->
	<resource-ref>
		<res-ref-name>mail/MailSession</res-ref-name>
		<res-type>javax.mail.Session</res-type>
		<res-auth>Container</res-auth>
		<res-sharing-scope>Shareable</res-sharing-scope>
	</resource-ref>
	<!-- 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>

faces-config.xml:
<!--?xml version="1.0" encoding="UTF-8"?-->
<faces-config 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-facesconfig_2_0.xsd" version="2.0">

 <managed-bean>
  <managed-bean-name>Bean1</managed-bean-name>
  <managed-bean-class>com.something.Bean</managed-bean-class>
  <managed-bean-scope>request</managed-bean-scope>
 </managed-bean>
 <application>
  <message-bundle>content.labels</message-bundle>
 </application>
</faces-config>
fastbob fastbob,修改在12 年前。

RE: JSF portlet - /*. Please define a different url-pattern.

Regular Member 帖子: 221 加入日期: 05-5-16 最近的帖子
Did a bit more research, and there are only two places that throw this exception (context is FacesContext):
        if ("/*".equals(RequestStateManager.get(context, RequestStateManager.INVOCATION_PATH))) {
            throw new FacesException(MessageUtils.getExceptionMessageString(
                  MessageUtils.FACES_SERVLET_MAPPING_INCORRECT_ID));
        }
It's not clear to me how or why this would get set.

Also seeing the following message in the log:
Apr 30, 2011 10:27:00 PM javax.faces.FactoryFinder$FactoryManagerCacheKey <init>
WARNING: Multiple JSF Applications found on same ClassLoader.  Unable to safely determine which FactoryManager instance to use. Defaulting to first match.
</init>
thumbnail
Jörn Kolberg,修改在12 年前。

RE: JSF portlet - /*. Please define a different url-pattern.

New Member 帖子: 6 加入日期: 11-5-26 最近的帖子
Hi there,
have you ever managed to solve the problem? We are running into the same hassle with Weblogic 10.3.3 and Liferay 5.2.8.
Any solutions? All I can offer is the following log entry :-)

WARNING: Multiple JSF Applications found on same ClassLoader. Unable to safely determine which FactoryManager instance to use. Defaulting to first match.
May 26, 2011 2:50:59 PM javax.faces.FactoryFinder$FactoryManagerCacheKey <init>
WARNING: Multiple JSF Applications found on same ClassLoader. Unable to safely determine which FactoryManager instance to use. Defaulting to first match.
14:50:59,785 ERROR [jsp:157] javax.faces.FacesException: The FacesServlet cannot have a url-pattern of /*. Please define a different url-pattern.
at com.sun.faces.application.view.JspViewHandlingStrategy.executePageToBuildView(JspViewHandlingStrategy.java:330)
at com.sun.faces.application.view.JspViewHandlingStrategy.buildView(JspViewHandlingStrategy.java:154)
at com.sun.faces.lifecycle.RenderResponsePhase.execute(RenderResponsePhase.java:100)
at com.sun.faces.lifecycle.Phase.doPhase(Phase.java:101)
at com.sun.faces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:139)
at org.portletfaces.bridge.BridgeImpl.doFacesRequest(BridgeImpl.java:422)
at org.portletfaces.bridge.GenericFacesPortlet.doView(GenericFacesPortlet.java:182)
at javax.portlet.GenericPortlet.doDispatch(GenericPortlet.java:328)
at javax.portlet.GenericPortlet.render(GenericPortlet.java:233)
at com.liferay.portlet.FilterChainImpl.doFilter(FilterChainImpl.java:103)
at com.liferay.portal.kernel.portlet.PortletFilterUtil.doFilter(PortletFilterUtil.java:66)
at com.liferay.portal.kernel.servlet.PortletServlet.service(PortletServlet.java:91)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:821)
at weblogic.servlet.internal.StubSecurityHelper$ServletServiceAction.run(StubSecurityHelper.java:227)
at weblogic.servlet.internal.StubSecurityHelper.invokeServlet(StubSecurityHelper.java:125)
at weblogic.servlet.internal.ServletStubImpl.execute(ServletStubImpl.java:300)
at weblogic.servlet.internal.TailFilter.doFilter(TailFilter.java:27)
at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:57)
at weblogic.servlet.internal.RequestEventsFilter.doFilter(RequestEventsFilter.java:27)
at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:57)


Cheers, Jörn
fastbob fastbob,修改在12 年前。

RE: JSF portlet - /*. Please define a different url-pattern.

Regular Member 帖子: 221 加入日期: 05-5-16 最近的帖子
Unfortunately, no. All I ever get out of the experts is try this example; no, try this one instead. I've looked at every one, to no avail.

I've been developing software for a long time and I'm not particularly dense (I adopt many new technologies each year), but this has been one of the more frustrating exercises in my career. Great, people who wrote some of the software can write examples that work. Others not close to the UI/portal/bridge projects (like me) run into these sorts of weird errors.

Whenever I adopt a technology there is tradeoff between learning/deploying the technology and getting the real work done (developing the application). If things aren't working with a technology, there comes a point where you have to decide whether to invest more time and effort into the current solution or investigate an entirely different approach. I'm about at that point.
thumbnail
Luke McLean,修改在12 年前。

RE: JSF portlet - /*. Please define a different url-pattern.

Junior Member 帖子: 46 加入日期: 07-8-16 最近的帖子
I had this problem and it took me a day to solve.

The problem is that I was still referencing the portlet in the portlet.xml like this:

<portlet>
<portlet-name>composite_portlet</portlet-name>
<display-name>Composite Portlet</display-name>
<portlet-class>org.portletfaces.bridge.GenericFacesPortlet</portlet-class>
<init-param>
<name>javax.portlet.faces.defaultViewId.view</name>
<value>/xhtml/portlet/composite/main.iface</value>
</init-param>
<init-param>
<name>javax.portlet.faces.defaultViewId.edit</name>
<value>/xhtml/portlet/composite/config.iface</value>
</init-param>
.... etc

I changed it to refer to the file with the xhtml extension and the error went away... I tried everything else I could find on the internet and NOTHING else worked (all dead ends)

<portlet>
<portlet-name>composite_portlet</portlet-name>
<display-name>Composite Portlet</display-name>
<portlet-class>org.portletfaces.bridge.GenericFacesPortlet</portlet-class>
<init-param>
<name>javax.portlet.faces.defaultViewId.view</name>
<value>/xhtml/portlet/composite/main.xhtml</value>
</init-param>
<init-param>
<name>javax.portlet.faces.defaultViewId.edit</name>
<value>/xhtml/portlet/composite/config.xhtml</value>
</init-param>
.... etc
fastbob fastbob,修改在12 年前。

RE: JSF portlet - /*. Please define a different url-pattern.

Regular Member 帖子: 221 加入日期: 05-5-16 最近的帖子
After several months on other tasks I created an entirely new portlet from scratch using JSF 2.0, no other libraries (no ICEFaces), and the minimal faces-config.xml as above, I ran into exactly this same error.

Changing the extension to .xhtml fixed the problem.

Thanks a million, Luke!
Sergio Andres Valdez Valdez,修改在12 年前。

RE: JSF portlet - /*. Please define a different url-pattern.

New Member 帖子: 5 加入日期: 11-4-12 最近的帖子
This was the solution for me, thanks a lot.
thumbnail
William Gosse,修改在12 年前。

RE: JSF portlet - /*. Please define a different url-pattern.

Liferay Master 帖子: 533 加入日期: 10-7-4 最近的帖子
The problem is caused by the fact the portlet.xml entry for the portlet that is generated when the project is originally created seems to be incorrect.
This original entry looks something like this:
<portlet>
<portlet-name>icetest3</portlet-name>
<display-name>Icetest3</display-name>
<portlet-class>org.portletfaces.bridge.GenericFacesPortlet</portlet-class>
<init-param>
<name>view-template</name>
<value>/xhtml/portletViewMode.xhtml</value>
</init-param>
...

Changing the name of the init-param to be the following corrects the issue:
<portlet>
<portlet-name>icetest3</portlet-name>
<display-name>Icetest3</display-name>
<portlet-class>org.portletfaces.bridge.GenericFacesPortlet</portlet-class>
<init-param>
<name>javax.portlet.faces.defaultViewId.view</name>
<value>/xhtml/portletViewMode.xhtml</value>
</init-param>
...

This is why subsequent JSF portlets added to the project work correctly when deployed. Their init-parm name element is being correctly set to javax.portlet.faces.defaultViewId.view.
thumbnail
Neil Griffin,修改在12 年前。

RE: JSF portlet - /*. Please define a different url-pattern.

Liferay Legend 帖子: 2655 加入日期: 05-7-27 最近的帖子
The view-template problem might be an indicator of a bug in the Liferay Plugins SDK for newly created JSF portlets. See LPS-25140
thumbnail
William Gosse,修改在12 年前。

RE: JSF portlet - /*. Please define a different url-pattern.

Liferay Master 帖子: 533 加入日期: 10-7-4 最近的帖子
Again adding a new jsf portlet to an existing jsf porlet project sets the init-param name to javax.portlet.faces.defaultViewId.view. So are you saying that this is not fully correct as well?
thumbnail
Neil Griffin,修改在12 年前。

RE: JSF portlet - /*. Please define a different url-pattern.

Liferay Legend 帖子: 2655 加入日期: 05-7-27 最近的帖子
javax.portlet.faces.defaultViewId.view is correct
thumbnail
Debasis Padhi,修改在11 年前。

RE: JSF portlet - /*. Please define a different url-pattern.

Junior Member 帖子: 54 加入日期: 12-3-23 最近的帖子
Thanks This is the exact solution ....
I did the change in my portlet.xml file
inside the <init-param>
the name parameter should be
<name>javax.portlet.faces.defaultViewId.view</name>
thumbnail
Neil Griffin,修改在11 年前。

Moved thread to Liferay Faces forum category

Liferay Legend 帖子: 2655 加入日期: 05-7-27 最近的帖子
Moved thread to Liferay Faces forum category