Using API Rest at JBOSS

Hello,

I’m using Bonita at 5.10.1 version.

I have developed a Java Web Application that connect with Bonita API Rest and run a process. The app run fine at Apache Tomcat, but when i try to run it at JBoss 5.1, i catch this error:

Exception occurred in target VM: Missing users.properties file. javax.security.auth.login.LoginException: Missing users.properties file. at org.jboss.security.auth.spi.UsersRolesLoginModule.login(UsersRolesLoginModule.java:148) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:606) at javax.security.auth.login.LoginContext.invoke(LoginContext.java:762) at javax.security.auth.login.LoginContext.access$000(LoginContext.java:203) at javax.security.auth.login.LoginContext$4.run(LoginContext.java:690) at javax.security.auth.login.LoginContext$4.run(LoginContext.java:688) at java.security.AccessController.doPrivileged(Native Method) at javax.security.auth.login.LoginContext.invokePriv(LoginContext.java:687) at javax.security.auth.login.LoginContext.login(LoginContext.java:595) at com.bintertechnic.sms.controllers.RegistroController.arrancarProceso(RegistroController.java:449) at com.bintertechnic.sms.controllers.RegistroController.doPost(RegistroController.java:182) at javax.servlet.http.HttpServlet.service(HttpServlet.java:637) at javax.servlet.http.HttpServlet.service(HttpServlet.java:717) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206) at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206) at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:235) at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191) at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:190) at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:92) at org.jboss.web.tomcat.security.SecurityContextEstablishmentValve.process(SecurityContextEstablishmentValve.java:126) at org.jboss.web.tomcat.security.SecurityContextEstablishmentValve.invoke(SecurityContextEstablishmentValve.java:70) at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127) at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102) at org.jboss.web.tomcat.service.jca.CachedConnectionValve.invoke(CachedConnectionValve.java:158) at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109) at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:330) at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:829) at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:598) at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447) at java.lang.Thread.run(Thread.java:744)

I have read that i must adapt the Jboss file (login-config.xml) to include the information of JAAS file, but I dont know what to do exactly.

This is the code to connect with API

System.setProperty(BonitaConstants.JAAS_PROPERTY, propiedades.getProperty("jaasFile")); // Type of API to use System.setProperty(BonitaConstants.API_TYPE_PROPERTY, org.ow2.bonita.facade.Context.REST.toString()); // REST web application URL System.setProperty(BonitaConstants.REST_SERVER_ADDRESS_PROPERTY, propiedades.getProperty("direccionRestServer")); // Verification of username and password using BonitaAuth login context // If the login operation failed (incorrect username and/or password, it will raise an exception and program // execution will be aborted // This operation is optional. LoginContext bonitaAuth = new LoginContext("BonitaAuth", new SimpleCallbackHandler(propiedades.getProperty("adminUser"), propiedades.getProperty("adminPass"))); bonitaAuth.login(); bonitaAuth.logout(); // Use the BonitaStore to share with the BEE the username of the user performing the APIs calls LoginContext bonitaStore = new LoginContext("BonitaStore", new SimpleCallbackHandler(propiedades.getProperty("adminUser"), "doesn't matter")); bonitaStore.login();
    // Get process definition
    ProcessDefinition processDefinition = null;
    QueryDefinitionAPI queryDefinitionAPI = AccessorUtil.getQueryDefinitionAPI();
    processDefinition = queryDefinitionAPI.getProcess(propiedades.getProperty("nombreProceso"), propiedades.getProperty("versionProceso"));
    // Initialize process variables - key = name of process variable.
    Map<String, Object> mapData = new HashMap<String, Object>();
    mapData.put("codigoNotificacion", notificacion.getCodigoNotificacion());
    // Start process
    RuntimeAPI runtimeAPI = AccessorUtil.getRuntimeAPI();
    ProcessInstanceUUID processInstanceUUID = runtimeAPI.instantiateProcess(processDefinition.getUUID(), mapData);
    bonitaStore.logout();

And here is my JAAS file

BonitaAuth { org.ow2.bonita.identity.auth.BonitaIdentityLoginModule required; };

BonitaStore {
org.ow2.bonita.identity.auth.BonitaRESTLoginModule required restUser=“restuser” restPassword=“restbpm”;
};

BonitaAuth-default {
org.ow2.bonita.identity.auth.BonitaIdentityLoginModule required domain=“default”;
org.ow2.bonita.identity.auth.LocalStorageLoginModule required domain=“default”;
};

BonitaStore-default {
org.ow2.bonita.identity.auth.LocalStorageLoginModule required domain=“default”;
};

/**

  • Used by the REST server
    */
    BonitaRESTServer {
    org.ow2.bonita.identity.auth.BonitaRESTServerLoginModule required logins=“restuser” passwords=“restbpm” roles=“restuser”;
    };

Any idea?

Thanks and regards