glassfish
  1. glassfish
  2. GLASSFISH-20667

EAR deployment fails with WELD-001417: Enabled interceptor (...) is neither annotated @Interceptor nor registered through a portable extension

    Details

    • Type: Bug Bug
    • Status: Resolved
    • Priority: Blocker Blocker
    • Resolution: Works as designed
    • Affects Version/s: 4.0_b89_RC5
    • Fix Version/s: None
    • Component/s: cdi
    • Labels:
      None
    • Environment:

      Windows 8
      Glassfish 4 b89 (bundled with NetBeans 7.3.1)

      Description

      In a maven enterprise application with EJB and WEB modules, deployment fails if the EJB module declares a CDI interceptor.

      Btw, implicit CDI is disabled. Not sure it matters.

      The beans.xml in the EJB module:

      <?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>com.foo.BarInterceptor</class>
          </interceptors>
      </beans>
      

      Interceptor and binding:

      @Interceptor @Bar
      public class BarInterceptor implements Serializable {
      
          public BarInterceptor() {}
          
          @AroundInvoke
          public Object log(InvocationContext context) throws Exception {
              return context.proceed();
          }
          
          private static final long serialVersionUID = 1L;
      }
      
      @Inherited
      @InterceptorBinding
      @Retention(RUNTIME)
      @Target({METHOD, TYPE})
      public @interface Bar {}
      

      Server log

      [2013-06-26T20:17:10.522-0300] [glassfish 4.0] [SEVERE] [NCLS-CORE-00026] [javax.enterprise.system.core] [tid: _ThreadID=38 _ThreadName=admin-listener(4)] [timeMillis: 1372288630522] [levelValue: 1000] [[
        Exception during lifecycle processing
      org.glassfish.deployment.common.DeploymentException: CDI deployment failure:WELD-001417 Enabled interceptor class <class>com.foo.BarInterceptor</class> in file:/E:/.../Interceptor-ear/Interceptor-ejb-1.0-SNAPSHOT_jar/META-INF/beans.xml@7 is neither annotated @Interceptor nor registered through a portable extension
      	at org.glassfish.weld.WeldDeployer.event(WeldDeployer.java:225)
      	at org.glassfish.kernel.event.EventsImpl.send(EventsImpl.java:131)
      	at org.glassfish.internal.data.ApplicationInfo.load(ApplicationInfo.java:328)
      	at com.sun.enterprise.v3.server.ApplicationLifecycle.deploy(ApplicationLifecycle.java:493)
      	at com.sun.enterprise.v3.server.ApplicationLifecycle.deploy(ApplicationLifecycle.java:219)
      	at org.glassfish.deployment.admin.DeployCommand.execute(DeployCommand.java:491)
      	at com.sun.enterprise.v3.admin.CommandRunnerImpl$2$1.run(CommandRunnerImpl.java:527)
      	at com.sun.enterprise.v3.admin.CommandRunnerImpl$2$1.run(CommandRunnerImpl.java:523)
      	at java.security.AccessController.doPrivileged(Native Method)
      	at javax.security.auth.Subject.doAs(Subject.java:356)
      	at com.sun.enterprise.v3.admin.CommandRunnerImpl$2.execute(CommandRunnerImpl.java:522)
      	at com.sun.enterprise.v3.admin.CommandRunnerImpl.doCommand(CommandRunnerImpl.java:546)
      	at com.sun.enterprise.v3.admin.CommandRunnerImpl.doCommand(CommandRunnerImpl.java:1423)
      	at com.sun.enterprise.v3.admin.CommandRunnerImpl.access$1500(CommandRunnerImpl.java:108)
      	at com.sun.enterprise.v3.admin.CommandRunnerImpl$ExecutionContext.execute(CommandRunnerImpl.java:1762)
      	at com.sun.enterprise.v3.admin.CommandRunnerImpl$ExecutionContext.execute(CommandRunnerImpl.java:1674)
      	at com.sun.enterprise.v3.admin.AdminAdapter.doCommand(AdminAdapter.java:534)
      	at com.sun.enterprise.v3.admin.AdminAdapter.onMissingResource(AdminAdapter.java:224)
      	at org.glassfish.grizzly.http.server.StaticHttpHandler.service(StaticHttpHandler.java:297)
      	at com.sun.enterprise.v3.services.impl.ContainerMapper.service(ContainerMapper.java:246)
      	at org.glassfish.grizzly.http.server.HttpHandler.runService(HttpHandler.java:191)
      	at org.glassfish.grizzly.http.server.HttpHandler.doHandle(HttpHandler.java:168)
      	at org.glassfish.grizzly.http.server.HttpServerFilter.handleRead(HttpServerFilter.java:189)
      	at org.glassfish.grizzly.filterchain.ExecutorResolver$9.execute(ExecutorResolver.java:119)
      	at org.glassfish.grizzly.filterchain.DefaultFilterChain.executeFilter(DefaultFilterChain.java:288)
      	at org.glassfish.grizzly.filterchain.DefaultFilterChain.executeChainPart(DefaultFilterChain.java:206)
      	at org.glassfish.grizzly.filterchain.DefaultFilterChain.execute(DefaultFilterChain.java:136)
      	at org.glassfish.grizzly.filterchain.DefaultFilterChain.process(DefaultFilterChain.java:114)
      	at org.glassfish.grizzly.ProcessorExecutor.execute(ProcessorExecutor.java:77)
      	at org.glassfish.grizzly.nio.transport.TCPNIOTransport.fireIOEvent(TCPNIOTransport.java:838)
      	at org.glassfish.grizzly.strategies.AbstractIOStrategy.fireIOEvent(AbstractIOStrategy.java:113)
      	at org.glassfish.grizzly.strategies.WorkerThreadIOStrategy.run0(WorkerThreadIOStrategy.java:115)
      	at org.glassfish.grizzly.strategies.WorkerThreadIOStrategy.access$100(WorkerThreadIOStrategy.java:55)
      	at org.glassfish.grizzly.strategies.WorkerThreadIOStrategy$WorkerThreadRunnable.run(WorkerThreadIOStrategy.java:135)
      	at org.glassfish.grizzly.threadpool.AbstractThreadPool$Worker.doWork(AbstractThreadPool.java:564)
      	at org.glassfish.grizzly.threadpool.AbstractThreadPool$Worker.run(AbstractThreadPool.java:544)
      	at java.lang.Thread.run(Thread.java:722)
      Caused by: org.jboss.weld.exceptions.DeploymentException: WELD-001417 Enabled interceptor class <class>com.foo.BarInterceptor</class> in file:/E:/.../Interceptor-ear/Interceptor-ejb-1.0-SNAPSHOT_jar/META-INF/beans.xml@7 is neither annotated @Interceptor nor registered through a portable extension
      	at org.jboss.weld.bootstrap.Validator.validateEnabledInterceptorClasses(Validator.java:656)
      	at org.jboss.weld.bootstrap.Validator.validateDeployment(Validator.java:482)
      	at org.jboss.weld.bootstrap.WeldBootstrap.validateBeans(WeldBootstrap.java:536)
      	at org.glassfish.weld.WeldDeployer.event(WeldDeployer.java:216)
      	... 36 more
      ]]
      [2013-06-26T20:17:10.527-0300] [glassfish 4.0] [SEVERE] [] [javax.enterprise.system.core] [tid: _ThreadID=38 _ThreadName=admin-listener(4)] [timeMillis: 1372288630527] [levelValue: 1000] [[
        Exception while loading the app]]
      [2013-06-26T20:17:10.556-0300] [glassfish 4.0] [SEVERE] [AS-WEB-GLUE-00192] [javax.enterprise.web] [tid: _ThreadID=38 _ThreadName=admin-listener(4)] [timeMillis: 1372288630556] [levelValue: 1000] [[
        Undeployment failed for context /Interceptor-web]]
      [2013-06-26T20:17:10.650-0300] [glassfish 4.0] [SEVERE] [] [javax.enterprise.system.core] [tid: _ThreadID=38 _ThreadName=admin-listener(4)] [timeMillis: 1372288630650] [levelValue: 1000] [[
        Exception while loading the app : CDI deployment failure:WELD-001417 Enabled interceptor class <class>com.foo.BarInterceptor</class> in file:/E:/.../Interceptor-ear/Interceptor-ejb-1.0-SNAPSHOT_jar/META-INF/beans.xml@7 is neither annotated @Interceptor nor registered through a portable extension
      org.jboss.weld.exceptions.DeploymentException: WELD-001417 Enabled interceptor class <class>com.foo.BarInterceptor</class> in file:/E:/.../gfdeploy/Interceptor-ear/Interceptor-ejb-1.0-SNAPSHOT_jar/META-INF/beans.xml@7 is neither annotated @Interceptor nor registered through a portable extension
      	at org.jboss.weld.bootstrap.Validator.validateEnabledInterceptorClasses(Validator.java:656)
      	at org.jboss.weld.bootstrap.Validator.validateDeployment(Validator.java:482)
      	at org.jboss.weld.bootstrap.WeldBootstrap.validateBeans(WeldBootstrap.java:536)
      	at org.glassfish.weld.WeldDeployer.event(WeldDeployer.java:216)
      	at org.glassfish.kernel.event.EventsImpl.send(EventsImpl.java:131)
      	at org.glassfish.internal.data.ApplicationInfo.load(ApplicationInfo.java:328)
      	at com.sun.enterprise.v3.server.ApplicationLifecycle.deploy(ApplicationLifecycle.java:493)
      	at com.sun.enterprise.v3.server.ApplicationLifecycle.deploy(ApplicationLifecycle.java:219)
      	at org.glassfish.deployment.admin.DeployCommand.execute(DeployCommand.java:491)
      	at com.sun.enterprise.v3.admin.CommandRunnerImpl$2$1.run(CommandRunnerImpl.java:527)
      	at com.sun.enterprise.v3.admin.CommandRunnerImpl$2$1.run(CommandRunnerImpl.java:523)
      	at java.security.AccessController.doPrivileged(Native Method)
      	at javax.security.auth.Subject.doAs(Subject.java:356)
      	at com.sun.enterprise.v3.admin.CommandRunnerImpl$2.execute(CommandRunnerImpl.java:522)
      	at com.sun.enterprise.v3.admin.CommandRunnerImpl.doCommand(CommandRunnerImpl.java:546)
      	at com.sun.enterprise.v3.admin.CommandRunnerImpl.doCommand(CommandRunnerImpl.java:1423)
      	at com.sun.enterprise.v3.admin.CommandRunnerImpl.access$1500(CommandRunnerImpl.java:108)
      	at com.sun.enterprise.v3.admin.CommandRunnerImpl$ExecutionContext.execute(CommandRunnerImpl.java:1762)
      	at com.sun.enterprise.v3.admin.CommandRunnerImpl$ExecutionContext.execute(CommandRunnerImpl.java:1674)
      	at com.sun.enterprise.v3.admin.AdminAdapter.doCommand(AdminAdapter.java:534)
      	at com.sun.enterprise.v3.admin.AdminAdapter.onMissingResource(AdminAdapter.java:224)
      	at org.glassfish.grizzly.http.server.StaticHttpHandler.service(StaticHttpHandler.java:297)
      	at com.sun.enterprise.v3.services.impl.ContainerMapper.service(ContainerMapper.java:246)
      	at org.glassfish.grizzly.http.server.HttpHandler.runService(HttpHandler.java:191)
      	at org.glassfish.grizzly.http.server.HttpHandler.doHandle(HttpHandler.java:168)
      	at org.glassfish.grizzly.http.server.HttpServerFilter.handleRead(HttpServerFilter.java:189)
      	at org.glassfish.grizzly.filterchain.ExecutorResolver$9.execute(ExecutorResolver.java:119)
      	at org.glassfish.grizzly.filterchain.DefaultFilterChain.executeFilter(DefaultFilterChain.java:288)
      	at org.glassfish.grizzly.filterchain.DefaultFilterChain.executeChainPart(DefaultFilterChain.java:206)
      	at org.glassfish.grizzly.filterchain.DefaultFilterChain.execute(DefaultFilterChain.java:136)
      	at org.glassfish.grizzly.filterchain.DefaultFilterChain.process(DefaultFilterChain.java:114)
      	at org.glassfish.grizzly.ProcessorExecutor.execute(ProcessorExecutor.java:77)
      	at org.glassfish.grizzly.nio.transport.TCPNIOTransport.fireIOEvent(TCPNIOTransport.java:838)
      	at org.glassfish.grizzly.strategies.AbstractIOStrategy.fireIOEvent(AbstractIOStrategy.java:113)
      	at org.glassfish.grizzly.strategies.WorkerThreadIOStrategy.run0(WorkerThreadIOStrategy.java:115)
      	at org.glassfish.grizzly.strategies.WorkerThreadIOStrategy.access$100(WorkerThreadIOStrategy.java:55)
      	at org.glassfish.grizzly.strategies.WorkerThreadIOStrategy$WorkerThreadRunnable.run(WorkerThreadIOStrategy.java:135)
      	at org.glassfish.grizzly.threadpool.AbstractThreadPool$Worker.doWork(AbstractThreadPool.java:564)
      	at org.glassfish.grizzly.threadpool.AbstractThreadPool$Worker.run(AbstractThreadPool.java:544)
      	at java.lang.Thread.run(Thread.java:722)
      ]]
      

        Activity

        Hide
        synti added a comment -

        The problem is the new namespace. Both deployment and interception works fine after changing it back to:

        <beans xmlns="http://java.sun.com/xml/ns/javaee"
               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/beans_1_0.xsd">
        
        Show
        synti added a comment - The problem is the new namespace. Both deployment and interception works fine after changing it back to: <beans xmlns= "http://java.sun.com/xml/ns/javaee" 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/beans_1_0.xsd" >
        Hide
        jjsnyder83 added a comment -

        Please attach the app and source code (if possible) that demonstrates the failure.

        Show
        jjsnyder83 added a comment - Please attach the app and source code (if possible) that demonstrates the failure.
        Hide
        synti added a comment -
        Show
        synti added a comment - Contains source and app: https://dl.dropboxusercontent.com/u/91581899/Interceptor.zip
        Hide
        laurent_bauchau added a comment - - edited

        The problem is the new namespace. Both deployment and interception works fine after changing it back to:

        <beans xmlns="http://java.sun.com/xml/ns/javaee"
        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/beans_1_0.xsd">

        This change doesn't solve the problem for me.

        I've "solved" the problem with: bean-discovery-mode="all" instead of "annotated"

        Show
        laurent_bauchau added a comment - - edited The problem is the new namespace. Both deployment and interception works fine after changing it back to: <beans xmlns="http://java.sun.com/xml/ns/javaee" 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/beans_1_0.xsd "> This change doesn't solve the problem for me. I've "solved" the problem with: bean-discovery-mode="all" instead of "annotated"
        Hide
        synti added a comment -

        Just confirming. Using the 1.1 beans.xml with bean-discovery-mode="all" also worked here.

        Show
        synti added a comment - Just confirming. Using the 1.1 beans.xml with bean-discovery-mode="all" also worked here.
        Hide
        javadon added a comment -

        I too have same problem,

        Environment: eclipse kepler, java-ee7, cdi 1.1, Glass Fish 4.0.1,..etc.

        http://stackoverflow.com/questions/17258639/interceptor-issue-with-java-ee7

        any help will be appreciated.

        Show
        javadon added a comment - I too have same problem, Environment: eclipse kepler, java-ee7, cdi 1.1, Glass Fish 4.0.1,..etc. http://stackoverflow.com/questions/17258639/interceptor-issue-with-java-ee7 any help will be appreciated.
        Hide
        TangYong added a comment -

        JJ
        CC: All

        The issue should be right behavior on current CDI Spec. I have done a confirmation on wildfly-8.0.0.Alpha4 and the same WELD-001417
        exception is thrown. You can confirm with JBOSS guys.

        The issue has two workarounds :

        1. backing CDI 1.0
        using http://java.sun.com/xml/ns/javaee/beans_1_0.xsd

        2. using bean-discovery-mode="all"

        So, if being the such case, the issue should be closed.

        Thanks
        Tang

        Show
        TangYong added a comment - JJ CC: All The issue should be right behavior on current CDI Spec. I have done a confirmation on wildfly-8.0.0.Alpha4 and the same WELD-001417 exception is thrown. You can confirm with JBOSS guys. The issue has two workarounds : 1. backing CDI 1.0 using http://java.sun.com/xml/ns/javaee/beans_1_0.xsd 2. using bean-discovery-mode="all" So, if being the such case, the issue should be closed. Thanks Tang
        Hide
        jjsnyder83 added a comment -

        I believe the deployment exception is accurate for CDI 1.1. The beans.xml for the jar with the interceptor contains:
        bean-discovery-mode="annotated"

        This means that only classes with bean-defining annotations will be managed by CDI. Since the interceptor does not contain a bean-defining annotation it is not managed by CDI. bean-defining annotations and implicit CDI is new with CDI 1.1.

        Changing bean-discover-mode to "all" is the correct solution.

        Show
        jjsnyder83 added a comment - I believe the deployment exception is accurate for CDI 1.1. The beans.xml for the jar with the interceptor contains: bean-discovery-mode="annotated" This means that only classes with bean-defining annotations will be managed by CDI. Since the interceptor does not contain a bean-defining annotation it is not managed by CDI. bean-defining annotations and implicit CDI is new with CDI 1.1. Changing bean-discover-mode to "all" is the correct solution.

          People

          • Assignee:
            jjsnyder83
            Reporter:
            synti
          • Votes:
            2 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: