hi felipe,

the project-setup isn't complete.
you can use e.g. the myfaces archetype to have a look at the correct setup
of openwebbeans (= cdi implementation) + codi (= cdi extension) (see [1]) or
a basic project-template (see [2]) for openwebbeans and deltaspike.
(+ fyi: you have mixed jsf annotations with @Named)

regards,
gerhard

[1] http://s.apache.org/LJS
[2] https://github.com/os890/javaweb-cdi-ds-project-template

http://www.irian.at

Your JSF/JavaEE powerhouse -
JavaEE Consulting, Development and
Courses in English and German

Professional Support for Apache MyFaces



2014-05-04 5:47 GMT+02:00 Felipe Pina <[email protected]>:

> Hello my name is Felipe and i have a CDI doubts.
>
> I have installed the tomee and i setup all the classes and it works fine,
> but my server has very little ram memory, and this reason led me to try to
> install only the apache
> codi<http://myfaces.apache.org/extensions/cdi/index.html>core into
> apache
> tomcat 7 <http://tomcat.apache.org/download-70.cgi> .
>
> The project *compiles successfully*, but *the red line below* remains null!
>
> Question:  Is it necessary to add some additional dependency in order to
> the dependency injection works ?
>
> *So, I followed the following steps:*
>
>
>    1.
>
> *Using maven to include only the cdi core *
>
> <!-- **************************************************** CODI CDI
> dependencies -->
>
>
>
>
>
> <dependency>
>
>
> <groupId>org.apache.geronimo.specs</groupId>
>
>
> <artifactId>geronimo-atinject_1.0_spec</artifactId>
>
>
> <version>1.0</version>
>
>
> </dependency>
>
>
>
>
>
> <dependency>
>
>
> <groupId>org.apache.geronimo.specs</groupId>
>
>
> <artifactId>geronimo-jcdi_1.0_spec</artifactId>
>
>
> <version>1.0</version>
>
>
> </dependency>
>
>
>
>
>
> <dependency>
>
>
> <groupId>org.apache.myfaces.extensions.cdi.core</groupId>
>
>
> <artifactId>myfaces-extcdi-core-api</artifactId>
>
>
> <version>${codi.version}</version>
>
>
>
>
> </dependency>
>
>
>
>
>
> <dependency>
>
>
> <groupId>org.apache.myfaces.extensions.cdi.core</groupId>
>
>
> <artifactId>myfaces-extcdi-core-impl</artifactId>
>
>
> <version>${codi.version}</version>
>
>
>
>
> </dependency>
>
>  *2 Setup my producer.*
>
> @javax.enterprise.context.ApplicationScoped
> public class FacadeFactory {
>
> @javax.enterprise.inject.Produces
>
>  public GrowUpFacadeAdapter getFacade() {
>
> return new GrowUpFacade();
> }
> }
>
> public class GrowUpFacade implements GrowUpFacadeAdapter {
> ....
> }
>
> public interface GrowUpFacadeAdapter extends Serializable {
> ....
> }
>
> *3 My JSF bean*
>
>
>
>
>
>
> *@ManagedBean(name="pedidoMBean")
> @javax.faces.bean.SessionScoped@javax.enterprise.context.SessionScoped
> @javax.inject.Named
> public class PedidoMBean extends AutenticadorMBean  { @javax.inject.Inject
> private GrowUpFacadeAdapter facade;         <------  remains null !!!!
> .....}*
>
>
> public class AutenticadorMBean implements Serializable {
> .....
> }
>
> *4 beans.xml*
>
>
> *<beans xmlns="http://java.sun.com/xml/ns/javaee
> <http://java.sun.com/xml/ns/javaee>"
> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance
> <http://www.w3.org/2001/XMLSchema-instance>"
> xsi:schemaLocation="http://java.sun.com/xml/ns/javaee
> <http://java.sun.com/xml/ns/javaee>
> http://java.sun.com/xml/ns/javaee/beans_1_0.xsd
> <http://java.sun.com/xml/ns/javaee/beans_1_0.xsd>"> </beans>*
>
>
>  --
> Atenciosamente,
> Felipe Pina
>
>
>
> --
> Atenciosamente,
> Felipe Pina
>

Reply via email to