Dude, I just found out it actually works. I've had this problem with a SLSB, not a datasource but I guess it's the same issue, I've had the same exception:
Code:
Caused by: javax.naming.NameNotFoundException: xxx not found
at com.sun.enterprise.naming.TransientContext.doLookup(TransientContext.java:216)
Technically speaking I still have it, but the reference is set anyway. Here's my config:
web.xml:
Code:
<ejb-local-ref id="ejb_testmanager">
<ejb-ref-name>ejb/TestManager</ejb-ref-name>
<ejb-ref-type>Session</ejb-ref-type>
<local>yyy.test.TestManager</local>
</ejb-local-ref>
applicationContext.xml:
Code:
<jee:jndi-lookup id="xxxx" jndi-name="java:comp/env/ejb/TestManager"/>
java class, spring controller:
Code:
@Controller
public class TestUIController {
...
private TestManager testManager;
@RequestMapping("/")
public String indexHandler() {
System.out.println("wtf: " + testManager);
if (testManager != null) {
System.out.println("Wooohooo!");
testManager.GenerateSomeData();
}
return "index";
}
...
@Resource(name="xxxx")
public void setTestManager(TestManager testManager) {
this.testManager = testManager;
}
}
And this is just fine. The indexHandler method generates some data.
Yes, I've still got the NameNotFoundException exception from sun, but spring is just fine. I guess this is the first exception in my project I'll have to ignore, hope the last one :/ Maybe you've got a similar issue? HTH
Kornel