Integrate Weld CDI into a JSF 1.2 EJB Application on jboss 6 AS

1.1k views Asked by At

Since two evenings, I am trying to integrate weld CDI into an EJB 3.1 Application with JSF 1.2. I simply tried to call a with @Named annotated controller in an JSF page. The problem is, that no exception is thrown, when I deploy the project and also no exception is thrown when I call the page.

The simple example contains only:

The Controller:

import javax.inject.Named;

@Named
public class HelloWorldController {

    public HelloWorldController(){
        System.out.println("Hello World!");
    }

    public String getMessage() {
        return "Hello Weld World";
    }
}

And it's call:

<h1><h:outputText value="#{helloWorldController.message}" /></h1>

THX

1

There are 1 answers

2
Arjan Tijms On BEST ANSWER

Did you add the required empty beans.xml file to the META-INF WEB-INF? This is often the main cause of CDI mysteriously not working.

See http://seamframework.org/Documentation/WhatIsBeansxmlAndWhyDoINeedIt