Shubham Guptas

+ Follow
since May 02, 2010
Cows and Likes
Total received
In last 30 days
Total given
Total received
Received in last 30 days
Total given
Given in last 30 days
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Shubham Guptas

Madhan Sundararajan Devaki wrote:From the trace I observe that, sometimes your application gets connection timed out.

so silly of me....Thanks....I increased connection time out and it worked....
I wrote load test application for java web application running on tomcat server.

I am using HTTPClient for sending XML request. The code I am using is as follows:

The above code is thread body and I am running 200 threads. but for some requests I am getting following exception

Any help would be appreciated. Thanks

sudhir nim wrote:web.xml being read by container has nothing to do with the URL weather it's TestService or any thing else. It will be used by container. You don't need to worry about when container reads it.
And the URL your are mentioning "http://sever-ip/TestService/" Here /TestService is called context path and you cant modify it using web.xml. I would still advice your to read basic guides on java web development, and get some ideas about things like, context path, url patterns, servlet mappings etc.

so I want to modify context path. I can do that by using <context> element in server.xml . OK done!

now i can access my service from http://server-ip/EvaluateService

and also from http://server-ip/TestService

Okkk Done...!

now the problem is tomcat creates two separate instances ie one for EvaluateService and one for TestService

I noticed this because i created hit counter to test this. and after I access TestService twice (refresh) the counter value 2 is displayed. now If I access EvaluateService the counter value is 1.

now if I access TestService again it display 3.

that is it is creating two separate instances.

How can I avoid the creation of these two separate instances.

10 years ago

sudhir nim wrote:Servlet doesnt read web.xml, it is used by web container, web.xml doesnt go in any arbitrary directory, it must be inside WEB-INF directory. Read some basic servlet tutorials.
See for more details on web application directory structure and this servlet example

ya i know that it will be in web.inf directory and web.inf will be in some directory say the name as "TestService".

now the web.xml will be only read if URL contains "TestService"

so through servlet-mapping it can be modified as


where the grenn color will be mandatory and red color portion we can change using servlet-mapping.

10 years ago

Bear Bibeault wrote:One more time: servlet mappings have NOTHING to do with directories. Nothing. Nada. Zero. Zilch.

You can map the servlet to ANY path you want, and there are no directories with the same name. None. Zero.

For example:

This maps the servlet to both ralph/* and henry/*.

And there are NO directories named ralph or henry anywhere.

Once again: servlet mappings have nothing to do with directories. Nothing.

I am agreed that <servlet-mapping> is nothing to do with directories. okay....

one more doubt the above will be stored in web.xml and which will be stored in webapps inside some directory say "TestService"

the above web.xml will be only read when the URL will contain /TestService/

how I can configure servelet to read web.xml with out having /TestService/ in my URL?
10 years ago

Bear Bibeault wrote:Servlet mappings have nothing to do with directories. If you want two URLs to go to the same servlet, just add two mappings to the servlet.

my servlet is deployed in "TestService" directory. web.xml of this servlet will be accessed only if my URL pattern is


and through URL mapping I can change it to






but "http://server-ip/TestService/" is mandatory as it is inside "Test Service" directory

but my incoming requests are in pattern "http://server-ip/EvaluateService/" and I don't want to have "EvaluateService" directory inside webapps.
10 years ago

Bear Bibeault wrote:Just add another mapping to the deployment descriptor.

thanks for your response.

but this won't work. I am not having directory in webapps as "EvaluateService"

so where to describe deployment descriptor. Please elaborate.
10 years ago
Hi Ranchers,

I created the servlet which is running on following URL


and it is working fine.

but my problem is I am getting all the requests to URL

http://server-ip/EvaluateService (It should perform same function as that of servlet which I created)

and my tomcat webapps folder should not contain "EvaluateService" directory.

and if I am getting any request on URL "http://server-ip/EvaluateService"
it should redirect automatically to "http://server-ip/TestService/"

Please help me that how can I configure my tomcat for this. I don't think any changes in servlet code will be required.

10 years ago
I am also looking for the same.

Please anyone provide me that how I can parse .p12 file using java.
10 years ago