[jboss-user] [Tomcat, HTTPD, Servlets & JSP] - MalformedURLException with

PickATrail do-not-reply at jboss.com
Tue Oct 17 12:37:27 EDT 2006


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

View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3978837#3978837

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3978837



More information about the jboss-user mailing list