| Author |
accessing data from other tomcat directory
|
Chris Brand
Greenhorn
Joined: Mar 02, 2009
Posts: 4
|
|
hi there
we have 2 tomcats running on 2 different servers but with one common oracle database as source for metadata.
the application we run on tomcat is a web based document viewer. the physical pdf's are stored under
webapps/storage (some 10'000 documents...).
so one tomcat is the prod. environment, the other we use to publish data but without interfering the productive machine's CPU and resources.
how can i tell one tomcat that it should not use his own webapps/storage directory for the pdf's but
the other one's?
because i already have a common database, i also want to share the source for the pdf's so i don't
have to copy it over and store it redundantly.
is this possible? in short: from tomcat A we want to use/share files (pdf's) stored in tomcat B
thanks a lot
chris.
ps:
we're using tomcat5_5
|
 |
Joe Ess
Bartender
Joined: Oct 29, 2001
Posts: 8264
|
|
Welcome to the JavaRanch.
I'd move the PDF's to a central directory (shared drive, NFS drive) and point both webapp instances to it.
You could create a web service on one of the Tomcat instances to serve and manage the PDF's for the other instance, but that would be my distant second choice.
|
"blabbing like a narcissistic fool with a superiority complex" ~ N.A.
[How To Ask Questions On JavaRanch]
|
 |
Chris Brand
Greenhorn
Joined: Mar 02, 2009
Posts: 4
|
|
hi joe!
thanks for your reply. how would i then point both webapp instances to that central directory???
cheeers
chris.
|
 |
Joe Ess
Bartender
Joined: Oct 29, 2001
Posts: 8264
|
|
Give them the full path.
Or are you asking how you return a file as the result of a request. That would depend on your application. Did you use a framework or plain servlets?
|
 |
Chris Brand
Greenhorn
Joined: Mar 02, 2009
Posts: 4
|
|
hello joe
we're not using a framework but own jsp's and java classes. the path to the storage folder we define in a table in the database - relative to the webapps dir and relative to the application dir.
br
chris
|
 |
Rajneesh Kumar Rajput
Ranch Hand
Joined: Feb 25, 2009
Posts: 39
|
|
You should configure, both tomcat in cluster mode and use Apache as an interface to the world. You can expose shared location to Apache only which actually points to your published directory.
Will that help?
|
 |
Chris Brand
Greenhorn
Joined: Mar 02, 2009
Posts: 4
|
|
hi raj
thanks for the info. we will play around a bit and get back here...
cheers !!!
chris
|
 |
Joe Ess
Bartender
Joined: Oct 29, 2001
Posts: 8264
|
|
Rajneesh Kumar Rajput wrote:You should configure, both tomcat in cluster mode
Correct me if I'm wrong, but clustering is useful when you have so many users trying to access the same resource you need to divide them among Tomcat instances. What Chris has is two different functions being served by two different Tomcat instances (which could probably be rolled into one instance with two different contexts or virtual hosts).
Adding another server (Apache) to the mix is probably adding unnecessary complexity.
|
 |
Rajneesh Kumar Rajput
Ranch Hand
Joined: Feb 25, 2009
Posts: 39
|
|
Hi Joe Ess,
Yes, you are right about the definition of clustering and I should not have used that word in my reply. But, I was thinking if you would like to share same session also between both tomcat might be that is not required at all.
Anyways stil if you think of Apache, it can handle a scenerio where URL that you type can be redirected to a specifc machine which could be either tomcat1 or tomcat 2 to process further, and because you will move resources folder to the machine in which apache is installed and that can be found by provided a URL path because the request will always made to Apache machine. You can use URLRewrite module and ProxyPass module of Apache to actually modify urls and to redirect(to specific tomcat port etc) them respectively.
The difference will be that currently path is relative to webapps i.e. /storage later it will be relative to apache and should be accessible by both tomcat. Make sure, that any request made for /storage, will be not be redirected to any of the tomcat and will be handled by apache itself.
see if that helps or might be I stil didn't get question correctly.
|
 |
Joe Ess
Bartender
Joined: Oct 29, 2001
Posts: 8264
|
|
Rajneesh Kumar Rajput wrote:Anyways stil if you think of Apache. . .
I think you are proposing a web service to serve up the PDF's. I proposed the same thing in my first post.
|
 |
 |
|
|
subject: accessing data from other tomcat directory
|
|
|