Resource reference with name 'jdbc/devl' not found in ibm-web-bnd.xml
Asked Answered
N

2

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.

Naumann answered 11/9, 2014 at 13:45 Comment(5)
Yes, the <resource-ref name="..."> should match the <res-ref-name> (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.Gilford
@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:".Naumann
@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?Naumann
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.Gilford
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...Woosley
W
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.

Wimmer answered 11/6, 2020 at 15:41 Comment(0)
D
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.

Dkl answered 24/6, 2016 at 13:44 Comment(1)
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)Ferminafermion

© 2022 - 2024 — McMap. All rights reserved.