JSF Managed bean in jar not instantiated

南笙酒味 提交于 2019-12-06 14:22:24
Dawid Pytel

Looks like Base project - the one with session bean is not correctly exported. JSF requires faces-config.xml to be placed in sbeans.jar directly in META-INF directory. However, according to your description Base project is a web project. When I created such project and exported it using the way you did I got the following structure:

sbeans.jar
  |--META-INF (empty)
  |--WebContent
       |--META-INF
            |--faces-config.xml

As you see faces-config.xml is placed in wrong place.

To fix this either:

  • change project type to plain java - you anyway export it as JAR not WAR, don't you? (looks like the only way to do it is to create new project from scratch). Then you can then use the following hint https://stackoverflow.com/a/11027541/1071508 to generate WAR with all dependencies with only few mouse clicks.
  • if changing project type is not possible consider converting projects to maven so that you take advantage of plugins. Then you can rename the WAR during creation: Renaming Maven dependency in WAR's WEB-INF/lib folder
  • if previous solution is not possible for some reason
    • create META-INF in Java Resources/src and place faces-config.xml there
    • or export project as WAR and rename it to .jar after exporting
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!