How to reference JSF managed beans which are provided in a JAR file?

前端 未结 3 1765
隐瞒了意图╮
隐瞒了意图╮ 2020-11-29 04:14

I have a WAR file with the following structure:

\"enter

The JSF managed bean <

3条回答
  •  北荒
    北荒 (楼主)
    2020-11-29 05:03

    I have same problem with CDI beans in my case.

    I have common.jar project where i placed the CDI beans. (without beans.xml) and I have webapp.war that contains common.jar in it`s lib and beans.xml.

    when i call a cdi bean from jsf, i get it is not reachable exception:/

    project structure is created using maven : - maven-archetype-quickstart for common.jar - maven-archetype-webapp for webapp.war

    I am using eclipse/juno en deploy to Glassfish 3.1.x.

    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

    Resolved: For EJB and JAR packaging you should place the beans.xml in src/main/resources/META-INF/. For WAR packaging you should place the beans.xml in src/main/webapp/WEB-INF/. Remember that only .java files should be put in the src/main/java and src/test/java directories. Resources like .xml files should be in src/main/resources.

    from topic: CDI: beans.xml, where do I put you?

提交回复
热议问题