LinuxQuestions.org
Visit Jeremy's Blog.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices


Reply
  Search this Thread
Old 08-20-2003, 01:32 PM   #1
mortsahl
LQ Newbie
 
Registered: Aug 2003
Location: Littleton, CO
Distribution: Red Hat 9
Posts: 8

Rep: Reputation: 0
Tomcat Question


This is more of a Tomcat question than linux, but I can't find the answer so hopefully someone here can help.

I've deployed a web app successfully. A feature of the app allows the user to upload pictures ... this works fine.

The problem is, another feature allows you to view the pictures. I can't get this to work.

Problem is, I can write the pictures to the file system but how do I get Tomcat to see them? How do I add a docroot outside of the war file? I guess I could always store them as blobs in the database, but that's not something I really want to do.

Help!
 
Old 08-21-2003, 09:53 PM   #2
MiscGeek
Member
 
Registered: Jan 2003
Location: Georgia, US
Distribution: RHEL WS4
Posts: 189

Rep: Reputation: 30
Well the war file should get expanded to a directory of the same name in $TOMCAT_HOME/webapps (i.e. mywebapp.war becomes $TOMCAT_HOME/webapps/mywebapp) If you save your images to this directory they should be available to tomcat and your webapp.

Mike
 
Old 08-21-2003, 10:30 PM   #3
mortsahl
LQ Newbie
 
Registered: Aug 2003
Location: Littleton, CO
Distribution: Red Hat 9
Posts: 8

Original Poster
Rep: Reputation: 0
Thanks for your help. I alway REALLY appreciate when people are willing to help cuz I'm alway full of questions!

In my case, Tomcat is integrated with JBoss and in this version of it war files don't get expanded into a directory structure. I had to come up with a different solution.

For anyone reading this thread who may be interested, I found that there were 2 solutions to my problem. I tried both, and both worked. Don't know which one is best for my purposes, I'll have to do some testing.

Solution #1 - create a directory named uploads.war (or whatever name you want, just make sure the directory has a .war extension). For JBoss, I had to create a WEB-INF directory with a jboss-web.xml file that defined the context. Then from my "real" application I uploaded the graphic files to a hard coded location (/usr/jboss/server/default/deploy/upload.war). To read the files I used http://www.mydomain.com/uploads/filename.gif. That works very well and is an interesting way of serving static content with JBoss/Tomcat.

The other solution was a lot more work for me to get going but I finally succeeded. I configured Apache to use Tomcat as a jsp container so I could then just put and get my graphics from docroot. The downside is Apache handing off requests to Tomcat so there is some time penalty involved, but I'm not sure how much yet. But, I don't have to do a port forward from 8080 to 80.

The first solution was something I wouldn't have thought of doing, someone else suggested it and I was suprised it worked but is the easiest -- took all of 2 or 3 minutes to implement. The second solution is more conventional but I had to recompile Apache2 (Red Hat 9 does a real strange install, with missing pieces, by default) and I had to compile the mod_jk2 connector, etc ... a lot more work and lots of questions on jboss.org before I got it working correctly.
 
Old 08-22-2003, 06:05 AM   #4
MiscGeek
Member
 
Registered: Jan 2003
Location: Georgia, US
Distribution: RHEL WS4
Posts: 189

Rep: Reputation: 30
Interesting, I've started looking into JBoss for an upcoming project but havn't tried using the integrated tomat container. I only need the message queue interface.

Glad you found a solution. This is pretty cool, you asked a question and I learned something

Mike
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Tomcat Header Question rmcushing Linux - Software 1 10-18-2004 06:20 PM
Basic JSP/Tomcat question. CodeWarrior Programming 1 07-06-2003 09:15 AM
tomcat question ChangeOfPace Linux - Software 7 03-19-2003 03:41 PM
Help a thicko newbie....tomcat question. kalliste Linux - Software 0 02-04-2003 11:49 AM
tomcat question.. doublefailure Linux - Software 0 07-30-2002 04:10 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 02:23 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration