Note that there are some explanatory texts on larger screens.

plurals
  1. PONameNotFoundException while opening connection from Datasource, JNDI
    primarykey
    data
    text
    <p>i had an application working with JSF and i oppened the connection manually, but now i have to change it and open all the connections from a Datasource, so i have an .xml file in the directory (Jboss 7)</p> <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt; &lt;datasources xmlns="http://www.jboss.org/ironjacamar/schema"&gt; &lt;datasource jndi-name="java:jboss/datasources/MyForum" enabled="true" use-java-context="true" pool-name="MyForum"&gt; &lt;connection-url&gt;jdbc:hsqldb:hsql://localhost&lt;/connection-url&gt; &lt;driver&gt;hsqldb.jar&lt;/driver&gt; &lt;pool&gt;&lt;/pool&gt; &lt;security&gt; &lt;user-name&gt;sa&lt;/user-name&gt; &lt;password&gt;&lt;/password&gt; &lt;/security&gt; &lt;/datasource&gt; &lt;/datasources&gt; </code></pre> <p>Then i have the code to acces the JNDI name in a class "JdbcHelper" </p> <pre><code>public Connection createConnection() { try { String jndiKey = getProperty("JNDI_DATASOURCE"); Context ctx = new InitialContext(); DataSource ds = (DataSource) ctx.lookup(jndiKey); return ds.getConnection(); } catch (NamingException e) { throw new RuntimeException("Can't open JDBC conection from JNDI", e); } catch (SQLException e) { throw new RuntimeException("Can't open JDBC conection", e); } } </code></pre> <p>The line which is launching the exception is this one <code>DataSource ds = (DataSource) ctx.lookup(jndiKey);</code> I don't know if you need more information, but if you need just ask, i really need to do this and I can't find the solution :(</p> <p>Update, here's the detail-message of the exception </p> <pre><code>datasources/MyForum -- service jboss.naming.context.java.jboss.datasources.MyForum </code></pre> <p>Thank you so much in advance. :)</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload