Skip to content

Instantly share code, notes, and snippets.

@gbougeard
Created September 25, 2014 16:26
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save gbougeard/0ff8b17a261059d64435 to your computer and use it in GitHub Desktop.
Save gbougeard/0ff8b17a261059d64435 to your computer and use it in GitHub Desktop.
JBAS014312: Cannot lookup jndi name: java:jboss/datasources/MySQLDS since it doesn't belong to java:app, java:module, java:comp or java:global namespace
<dataSource type="JNDI">
<property name="data_source" value="java:jboss/datasources/MySQLDS"/>
</dataSource>
<datasource jta="true" jndi-name="java:/boss/datasources/MySQLDS" pool-name="MySQLDS" enabled="true" use-java-context="true" spy="false">
@hasalex
Copy link

hasalex commented Sep 25, 2014

Do not access directly with the JNDI name.

Declare a Resource in web.xml :


<resource-ref>
    <res-ref-name>jdbc/mysql-ds</res-ref-name>
    <res-type>javax.sql.DataSource</res-type>
    <res-auth>Container</res-auth>
    <lookup-name>java:jboss/datasources/MySQLDS</lookup-name>
</resource-ref>

And lookup "java:comp/env/jdbc/mysql-ds"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment