This discussion is archived
1 Reply Latest reply: Mar 7, 2012 4:00 AM by gimbal2 RSS

JAX-RS   how to access the file from Web Application

867365 Newbie
Currently Being Moderated
HI

I am using JAX-RS , I want read XSLT file which how do I do that

I tried below code

@Context ServletContext context;

     String location = context.getRealPath("/WEB-INF/provide.txt");
     System.out.println("File path :-"+location);
     File stylesheet = new File(location);

It is throwing below exception

07-Mar-2012 14:33:35 com.sun.jersey.spi.container.ContainerResponse mapMappableContainerException
SEVERE: The RuntimeException could not be mapped to a response, re-throwing to the HTTP container.


can you please adivce
  • 1. Re: JAX-RS   how to access the file from Web Application
    gimbal2 Guru
    Currently Being Moderated
    Apparently a RuntimeException is being caused in this code - I am going to venture a guess it is a NullPointerException. What you see here is basically jersey's response to that happening; it doesn't know how to deal with the exception that was caused.

    So yeah, time to check the logs for more details. Or fire up the debugger and step through the code to see where it blows.

Legend

  • Correct Answers - 10 points
  • Helpful Answers - 5 points