IRC log for #tomcat on 20080210

00:00.27puckobedtime. gf has finally finished the old "Titanic"-movie :)
00:00.27jtechI would like to have a java bean access the fileystem and return the # of files in my 'images' directory which is located at C:\Program Files\apache-tomcat-6.0.14\webapps\gallery\images. How can I access this directory without an absolute path? If I do a System.out.println(new File(".").getAbsolutePath()), this returns c:\Program Files\apache-tomcat-6.0.14. How can i get to my gallery root without doing something weird like new File("./weba
00:02.16jtechany help would be greatly appreciated
00:02.42jasonbjtech: The current working directory of the whole JVM (in your installation) is apparently set to the root of your Tomcat installation.  All webapps would see that as the current working directory.
00:03.20jtechis there a way to get the context path programaticallty?
00:03.25jasonbjtech:  You can use the Servlet API to find the real path of the images directory.  Let me see if I can get you the method call..
00:03.37jtechthat would be awesome
00:03.55jtechIve been doing non-webapp stuff for years and this is driving me a little nutz.
00:03.57jtech:)
00:06.51jasonbProbably this would work: getServletContext().getRealPath("/images");
00:15.08*** join/#tomcat jtech2 (n=john@cpe-72-177-89-18.austin.res.rr.com)
00:15.32jasonbjtech2: Probably this would work: getServletContext().getRealPath("/images");
00:20.47jtech2where does getServletContext() come from. My java class is just a plain ol java bean
00:30.16jtech2tet
00:30.18jtech2test
00:30.23jtech2arg
00:31.14jtech2Im sorry; did you happen to answer the question of how I access the getServletContext(). My connection just dropped
00:44.15jtech2test. is anyone there?
00:45.25jasonbI answered it twice, yes.. including with you sitting right here in the channel.
00:45.48jasonboh, about getServletContext() you mean..
00:45.53jtech2yes :)
00:46.23jasonbThis has to be connected to a request somehow.  So, you would need to pass a reference to your bean either of the request object or the servlet context.
02:04.58SebbohOr if you're using some framework, you could inject some object that can give you the servletContext.  ..I think...  I think I did that the other day. :)  (Not 100% sure.)
04:11.50*** join/#tomcat Chicago (n=Chicago@c-98-206-71-108.hsd1.in.comcast.net)
04:30.21*** join/#tomcat acidjnk (i=acid@p5B3F223F.dip0.t-ipconnect.de)
05:23.09petvirusanyone alive/awake?
05:27.30petviruswhats up with sleeping at 12:30 am?
05:57.49MHSL?
05:57.54MHSL1.57pm here
06:13.52lyken4:13pm here
06:57.18*** join/#tomcat andyt (n=andyt@THOMPSON.ADMIN.SCPS.NYU.EDU) [NETSPLIT VICTIM]
08:44.20*** join/#tomcat thesasa_ (n=sasa@c-76-21-127-0.hsd1.ca.comcast.net)
09:26.39*** join/#tomcat gregor_k (n=a@stgt-4dbda1a8.pool.einsundeins.de)
09:35.39*** join/#tomcat ozkan (n=opera@88.248.140.104)
09:41.41*** part/#tomcat ozkan (n=opera@88.248.140.104)
09:55.30*** join/#tomcat linuxfreck (n=freck@pD9ED1E6C.dip0.t-ipconnect.de)
10:44.21*** join/#tomcat Nicke (n=niclasa@ua-83-227-140-135.cust.bredbandsbolaget.se)
11:00.15*** join/#tomcat acidjnk (i=acid@p5B3F1168.dip0.t-ipconnect.de)
13:34.06*** join/#tomcat jwisher (n=jwisher@87-194-191-78.bethere.co.uk)
14:04.38*** join/#tomcat SmashCat (n=vircuser@82.152.156.190)
14:06.05SmashCatHi, I've just installed Tomcat on an Ubuntu Linux machine, and found it to be extremely slow to serve pages. The server is running a 1.2ghz CPU with 768MB RAM. Is this below the minimum required hardware for Tomcat? When serving pages, the load increases to 99% with the Java process.
14:09.42raar(not that I know what the problem might be) I'm running Tomcat4 on a p400 with 128mb ram, and everything works fine; page load times are pretty decent
14:10.05raarobviously it also depends on the number of hits, and what your jsp/servlets are doing
14:10.30raarbut frankly I think the problem is not that your hardware isn't good enough
14:10.34SmashCatraar: Yeah, it's completely crashed now. Got a massive log full of "GC Warning: Out of Memory!  Returning NIL!" even though the server is running nothing else, and is on a private network ;-)
14:10.54raarwow :O
14:11.14raarI wouldn't know what the problem is, sorry - *pokes other people* ;)
14:11.28SmashCatHeh, I'll try a different server ;-) Must be a bug in Tomcat 5.0 I guess.
14:18.14*** part/#tomcat djr (n=djr@sighup.se)
14:24.05SmashCatHeh, just restarted Tomcat, and it needs 252MB RAM to show it's "Installation Successful" page - do people actually use this for production websites?! I can't see how it would even service 3 or 4 visitors at a time on a medium spec server.
14:28.01linuxfreckSmashCat: which tomcat version and java vm are you using?
14:28.32linuxfreckSmashCat: but anyway, tomcat is used widely in major installations, e.g. at walmart
14:28.53SmashCatIt's java version "1.6.0_03" with Tomcat 5.0
14:29.33linuxfreckwell it shouldn't need that much ram
14:30.09linuxfrecknevertheless it's recommended to use the latest tomcat version
14:30.22SmashCatJust went to the Tomcat admin page (takes it about 10 seconds to load) and it's using just under 300MB.
14:30.28linuxfreckthere were several bugs in tomcat 5.0 that caused oom errors
14:30.39linuxfreckhow do you count memory usage?
14:31.10SmashCatIronically, I'm doing this to test performance using Servlets instead of a PHP framework I built some time back. Memory usage taken from "top" in Linux term
14:31.42SmashCat294 Virtual, 181 Resident, 21 Shared
14:33.00SmashCatThis is a brand new install, nothing added. I think I tried Tomcat 5.5 and couldn't even get that to start up (might be an Ubuntu packaging problem though)
14:33.13linuxfreckin general, php needs less resources in small sites, but servlets scale better
14:33.36linuxfreckSmashCat: try the binary download from tomcat.apache.org and make sure that you really use sun's java
14:33.47linuxfreckdebian and ubuntu tomcat packages are known to suck.
14:35.18SmashCatYeah, I'll try that in a while. I seem to remember when I had to install TC manually years ago it was a nightmare getting it configured to run at all - was trying to avoid that by using a package.
14:38.17*** join/#tomcat dop3 (n=s3@201.21.209.80)
14:42.49linuxfreckSmashCat: not that difficult really, you download the .tar.gz, unpack it and run the startup.sh script
14:43.04linuxfreckSmashCat: if that doesn't work, your java installation is screwed up
14:44.02SmashCatHeh, yeah sounds better than before - think i had to set up a special account that set a bunch of environment variables, then launched some binary to start it up.
14:44.57linuxfreckwell as usual it's good to run any server as its own non-privileged user.
14:45.08linuxfreckbut you're testing stuff right now, no?
14:45.15SmashCatJust thought i'd try the Ubunto Tomcat 5.5 install again. It is screwed - looking for the server.xml in the wrong place. Moving the conf dir to where it's looking, then throws up more errors about invalid "CATALINA_BASE" setting etc.
14:45.42SmashCatlinuxfreck - yeah, this is not going to be a production server
14:48.53linuxfreckSmashCat: btw what happens when you run java -version ?
14:50.00SmashCatI get: java version "1.6.0_03"
14:50.00SmashCatJava(TM) SE Runtime Environment (build 1.6.0_03-b05)
14:50.00SmashCatJava HotSpot(TM) Client VM (build 1.6.0_03-b05, mixed mode, sharing)
14:50.27linuxfreckalright, seems that your java install isn't as screwed as mine :)
14:51.38SmashCatHeh - yeah, I can compile stuff ok. Funnily enough, I've just got it running by copying all the config files into both places it's looking, and chmodding all the dirs to 777 ;-) Although it's not responding on any ports I've tried - the process is running
14:52.11linuxfreckI wouldn't call that 'running' :)
14:52.18linuxfreckwhat's in the log files?
14:53.08SmashCatApparently it's listening on port 8009 - but I have yet to see evidence of this ;-)
14:53.47SmashCatI guess "200 OK" and a blank page is evidence enough.
14:53.58linuxfreckheh, probably
14:54.50SmashCatOh yeah, in the logs I've got "org.apache.jk.common.MsgAjp processHeader SEVERE: BAD packet signature 18245"
14:55.46linuxfreckthat comes from connecting to port 8009 and writing crap  :)
14:56.15SmashCatI just went to the server with my browser.
14:57.17SmashCatThink I'll leave it ;-) I'll get one of the admins to install it at work on a dev server at work so they can get the headache while I can just code ;-)
14:58.31linuxfreckheh :)
15:01.27SmashCatAh, I just read that error comes up if you don't proxy through apache to hide the port number. I'll make sure I remember to tell them that too ;-)
15:02.40linuxfreckwell port 8009 is for the ajp connection to apache httpd, but you should be able to use the http connector at 8080
15:03.10linuxfreckrunning apache httpd as a frontend is deprecated unless you're load balancing anyway
15:04.38SmashCatHmm, netstat only shows services listening on 8009 and 8180 - might be another Ubuntu "tweak" though
15:05.00*** join/#tomcat vikumar (n=Vimal@nat/redhat-in/x-2784dc00aca2a98b)
15:05.08linuxfrecktry 8180 rather than 8080 then
15:05.28SmashCatYeah, nothing there, I tried
15:06.06SmashCatRight, definitely leaving it now! ;-) Thanks for the help though!
15:06.13linuxfrecknp
15:06.22*** part/#tomcat SmashCat (n=vircuser@82.152.156.190)
15:22.51*** join/#tomcat ozkan (n=opera@88.248.140.104)
15:23.02*** part/#tomcat ozkan (n=opera@88.248.140.104)
16:04.41*** join/#tomcat kaushal (n=chatzill@59.93.96.95)
16:04.41kaushalhi
16:04.41petvirushi
16:04.42petvirusanyone awake now?
16:04.47kaushalpetvirus: hi
16:04.52kaushalI have a question
16:04.54*** join/#tomcat Quiddity (n=steve@ng1.cptxoffice.net)
16:05.05petvirusi might not be able to answer it, but ask
16:05.23kaushalIf a request coming to apache a.html the request will go to apache
16:05.50kaushalbut if a request for a.jsp file it will go to tomcat
16:05.57kaushalthrough modjk
16:06.04petvirusyes
16:06.13kaushalhow will the configuration look like in apache
16:06.55petvirusJkMount /absolute/path/to/jsp/*.jsp worker1
16:07.01petvirusthats if you called your worker worker1
16:07.59kaushalpetvirus: can i have a sample configuration in apache
16:08.02petvirusthere are many a-mod_jk tutorials
16:08.05petviruslet me see
16:08.12kaushalusing the directive Jkmount
16:08.15petviruswhat version of modjk do you use?
16:09.26petvirusthis is my vhost config in apache2
16:09.27petvirushttp://rafb.net/p/8Azwz183.html
16:09.36petvirusthe directive you care about is at the bottom
16:09.51kaushalok
16:11.07petvirusyou might be missing workers.properties
16:11.11petviruswhich you also need
16:11.16petvirusi suggest reading some docs
16:11.28petvirusor find a tutorial for your version of tomcat + your OS
16:12.59kaushalpetvirus: thanks
16:13.01kaushal:)
16:14.26petvirusmake sure its for the right version of tomcat
16:14.47petvirusi found one for 5.0 (i have 5.5) and totally screwed up everything
16:18.39*** join/#tomcat chrisjw (n=funny@82-71-87-171.dsl.in-addr.zen.co.uk)
16:33.46*** join/#tomcat prgrmr (n=prgrmr@bzq-79-183-115-250.red.bezeqint.net)
16:50.30*** join/#tomcat chrisjw (n=funny@82-71-87-172.dsl.in-addr.zen.co.uk)
16:55.22*** join/#tomcat tedd (n=tedd@81-226-215-102-no31.tbcn.telia.com)
16:58.32teddtomcat-6.0.14-r1, java-1.5.0_13, gentoo linux (Portage 2.1.3.19 (default-linux/x86/2007.0, gcc-4.1.2, glibc-2.6.1-r0, 2.6.18-8.1.8.el5.028stab039.1PAE i686)
16:58.32tedd)
16:59.16teddok, my question is, how do I add an arbitrary number of subdomains to my configuration like <Alias>*.domain.com</Alias>
16:59.31teddthis doesn't work and I cant find a way to do this
17:02.09*** join/#tomcat Chicago (n=Chicago@c-98-206-71-108.hsd1.in.comcast.net)
17:15.13jasonbtedd: If your DNS has *.domain.com mapped to your Tomcat machine's IP address, then just declare a host called "localhost", and that host will receive requests for all of those hosts.
17:15.24jasonb(since "localhost" is the default host)
17:16.15*** join/#tomcat Nicke (n=niclasa@ua-83-227-140-135.cust.bredbandsbolaget.se)
17:22.32*** join/#tomcat chrisjw (n=funny@82-71-87-172.dsl.in-addr.zen.co.uk)
17:23.28tedddyes, but I have more than one virtual host in my tomcat config :/
17:23.49jasonbteddd: So?
17:24.19jasonbteddd: Tomcat supports having as many hosts as you want.
17:25.47tedddok, so you mean that I should use <Host name="localhost"...> on my domain that should support *.domain.com and then the other domains in my tomcat config will work aswell?
17:26.43linuxfreckjasonb: I think the problem is that your solution won't work if you have 2 or more domains where you want to use wildcards
17:26.44tedddname="localhost" will pickup all requests exept the ones I have explicitly declared with name="mydomain.com"
17:27.27tedddexactly. but for the time beeing one domain with wildcards is ok
17:27.34jasonblinuxfreck: It really depends on what you're doing.
17:27.41tedddi'll try it
17:28.26jasonbI currently run some sites hosted that way.
17:29.50tedddOk, this works fine for one host name="localhost" but if I want more it wont work.
17:30.12jasonbMore what?
17:30.20tedddthis will do for now, but what I really want is something like <Alias>*.domain.com</Alias>
17:30.32tedddmore domains with arbitrary subdomains
17:30.59jasonbOkay, one way you can do this is to configure your server machine to have more than one IP address.
17:31.13tedddyes, that would also do it
17:31.14jasonbEach *.domain.com pattern should be mapped in DNS to one IP address.
17:31.55tedddhow would the configuration look like?
17:32.25tedddwhere do the mapping with the ip used?
17:32.31tedddis*
17:36.04jasonbI think to do this you may need to declare two <Service> container elements, and all elements inside it, including <Connector> and <Engine>.  That way, the connectors would only see the engine with a default host that is right for the *.domain.com it's configured for.
17:37.57tedddok, I see how it is supposed to be done now, thanks for your help
17:38.03jasonbYou're welcome.
17:38.06ChicagoHi, I want to build "Ace Operator" from here -> http://www.quik-j.com/ace_operator_source.htm  The application requests Tomcat 4.1.x My OS is Linux 2.6.23-gentoo-r6 and I have the blackdown-jdk-1.4.2 as well as sun-jdk-1.5 and sun-jdk-1.6 installed. When I goto emerge Tomcat, only versions 5 and 6 are available. If I goto emerge tomcat-servlet-api, then a version numbered 4.1.36 is also available. Can somebody help me to properly in
17:38.06Chicagostall Tomcat on Gentoo so I can build Ace Operator?
17:38.21jasonbouch.
17:40.05linuxfreckteddd: you can use ip based virtual hosts by setting useIPVHosts?="true" in the Connector element
17:40.09linuxfreckjasonb: heh.
17:41.14linuxfreckteddd: omit the ? though
17:41.27tedddI just did ;)
17:41.33tedddthis looks nice
17:41.39tedddneed another ip thou
17:41.46tedddthanks again
17:42.27linuxfreckanother contribution to ipv4 address depletion :)
17:43.13*** join/#tomcat Zack1403 (n=Zack1403@71-222-116-87.ptld.qwest.net)
18:16.24*** join/#tomcat jtech (n=john@cpe-72-177-89-18.austin.res.rr.com)
18:43.04*** join/#tomcat rambo123 (n=rocky@59.94.98.69)
18:57.30*** join/#tomcat chrisjw (n=funny@82-71-87-170.dsl.in-addr.zen.co.uk)
19:05.58tedddNow, when deploying our app in a linux environment this error occurs.
19:05.59tedddCaused by: org.hibernate.search.SearchException: Cannot write into index directory: /var/www/keso.net/webapps/ROOT/WEB-INF/data/index
19:06.31tedddI tried to add write rights to the data directory
19:07.11tedddbut, when I think about it, I added wright access for apache.. that should be tomcat
19:08.57*** join/#tomcat _4ndr34hack (n=andr34ha@79.27.116.137)
19:13.19*** join/#tomcat Zack1403 (n=Zack1403@71-222-116-87.ptld.qwest.net)
19:26.07*** part/#tomcat rambo123 (n=rocky@59.94.98.69)
20:07.28AlexRop n
21:28.11*** join/#tomcat jtech (n=john@cpe-72-177-89-18.austin.res.rr.com)
22:06.28*** join/#tomcat jtech2 (n=john@cpe-72-177-89-18.austin.res.rr.com)
22:51.22*** join/#tomcat wltjr (n=wltjr@gentoo/developer/wltjr)
23:51.58petvirusanyone alive?
23:55.24pvfuck

Generated by irclog2html.pl Modified by Tim Riker to work with infobot.