13 Replies Latest reply on Oct 10, 2007 4:12 PM by paulovittor23

    Captcha image doesn't appear =(

    paulovittor23

      Hi, Im trying to implement an exeample using the captcha feature but I'm getting a blank image when I run my application...
      I think it's because the element "captcha" from the #{captcha.id} are null or something like that...
      Reading the documentation I saw that I need to register the module captcha in the application.xml file, but this file does'nt exists in my seam app =(
      It's really necessary ? Should I create it ?
      The captcha servlet is declared at web.xml correctely, like above:


      <servlet>
      <servlet-name>Seam Resource Servlet</servlet-name>
      <servlet-class>org.jboss.seam.servlet.ResourceServlet</servlet-class>
      </servlet>

      <servlet-mapping>
      <servlet-name>Seam Resource Servlet</servlet-name>
      <url-pattern>/seam/resource/*</url-pattern>
      </servlet-mapping>

      And in the login page I added the folling code:

      <div>
      <h:graphicImage value="/seam/resource/captcha?#{captcha.id}"/>
      </div>

      <div>
      <h:outputLabel for="verifyCaptcha">Enter the above letters</h:outputLabel>
      <h:inputText id="verifyCaptcha" value="#{captcha.response}" required="true"/>
      <div class="validationError"><h:message for="verifyCaptcha"/></div>
      </div>

      Someone knows what it could be ?
      I appreciate your attention =)

      []s
      Paulo Vitor
      São Paulo, Brazil

        • 1. Re: Captcha image doesn't appear =(
          dhinojosa

          I had the same issue....then I looked in my lib and didn't have the jcaptcha jar, and had to put it in there.

          I don't know if that is your issue, but just thought I'd offer that up.

          • 2. Re: Captcha image doesn't appear =(
            shane.bryzak

            Do you get the following line in your log when your application deploys?

            12:11:15,750 INFO [Contexts] starting up: org.jboss.seam.captcha.captchaImage


            • 3. Re: Captcha image doesn't appear =(
              paulovittor23

              Thanks for the replies and for understand my poor English, I'm studying it yet =)

              I had the same issue....then I looked in my lib and didn't have the jcaptcha jar, and had to put it in there.

              I don't know if that is your issue, but just thought I'd offer that up.


              I searched for tha captcha jar inside my lib directory and it's there...


              Do you get the following line in your log when your application deploys?

              Code:

              12:11:15,750 INFO [Contexts] starting up: org.jboss.seam.captcha.captchaImage


              No, this line not appear when I deploy my app, theres something wrong ?

              Thanks again =)

              • 4. Re: Captcha image doesn't appear =(
                paulovittor23

                anyone ?

                • 5. Re: Captcha image doesn't appear =(
                  pmuir

                  The jcaptcha component isn't starting, probably you don't have the jcaptcha jar in the ear classpath of your deployed applicaiton

                  • 6. Re: Captcha image doesn't appear =(
                    paulovittor23

                    The jcaptcha jar is inside my app's lib directory...I searched the jar inside my war, and it's there too..( I'm not working with EJB =) )

                    • 7. Re: Captcha image doesn't appear =(
                      pmuir

                      The only reason it won't install is because of the missing dependency.

                      • 8. Re: Captcha image doesn't appear =(
                        paulovittor23

                        ok, I'll check it better in a few minutes and post the results...
                        only one more thing...when I access my app for the first time I receive these messages from the console...

                        10:09:19,916 INFO [Server] JBoss (MX MicroKernel) [4.0.5.GA (build: CVSTag=Branch_4_0 date=200610162339)] Started in 55s:906ms
                        10:09:26,650 INFO [ServletCacheAdministrator] Created new instance of ServletCacheAdministrator
                        10:09:26,650 INFO [ServletCacheAdministrator] Created new application-scoped cache at key: __oscache_cache
                        10:09:26,853 INFO [Lifecycle] starting up: org.jboss.seam.security.identity
                        10:09:29,010 ERROR [STDERR] 10/10/2007 10:09:28 com.sun.facelets.compiler.TagLibraryConfig loadImplicit
                        INFO: Added Library from: jar:file:/D:/java/server/jboss-4.0.5.GA_EJB/server/default/./tmp/deploy/tmp8942jprounidademedida-exp.war/WEB-INF/lib/jboss-seam-pdf.jar!/META-INF/seam-pdf.taglib.xml
                        10:09:29,119 ERROR [STDERR] 10/10/2007 10:09:29 com.sun.facelets.compiler.TagLibraryConfig loadImplicit
                        INFO: Added Library from: jar:file:/D:/java/server/jboss-4.0.5.GA_EJB/server/default/./tmp/deploy/tmp8942jprounidademedida-exp.war/WEB-INF/lib/richfaces-3.0.1-SNAPSHOT.jar!/META-INF/rich.taglib.xml
                        10:09:29,166 ERROR [STDERR] 10/10/2007 10:09:29 com.sun.facelets.compiler.TagLibraryConfig loadImplicit
                        INFO: Added Library from: jar:file:/D:/java/server/jboss-4.0.5.GA_EJB/server/default/./tmp/deploy/tmp8942jprounidademedida-exp.war/WEB-INF/lib/jsf-facelets.jar!/META-INF/jsf-ui.taglib.xml
                        10:09:29,213 ERROR [STDERR] 10/10/2007 10:09:29 com.sun.facelets.compiler.TagLibraryConfig loadImplicit
                        INFO: Added Library from: jar:file:/D:/java/server/jboss-4.0.5.GA_EJB/server/default/./tmp/deploy/tmp8942jprounidademedida-exp.war/WEB-INF/lib/ajax4jsf-1.1.1-SNAPSHOT.jar!/META-INF/a4j.taglib.xml
                        10:09:29,228 ERROR [STDERR] 10/10/2007 10:09:29 com.sun.facelets.compiler.TagLibraryConfig loadImplicit
                        INFO: Added Library from: jar:file:/D:/java/server/jboss-4.0.5.GA_EJB/server/default/./tmp/deploy/tmp8942jprounidademedida-exp.war/WEB-INF/lib/jsf-facelets.jar!/META-INF/jsf-html.taglib.xml
                        10:09:29,244 ERROR [STDERR] 10/10/2007 10:09:29 com.sun.facelets.compiler.TagLibraryConfig loadImplicit
                        INFO: Added Library from: jar:file:/D:/java/server/jboss-4.0.5.GA_EJB/server/default/./tmp/deploy/tmp8942jprounidademedida-exp.war/WEB-INF/lib/jboss-seam-ui.jar!/META-INF/seam-ui.taglib.xml
                        10:09:29,947 ERROR [STDERR] 10/10/2007 10:09:29 com.sun.facelets.compiler.TagLibraryConfig loadImplicit
                        INFO: Added Library from: jar:file:/D:/java/server/jboss-4.0.5.GA_EJB/server/default/./tmp/deploy/tmp8942jprounidademedida-exp.war/WEB-INF/lib/jsf-facelets.jar!/META-INF/jsf-core.taglib.xml
                        10:09:29,978 ERROR [STDERR] 10/10/2007 10:09:29 com.sun.facelets.compiler.TagLibraryConfig loadImplicit
                        INFO: Added Library from: jar:file:/D:/java/server/jboss-4.0.5.GA_EJB/server/default/./tmp/deploy/tmp8942jprounidademedida-exp.war/WEB-INF/lib/jsf-facelets.jar!/META-INF/jstl-core.taglib.xml
                        10:09:29,978 ERROR [STDERR] 10/10/2007 10:09:29 com.sun.facelets.compiler.TagLibraryConfig loadImplicit
                        INFO: Added Library from: jar:file:/D:/java/server/jboss-4.0.5.GA_EJB/server/default/./tmp/deploy/tmp8942jprounidademedida-exp.war/WEB-INF/lib/jboss-seam-mail.jar!/META-INF/seam-mail.taglib.xml
                        10:09:29,994 ERROR [STDERR] 10/10/2007 10:09:29 com.sun.facelets.compiler.TagLibraryConfig loadImplicit
                        INFO: Added Library from: jar:file:/D:/java/server/jboss-4.0.5.GA_EJB/server/default/./tmp/deploy/tmp8942jprounidademedida-exp.war/WEB-INF/lib/jsf-facelets.jar!/META-INF/jstl-fn.taglib.xml
                        10:09:34,072 WARN [HtmlLabelRenderer] Attribute 'for' of label component with id login:_id18 is not defined
                        10:09:34,088 INFO [MyfacesConfig] No context init parameter 'org.apache.myfaces.PRETTY_HTML' found, using default value true
                        10:09:34,088 INFO [MyfacesConfig] No context init parameter 'org.apache.myfaces.ALLOW_JAVASCRIPT' found, using default value true
                        10:09:34,088 INFO [MyfacesConfig] Tomahawk jar not available. Autoscrolling, DetectJavascript, AddResourceClass and CheckExtensionsFilter are disabled now.
                        10:09:34,088 WARN [HtmlLabelRenderer] Attribute 'for' of label component with id login:_id20 is not defined


                        but everything is working normally...

                        • 9. Re: Captcha image doesn't appear =(
                          shane.bryzak

                          Can you please describe your packaging.

                          • 10. Re: Captcha image doesn't appear =(
                            paulovittor23

                            Well, I used the seam generator from jboss-seam-1.2.1.GA to create my app...
                            It's using RichFaces 3.0.1, ajax4jsf-1.1.1 and seam 1.2.1.

                            Structure:

                            jars:

                            08/10/2007 12:08 58.225 activation.jar
                            08/10/2007 12:08 1.214.410 ajax4jsf-1.1.1-SNAPSHOT.jar
                            08/10/2007 12:08 5.667 ant-antlr-1.6.5.jar
                            08/10/2007 12:08 9.180 ant-launcher.jar
                            08/10/2007 12:08 421.008 ant-nodeps.jar
                            08/10/2007 12:08 1.034.049 ant.jar
                            08/10/2007 12:08 443.432 antlr-2.7.6.jar
                            08/10/2007 12:08 546.498 antlr-3.0ea8.jar
                            08/10/2007 12:08 188.671 commons-beanutils-1.7.0.jar
                            08/10/2007 12:08 46.725 commons-codec-1.3.jar
                            08/10/2007 12:08 559.366 commons-collections-3.1.jar
                            08/10/2007 12:08 168.446 commons-digester-1.6.jar
                            08/10/2007 12:08 112.341 commons-el-1.0.jar
                            08/10/2007 12:08 36.846 commons-jci-core-1.0-406301.jar
                            08/10/2007 12:08 10.802 commons-jci-janino-2.4.3.jar
                            08/10/2007 12:08 207.723 commons-lang-2.1.jar
                            08/10/2007 12:08 26.202 commons-logging-api-1.0.4.jar
                            08/10/2007 12:08 635.207 drools-compiler-3.0.5.jar
                            08/10/2007 12:08 550.976 drools-core-3.0.5.jar
                            08/10/2007 12:08 29.309 el-api.jar
                            08/10/2007 12:08 99.659 el-ri.jar
                            08/10/2007 12:08 2.574.777 hibernate-all.jar
                            08/10/2007 12:08 1.802.694 itext-2.0.1.jar
                            08/10/2007 12:08 383.546 janino-2.4.3.jar
                            08/10/2007 12:08 50.493 javax.servlet.jsp.jar
                            08/10/2007 12:08 672.720 jboss-aop-jdk50.jar
                            08/10/2007 12:08 706.964 jboss-cache-jdk50.jar
                            08/10/2007 12:08 8.210.655 jboss-ejb3-all.jar
                            08/10/2007 12:08 11.426 jboss-seam-debug.jar
                            08/10/2007 12:08 46.735 jboss-seam-ioc.jar
                            08/10/2007 12:08 21.736 jboss-seam-mail.jar
                            08/10/2007 12:08 48.775 jboss-seam-pdf.jar
                            08/10/2007 12:08 82.422 jboss-seam-remoting.jar
                            08/10/2007 12:08 124.446 jboss-seam-ui.jar
                            08/10/2007 12:08 665.529 jboss-seam.jar
                            08/10/2007 12:08 603.060 jbpm-3.1.4.jar
                            08/10/2007 12:08 420.866 jcaptcha-all-1.0-RC4.jar
                            08/10/2007 12:08 1.821.443 jgroups.jar
                            08/10/2007 12:08 287.090 jsf-facelets.jar
                            08/10/2007 12:08 16.923 jstl-1.1.0.jar
                            10/10/2007 14:21 0 libs.txt
                            08/10/2007 12:08 13.737 mail-ra.jar
                            08/10/2007 12:08 387.690 mail.jar
                            08/10/2007 12:08 249.563 myfaces-api-1.1.4.jar
                            08/10/2007 12:08 524.089 myfaces-impl-1.1.4.jar
                            08/10/2007 12:08 440.483 mysql-connector-java-3.1.11-bin.jar
                            08/10/2007 12:08 124.487 oscache-2.3.2.jar
                            08/10/2007 12:08 16.878 portlet-api-lib.jar
                            08/10/2007 12:08 1.172 readme.txt
                            08/10/2007 12:08 823.367 richfaces-3.0.1-SNAPSHOT.jar
                            08/10/2007 12:08 97.523 servlet-api.jar
                            08/10/2007 12:08 2.665.959 spring.jar
                            08/10/2007 12:08 358.843 stringtemplate-2.3b6.jar
                            08/10/2007 12:08 653.510 testng-4.5.1-jdk15.jar
                            08/10/2007 12:08 4.717.585 thirdparty-all.jar


                            components.xml:

                            <?xml version="1.0" encoding="UTF-8"?>
                            <components xmlns="http://jboss.com/products/seam/components"
                            xmlns:core="http://jboss.com/products/seam/core"
                            xmlns:drools="http://jboss.com/products/seam/drools"
                            xmlns:security="http://jboss.com/products/seam/security"
                            xmlns:mail="http://jboss.com/products/seam/mail"
                            xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
                            xsi:schemaLocation=
                            "http://jboss.com/products/seam/core http://jboss.com/products/seam/core-1.1.xsd
                            http://jboss.com/products/seam/drools http://jboss.com/products/seam/drools-1.1.xsd
                            http://jboss.com/products/seam/security http://jboss.com/products/seam/security-1.1.xsd
                            http://jboss.com/products/seam/mail http://jboss.com/products/seam/mail-1.2.xsd
                            http://jboss.com/products/seam/components http://jboss.com/products/seam/components-1.1.xsd">

                            <core:init debug="@debug@" jndi-pattern="@jndiPattern@"/>

                            <core:manager concurrent-request-timeout="500"
                            conversation-timeout="120000"
                            conversation-id-parameter="cid"
                            conversation-is-long-running-parameter="clr"/>

                            <core:managed-persistence-context name="entityManager"
                            auto-create="true"
                            entity-manager-factory="#{jprounidademedidaEntityManagerFactory}"/>

                            <core:entity-manager-factory name="jprounidademedidaEntityManagerFactory"
                            persistence-unit-name="jprounidademedida"/>

                            <core:ejb installed="@embeddedEjb@"/>

                            <drools:rule-base name="securityRules">
                            <drools:rule-files><value>/security.drl</value></drools:rule-files>
                            </drools:rule-base>

                            <security:identity authenticate-method="#{authenticator.authenticate}"
                            jaas-config-name="sso_user_pass" />

                            <event type="org.jboss.seam.notLoggedIn">
                            <action expression="#{redirect.captureCurrentView}"/>
                            </event>
                            <event type="org.jboss.seam.postAuthenticate">
                            <action expression="#{redirect.returnToCapturedView}"/>
                            </event>

                            <mail:mail-session host="localhost" port="2525" username="test" password="test" />

                            </components>


                            faces-config.xml:

                            <?xml version='1.0' encoding='UTF-8'?>
                            <!DOCTYPE faces-config PUBLIC
                            "-//Sun Microsystems, Inc.//DTD JavaServer Faces Config 1.1//EN"
                            "http://java.sun.com/dtd/web-facesconfig_1_1.dtd">

                            <faces-config>

                            <application>
                            <message-bundle>messages</message-bundle>
                            </application>

                            <!-- Seam transaction management -->
                            <lifecycle>
                            <phase-listener>org.jboss.seam.jsf.TransactionalSeamPhaseListener</phase-listener>
                            </lifecycle>

                            </faces-config>


                            web.xml:

                            <?xml version="1.0" ?>
                            <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">

                            <!-- Ajax4jsf (must come first!) -->

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

                            <filter-mapping>
                            <filter-name>ajax4jsf</filter-name>
                            <url-pattern>*.seam</url-pattern>
                            </filter-mapping>

                            <context-param>
                            <param-name>org.ajax4jsf.VIEW_HANDLERS</param-name>
                            <param-value>org.jboss.seam.ui.facelet.SeamFaceletViewHandler</param-value>
                            </context-param>

                            <context-param>
                            <param-name>org.ajax4jsf.SKIN</param-name>
                            <param-value>blueSky</param-value>
                            </context-param>

                            <!-- Seam -->

                            <listener>
                            <listener-class>org.jboss.seam.servlet.SeamListener</listener-class>
                            </listener>

                            <filter>
                            <filter-name>Seam Filter</filter-name>
                            <filter-class>org.jboss.seam.web.SeamFilter</filter-class>
                            </filter>

                            <filter-mapping>
                            <filter-name>Seam Filter</filter-name>
                            <url-pattern>/*</url-pattern>
                            </filter-mapping>

                            <servlet>
                            <servlet-name>Seam Resource Servlet</servlet-name>
                            <servlet-class>org.jboss.seam.servlet.ResourceServlet</servlet-class>
                            </servlet>

                            <servlet-mapping>
                            <servlet-name>Seam Resource Servlet</servlet-name>
                            <url-pattern>/seam/resource/*</url-pattern>
                            </servlet-mapping>

                            <!-- MyFaces -->

                            <listener>
                            <listener-class>org.apache.myfaces.webapp.StartupServletContextListener</listener-class>
                            </listener>

                            <!-- Facelets development mode (disable in production) -->

                            <context-param>
                            <param-name>facelets.DEVELOPMENT</param-name>
                            <param-value>true</param-value>
                            </context-param>

                            <!-- JSF -->

                            <context-param>
                            <param-name>javax.faces.STATE_SAVING_METHOD</param-name>
                            <param-value>client</param-value>
                            </context-param>

                            <context-param>
                            <param-name>javax.faces.DEFAULT_SUFFIX</param-name>
                            <param-value>.xhtml</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>*.seam</url-pattern>
                            </servlet-mapping>

                            <security-constraint>
                            <display-name>Restrict raw XHTML Documents</display-name>
                            <web-resource-collection>
                            <web-resource-name>XHTML</web-resource-name>
                            <url-pattern>*.xhtml</url-pattern>
                            </web-resource-collection>
                            <auth-constraint>
                            <role-name>*</role-name>
                            </auth-constraint>
                            </security-constraint>

                            </web-app>


                            • 11. Re: Captcha image doesn't appear =(
                              wquraishi

                              you might want to try to drop the jar in /server/default/lib directory.

                              • 12. Re: Captcha image doesn't appear =(
                                wquraishi

                                actually disregard my last message, in order for me to get it working i added:

                                 <fileset dir="${lib.dir}">
                                 <include name="jboss-seam.jar" />
                                 <include name="jbpm*.jar" />
                                 <include name="jboss-el.jar" />
                                 <include name="quartz*.jar" />
                                 <include name="drools-*.jar"/>
                                 <include name="janino-*.jar"/>
                                 <include name="antlr-*.jar"/>
                                 <include name="mvel*.jar"/>
                                 <include name="jboss-cache*.jar"/>
                                 <include name="jboss-aop*.jar"/>
                                 <include name="jgroups*.jar"/>
                                 <include name="jcaptcha*.jar"/>
                                 </fileset>
                                


                                to the ear target in build.xml.

                                • 13. Re: Captcha image doesn't appear =(
                                  paulovittor23

                                  I put jcaptcha and some other jars inside my /server/default;lib directory and it works fine...

                                  but, in teory, "my_app/WEB-INF/lib" and "jboss/server/default/lib" locations are part of my classpath, so, why my app doesn't work when the jars were inside it ?

                                  Thanks for the attention and time all of u spent helping me ! =)