1

I'm trying to build a webapp that includes a webfragment which contains a flow.

I started building a standalone version of the webapp I want to use as a webfragment. That's working. After that I converted it to this structure:

flow-webfragment\src\main\java\javaclasses..

flow-webfragment\src\main\resources\META-INF\beans.xml
flow-webfragment\src\main\resources\META-INF\faces-config.xml
flow-webfragment\src\main\resources\META-INF\web-fragment.xml

flow-webfragment\src\main\resources\META-INF\resources\META-INF\context.xml
flow-webfragment\src\main\resources\META-INF\resources\META-INF\myflowdir
flow-webfragment\src\main\resources\META-INF\resources\META-INF\webfragment-start.xhtml

I'm not sure about the structure.. If there is a better one or a convention please tell me.

The webfragment is set up correctly and my webapp recognizes it. I can go to the "webfragment-start.xhtml" page, but when I try to enter my flow, I get a NullPointerException:

java.lang.NullPointerException
at com.sun.faces.flow.FlowCDIContext.flowEntered(FlowCDIContext.java:332)
at com.sun.faces.flow.FlowHandlerImpl.pushFlow(FlowHandlerImpl.java:385)
at com.sun.faces.flow.FlowHandlerImpl.transition(FlowHandlerImpl.java:280)
at com.sun.faces.application.NavigationHandlerImpl.handleNavigation(NavigationHandlerImpl.java:239)
at com.sun.faces.application.NavigationHandlerImpl.handleNavigation(NavigationHandlerImpl.java:182)
at com.sun.faces.application.ActionListenerImpl.processAction(ActionListenerImpl.java:132)

I think CDI is not correctly available, because on another project, where I'm also using JSF 2.2 and Omnifaces, I get this message

org.omnifaces.ApplicationInitializer checkCDIAvailable

see http://omnifaces.org/cdi/

I also followed BalusC's instruction on how to install CDI in tomcat and it works as standalone webapp, but not as a webfragment.

I didn't find good and understandable tutorials on how to build webfragment. If you know one, you're welcome to tell me.

Every help is highly appreciated!

Kind regards, Mischa

MiScha
  • 31
  • 5

1 Answers1

0

I just forgot to add

<Context>
<Resource name="BeanManager" 
    auth="Container"
    type="javax.enterprise.inject.spi.BeanManager"
    factory="org.jboss.weld.resources.ManagerObjectFactory" />
</Context>

to the context.xml.

MiScha
  • 31
  • 5