00:00.27 | pucko | bedtime. gf has finally finished the old "Titanic"-movie :) |
00:00.27 | jtech | I 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.16 | jtech | any help would be greatly appreciated |
00:02.42 | jasonb | jtech: 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.20 | jtech | is there a way to get the context path programaticallty? |
00:03.25 | jasonb | jtech: 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.37 | jtech | that would be awesome |
00:03.55 | jtech | Ive been doing non-webapp stuff for years and this is driving me a little nutz. |
00:03.57 | jtech | :) |
00:06.51 | jasonb | Probably 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.32 | jasonb | jtech2: Probably this would work: getServletContext().getRealPath("/images"); |
00:20.47 | jtech2 | where does getServletContext() come from. My java class is just a plain ol java bean |
00:30.16 | jtech2 | tet |
00:30.18 | jtech2 | test |
00:30.23 | jtech2 | arg |
00:31.14 | jtech2 | Im sorry; did you happen to answer the question of how I access the getServletContext(). My connection just dropped |
00:44.15 | jtech2 | test. is anyone there? |
00:45.25 | jasonb | I answered it twice, yes.. including with you sitting right here in the channel. |
00:45.48 | jasonb | oh, about getServletContext() you mean.. |
00:45.53 | jtech2 | yes :) |
00:46.23 | jasonb | This 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.58 | Sebboh | Or 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.09 | petvirus | anyone alive/awake? |
05:27.30 | petvirus | whats up with sleeping at 12:30 am? |
05:57.49 | MHSL | ? |
05:57.54 | MHSL | 1.57pm here |
06:13.52 | lyken | 4: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.05 | SmashCat | Hi, 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.42 | raar | (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.05 | raar | obviously it also depends on the number of hits, and what your jsp/servlets are doing |
14:10.30 | raar | but frankly I think the problem is not that your hardware isn't good enough |
14:10.34 | SmashCat | raar: 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.54 | raar | wow :O |
14:11.14 | raar | I wouldn't know what the problem is, sorry - *pokes other people* ;) |
14:11.28 | SmashCat | Heh, 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.05 | SmashCat | Heh, 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.01 | linuxfreck | SmashCat: which tomcat version and java vm are you using? |
14:28.32 | linuxfreck | SmashCat: but anyway, tomcat is used widely in major installations, e.g. at walmart |
14:28.53 | SmashCat | It's java version "1.6.0_03" with Tomcat 5.0 |
14:29.33 | linuxfreck | well it shouldn't need that much ram |
14:30.09 | linuxfreck | nevertheless it's recommended to use the latest tomcat version |
14:30.22 | SmashCat | Just went to the Tomcat admin page (takes it about 10 seconds to load) and it's using just under 300MB. |
14:30.28 | linuxfreck | there were several bugs in tomcat 5.0 that caused oom errors |
14:30.39 | linuxfreck | how do you count memory usage? |
14:31.10 | SmashCat | Ironically, 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.42 | SmashCat | 294 Virtual, 181 Resident, 21 Shared |
14:33.00 | SmashCat | This 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.13 | linuxfreck | in general, php needs less resources in small sites, but servlets scale better |
14:33.36 | linuxfreck | SmashCat: try the binary download from tomcat.apache.org and make sure that you really use sun's java |
14:33.47 | linuxfreck | debian and ubuntu tomcat packages are known to suck. |
14:35.18 | SmashCat | Yeah, 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.49 | linuxfreck | SmashCat: not that difficult really, you download the .tar.gz, unpack it and run the startup.sh script |
14:43.04 | linuxfreck | SmashCat: if that doesn't work, your java installation is screwed up |
14:44.02 | SmashCat | Heh, 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.57 | linuxfreck | well as usual it's good to run any server as its own non-privileged user. |
14:45.08 | linuxfreck | but you're testing stuff right now, no? |
14:45.15 | SmashCat | Just 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.42 | SmashCat | linuxfreck - yeah, this is not going to be a production server |
14:48.53 | linuxfreck | SmashCat: btw what happens when you run java -version ? |
14:50.00 | SmashCat | I get: java version "1.6.0_03" |
14:50.00 | SmashCat | Java(TM) SE Runtime Environment (build 1.6.0_03-b05) |
14:50.00 | SmashCat | Java HotSpot(TM) Client VM (build 1.6.0_03-b05, mixed mode, sharing) |
14:50.27 | linuxfreck | alright, seems that your java install isn't as screwed as mine :) |
14:51.38 | SmashCat | Heh - 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.11 | linuxfreck | I wouldn't call that 'running' :) |
14:52.18 | linuxfreck | what's in the log files? |
14:53.08 | SmashCat | Apparently it's listening on port 8009 - but I have yet to see evidence of this ;-) |
14:53.47 | SmashCat | I guess "200 OK" and a blank page is evidence enough. |
14:53.58 | linuxfreck | heh, probably |
14:54.50 | SmashCat | Oh yeah, in the logs I've got "org.apache.jk.common.MsgAjp processHeader SEVERE: BAD packet signature 18245" |
14:55.46 | linuxfreck | that comes from connecting to port 8009 and writing crap :) |
14:56.15 | SmashCat | I just went to the server with my browser. |
14:57.17 | SmashCat | Think 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.31 | linuxfreck | heh :) |
15:01.27 | SmashCat | Ah, 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.40 | linuxfreck | well port 8009 is for the ajp connection to apache httpd, but you should be able to use the http connector at 8080 |
15:03.10 | linuxfreck | running apache httpd as a frontend is deprecated unless you're load balancing anyway |
15:04.38 | SmashCat | Hmm, 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.08 | linuxfreck | try 8180 rather than 8080 then |
15:05.28 | SmashCat | Yeah, nothing there, I tried |
15:06.06 | SmashCat | Right, definitely leaving it now! ;-) Thanks for the help though! |
15:06.13 | linuxfreck | np |
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.41 | kaushal | hi |
16:04.41 | petvirus | hi |
16:04.42 | petvirus | anyone awake now? |
16:04.47 | kaushal | petvirus: hi |
16:04.52 | kaushal | I have a question |
16:04.54 | *** join/#tomcat Quiddity (n=steve@ng1.cptxoffice.net) |
16:05.05 | petvirus | i might not be able to answer it, but ask |
16:05.23 | kaushal | If a request coming to apache a.html the request will go to apache |
16:05.50 | kaushal | but if a request for a.jsp file it will go to tomcat |
16:05.57 | kaushal | through modjk |
16:06.04 | petvirus | yes |
16:06.13 | kaushal | how will the configuration look like in apache |
16:06.55 | petvirus | JkMount /absolute/path/to/jsp/*.jsp worker1 |
16:07.01 | petvirus | thats if you called your worker worker1 |
16:07.59 | kaushal | petvirus: can i have a sample configuration in apache |
16:08.02 | petvirus | there are many a-mod_jk tutorials |
16:08.05 | petvirus | let me see |
16:08.12 | kaushal | using the directive Jkmount |
16:08.15 | petvirus | what version of modjk do you use? |
16:09.26 | petvirus | this is my vhost config in apache2 |
16:09.27 | petvirus | http://rafb.net/p/8Azwz183.html |
16:09.36 | petvirus | the directive you care about is at the bottom |
16:09.51 | kaushal | ok |
16:11.07 | petvirus | you might be missing workers.properties |
16:11.11 | petvirus | which you also need |
16:11.16 | petvirus | i suggest reading some docs |
16:11.28 | petvirus | or find a tutorial for your version of tomcat + your OS |
16:12.59 | kaushal | petvirus: thanks |
16:13.01 | kaushal | :) |
16:14.26 | petvirus | make sure its for the right version of tomcat |
16:14.47 | petvirus | i 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.32 | tedd | tomcat-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.32 | tedd | ) |
16:59.16 | tedd | ok, my question is, how do I add an arbitrary number of subdomains to my configuration like <Alias>*.domain.com</Alias> |
16:59.31 | tedd | this 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.13 | jasonb | tedd: 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.24 | jasonb | (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.28 | teddd | yes, but I have more than one virtual host in my tomcat config :/ |
17:23.49 | jasonb | teddd: So? |
17:24.19 | jasonb | teddd: Tomcat supports having as many hosts as you want. |
17:25.47 | teddd | ok, 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.43 | linuxfreck | jasonb: 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.44 | teddd | name="localhost" will pickup all requests exept the ones I have explicitly declared with name="mydomain.com" |
17:27.27 | teddd | exactly. but for the time beeing one domain with wildcards is ok |
17:27.34 | jasonb | linuxfreck: It really depends on what you're doing. |
17:27.41 | teddd | i'll try it |
17:28.26 | jasonb | I currently run some sites hosted that way. |
17:29.50 | teddd | Ok, this works fine for one host name="localhost" but if I want more it wont work. |
17:30.12 | jasonb | More what? |
17:30.20 | teddd | this will do for now, but what I really want is something like <Alias>*.domain.com</Alias> |
17:30.32 | teddd | more domains with arbitrary subdomains |
17:30.59 | jasonb | Okay, one way you can do this is to configure your server machine to have more than one IP address. |
17:31.13 | teddd | yes, that would also do it |
17:31.14 | jasonb | Each *.domain.com pattern should be mapped in DNS to one IP address. |
17:31.55 | teddd | how would the configuration look like? |
17:32.25 | teddd | where do the mapping with the ip used? |
17:32.31 | teddd | is* |
17:36.04 | jasonb | I 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.57 | teddd | ok, I see how it is supposed to be done now, thanks for your help |
17:38.03 | jasonb | You're welcome. |
17:38.06 | Chicago | Hi, 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.06 | Chicago | stall Tomcat on Gentoo so I can build Ace Operator? |
17:38.21 | jasonb | ouch. |
17:40.05 | linuxfreck | teddd: you can use ip based virtual hosts by setting useIPVHosts?="true" in the Connector element |
17:40.09 | linuxfreck | jasonb: heh. |
17:41.14 | linuxfreck | teddd: omit the ? though |
17:41.27 | teddd | I just did ;) |
17:41.33 | teddd | this looks nice |
17:41.39 | teddd | need another ip thou |
17:41.46 | teddd | thanks again |
17:42.27 | linuxfreck | another 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.58 | teddd | Now, when deploying our app in a linux environment this error occurs. |
19:05.59 | teddd | Caused by: org.hibernate.search.SearchException: Cannot write into index directory: /var/www/keso.net/webapps/ROOT/WEB-INF/data/index |
19:06.31 | teddd | I tried to add write rights to the data directory |
19:07.11 | teddd | but, 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.28 | Alex | Rop 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.58 | petvirus | anyone alive? |
23:55.24 | pv | fuck |