Wildfly 15 WFLYWELD0038: Could not inject SecurityManager, security is not enabled
andrej.petras Jan 9, 2019 2:30 PMHi,
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:
- Start the server
- Copy the test-jpa-1.1.0-SNAPSHOT.war in the deployments directory
- 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
-
jpa_log_wildfly_15_jdk11.zip 3.0 KB
-
wildfly15_stacktrace.log.zip 1.7 KB
-
test-jpa-1.1.0-SNAPSHOT.war 5.6 KB
-
test1.zip 5.6 KB