Why datasource is not found in JNDI after injection from jndi.properties?

后端 未结 1 615
天命终不由人
天命终不由人 2021-01-18 04:50

This is my persistence.xml:


  
    org.hibernate.ejb.HibernatePersis         


        
1条回答
  •  陌清茗
    陌清茗 (楼主)
    2021-01-18 05:38

    Should be found if you lookup openejb:Resource/jdbc/abcDS

    As well you can get injection in your TestCase. Basically, you:

    1. add an empty src/test/resources/META-INF/application-client.xml or ejb-jar.xml
    2. Annotate your test with @LocalClient
    3. Call initialContext.bind("inject", this)

    See the testcase-injection example in the examples.zip

    EDIT If the lookup still fails, post your log output (the console output).

    0 讨论(0)
提交回复
热议问题