This week's book giveaway is in the Agile and other Processes forum.
We're giving away four copies of The Mikado Method and have Ola Ellnestam and Daniel Brolund on-line!
See this thread for details.
The moose likes Servlets and the fly likes getContext() returning null Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


Win a copy of The Mikado Method this week in the Agile and other Processes forum!
JavaRanch » Java Forums » Java » Servlets
Reply Bookmark "getContext() returning null" Watch "getContext() returning null" New topic
Author

getContext() returning null

Nikhil Sagar
Ranch Hand

Joined: Apr 21, 2012
Posts: 214

Here is My code..


here on this line....
i am getting NullPointerException
first_app is deployed and running and working fine.
I am a newbie to serblets so please explain your answer properly.
Thanks in advance.


OCPJP 6 86%
Anirudh Srivastav
Greenhorn

Joined: Jun 30, 2012
Posts: 13
Nikhil,

Hope this helps you!

http://www.coderanch.com/t/359528/Servlets/java/ServletContext-getContext-method


Anirudh
PMP, OCJCP 6
Seetharaman Venkatasamy
Ranch Hand

Joined: Jan 28, 2008
Posts: 5575

otherCtx is null?

did you tune crossContext attribute in Context xml?
*Note:Some of the server may not support this function.
Ning Si Liu
Greenhorn

Joined: Jul 27, 2012
Posts: 2
Anirudh's link is good.
Sorry,I'm new here.I just want a post to test my account.
Seetharaman Venkatasamy
Ranch Hand

Joined: Jan 28, 2008
Posts: 5575

Welcome to JavaRanch Ning Si Liu !
Ning Si Liu
Greenhorn

Joined: Jul 27, 2012
Posts: 2
Seetharaman Venkatasamy wrote:Welcome to JavaRanch Ning Si Liu !

Thanks so much.I didn't plan to be gotten noticed.
Nikhil Sagar
Ranch Hand

Joined: Apr 21, 2012
Posts: 214

Seetharaman Venkatasamy wrote:otherCtx is null?

did you tune crossContext attribute in Context xml?
*Note:Some of the server may not support this function.


Unable to locate Context xml please tell me where is it??
i am using GlassFish Server Open Source Edition 3.1.2 (build 23)
Anirudh Srivastav
Greenhorn

Joined: Jun 30, 2012
Posts: 13
I guess you would have figured it out by yourself in case haven't here is a piece of info which would help you.

There is property named crossContextAllowed which is equivalent to crossContext of tomcat. It should be available in your web application's web app xml. You may refer your server user guide to know the exact syntax.

Hope this helps.

Regards
Anirudh Srivastav
Greenhorn

Joined: Jun 30, 2012
Posts: 13
Ning,

You are welcome. Enjoy your Java Ranch journey !!
 
I agree. Here's the link: http://ej-technologies/jprofiler - if it wasn't for jprofiler, we would need to run our stuff on 16 servers instead of 3.
 
subject: getContext() returning null
 
Similar Threads
RequestDispatcher problem
getServletContext() returning null
Could not get session
can any body solved my problem on RequestDispatcher.
servlet cant see getServletContext() from inheritance