9 Replies Latest reply on May 7, 2009 6:28 AM by nbelaevski

    Error: 'A4J' is undefined

    hferreira25

      Hi,

      I'm working with WebSphere AS + RichFaces.

      I copy the source code from the livedemo exadel page.

      When I add a4j elements the browser shows the following error:
      Error: 'A4J' is undefined

      The RichFaces libs are in the class path the a4j is in the xmlns.

      Can you help me to what's the possible problem?

      Thanks in Advance

        • 1. Re: Error: 'A4J' is undefined
          ilya_shaikovsky

          describe environment more carefully.

          • 2. Re: Error: 'A4J' is undefined
            hferreira25

            Hi,

            The Application Server: IBM WebSphere Application Server V7.0.
            I'm creating a WAR file where I want to user RichFaces.
            The RichFaces version is 3.3.0 (last version that I get from the JBoss.org).

            I follow the instructions described in the RichFaces PDF, and I know they are working because if the widgets I use are only the namespace <rich: it works ok.

            I also created a simple JSF page with the following code

            <rich:panel header="Simple Echo">
            <h:inputText size="50" value="#{user.text}">
            <a4j:support event="onkeyup" reRender="rep" />
            </h:inputText>
            <h:outputText value="#{user.text}" id="rep" />
            </rich:panel>

            When I open this pages and in the onkeyup event instant the browser shows the bug.

            Thanks



            • 3. Re: Error: 'A4J' is undefined
              ilya_shaikovsky

              show please web.xml and also paste full page code.

              • 4. Re: Error: 'A4J' is undefined
                hferreira25

                web.xml

                <?xml version="1.0" encoding="UTF-8"?>
                <web-app version="2.5" 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_2_5.xsd">
                <context-param>
                <param-name>com.sun.faces.verifyObjects</param-name>
                <param-value>true</param-value>
                </context-param>
                <context-param>
                <param-name>com.sun.faces.validateXml</param-name>
                <param-value>true</param-value>
                </context-param>
                <context-param>
                <param-name>javax.faces.DEFAULT_SUFFIX</param-name>
                <param-value>.xhtml</param-value>
                </context-param>
                <context-param>
                <param-name>facelets.DEVELOPMENT</param-name>
                <param-value>false</param-value>
                </context-param>
                <context-param>
                <param-name>facelets.SKIP_COMMENTS</param-name>
                <param-value>true</param-value>
                </context-param>
                <context-param>
                <param-name>org.richfaces.SKIN</param-name>
                <param-value>classic</param-value>
                </context-param>
                <context-param>
                <param-name>org.ajax4jsf.VIEW_HANDLERS</param-name>
                <param-value>com.sun.facelets.FaceletViewHandler</param-value>
                </context-param>
                <context-param>
                <param-name>javax.faces.STATE_SAVING_METHOD</param-name>
                <param-value>server</param-value>
                </context-param>
                <context-param>
                <param-name>javax.faces.CONFIG_FILES</param-name>
                <param-value>/WEB-INF/faces-config.xml</param-value>
                </context-param>
                <context-param>
                <param-name>com.ibm.ws.jsf.JSP_UPDATE_CHECK</param-name>
                <param-value>true</param-value>
                </context-param>
                <context-param>
                <param-name>com.ibm.ws.jsf.LOAD_FACES_CONFIG_AT_STARTUP</param-name>
                <param-value>true</param-value>
                </context-param>

                <display-name>RichFaces Filter</display-name>
                <filter-name>richfaces</filter-name>
                <filter-class>org.ajax4jsf.Filter</filter-class>

                <filter-mapping>
                <filter-name>richfaces</filter-name>
                <servlet-name>Faces Servlet</servlet-name>
                REQUEST
                FORWARD
                INCLUDE
                </filter-mapping>

                <listener-class>com.sun.faces.config.ConfigureListener</listener-class>


                <servlet-name>Faces Servlet</servlet-name>
                <servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
                <load-on-startup>1</load-on-startup>

                <servlet-mapping>
                <servlet-name>Faces Servlet</servlet-name>
                <url-pattern>
                *.faces</url-pattern>
                </servlet-mapping>
                <servlet-mapping>
                <servlet-name>Faces Servlet</servlet-name>
                <url-pattern>*.jsf</url-pattern>
                <url-pattern>
                /faces/*</url-pattern>
                </servlet-mapping>
                <welcome-file-list>
                <welcome-file>
                index.html
                </welcome-file>
                </welcome-file-list>
                </web-app>



                The page:
                <?xml version='1.0' encoding='UTF-8' ?>
                <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
                "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
                <html xmlns="http://www.w3.org/1999/xhtml"
                xmlns:ui="http://java.sun.com/jsf/facelets"
                xmlns:f="http://java.sun.com/jsf/core"
                xmlns:h="http://java.sun.com/jsf/html"
                xmlns:a4j="http://richfaces.org/a4j"
                xmlns:rich="http://richfaces.org/rich">



                <f:view>


                <h:form method="post">
                Hello World!!!!!!!!!!!!!

                <rich:panel header="Simple Echo">
                <h:inputText size="50" value="#{user.text}">
                <a4j:support event="onkeyup" reRender="rep" />
                </h:inputText>
                <h:outputText value="#{user.text}" id="rep" />
                </rich:panel>

                </h:form>

                </f:view>

                • 5. Re: Error: 'A4J' is undefined
                  ilya_shaikovsky

                  and b.t.w. which JSF implementation used?

                  • 6. Re: Error: 'A4J' is undefined
                    hferreira25

                    JSF 1.2 RI from SUN

                    • 7. Re: Error: 'A4J' is undefined
                      ilya_shaikovsky

                      you should not use two url-pattern in one servlet mapping defenition. define two mappings.

                      • 8. Re: Error: 'A4J' is undefined
                        hferreira25


                        Hi,

                        Apparently it solved the problem, I don't understand why, but it works now.

                        Thanks for your help.

                        • 9. Re: Error: 'A4J' is undefined
                          nbelaevski

                          Your initial file was not correct according to schema, that's why it was incorrectly parsed causing the issue.