読者です 読者をやめる 読者になる 読者になる

メモ:Java8 + WildFly8 で static method を 実装した interface で CDI エラーが出る

バージョンは、Java:8u5 WildFly:8.0.0.Final

package sample;

public interface DefaultInterface {
  default String getString() {
    return "abc";
  }
  /* // コメントアウト外すと実行時エラー
  static String getHoge() {
    return "ddd";
  }
  */
}
package sample;

import javax.enterprise.context.RequestScoped;
import javax.inject.Named;

import lombok.Data;

@Named
@RequestScoped
@Data
public class BackingBean implements DefaultInterface {
  private String input;
  private String output;
  
  public void confirm() {
    output = input + getString();
  }
}

RequestScoped, ViewScoped, SessionScoped, ApplicationScoped はダメで
Dependent にすると、static method をコメントアウトしなくても大丈夫でした。
スタックトレースはこちら

Stack Trace
javax.servlet.ServletException: WELD-001524: Unable to load proxy class for bean Managed Bean [class sample.BackingBean] with qualifiers [@Default @Any @Named] with class class sample.BackingBean using classloader ModuleClassLoader for Module "deployment.JavaEE7Test.war:main" from Service Module Loader
javax.faces.webapp.FacesServlet.service(FacesServlet.java:659)
io.undertow.servlet.handlers.ServletHandler.handleRequest(ServletHandler.java:85)
io.undertow.servlet.handlers.security.ServletSecurityRoleHandler.handleRequest(ServletSecurityRoleHandler.java:61)
io.undertow.servlet.handlers.ServletDispatchingHandler.handleRequest(ServletDispatchingHandler.java:36)
org.wildfly.extension.undertow.security.SecurityContextAssociationHandler.handleRequest(SecurityContextAssociationHandler.java:78)
io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:25)
io.undertow.servlet.handlers.security.SSLInformationAssociationHandler.handleRequest(SSLInformationAssociationHandler.java:113)
io.undertow.security.handlers.AuthenticationCallHandler.handleRequest(AuthenticationCallHandler.java:52)
io.undertow.security.handlers.AbstractConfidentialityHandler.handleRequest(AbstractConfidentialityHandler.java:45)
io.undertow.servlet.handlers.security.ServletConfidentialityConstraintHandler.handleRequest(ServletConfidentialityConstraintHandler.java:61)
io.undertow.servlet.handlers.security.CachedAuthenticatedSessionHandler.handleRequest(CachedAuthenticatedSessionHandler.java:70)
io.undertow.security.handlers.SecurityInitialHandler.handleRequest(SecurityInitialHandler.java:76)
io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:25)
org.wildfly.extension.undertow.security.jacc.JACCContextIdHandler.handleRequest(JACCContextIdHandler.java:61)
io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:25)
io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:25)
io.undertow.servlet.handlers.ServletInitialHandler.handleFirstRequest(ServletInitialHandler.java:240)
io.undertow.servlet.handlers.ServletInitialHandler.dispatchRequest(ServletInitialHandler.java:227)
io.undertow.servlet.handlers.ServletInitialHandler.access$000(ServletInitialHandler.java:73)
io.undertow.servlet.handlers.ServletInitialHandler$1.handleRequest(ServletInitialHandler.java:146)
io.undertow.server.Connectors.executeRootHandler(Connectors.java:168)
io.undertow.server.HttpServerExchange$1.run(HttpServerExchange.java:687)
java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
java.lang.Thread.run(Thread.java:745)