• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

getServletContext().getContent() returning null

 
T Vergilio
Ranch Hand
Posts: 230
5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have created two web applications to test getting the ServletContext of one application from within another application.

Code for the first Servlet, from the first application:



This will print the path "/MyServlets", which I will use in the second Servlet, as well as "from within the same servlet, flavour is: vanilla", which proves that this value has been set (I set it in the deployment descriptor).

Now here is the code for the second Servlet, which lives in the second application:


What am I doing wrong?

Thanks in advance for your help
 
Frits Walraven
Creator of Enthuware JWS+ V6
Saloon Keeper
Pie
Posts: 2402
92
Android Chrome Eclipse IDE
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Chandella,

What am I doing wrong?

If you are using Tomcat as a server you have to put the following line in either the server.xml or better the context.xml of your server:

Regards,
Frits
 
T Vergilio
Ranch Hand
Posts: 230
5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Spot on, added that line to context.xml and it now works

Thank you ever so much, Frits!
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic