• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • paul wheaton
  • Jeanne Boyarsky
  • Ron McLeod
Sheriffs:
  • Paul Clapham
  • Liutauras Vilda
  • Devaka Cooray
Saloon Keepers:
  • Tim Holloway
  • Roland Mueller
Bartenders:

MalformedURLException not understood

 
Ranch Hand
Posts: 68
Netbeans IDE Firefox Browser Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I don't know if this right subforum to write in since the post going across different topics.

Wrapped in a javax.xml.stream.XMLStreamException I get a java.net.MalformedURLException. Why is a mystery to me as any MalformedURLException thrown by constructing an URL object in the same method, which is later passed on, is caught separately and never occur. The situation is further complicated by the fact that the stack trace doesn't contain references to line numbers in my code.

The stack trace for the MalformedURLException looks like this:


The class dk.lokus.server.QXLCollector is my own code, but it is executed by putting instances of it in a queue that is assigned to a ThreadPoolExecutor. Along with the stack trace the URL is logged, and entering it in a browser just a few minutes after the exception happens leads to the file loading just fine. I have almost identical code (the code for opening the connection is identical, the URL and processing code is not) in other parts of the application and this code is the only that exhibits this behavior which leads me to suspect that it is somehow related to the combination of code and server.

I thought that I would ask for input here since I'm completely lost in regards to this situation but I need to figure it out as it threatens the stability of the entire application.
 
Sheriff
Posts: 22821
132
Eclipse IDE Spring Chrome Java Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
The problem is caused by the XML reading part, in particular the entity handling (com.sun.org.apache.xerces.internal.impl.XMLEntityManager.setupCurrentEntity). That method tries to create a URL but can't. I think you will have a bit more success in our XML forum. Moving there.
 
Sheriff
Posts: 28368
99
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
So the problem is not caused by a URL which you are creating, but by a URL which is in the XML document you are parsing. Accordingly you should look at that document and see if there are malformed URLs in it. The stack trace suggests the parser is processing "entities".
 
Philip Grove
Ranch Hand
Posts: 68
Netbeans IDE Firefox Browser Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I suspect that the root of the problem is the behavior of the XMLStreamReader. Since the XMLStreamReader is created through the XMLInputFactory I have tried to set properties to stop it from resolving and replacing external entities. I have added these two lines to my code (of course before creating the XMLStreamReader) but it makes no difference at all:


I am completely new to StAX so if anybody could point me in the direction of a good source of information I would appreciate it.
 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Rob Spoor wrote:The problem is caused by the XML reading part, in particular the entity handling (com.sun.org.apache.xerces.internal.impl.XMLEntityManager.setupCurrentEntity). That method tries to create a URL but can't. I think you will have a bit more success in our XML forum. Moving there.




I made a crawer using StAX. The thing is that I didnĀ“t install JSR-173, You can download in softonic.com. So before I got this message:
Exception in thread "main" java.lang.NoSuchMethodError: com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl.getNamespaceContext()Lcom/sun/org/apache/xerces/internal/xni/NamespaceContext;
at com.sun.org.apache.xerces.internal.impl.XMLStreamReaderImpl.<init>(XMLStreamReaderImpl.java:100)
at com.sun.xml.internal.stream.XMLInputFactoryImpl.getXMLStreamReaderImpl(XMLInputFactoryImpl.java:264)
at com.sun.xml.internal.stream.XMLInputFactoryImpl.createXMLStreamReader(XMLInputFactoryImpl.java:131)

By alvaro.
 
How do they get the deer to cross at the signs? Or to read this tiny ad?
Smokeless wood heat with a rocket mass heater
https://woodheat.net
reply
    Bookmark Topic Watch Topic
  • New Topic