1 Reply Latest reply on Nov 2, 2006 1:17 PM by pickatrail

    MalformedURLException with

      I'm running into a rather strange problem with JBoss. I have a web
      application that looks up a resource and instantiates an URL to it as
      follows:

      final ServletContext ctx = session.getServletContext();
      final String resourcePath = "/WEB-INF/web.xml";

      final URL url = ctx.getResource(resourcePath);
      final String externalForm = url.toExternalForm();

      // The value of externalForm is something like
      // "jndi:/localhost/problem/WEB-INF/web.xml".

      // The following line fails under in specific situation
      final URL url2 = new URL(externalForm);

      This usually works as expected. However, I have another web
      application deployed in the same JBoss server, and once I have
      used this other one, the "new URL(...)" line fails with a
      MalformedURLException:

      java.net.MalformedURLException: unknown protocol: jndi
      at java.net.URL.(URL.java:544)
      at java.net.URL.(URL.java:434)
      at java.net.URL.(URL.java:383)
      at org.apache.jsp.index_jsp._jspService(...)
      ...

      This other application is the WebViewerExample from BIRT 2.1.1
      (http://www.eclipse.org/birt/), for those of you who would like to
      reproduce the problem.

      I see this problem on JBoss 4.0.1sp1 and 4.0.4. I have *not* been
      able to reproduce it using plain Tomcat (5.0.x and 5.5.x).

      Has anyone run into similar problem? Any suggestion for workaround?
      Thanks.

      -- Patrick