Uploaded image for project: 'Struts 2'
  1. Struts 2
  2. WW-4548

Struts2-CDI-plugin is not able to get a reference of BeanManager through lookup

    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Not A Problem
    • Affects Version/s: 2.3.24
    • Fix Version/s: 2.3.28
    • Component/s: Plugin - CDI
    • Labels:
      None
    • Environment:

      Weblogic 12c

      Description

      Hello,
      I'm trying to get CDI (WELD) to work on our Java EE application. We use Struts2 as front-end framework with Action classes (as controllers).
      We want to be able to use CDI and inject into the Action classes but we have no success on integrating the cdi-plugin.

      On weblogic server startup I get the following error:

      16-Sep-2015-09:52:04  [ACTIVE] ExecuteThread: '0' for queue: 'weblogic.kernel.Default (self-tuning)' [ERROR] InterceptorBuilder.Actual exception
      Caught Exception while registering Interceptor class com.opensymphony.xwork2.interceptor.ExceptionMappingInterceptor - interceptor - zip:D:/dev/bin/oracle/weblogic/12.1.3.0/user_projects/domains/granite_domain/servers/GraniteServer/tmp/_W
      L_user/granite/dajv2g/APP-INF/lib/struts2-core-2.3.24.jar!/struts-default.xml:194:116
              at com.opensymphony.xwork2.factory.DefaultInterceptorFactory.buildInterceptor(DefaultInterceptorFactory.java:64)
              at com.opensymphony.xwork2.ObjectFactory.buildInterceptor(ObjectFactory.java:209)
              at com.opensymphony.xwork2.config.providers.InterceptorBuilder.constructInterceptorReference(InterceptorBuilder.java:70)
              at com.opensymphony.xwork2.config.providers.XmlConfigurationProvider.lookupInterceptorReference(XmlConfigurationProvider.java:1114)
              at com.opensymphony.xwork2.config.providers.XmlConfigurationProvider.loadInterceptorStack(XmlConfigurationProvider.java:932)
      

      Which is caused by:

      Caused by: java.lang.NullPointerException
              at org.apache.struts2.cdi.CdiObjectFactory.getInjectionTarget(CdiObjectFactory.java:185)
              at org.apache.struts2.cdi.CdiObjectFactory.buildBean(CdiObjectFactory.java:158)
              at com.opensymphony.xwork2.ObjectFactory.buildBean(ObjectFactory.java:178)
              at com.opensymphony.xwork2.factory.DefaultInterceptorFactory.buildInterceptor(DefaultInterceptorFactory.java:42)
      

      I checked out the source code and I could see that the beanManager instance variable is NULL. This happens because none of the 3 lookups is able to get a reference to the BeanManager.

        Attachments

          Activity

            People

            • Assignee:
              Unassigned
              Reporter:
              Alboz Albi ho
            • Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: