You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by bu...@apache.org on 2008/05/13 23:22:45 UTC

DO NOT REPLY [Bug 44992] New: Troubles with ApplicationContext. getResource and the WoodStox Parser

https://issues.apache.org/bugzilla/show_bug.cgi?id=44992

           Summary: Troubles with ApplicationContext.getResource and the
                    WoodStox Parser
           Product: Tomcat 5
           Version: 5.5.17
          Platform: PC
        OS/Version: Windows XP
            Status: NEW
          Severity: normal
          Priority: P2
         Component: Catalina
        AssignedTo: tomcat-dev@jakarta.apache.org
        ReportedBy: dougd@bea.com


I am having problems with Tomcat, Glassfish and the Woodstox Parser.

When calling servletContext.getResource with a WSDL file name which is a
resource in the webapp, the following is returned 
jndi:/localhost/myWebApp/WEB-INF/wsdl/StockQuoteService.wsdl

I see that Tomcat has its own UrlStreamHandler, DirContextUrlStreamHandler.

Now Woodstox wants to create an URL on
jndi:/localhost/myWebApp/WEB-INF/wsdl/StockQuoteService.wsdl
I guess for validation.

The java.net.Url constructor code eventually calls parseUrl and fails with a
MalformedUrlException

DirContextURLStreamHandler did not override that method and the invocation went
up to URLStreamHandler which threw the MalformedUrlException.


I don't quite understand why this Custom UrlStreamHandler is used instead of
say a file:/// formatted URL


-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org


DO NOT REPLY [Bug 44992] Troubles with ApplicationContext. getResource and the WoodStox Parser

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=44992


Mark Thomas <ma...@apache.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |WORKSFORME




--- Comment #1 from Mark Thomas <ma...@apache.org>  2008-05-13 15:15:23 PST ---
This works for me with the latest 6.0.x and 5.5.x

There may be an issue with both the parser and Tomcat calling
URL.setURLStreamHandlerFactory() although in that case I'd expect you to see an
error in the logs somewhere.

For the record parseUrl() has nothing to do with the exception you are seeing.
The exception is thrown by the constructor of java.net.URL (not java.net.Url)
when it can't find an appropriate protocol handler


-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org


DO NOT REPLY [Bug 44992] Troubles with ApplicationContext. getResource and the WoodStox Parser

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=44992


Mark Thomas <ma...@apache.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|REOPENED                    |RESOLVED
         Resolution|                            |WORKSFORME




--- Comment #3 from Mark Thomas <ma...@apache.org>  2008-05-14 07:45:20 PST ---
For both 6.0.x and 5.5.x the following runs without error in a JSP:

URL url = new
URL("jndi:/localhost/myWebApp/WEB-INF/wsdl/StockQuoteService.wsdl");

>From your description it looks like an issue with how OSGI interacts with the
URL class to provide additional protocol handlers. I don't see anything in this
report to suggest a Tomcat bug at this point.

Again, parseURL() is a red herring. That method doesn't throw the exception you
are seeing.


-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org


DO NOT REPLY [Bug 44992] Troubles with ApplicationContext. getResource and the WoodStox Parser

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=44992





--- Comment #4 from Doug Drechsel <do...@bea.com>  2008-05-15 06:03:57 PST ---
Sometimes I get lost in the weeds.  I needed to override setURL when using the
OSGI UrlStreamHandlerService.  Not doing that caused the setURL in
java.net.URLStreamHandler to be called which failed here

        if (this != u.handler) {
            throw new SecurityException("handler for url different from " +
                                        "this handler");
        }

and this bubbles up as a MalformedURLException.

Tnx for the perspective.


-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org


DO NOT REPLY [Bug 44992] Troubles with ApplicationContext. getResource and the WoodStox Parser

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=44992





--- Comment #5 from Mark Thomas <ma...@apache.org>  2008-05-15 06:07:51 PST ---
No problem. Glad you got it working.


-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org


DO NOT REPLY [Bug 44992] Troubles with ApplicationContext. getResource and the WoodStox Parser

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=44992


Doug Drechsel <do...@bea.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|RESOLVED                    |REOPENED
         Resolution|WORKSFORME                  |




--- Comment #2 from Doug Drechsel <do...@bea.com>  2008-05-14 05:29:27 PST ---
Yes, I did get the unknown protocol early on.  I am in an OSGI environment so I
registered the Tomcat URLStreamHandler with the URLStreamHandlerService.

But leaving OSGI aside, if in the JVM, no process beats Tomcat to registering
the URLStreamHandler and Tomcat gets its URLStreamHandler in, then Woodstox
would not get the unknown protocol error

In JVM1.5.11 , java.net.URL

    public URL(String spec) throws MalformedURLException {
        this(null, spec);
    }

calls

    public URL(URL context, String spec) throws MalformedURLException {
        this(context, spec, null);
    }

calls

    public URL(URL context, String spec, URLStreamHandler handler)
        throws MalformedURLException

which calls

            handler.parseURL(this, spec, start, limit);

        } catch(MalformedURLException e) {
            throw e;
        } catch(Exception e) {
            throw new MalformedURLException(e.getMessage());
        }


-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org


DO NOT REPLY [Bug 44992] Troubles with ApplicationContext. getResource and the WoodStox Parser

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=44992


Doug Drechsel <do...@bea.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |dougd@bea.com




-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org