You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomee.apache.org by DonatasCiuksys <do...@mitsoft.lt> on 2012/10/02 16:25:32 UTC

Simple JSF+CDI app is not working

Env: Windows 7, Java 1.7.0_07

Steps to reproduce:

1. Download Tomee 1.5.0 ZIP, unzip to some folder.
2. Setup CATALINA_HOME variable pointing to the same folder.
3. Put the file TomeeTest.war (attached) to /webapps folder
3. Execute startup.bat (tomme starts up OK, http://localhost:8080/tomee is
visible and functions OK, all the tests are OK)
4. Point browser to http://localhost:8080/TomeeTest/
5. Page loads, renders only: "Current date is:" without actual date.

index.xhtml contains:
    <h:body>
        Current date is: #{dateBean.currentDate()}
    </h:body>

DateBean.java contains:

@Named
@RequestScoped
public class DateBean {
    
    @PostConstruct
    private void init() {
        System.out.println("INIT: " + this);
    }
    
    @PreDestroy
    private void die() {
        System.out.println("DIE: " + this);
    }

    public String currentDate() {
        System.out.println("Method was called...");
        return "" + new Date();
    }

}

What am I doing wrong?

TomeeTest.war
<http://openejb.979440.n4.nabble.com/file/n4657748/TomeeTest.war>  



--
View this message in context: http://openejb.979440.n4.nabble.com/Simple-JSF-CDI-app-is-not-working-tp4657748.html
Sent from the OpenEJB User mailing list archive at Nabble.com.

Re: Simple JSF+CDI app is not working

Posted by Romain Manni-Bucau <rm...@gmail.com>.
As workaround you can try removing tomee-myfaces from lib
Le 2 oct. 2012 17:53, "Romain Manni-Bucau" <rm...@gmail.com> a écrit :

> should be better on trunk
>
> *Romain Manni-Bucau*
> *Twitter: @rmannibucau <https://twitter.com/rmannibucau>*
> *Blog: **http://rmannibucau.wordpress.com/*<http://rmannibucau.wordpress.com/>
> *LinkedIn: **http://fr.linkedin.com/in/rmannibucau*
> *Github: https://github.com/rmannibucau*
>
>
>
>
> 2012/10/2 DonatasCiuksys <do...@mitsoft.lt>
>
>> Are there any workarround (something in config files) to make MyFaces pick
>> the OWB el resolver?
>>
>>
>>
>> --
>> View this message in context:
>> http://openejb.979440.n4.nabble.com/Simple-JSF-CDI-app-is-not-working-tp4657748p4657756.html
>> Sent from the OpenEJB User mailing list archive at Nabble.com.
>>
>
>

Re: Simple JSF+CDI app is not working

Posted by Romain Manni-Bucau <rm...@gmail.com>.
should be better on trunk

*Romain Manni-Bucau*
*Twitter: @rmannibucau <https://twitter.com/rmannibucau>*
*Blog: **http://rmannibucau.wordpress.com/*<http://rmannibucau.wordpress.com/>
*LinkedIn: **http://fr.linkedin.com/in/rmannibucau*
*Github: https://github.com/rmannibucau*




2012/10/2 DonatasCiuksys <do...@mitsoft.lt>

> Are there any workarround (something in config files) to make MyFaces pick
> the OWB el resolver?
>
>
>
> --
> View this message in context:
> http://openejb.979440.n4.nabble.com/Simple-JSF-CDI-app-is-not-working-tp4657748p4657756.html
> Sent from the OpenEJB User mailing list archive at Nabble.com.
>

Re: Simple JSF+CDI app is not working

Posted by DonatasCiuksys <do...@mitsoft.lt>.
Are there any workarround (something in config files) to make MyFaces pick
the OWB el resolver?



--
View this message in context: http://openejb.979440.n4.nabble.com/Simple-JSF-CDI-app-is-not-working-tp4657748p4657756.html
Sent from the OpenEJB User mailing list archive at Nabble.com.

Re: Simple JSF+CDI app is not working

Posted by Romain Manni-Bucau <rm...@gmail.com>.
i guess so, myfaces doesnt pickt the openwebbeans el resolver

using a @ManagedBean (jsf) should work

*Romain Manni-Bucau*
*Twitter: @rmannibucau <https://twitter.com/rmannibucau>*
*Blog: **http://rmannibucau.wordpress.com/*<http://rmannibucau.wordpress.com/>
*LinkedIn: **http://fr.linkedin.com/in/rmannibucau*
*Github: https://github.com/rmannibucau*




2012/10/2 DonatasCiuksys <do...@mitsoft.lt>

> Changing web.xml version from 3.0 to 2.5 did not help (and I cannot find
> any
> more differences looking to JSF+CDI+EJB Tomee example).
>
> NOTE: the same war runs OK in Glassfish, the date gets printed in browser.
> Are there any issues in integration between MyFaces and CDI?
>
>
>
> --
> View this message in context:
> http://openejb.979440.n4.nabble.com/Simple-JSF-CDI-app-is-not-working-tp4657748p4657753.html
> Sent from the OpenEJB User mailing list archive at Nabble.com.
>

Re: Simple JSF+CDI app is not working

Posted by DonatasCiuksys <do...@mitsoft.lt>.
Changing web.xml version from 3.0 to 2.5 did not help (and I cannot find any
more differences looking to JSF+CDI+EJB Tomee example).

NOTE: the same war runs OK in Glassfish, the date gets printed in browser.
Are there any issues in integration between MyFaces and CDI?



--
View this message in context: http://openejb.979440.n4.nabble.com/Simple-JSF-CDI-app-is-not-working-tp4657748p4657753.html
Sent from the OpenEJB User mailing list archive at Nabble.com.

Re: Simple JSF+CDI app is not working

Posted by DonatasCiuksys <do...@mitsoft.lt>.
Yes.

As could be seen in war file:
/WEB-INF/beans.xml:

<?xml version="1.0" encoding="UTF-8"?>
<beans 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/beans_1_0.xsd">
</beans>


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">
    <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>*.xhtml</url-pattern>
    </servlet-mapping>
    <session-config>
        <session-timeout>
            30
        </session-timeout>
    </session-config>
    <welcome-file-list>
        <welcome-file>index.xhtml</welcome-file>
    </welcome-file-list>
</web-app>




--
View this message in context: http://openejb.979440.n4.nabble.com/Simple-JSF-CDI-app-is-not-working-tp4657748p4657750.html
Sent from the OpenEJB User mailing list archive at Nabble.com.

Re: Simple JSF+CDI app is not working

Posted by José Luis Cetina <ma...@gmail.com>.
Do you create the beans.xml file?
El 02/10/2012 09:26, "DonatasCiuksys" <do...@mitsoft.lt> escribió:

> Env: Windows 7, Java 1.7.0_07
>
> Steps to reproduce:
>
> 1. Download Tomee 1.5.0 ZIP, unzip to some folder.
> 2. Setup CATALINA_HOME variable pointing to the same folder.
> 3. Put the file TomeeTest.war (attached) to /webapps folder
> 3. Execute startup.bat (tomme starts up OK, http://localhost:8080/tomee is
> visible and functions OK, all the tests are OK)
> 4. Point browser to http://localhost:8080/TomeeTest/
> 5. Page loads, renders only: "Current date is:" without actual date.
>
> index.xhtml contains:
>     <h:body>
>         Current date is: #{dateBean.currentDate()}
>     </h:body>
>
> DateBean.java contains:
>
> @Named
> @RequestScoped
> public class DateBean {
>
>     @PostConstruct
>     private void init() {
>         System.out.println("INIT: " + this);
>     }
>
>     @PreDestroy
>     private void die() {
>         System.out.println("DIE: " + this);
>     }
>
>     public String currentDate() {
>         System.out.println("Method was called...");
>         return "" + new Date();
>     }
>
> }
>
> What am I doing wrong?
>
> TomeeTest.war
> <http://openejb.979440.n4.nabble.com/file/n4657748/TomeeTest.war>
>
>
>
> --
> View this message in context:
> http://openejb.979440.n4.nabble.com/Simple-JSF-CDI-app-is-not-working-tp4657748.html
> Sent from the OpenEJB User mailing list archive at Nabble.com.
>