2 Replies Latest reply on Jan 11, 2019 12:08 PM by Andrej Petras

    Wildfly 15 WFLYWELD0038: Could not inject SecurityManager, security is not enabled

    Andrej Petras Newbie

      Hi,

       

      In my project I am using the JPA-listener with @Inject Principal (test.JpaListener class).

       

      The application is running fine on the Wildfly14 server but on the Wildly15 server I got this error:

      Caused by: java.lang.IllegalStateException: WFLYWELD0038: Could not inject SecurityManager, security is not enabled
              at org.jboss.as.weld@15.0.0.Final//org.jboss.as.weld.services.bootstrap.WeldSecurityServices.getPrincipal(WeldSecurityServices.java:83)
              at org.jboss.weld.core@3.0.5.Final//org.jboss.weld.bean.builtin.ee.PrincipalBean$PrincipalCallable.call(PrincipalBean.java:41)
              at org.jboss.weld.core@3.0.5.Final//org.jboss.weld.bean.builtin.ee.PrincipalBean$PrincipalCallable.call(PrincipalBean.java:30)
              at org.jboss.weld.core@3.0.5.Final//org.jboss.weld.bean.builtin.CallableMethodHandler.invoke(CallableMethodHandler.java:38)
              at org.jboss.weld.core@3.0.5.Final//org.jboss.weld.bean.proxy.EnterpriseTargetBeanInstance.invoke(EnterpriseTargetBeanInstance.java:56)
              at org.jboss.weld.core@3.0.5.Final//org.jboss.weld.bean.proxy.ProxyMethodHandler.invoke(ProxyMethodHandler.java:106)
              at org.jboss.weld.core@3.0.5.Final//org.jboss.weld.security.Principal$$Proxy$_$$_Weld$Proxy$.getName(Unknown Source)
              at deployment.test-jpa-1.1.0-SNAPSHOT.war//test.JpaListener.prePersist(JpaListener.java:89)
      

       

       

      The lookup of the EJBContext and getting the caller principal name is working fine on Wildfly15 server:

      InitialContext  ctx = new InitialContext();
      EJBContext ejbCtx = (EJBContext) ctx.lookup("java:comp/EJBContext");
      Principal principal = ejbCtx.getCallerPrincipal();
      String name = principal.getName();
      
      

       

      Did I am miss something in the configuration of the Server, CDI and JPA?

       

      Thanks!

      Andrej

       

      How to reproduce this error on the Widlfly 15:

      1. Start the server
      2. Copy the test-jpa-1.1.0-SNAPSHOT.war in the deployments directory
      3. Call the rest-service 'curl http://localhost:8080/test-jpa/model'

       

       

       

      Attachments:

      • wildfly15_stacktrace.log - stack trace log from wildfly 15 (unzip server)
      • jpa_log_wildfly_15_jdk11 - stacktrace Wildfly15.0.0.Final-1 docker image
      • test-jpa-1.1.0-SNAPSHOT.war - test application
      • test1.zip - source code