ophychius
ophychius

Reputation: 2653

JNDI - Glassfish JDBC, error when referencing data source

On a glassfish server I have a JDBC Connection pool set up for my postgresql database. I have also create a JDBC Resource on my Glassfish server for this Connection pool

If I create a web app that I deploy and run on this Glassfish server I get the following message about the jdbc resource. (IDE is Eclipse)

[#|2011-10-03T13:33:09.745+0200|WARNING|glassfish3.1.1|javax.enterprise.system.tools.deployment.org.glassfish.deployment.common|_ThreadID=132;_ThreadName=Thread-2;|This web app [GlassfishTest] has no expand »resource environment reference by the name of [jdbc/MEM_Reporting]|#]

In my web.xml the resource is configured as follows:

<resource-env-ref>
<resource-env-ref-name>jdbc/MEM_Reporting</resource-env-ref-name>
<jndi-name>reporting</jndi-name>
</resource-env-ref>

I have been searching for a while now but cant find any solution, hope any of you guyz can help out.

Upvotes: 0

Views: 4119

Answers (2)

Toni Garabedyan
Toni Garabedyan

Reputation: 101

I add <jndi-name> tag in glassfish-web.xml file, not in sun-web.xml and after that the warning dissapear.

Upvotes: 0

Martin Gamulin
Martin Gamulin

Reputation: 3865

Shouldn't you've be using resource-ref instead of resource-env-ref?

UPDATE:

How do you reference it? Did you try to reference it with "java:comp/env/jdbc/MEM_Reporting"

also in web.xml resource-ref should look ike

<resource-ref>
  <res-ref-name>jdbc/MEM_Reporting</res-ref-name>
  <res-type>javax.sql.DataSource</res-type>
  <res-auth>Container</res-auth>
</resource-ref>

in sun-web.xml

 <resource-ref>
     <res-ref-name>jdbc/MEM_Reporting</res-ref-name>
     <jndi-name>jdbc/MEM_Reporting</jndi-name>
 </resource-ref>

Also, take a look at Sun documentation for Reference Elements

Upvotes: 2

Related Questions