1

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

Tiny
  • 27,221
  • 105
  • 339
  • 599
ich-bin-drin
  • 543
  • 3
  • 12
  • 23

1 Answers1

2

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

Arjan Tijms
  • 37,782
  • 12
  • 108
  • 140
  • Yes. But if i build my ear, they aren't deployed. – ich-bin-drin Feb 20 '11 at 10:37
  • You mean if you inspect the deployment manually, beans.xml isn't present? What tool are you using for your deployment then? Otherwise just add them yourself to they ear, just to see if it works. If it works you can try to fix your build tool. – Arjan Tijms Feb 20 '11 at 10:41