javax.naming.Exception: Could not create resource instance

75 Views Asked by At

I'm maintaining a Java web application. At some point, it runs the following code:

Context ctx = (Context) new InitialContext.lookup("java:comp/env");
java.net.URL url;

try {
    url = (java.net.URL) ctx.lookup("url/example");
} catch (Exception ex) {
    logger.warn(ex)
    url = null
}

When attempting to resolve the second lookup ("url/example"), it crashes giving the following error:

javax.naming.Exception: Could not create resource instance

In my context.xml (located in /WebContent/META-INF/) I have defined a resource this way:

<Resource name="url/example"
    auth="Container"
    type="java.net.URL" />

Maybe there is something wrong whis this resource definition?

0

There are 0 best solutions below