Bug 903177 - Seam2.3 localization settings via component.xml doesn't work
Summary: Seam2.3 localization settings via component.xml doesn't work
Keywords:
Status: CLOSED INSUFFICIENT_DATA
Alias: None
Product: JBoss Enterprise WFK Platform 2
Classification: Retired
Component: Seam
Version: 2.2.0
Hardware: Unspecified
OS: Unspecified
unspecified
medium
Target Milestone: ---
: 2.4.0
Assignee: Marek Novotny
QA Contact: Marek Schmidt
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2013-01-23 12:04 UTC by Tomas Remes
Modified: 2013-07-22 13:21 UTC (History)
4 users (show)

Fixed In Version:
Clone Of:
Environment:
Last Closed: 2013-07-22 13:21:51 UTC
Type: Bug
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Red Hat Issue Tracker JBSEAM-5086 0 Major Closed localization settings via component.xml doesn't work 2013-11-25 10:52:35 UTC
Red Hat Issue Tracker WFK2-95 0 Major New Seam2.3 localization settings via component.xml doesn't work 2013-11-25 10:52:32 UTC

Description Tomas Remes 2013-01-23 12:04:33 UTC
Description of problem:

Adding following snippet to components.xml does not work as expected:

<inter:locale-config default-locale="cs" supported-locales="en cs"/>

And it produces following message in server log after application deployment:

"SEVERE [javax.faces] (MSC service thread 1-2) Application was not properly initialized at startup, could not find Factory: javax.faces.application.ApplicationFactory. Attempting to find backup."

Steps to Reproduce:
1. You can alter booking example to use more messages bundles.
2. Create copy of messages.properties named e.g messages_cs.properties
3. Rename original messages.properties to messages_en.properties
4. Add mentioned snippet to components.xml
5. Build app and deploy (don't forget to check you browser language settings, I used FF)

If you check class org.jboss.seam.international.LocaleConfig.java and its initLocaleConfig() method, then you'll notice that application variable resolves always to null in this case, therefore the locales are never set correctly. 
 
Workaround:

Add com.sun.faces.config.ConfigureListener to web.xml before org.jboss.seam.servlet.SeamListener. You can see https://issues.jboss.org/browse/JBSEAM-4401

Comment 1 Sneha 2013-03-25 08:44:14 UTC
Doc text updated.

Comment 3 Tomas Remes 2013-04-11 08:47:42 UTC
This isn't just the case of testsuite or test. This is the case of every Seam application using localization configuration in components.xml. Hence the doc text should be changed e.g to:

"When locale-config configuration is used in the Seam application, the following error message is shown in the server container log:

SEVERE [javax.faces] (MSC service thread 1-2) Application was not properly initialized at startup, could not find Factory: javax.faces.application.ApplicationFactory. Attempting to find backup.

As a consequence, locale-config configuration is not taken into account in the application. This issue can be worked around by using the com.sun.faces.config.ConfigureListener configuration in the application's web.xml file. As a result of the workaround, the locale configuration works as expected."

Comment 4 Petr Penicka 2013-04-17 22:39:10 UTC
Edited release note and inserted it into the 2.2.0 RN book.

Docs stage URL: https://documentation-devel.engineering.redhat.com/docs/en-US/JBoss_Web_Framework_Kit/2.2/html-single/2.2.0_Release_Notes/index.html

Build: JBoss_Web_Framework_Kit-2.2.0_Release_Notes-2.2-en-US-0-23

Comment 5 Marek Novotny 2013-04-18 13:42:15 UTC
Real issue here is the order of Mojarra initialization in WAR. Everytime you see the following error message
"SEVERE [javax.faces] (MSC service thread 1-2) Application was not properly initialized at startup, could not find Factory: javax.faces.application.ApplicationFactory. Attempting to find backup."

you are experiencing different order of applicaiton initialization than Seam and your web application will expect. If correct order is processed you couldn't see that error at all. Correct order is when Mojarra is initialized before Seam is processing configuration. The only working way now is to specify com.sun.faces.config.ConfigureListener in web.xml before org.jboss.seam.servlet.SeamListener configuration to strictly get such order AFAIK.

Comment 6 JBoss JIRA Server 2013-04-19 08:36:28 UTC
Marek Novotny <mnovotny> updated the status of jira JBSEAM-5086 to Closed

Comment 7 JBoss JIRA Server 2013-04-19 08:36:28 UTC
Marek Novotny <mnovotny> made a comment on jira JBSEAM-5086

I marked it as Deferred, because order of WAR initialization is not in Seam full competences, but rather application or container competences.

The scanning order of WAR from application point of view can be managed only in web.xml. Loading of the listener _com.sun.faces.config.ConfigureListener_ is done from existence of the Tag Library Definition in WAR or from the _javax.servlet.ServletContainerInitializer_. 

Adding _com.sun.faces.config.ConfigureListener_ before _org.jboss.seam.SeamListener_ is just emphasing that we need to have initialized Mojarra before we do Seam initialization, because there are Seam components which rely on initialized JSF environment.


Note You need to log in before you can comment on or make changes to this bug.