14 Replies Latest reply on Feb 24, 2015 1:42 AM by Martin Kouba

    CDI in multimodule maven project

    adam Brauner Newbie

      Good day friends,

      I have quite wierd problem.

      I am using WELD 2.2.9. FINAL

       

      I have multimodule maven project with CDI. Presentation layer have dependency to model layer. In model layer I create services @Named, @ApplicationScoped (from javax.enterprise.context)

      In presentation layer inject works fine everythink work fine till I try to use @Named, @ViewScoped (from javax.faces.view.ViewScoped) gives me

      Caused by: javax.el.PropertyNotFoundException: Target Unreachable, identifier 'viewBean' resolved to null

      I have beans.xml in model layer in resources/META-INF

      I have beans.xml in presentation layer in webapp/WEB-INF

      I am on tomcat so i have context.xml in webapp/META-INF with this

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

      and I have web.xml in webapp/WEB-INF with this

      <listener>

        <listener-class>org.jboss.weld.environment.servlet.Listener</listener-class>

      </listener>

      <resource-env-ref>

        <resource-env-ref-name>BeanManager</resource-env-ref-name>

        <resource-env-ref-type>javax.enterprise.inject.spi.BeanManager</resource-env-ref-type>

      </resource-env-ref>

      note: If I use @ViewScoped from org.omnifaces.cdi.ViewScoped than it works.

      .

       


      I think i setup everything right. Do you have any experience with this problem?

       

      Its fully described here:

      http://stackoverflow.com/questions/28586926/cdi-in-multimodule-maven-project

        • 1. Re: CDI in multimodule maven project
          Martin Kouba Master

          Hi Adam,

          what's the Tomcat version you're using? Also isn't the viewBean a selected alternative?

          • 2. Re: CDI in multimodule maven project
            adam Brauner Newbie

            Hello, Tomcat version 8 what you mean with this "Also isn't the viewBean a selected alternative?" viewBean is used as backing bean for .xhtml

            • 3. Re: CDI in multimodule maven project
              Martin Kouba Master

              I mean http://docs.jboss.org/cdi/spec/1.2/cdi-spec.html#alternatives. Do you run a standalone Tomcat instance or in an embedded mode (e.g. from within the IDE)?

              • 4. Re: CDI in multimodule maven project
                adam Brauner Newbie

                I run the project from IntelliJ but its standalone tomcat.

                • 5. Re: CDI in multimodule maven project
                  Tomas Remes Expert

                  Hi Adam,

                  This looks bit weird. I know there were some problems with javax.faces.view.ViewScoped but this looks ok at the first look. Can you please post your class declaration using the ViewScoped? And also the entire content of your web.xml or faces-config.xml could be helpful. Thank's

                  • 6. Re: Re: CDI in multimodule maven project
                    adam Brauner Newbie

                    I cant post full bean code cause its not public project. Also I cant imidiatelly answer to your question there must be some bug on this pages.

                    web.xml

                    <?xml version="1.0" encoding="UTF-8"?>

                    <web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"

                      xmlns="http://java.sun.com/xml/ns/javaee"

                      xsi:schemaLocation="http://java.sun.com/xml/ns/javaee

                    http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"

                      id="WebApp_ID" version="2.5">

                      <display-name>ProjectName</display-name>

                      <listener>

                      <listener-class>org.jboss.weld.environment.servlet.Listener</listener-class>

                      </listener>

                      <resource-env-ref>

                      <resource-env-ref-name>BeanManager</resource-env-ref-name>

                      <resource-env-ref-type>javax.enterprise.inject.spi.BeanManager</resource-env-ref-type>

                      </resource-env-ref>

                      <!-- Change to "Production" when you are ready to deploy -->

                      <context-param>

                      <param-name>javax.faces.PROJECT_STAGE</param-name>

                      <param-value>Development</param-value>

                      </context-param>

                      <context-param>

                      <param-name>primefaces.THEME</param-name>

                      <param-value>dot-luv</param-value>

                      </context-param>

                      <context-param>

                      <param-name>primefaces.FONT_AWESOME</param-name>

                      <param-value>true</param-value>

                      </context-param>

                      <!-- Welcome page -->

                      <welcome-file-list>

                      <welcome-file>index.jsf</welcome-file>

                      </welcome-file-list>

                      <!-- JSF mapping -->

                      <servlet>

                      <servlet-name>Faces Servlet</servlet-name>

                      <servlet-class>javax.faces.webapp.FacesServlet</servlet-class>

                      <load-on-startup>1</load-on-startup>

                      </servlet>

                      <!-- Map these files with JSF -->

                      <servlet-mapping>

                      <servlet-name>Faces Servlet</servlet-name>

                      <url-pattern>/faces/*</url-pattern>

                      </servlet-mapping>

                      <servlet-mapping>

                      <servlet-name>Faces Servlet</servlet-name>

                      <url-pattern>*.jsf</url-pattern>

                      </servlet-mapping>

                      <servlet-mapping>

                      <servlet-name>Faces Servlet</servlet-name>

                      <url-pattern>*.faces</url-pattern>

                      </servlet-mapping>

                      <servlet-mapping>

                      <servlet-name>Faces Servlet</servlet-name>

                      <url-pattern>*.xhtml</url-pattern>

                      </servlet-mapping>

                      <security-constraint>

                      <display-name>Exclude pages</display-name>

                      <web-resource-collection>

                      <web-resource-name>Restrict access to xhtml pages</web-resource-name>

                      <url-pattern>*.xhtml</url-pattern>

                      </web-resource-collection>

                      <auth-constraint>

                      </auth-constraint>

                      </security-constraint>

                    </web-app>


                    faces-config.xml

                    <?xml version="1.0" encoding="UTF-8"?>

                    <faces-config version="2.0" xmlns="http://java.sun.com/xml/ns/javaee"

                    xmlns:xi="http://www.w3.org/2001/XInclude" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"

                    xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-facesconfig_2_0.xsd">

                    </faces-config>


                    bean

                    import javax.inject.Inject;

                    import javax.inject.Named;

                    import javax.faces.view.ViewScoped;

                     

                    @Named

                    @ViewScoped

                    public class DotaBean implements Serializable {

                      private static final long serialVersionUID = 1L;

                      @Inject

                      private UserLoginBean userLoginBean;

                      @PostConstruct

                      public void init() {

                      }


                    • 7. Re: Re: Re: CDI in multimodule maven project
                      Tomas Remes Expert

                      Well It seems ok so far. Maybe output of "jar tf <you_war>" could be interesting as well. Anyway I tried to add your simple DotaBean to our Weld numberguess example, deployed to Tomcat 8.0.15 and it worked. I am attaching my war. On the game page you can see "This is from ViewScoped Hello!"

                      1 of 1 people found this helpful
                      • 8. Re: CDI in multimodule maven project
                        adam Brauner Newbie

                        Thanks in advance for helping me. Its rly wierd that only ViewScoped not working...

                        Model structuremoedl.PNG

                        Presentation structure presentation.PNG

                         

                        I test it on this simple page.

                         

                        import javax.annotation.PostConstruct;

                        import javax.faces.view.ViewScoped;

                        import javax.inject.Named;

                         


                        @Named
                        @ViewScoped
                        public class ViewTest {

                         

                          String test;

                         

                         

                           @PostConstruct
                           public void init(){

                           test = "TEST";

                          }

                         

                           public String getTest() {

                           return test;

                          }

                         

                           public void setTest(String test) {

                           this.test = test;

                          }

                        }

                         

                        <?xml version="1.0" encoding="UTF-8"?>

                        <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
                          "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

                        <html xmlns="http://www.w3.org/1999/xhtml"
                           xmlns:h="http://xmlns.jcp.org/jsf/html"
                           xmlns:ui="http://xmlns.jcp.org/jsf/facelets"
                           xmlns:f="http://xmlns.jcp.org/jsf/core">

                        <f:view>

                           <h:outputLabel value="#{viewTest.test}"/>

                        </f:view>

                        </html>


                        Post construct not called and label is not rendered.


                        This is mby interesting line:

                        2015-02-19 14:48:09 WARN  servletWeldServlet:71 - WELD-ENV-001004: Found both WEB-INF/beans.xml and WEB-INF/classes/META-INF/beans.xml. It's not portable to use both locations at the same time. Weld is going to use


                        This is log from deployment.

                        [2015-02-19 02:48:05,340] Artifact War of Skill - Presentation:war exploded: Artifact is being deployed, please wait...

                        2015-02-19 14:48:09 INFO  servletWeldServlet:57 - WELD-ENV-001008: Initialize Weld using ServletContainerInitializer

                        2015-02-19 14:48:09 INFO  Version:152 - WELD-000900: 2.2.9 (Final)

                        2015-02-19 14:48:09 INFO  Bootstrap:50 - WELD-ENV-000020: Using jandex for bean discovery

                        2015-02-19 14:48:09 WARN  servletWeldServlet:71 - WELD-ENV-001004: Found both WEB-INF/beans.xml and WEB-INF/classes/META-INF/beans.xml. It's not portable to use both locations at the same time. Weld is going to use file:/D:/Prace/Warofskill/WarOfSkill/War%20of%20Skill%20-%20Presentation/target/WarOfSkills/WEB-INF/beans.xml.

                        2015-02-19 14:48:10 INFO  Bootstrap:210 - WELD-000101: Transactional services not available. Injection of @Inject UserTransaction not available. Transactional observers will be invoked synchronously.

                        2015-02-19 14:48:10 WARN  Interceptor:47 - WELD-001700: Interceptor annotation class javax.ejb.PostActivate not found, interception based on it is not enabled

                        2015-02-19 14:48:10 WARN  Interceptor:47 - WELD-001700: Interceptor annotation class javax.ejb.PrePassivate not found, interception based on it is not enabled

                        2015-02-19 14:48:10 WARN  Event:84 - WELD-000411: Observer method [BackedAnnotatedMethod] public org.omnifaces.VetoAnnotatedTypeExtension.processAnnotatedType(@Observes ProcessAnnotatedType<Object>) receives events for all annotated types. Consider restricting events using @WithAnnotations or a generic type with bounds.

                        2015-02-19 14:48:10 WARN  Event:84 - WELD-000411: Observer method [BackedAnnotatedMethod] protected org.apache.deltaspike.core.impl.message.MessageBundleExtension.detectInterfaces(@Observes ProcessAnnotatedType<Object>) receives events for all annotated types. Consider restricting events using @WithAnnotations or a generic type with bounds.

                        2015-02-19 14:48:10 WARN  Event:84 - WELD-000411: Observer method [BackedAnnotatedMethod] protected org.apache.deltaspike.core.impl.exclude.extension.ExcludeExtension.vetoBeans(@Observes ProcessAnnotatedType<Object>, BeanManager) receives events for all annotated types. Consider restricting events using @WithAnnotations or a generic type with bounds.

                        2015-02-19 14:48:10 WARN  Event:84 - WELD-000411: Observer method [BackedAnnotatedMethod] protected org.apache.deltaspike.core.impl.interceptor.GlobalInterceptorExtension.promoteInterceptors(@Observes ProcessAnnotatedType<Object>, BeanManager) receives events for all annotated types. Consider restricting events using @WithAnnotations or a generic type with bounds.

                        19-Feb-2015 14:48:11.024 INFO [RMI TCP Connection(5)-127.0.0.1] org.apache.deltaspike.core.util.ClassDeactivationUtils.cacheResult class: org.apache.deltaspike.core.impl.scope.DeltaSpikeContextExtension activated=true

                        19-Feb-2015 14:48:11.036 INFO [RMI TCP Connection(5)-127.0.0.1] org.apache.deltaspike.core.util.ClassDeactivationUtils.cacheResult class: org.apache.deltaspike.core.impl.config.ConfigurationExtension activated=true

                        19-Feb-2015 14:48:11.036 INFO [RMI TCP Connection(5)-127.0.0.1] org.apache.deltaspike.core.util.ClassDeactivationUtils.cacheResult class: org.apache.deltaspike.core.impl.interceptor.GlobalInterceptorExtension activated=true

                        19-Feb-2015 14:48:11.038 INFO [RMI TCP Connection(5)-127.0.0.1] org.apache.deltaspike.core.util.ClassDeactivationUtils.cacheResult class: org.apache.deltaspike.core.impl.exception.control.extension.ExceptionControlExtension activated=true

                        19-Feb-2015 14:48:11.039 INFO [RMI TCP Connection(5)-127.0.0.1] org.apache.deltaspike.core.util.ClassDeactivationUtils.cacheResult class: org.apache.deltaspike.core.impl.message.MessageBundleExtension activated=true

                        19-Feb-2015 14:48:11.040 INFO [RMI TCP Connection(5)-127.0.0.1] org.apache.deltaspike.core.util.ClassDeactivationUtils.cacheResult class: org.apache.deltaspike.core.impl.message.NamedMessageBundleInvocationHandler activated=true

                        19-Feb-2015 14:48:11.040 INFO [RMI TCP Connection(5)-127.0.0.1] org.apache.deltaspike.core.util.ClassDeactivationUtils.cacheResult class: org.apache.deltaspike.core.impl.jmx.MBeanExtension activated=true

                        19-Feb-2015 14:48:11.041 INFO [RMI TCP Connection(5)-127.0.0.1] org.apache.deltaspike.core.util.ClassDeactivationUtils.cacheResult class: org.apache.deltaspike.core.impl.exclude.extension.ExcludeExtension activated=true

                        19-Feb-2015 14:48:11.041 INFO [RMI TCP Connection(5)-127.0.0.1] org.apache.deltaspike.core.util.ClassDeactivationUtils.cacheResult class: org.apache.deltaspike.core.impl.exclude.CustomProjectStageBeanFilter activated=true

                        19-Feb-2015 14:48:11.042 INFO [RMI TCP Connection(5)-127.0.0.1] org.apache.deltaspike.core.util.ClassDeactivationUtils.cacheResult class: org.apache.deltaspike.core.impl.exclude.GlobalAlternative activated=true

                        19-Feb-2015 14:48:11.070 INFO [RMI TCP Connection(5)-127.0.0.1] org.apache.deltaspike.core.util.ClassDeactivationUtils.cacheResult class: org.apache.deltaspike.jpa.impl.transaction.context.TransactionContextExtension activated=true

                        2015-02-19 14:48:11 INFO  Bootstrap:46 - WELD-000119: Not generating any bean definitions from org.omnifaces.cdi.param.RequestParameterProducer because of underlying class loading error: Type javax.validation.ConstraintViolation not found.  If this is unexpected, enable DEBUG logging to see the full error.

                        19-Feb-2015 14:48:11.379 INFO [RMI TCP Connection(5)-127.0.0.1] org.apache.deltaspike.core.util.ProjectStageProducer.initProjectStage Computed the following DeltaSpike ProjectStage: Production

                        2015-02-19 14:48:11 WARN  Validator:90 - WELD-001478: Interceptor class org.apache.deltaspike.jpa.impl.transaction.TransactionalInterceptor is enabled for the application and for the bean archive D:\Prace\Warofskill\WarOfSkill\War of Skill - Presentation\target\WarOfSkills\WEB-INF\classes. It will only be invoked in the @Priority part of the chain.

                        2015-02-19 14:48:11 WARN  Validator:90 - WELD-001478: Interceptor class org.apache.deltaspike.jpa.impl.transaction.TransactionalInterceptor is enabled for the application and for the bean archive /D:/Prace/Warofskill/WarOfSkill/War of Skill - Presentation/target/WarOfSkills/WEB-INF/lib/warofskill-model-1.0-SNAPSHOT.jar. It will only be invoked in the @Priority part of the chain.

                        2015-02-19 14:48:11 WARN  Validator:90 - WELD-001478: Interceptor class org.apache.deltaspike.jpa.impl.transaction.TransactionalInterceptor is enabled for the application and for the bean archive /D:/Prace/Warofskill/WarOfSkill/War of Skill - Presentation/target/WarOfSkills/WEB-INF/lib/deltaspike-jpa-module-impl-1.2.0.jar. It will only be invoked in the @Priority part of the chain.

                        2015-02-19 14:48:11 INFO  servletTomcat:45 - WELD-ENV-001100: Tomcat 7+ detected, CDI injection will be available in Servlets, Filters and Listeners.

                        2015-02-19 14:48:11 WARN  Bootstrap:695 - WELD-001125: Illegal bean type java.util.Comparator<org.apache.deltaspike.core.api.exception.control.HandlerMethod<?>> ignored on [EnhancedAnnotatedTypeImpl] public final  class org.apache.deltaspike.core.impl.exception.control.ExceptionHandlerComparator

                        2015-02-19 14:48:11 WARN  Bootstrap:695 - WELD-001125: Illegal bean type java.util.Comparator<javax.enterprise.inject.spi.AnnotatedMethod<? super T>> ignored on [EnhancedAnnotatedTypeImpl] private static  class org.apache.deltaspike.core.util.Annotateds$AnnotatedMethodComparator

                        2015-02-19 14:48:11 WARN  Bootstrap:695 - WELD-001125: Illegal bean type java.util.Comparator<javax.enterprise.inject.spi.AnnotatedCallable<? super T>> ignored on [EnhancedAnnotatedTypeImpl] private static  class org.apache.deltaspike.core.util.Annotateds$AnnotatedCallableComparator

                        2015-02-19 14:48:11 WARN  Bootstrap:695 - WELD-001125: Illegal bean type java.util.Comparator<javax.enterprise.inject.spi.AnnotatedConstructor<? super T>> ignored on [EnhancedAnnotatedTypeImpl] private static  class org.apache.deltaspike.core.util.Annotateds$AnnotatedConstructorComparator

                        2015-02-19 14:48:11 WARN  Bootstrap:695 - WELD-001125: Illegal bean type java.util.Comparator<javax.enterprise.inject.spi.AnnotatedField<? super T>> ignored on [EnhancedAnnotatedTypeImpl] private static  class org.apache.deltaspike.core.util.Annotateds$AnnotatedFieldComparator

                        19-Feb-2015 14:48:12.308 INFO [RMI TCP Connection(5)-127.0.0.1] org.omnifaces.ApplicationInitializer.logOmniFacesVersion Using OmniFaces version 2.0

                        2015-02-19 14:48:12 INFO  servletWeldServlet:51 - WELD-ENV-001006: org.jboss.weld.environment.servlet.EnhancedListener used for ServletContext notifications

                        19-Feb-2015 14:48:12.507 INFO [RMI TCP Connection(5)-127.0.0.1] com.sun.faces.config.ConfigureListener.contextInitialized Initializing Mojarra 2.2.10 ( 20150205-0906 https://svn.java.net/svn/mojarra~svn/tags/2.2.10@14334) for context ''

                        19-Feb-2015 14:48:12.722 INFO [RMI TCP Connection(5)-127.0.0.1] com.sun.faces.spi.InjectionProviderFactory.createInstance JSF1048: PostConstruct/PreDestroy annotations present.  ManagedBeans methods marked with these annotations will have said annotations processed.

                        19-Feb-2015 14:48:13.166 INFO [RMI TCP Connection(5)-127.0.0.1] org.ocpsoft.rewrite.faces.RewritePhaseListener.null RewritePhaseListener starting up.

                        19-Feb-2015 14:48:13.913 INFO [RMI TCP Connection(5)-127.0.0.1] com.sun.faces.config.ConfigureListener$WebConfigResourceMonitor$Monitor.<init> Monitoring file:/D:/Prace/Warofskill/WarOfSkill/War%20of%20Skill%20-%20Presentation/target/WarOfSkills/WEB-INF/faces-config.xml for modifications

                        19-Feb-2015 14:48:13.980 INFO [RMI TCP Connection(5)-127.0.0.1] org.primefaces.webapp.PostConstructApplicationEventListener.processEvent Running on PrimeFaces 5.1

                        2015-02-19 14:48:13 INFO  servletWeldServlet:74 - WELD-ENV-001009: org.jboss.weld.environment.servlet.Listener used for ServletRequest and HttpSession notifications

                        19-Feb-2015 14:48:13.989 INFO [RMI TCP Connection(5)-127.0.0.1] org.ocpsoft.rewrite.servlet.RewriteFilter.null RewriteFilter starting up...

                        19-Feb-2015 14:48:14.021 INFO [RMI TCP Connection(5)-127.0.0.1] org.ocpsoft.rewrite.servlet.RewriteFilter.null Loaded [4] org.ocpsoft.rewrite.servlet.spi.RewriteLifecycleListener [org.ocpsoft.rewrite.prettyfaces.PrettyFacesRewriteLifecycleListener<-100>, org.ocpsoft.rewrite.faces.FacesRewriteLifecycleListener<0>, org.ocpsoft.rewrite.servlet.config.lifecycle.JoinRewriteLifecycleListener<2147483647>, org.ocpsoft.rewrite.servlet.impl.DefaultRewriteLifecycleListener<2147483647>]

                        19-Feb-2015 14:48:14.021 INFO [RMI TCP Connection(5)-127.0.0.1] org.ocpsoft.rewrite.servlet.RewriteFilter.null Loaded [1] org.ocpsoft.rewrite.servlet.spi.RequestCycleWrapper [org.ocpsoft.rewrite.servlet.impl.HttpRewriteRequestCycleWrapper<0>]

                        19-Feb-2015 14:48:14.021 INFO [RMI TCP Connection(5)-127.0.0.1] org.ocpsoft.rewrite.servlet.RewriteFilter.null Loaded [1] org.ocpsoft.rewrite.spi.RewriteProvider [org.ocpsoft.rewrite.servlet.impl.DefaultHttpRewriteProvider<0>]

                        19-Feb-2015 14:48:14.021 INFO [RMI TCP Connection(5)-127.0.0.1] org.ocpsoft.rewrite.servlet.RewriteFilter.null Loaded [1] org.ocpsoft.rewrite.servlet.spi.RewriteResultHandler [org.ocpsoft.rewrite.servlet.impl.HttpRewriteResultHandler<0>]

                        19-Feb-2015 14:48:14.021 INFO [RMI TCP Connection(5)-127.0.0.1] org.ocpsoft.rewrite.servlet.RewriteFilter.null Loaded [1] org.ocpsoft.rewrite.servlet.spi.InboundRewriteProducer [org.ocpsoft.rewrite.servlet.impl.HttpInboundRewriteProducer<0>]

                        19-Feb-2015 14:48:14.021 INFO [RMI TCP Connection(5)-127.0.0.1] org.ocpsoft.rewrite.servlet.RewriteFilter.null Loaded [1] org.ocpsoft.rewrite.servlet.spi.OutboundRewriteProducer [org.ocpsoft.rewrite.servlet.impl.HttpOutboundRewriteProducer<0>]

                        19-Feb-2015 14:48:14.024 INFO [RMI TCP Connection(5)-127.0.0.1] org.ocpsoft.rewrite.servlet.RewriteFilter.null Loaded [1] org.ocpsoft.rewrite.servlet.spi.ContextListener [org.ocpsoft.rewrite.prettyfaces.PrettyConfigContextListener<0>]

                        19-Feb-2015 14:48:14.025 INFO [RMI TCP Connection(5)-127.0.0.1] org.ocpsoft.rewrite.servlet.RewriteFilter.null Loaded [0] org.ocpsoft.rewrite.servlet.spi.RequestListener []

                        19-Feb-2015 14:48:14.026 INFO [RMI TCP Connection(5)-127.0.0.1] org.ocpsoft.rewrite.servlet.RewriteFilter.null Loaded [1] org.ocpsoft.rewrite.servlet.spi.RequestParameterProvider [org.ocpsoft.rewrite.prettyfaces.PrettyFacesRequestParameterProvider<0>]

                        19-Feb-2015 14:48:14.031 INFO [RMI TCP Connection(5)-127.0.0.1] org.ocpsoft.rewrite.servlet.RewriteFilter.null Loaded [1] org.ocpsoft.rewrite.el.spi.ExpressionLanguageProvider [org.ocpsoft.rewrite.faces.FacesExpressionLanguageProvider<30>]

                        19-Feb-2015 14:48:14.034 INFO [RMI TCP Connection(5)-127.0.0.1] org.ocpsoft.rewrite.servlet.RewriteFilter.null Loaded [1] org.ocpsoft.rewrite.spi.InvocationResultHandler [org.ocpsoft.rewrite.faces.NavigatingInvocationResultHandler<100>]

                        19-Feb-2015 14:48:14.034 INFO [RMI TCP Connection(5)-127.0.0.1] org.ocpsoft.rewrite.servlet.RewriteFilter.null Loaded [0] org.ocpsoft.common.spi.ServiceEnricher []

                        19-Feb-2015 14:48:14.038 INFO [RMI TCP Connection(5)-127.0.0.1] org.ocpsoft.rewrite.servlet.RewriteFilter.null Loaded [1] org.ocpsoft.rewrite.spi.ConfigurationCacheProvider [org.ocpsoft.rewrite.servlet.impl.ServletContextConfigurationCacheProvider<0>]

                        19-Feb-2015 14:48:14.043 INFO [RMI TCP Connection(5)-127.0.0.1] org.ocpsoft.rewrite.servlet.RewriteFilter.null Loaded [3] org.ocpsoft.rewrite.config.ConfigurationProvider [org.ocpsoft.rewrite.prettyfaces.PrettyFacesRewriteConfigurationProvider<1>, org.ocpsoft.rewrite.annotation.config.AnnotationConfigProvider<100>, org.ocpsoft.rewrite.annotation.config.AnnotationConfigProvider<100>]

                        19-Feb-2015 14:48:14.049 INFO [RMI TCP Connection(5)-127.0.0.1] org.ocpsoft.rewrite.servlet.impl.DefaultHttpRewriteProvider.null Loaded [0] org.ocpsoft.rewrite.spi.RuleCacheProvider []

                        19-Feb-2015 14:48:14.095 INFO [RMI TCP Connection(5)-127.0.0.1] org.ocpsoft.rewrite.servlet.RewriteFilter.null Rewrite 2.0.12.Final initialized.

                        [2015-02-19 02:48:14,135] Artifact War of Skill - Presentation:war exploded: Artifact is deployed successfully

                        • 9. Re: CDI in multimodule maven project
                          Tomas Remes Expert

                          This structure image is not much helpful. The warning you mentioned is not substantial here. Can you turn on Weld DEBUG log level so we will see whether the ViewScoped bean is found by Weld?

                          • 11. Re: CDI in multimodule maven project
                            adam Brauner Newbie

                            Hello guys. Finally I found the problem. The problem was that my beans.xml was not totally empty

                            I had there

                            <?xml version="1.0" encoding="UTF-8"?>
                            <beans xmlns="http://xmlns.jcp.org/xml/ns/javaee"
                               xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
                               xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee http://xmlns.jcp.org/xml/ns/javaee/beans_1_1.xsd"
                               bean-discovery-mode="annotated">

                             

                            <interceptors>

                               <class>org.apache.deltaspike.jpa.impl.transaction.TransactionalInterceptor</class>

                            </interceptors>

                             

                            </beans>


                            which is depricated till version 1.1?


                            Thanks for your help.

                            • 12. Re: CDI in multimodule maven project
                              Martin Kouba Master

                              Adam, I still don't understand why it doesn't work with the cited beans.xml with bean-discovery-mode of annotated. @ViewScoped should be recognized as a bean defining annotation (it's a normal scope). What exactly should be deprecated?

                              • 13. Re: CDI in multimodule maven project
                                adam Brauner Newbie

                                2. Enable the Transaction Interceptor

                                For CDI 1.0 (or DeltaSpike v1.1.0 and earlier together with CDI 1.1+), you must enable the transaction interceptor in the project beans.xml file:

                                 

                                <beans> <!-- Not needed with CDI 1.1+ and DeltaSpike v1.1.1+ -->

                                <interceptors>

                                <class>org.apache.deltaspike.jpa.impl.transaction.TransactionalInterceptor</class>

                                </interceptors>

                                </beans>

                                 

                                I read on deltaspike web. That from version 1.1 its not necessary to fill anything into bean.xml even when you are using Deltaspike. Also on CDI 1.2 spec they say that default mode is anotated so it should not be specified. For me its also courious why its not working... But When I delete content of bean.xml everything start work like a charm.

                                • 14. Re: CDI in multimodule maven project
                                  Martin Kouba Master

                                  Also on CDI 1.2 spec they say that default mode is anotated so it should not be specified. For me its also courious why its not working...

                                  Not really. An empty beans.xml file determines an explicit bean archive with bean-discovey-mode of all (see http://docs.jboss.org/cdi/spec/1.2/cdi-spec.html#bean_archive). It looks like the bean with @ViewScoped is not recognized for an implicit bean archive in weld-servlet. This should work and there is a test in the weld test suite which passes.

                                  note: If I use @ViewScoped from org.omnifaces.cdi.ViewScoped than it works.

                                  This is odd. Is it correct to have version="2.0" in your faces-config.xml?