2

I have an application (war-binary-only) with an embedded jndi resource of java:jdbc/xyz

Which I try to express in a xyz-ds.xml file, but cannot find the right syntax.

Wildfly insist on having either java:/ or java:/jboss in the beginning of the jndi name, and neither seems to match..

<datasource jndi-name="java:/jdbc/xyz" poolname="xyz" enabled="true" use-java-context="true">
   ....
</datasource>

Does anybody know how to do this?

Niels Bech Nielsen
  • 4,777
  • 1
  • 21
  • 44

1 Answers1

0

This works for me in my Wildfly 8 standalone.xml configuration:
jndi-name="java:jboss/datasources/xyz".

This reflects to
<jta-data-source>java:/jdbc/xyz</jta-data-source>
in persistence.xml though.

It's a bit confusing and feels unintuitive, but according to the documentation, this is the right way.

Zhedar
  • 3,480
  • 1
  • 21
  • 44
  • I see what you mean. I tried to move it to java:jboss/datasources/xyz, but I cannot still retrieve it from the code, which only has an java:jdbc/xyz (no leading slash) – Niels Bech Nielsen Feb 19 '15 at 15:47
  • @NielsBechNielsen can't you modifiy the jndi in your persistence.xml? – Zhedar Feb 19 '15 at 15:48
  • I see, I'm not really sure if `java:jdbc/xyz` ever was a correct jndi for JBoss servers, so you may be unlucky at this point. – Zhedar Feb 19 '15 at 15:50
  • @Zhedar I am not seeing any reference to `java:/jdbc` in the documentation you point to. – avernet Jan 18 '17 at 18:19