4 Replies Latest reply on Jan 2, 2014 7:45 PM by ybxiang.china

    How to configure a Mail Session in Wildfly?

    rsoika

      I have a component which is using JavaMail. When I try to deploy my war archive I got a deployment error "JBAS014771: Services with missing/unavailable dependencies"

      I added the following configuration into ejb-jar.xml / web.xml:

       

      <!-- Mail Configuration -->
      <env-entry>
      <description> Mail Plugin Session name</description>
      <env-entry-name>IMIXS_MAIL_SESSION</env-entry-name>
      <env-entry-type>java.lang.String</env-entry-type>
      <env-entry-value>mail/org.imixs.workflow.mail</env-entry-value>
      </env-entry>
      <resource-ref>
      <res-ref-name>mail/org.imixs.workflow.mail</res-ref-name>
      <res-type>javax.mail.Session</res-type>
      <res-auth>Container</res-auth>
      <res-sharing-scope>Shareable</res-sharing-scope>
      </resource-ref>

       

       

      My java component simply injects a resource name which is used to lookup later the mail session with:

       

      @Resource(name = "IMIXS_MAIL_SESSION")

        private String sMailSession = "org.imixs.workflow.mail";

       

       

      But deployment on my war archive fails with the following message:

       

      19:18:05,306 INFO  [org.jboss.weld.deployer] (MSC service thread 1-1) JBAS016005: Starting Services for CDI deployment: imixs-workflow-web-sample-3.1.5.war

      19:18:05,330 INFO  [org.jboss.weld.deployer] (MSC service thread 1-4) JBAS016008: Starting weld service for deployment imixs-workflow-web-sample-3.1.5.war

      19:18:05,365 ERROR [org.jboss.as.controller.management-operation] (XNIO-1 task-7) JBAS014613: Operation ("deploy") failed - address: ([("deployment" => "imixs-workflow-web-sample-3.1.5.war")]) - failure description: {"JBAS014771: Services with missing/unavailable dependencies" => ["jboss.naming.context.java.module.\"imixs-workflow-web-sample-3.1.5\".\"imixs-workflow-web-sample-3.1.5\".env.mail.\"org.imixs.workflow.mail\" is missing [jboss.naming.context.java.jboss.resources.mail.\"org.imixs.workflow.mail\"]"]}

      19:18:05,366 ERROR [org.jboss.as.server] (XNIO-1 task-7) JBAS015870: Deploy of deployment "imixs-workflow-web-sample-3.1.5.war" was rolled back with the following failure message: {"JBAS014771: Services with missing/unavailable dependencies" => ["jboss.naming.context.java.module.\"imixs-workflow-web-sample-3.1.5\".\"imixs-workflow-web-sample-3.1.5\".env.mail.\"org.imixs.workflow.mail\" is missing [jboss.naming.context.java.jboss.resources.mail.\"org.imixs.workflow.mail\"]"]}

       

       

      I can not figure out how to define the mail resource in Wildfly.

      I thried to add mail sesson definitions with the jndi names: java:jboss/mail/org.imixs.workflow.mail or java:/mail/org.imixs.workflow.mail

      But it did not work for me.

      Can anybody give me a hint?

       

       

      ====
      Ralph