• 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
  • Paul Clapham
  • Ron McLeod
  • Tim Cooke
  • Junilu Lacar
Sheriffs:
  • Rob Spoor
  • Devaka Cooray
  • Jeanne Boyarsky
Saloon Keepers:
  • Jesse Silverman
  • Stephan van Hulst
  • Tim Moores
  • Carey Brown
  • Tim Holloway
Bartenders:
  • Jj Roberts
  • Al Hobbs
  • Piet Souris

SaxParseException while validating the xml using xsd file

 
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,

When I try to validate my xml input using validator, it throws the following exception:



The same thing used to work earlier, but now with no changes made, it's not working. The same thing works on other server without any issue.

Here is my xml file:

<CFTSContract contractNumber = "TAAAXCA" country="897" company="NEWSYSX" actionCode = 'U'>
</CFTSContract>

And my xsd file is:




And my validator java file is:


I am using WebSphere 9.0 for this web service. Any idea how this can be fixed.
 
Sheriff
Posts: 22504
122
Eclipse IDE Spring VI Editor Chrome Java Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Poorna Alle wrote:


That WEB-INF part is the problem. Any resource that's located inside the WEB-INF folder is not accessible directly through HTTP(S).

Since this XSD file is located in another web application, you can't simply use it as a resource. You need to go cross-context. For Tomcat, you could use https://stackoverflow.com/questions/6552231/requestdispatcher-to-url-in-a-different-web-app. You'd need to check out how to do this in WebSphere.
 
Rob Spoor
Sheriff
Posts: 22504
122
Eclipse IDE Spring VI Editor Chrome Java Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I think I misread your code. The XSD appears to be inside your application itself. That means that you can try using ServletContext.getResource. That also returns a URL, but one that does not use HTTP but instead simply looks directly inside your application.
 
Poorna Alle
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Rob, Thanks for the reply. In fact, this has been the working code since long, and it still works on other servers. So, we would not want to change the code and instead trying to find the reason why the exception is happening during validation. If we know the reason, we can fix that to make this same code work again.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic