7

RAD 7, WebSphere 7.

ibm-web-bnd.xml:

<resource-ref name="jdbc/devl" binding-name="jdbc/devl" />

web.xml:

<resource-ref>
  <res-ref-name>jdbc/devl</res-ref-name>
  <res-type>javax.sql.DataSource</res-type>
  <res-auth>Application</res-auth>
  <res-sharing-scope>Unshareable</res-sharing-scope>
  <mapped-name>jdbc/devl</mapped-name>
</resource-ref>

This conforms to the examples I see on the internet. This comes up because I am converting this app to servlet 2.5. As I understand it, the res-ref-name in web.xml should match the name attribute in resource-ref. The binding-name then matches the datasource defined in the admin console. To make it simple, I made them all match.

Is there another setting somewhere? Because this produces the error described in the title of the question.

pnuts
  • 58,317
  • 11
  • 87
  • 139
Entropy
  • 1,219
  • 6
  • 21
  • 45
  • Yes, the `` should match the `` (and the `binding-name="..."` should match the data source name, but that would be a different error). I'm not sure what's wrong. Can you update your question with the full error message? Perhaps there is a hint in the error message. – Brett Kail Sep 11 '14 at 15:28
  • @bkail - Actually, that IS the full message. It's an XML validation error. If I run with errors I get a regular jndi "what the heck is this" type exception. Like so: javax.naming.NameNotFoundException: Name "comp/env/devl" not found in context "java:". – Entropy Sep 11 '14 at 16:07
  • @bkail - I am able to make the XML validation error go away, but the jndi exception remains. I found some config files related to the project facet that thought the project was still in servlet 2.2. I thought just changing the web.xml and the .xmi's into xmls accomplished this. Are there other settings I am missing? – Entropy Sep 11 '14 at 17:59
  • If you can include the full error message (with timestamp, component, message ID, etc.) or exception (with full stack trace, all caused by, etc.), then I can try to take a closer look. I'm familiar with the product internals, so sometimes I can give a better answer (or ask more direct questions) if I can see all the information. – Brett Kail Sep 11 '14 at 20:52
  • Please attach full exception and also piece of code that does the lookup. As from the fragment of exception `NameNotFoundException: Name "comp/env/devl"` , the reference name is `dev1` not `jdbc/dev1` if you pasted it correctly... – Gas Sep 11 '14 at 22:42

2 Answers2

3

I have the same issue many times. It disappeared when I closed the eclipse and when I reopened it I made a "project -> clean". I hope it works for the next person who has this error. enter image description here

Also make sure you have the web.xml header updated to 2.5 or higher (3.0).This is related to the facets of the project, make sure they are with the same version enter image description here

if it doesn't let you change it, you should change it in this file : "org.eclipse.wst.common.project.facet.core.xml"

If the error continues, you should generate the binding file again. Make sure you have the correct server settings in the facets of the project enter image description here

To generate the file you must do it from java EE Tools. enter image description here

Remember that ibm-web-bnd.xml and web.xml must be in the same directory

Build, and clean project.

Community
  • 1
  • 1
Pichitron
  • 159
  • 5
1

If you are using Eclipse, try to update the web module version in project.facet.core.xml. It should be in synch with the web.xml web-app version.

Shan
  • 21
  • 1
  • 6
  • Also, it can happen if you have the correct web module version in the facet (sigh). I fixed *uninstalling* the `Dynamic Web Module` facet and reinstalling it again with the same version (2.5 in my case) – jneira Feb 15 '21 at 07:05