I'm getting a weird problem in GlassFish 2.1 - I'm a beginner with this container and I'm having trouble pinning this down.
I have a new install of GlassFish 2.1 with a JDBC connection pool defined called testDerbyPool. I then have a resource defined called jdbc/testDerbyPool pointing at that pool. The resource type is javax.sql.DataSource and I can successfully ping the pool.
I then have a single class in a webapp with this declaration:
@Resource(name="jdbc/testDerbyPool")
private javax.sql.DataSource source;
This declaration in my web.xml:
<resource-ref>
<res-ref-name>jdbc/testDerbyPool</res-ref-name>
<res-type>javax.sql.DataSource</res-type>
<res-auth>Container</res-auth>
</resource-ref>
When I try to deploy the application, I get this error:
[#|2009-09-09T21:40:47.582+0100|SEVERE|sun-appserver9.1|javax.enterprise.system.container.web|_ThreadID=24;_ThreadName=Thread-32;_RequestID=1ca4ab80-ae39-4920-be18-f535b025bb51;|WebModule[/cptest1]PWC1275: Exception sending context initialized event to listener instance of class com.sun.faces.config.ConfigureListener
and a huge stack trace, starting:
java.lang.NoClassDefFoundError: LDataSource;
at java.lang.Class.getDeclaredFields0(Native Method)
at java.lang.Class.privateGetDeclaredFields(Class.java:2291)
with root cause:
Caused by: java.lang.ClassNotFoundException: DataSource
at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1498)
at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:320)
I don't understand how DataSource can be 'not found'! Any ideas?