2 Replies Latest reply on Aug 12, 2019 4:37 AM by luwal

    JndiException: Unable to lookup JNDI name [java:jboss/TransactionManager]


      This exception I have got in time of deployment for most simple EJB+JPA application (for xa-datasource) without maven pom (WildFly 16/17, template was generated by Eclipse 2019-6 - File -> New -> EJB Project):

      Project's Java classes are not essential, may by Entity-POJO only (very simple too - id and message fields with getters/setters) as exception thrown on deployment stage.


      I've tried to find similar case for app deployment but without success. It's some strange situation. Especially, TransactionManager is present on JNDI and shown on Admin page:


      Summary for error on log:

      ERROR [org.jboss.as.controller.management-operation] (DeploymentScanner-threads - 1) WFLYCTL0013: Operation ("deploy") failed - address: ([("deployment" => "MulticEJB.jar")]) - failure description: {"WFLYCTL0080: Failed services" => {"jboss.persistenceunit.\"MulticEJB.jar#MulticEJB\"" => "javax.persistence.PersistenceException: [PersistenceUnit: MulticEJB] Unable to build Hibernate SessionFactory

          Caused by: javax.persistence.PersistenceException: [PersistenceUnit: MulticEJB] Unable to build Hibernate SessionFactory

          Caused by: org.hibernate.engine.jndi.JndiException: unable to find transaction manager

          Caused by: org.hibernate.engine.jndi.JndiException: Unable to lookup JNDI name [java:jboss/TransactionManager]

          Caused by: javax.naming.NameNotFoundException: jboss -- service jboss.naming.context.java.jboss.exported.jboss"}}


      Configs is:





      # credential as login to Admin page





      <?xml version="1.0" encoding="UTF-8"?>

      <persistence version="2.1" xmlns="http://xmlns.jcp.org/xml/ns/persistence"


          xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/persistence http://xmlns.jcp.org/xml/ns/persistence/persistence_2_1.xsd">


          <persistence-unit name="MulticEJB" transaction-type="JTA">




                  <property name="hibernate.hbm2ddl.auto" value="update" />

                  <property name="hibernate.dialect" value="org.hibernate.dialect.MySQL5InnoDBDialect" />






      <xa-datasource jndi-name="java:/MySqlTestXA" pool-name="MySqlTestXA">

          <xa-datasource-property name="ServerName">



          <xa-datasource-property name="DatabaseName">














      <driver name="mysql" module="com.mysql"/>



      <?xml version='1.0' encoding='UTF-8'?>

      <module xmlns="urn:jboss:module:1.1" name="com.mysql">


              <resource-root path="mysql-connector-java-8.0.17.jar"/>



              <module name="javax.api"/>

              <module name="javax.transaction.api"/>




      P.S. I suppose that my experience is not enought for XA-datasource and Narayana details but I can't to find the way to go futher and deep (JNDI? XA? Hibernate? pom-configuration only? etc.)

        • 1. Re: JndiException: Unable to lookup JNDI name [java:jboss/TransactionManager]

          Try to deploy the jar file without jndi.properties file inside.

          • 2. Re: JndiException: Unable to lookup JNDI name [java:jboss/TransactionManager]

            Thanks for respond Frank! Its work. Unfortunately it's bad pattern from examples here.


            jndi.properties used for Client class only. This Client was used for quick bean lookup demonstration after deployment to AS and example works for most primitive methods like as return "OK". Otherwise, Client needs for another project for properly work.


            In this case Bean gathers from jndi.properties and try to find JNDI through http-remoting://localhost:8080. So Bean doesn't see java:boss namespace from remote JNDI request and deployment failed when needs for update datasource.


            In additional, I was some misleaded here by mark from WildFly documentation (13. Local JNDI): "Only entries within the java:jboss/exported context are accessible over remote JNDI" and tried to use <xa-datasource jndi-name="java:jboss/exported/MySqlTestXA">. But for this case I've lost attention in mention java:jboss/TransactionManager - it's without "exported".


            Good sound for me here is motivation to read lot of documentation and thank you again for support.