Re: displaying JSP output through servlet
David, I'm not sure what you are trying to do but if you're just trying to do MVC then you might want to use struts and tiles. It works well for me. I also occasionally have a need for custom jsp tags, so I learned how to do that too. Hope this helps. Dean Hoover David Aleksanyan wrote: I'm trying to design an app in a way that all requests will have to go through a servlet. e.g. http://localhost:8080/myservlet?somestring But I want to make use of the JSP technology. So I'm thinking that I'll have to somehow include the JSP compiled classes into the servlet. and somehow put the output of the JSP into the response of the servlet. My question is - is this possible? and how do I do it? Any examples would help. Thanks, David Aleksanyan P.S. This is my first post, I hope it is to the point and it hasn't been answered before, otherwise - please tell me so. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
deploying via ant, mutiple virtual hosts apache/tomcat
I have a named virtual host in apache that uses mod_jk to communicate with tomcat. I use ant/manager to deploy from my development area, and everything works great. Now I've added another named virtual host to apache and a new worker for the tomcat connection. This works great too, but not for deployment. How can I get tomcat manager to differentiate between these "applications", since both of them are ROOT under different directories. When I run manager through HTML, I just see "/". I can deploy my war by hand and restart tomcat, but that is a pain. Any ideas? Dean Hoover - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
multiple virtual apache hosts
I have a website I have been working on for quite some time now. I use apache as the front end, and to serve static stuff. I use mod_jk to connect to tomcat 5. I develop in one area and use ant to deploy the entire app. On disk the /home/foo/ROOT directory is mapped to / for foo.com. This all works nicely. Now I want to set up a virtual host in apache to do the same thing (map /home/bar/ROOT to / for bar.com). The apache setup is done and works. What I don't understand is how to get tomcat manager to be able to deploy (via ant) / for 2 different domains. Can someone point me to an example? Thanks. Dean Hoover - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: HTTP header for dynamic pdf and IE6
Mark Lowe wrote: I've seen this before ;o) Try appending .pdf to the actual request. /myapp/pdfgen.do;iehack=.pdf That's not what seems to matter. If I change Content-Type from attachment to inline, the document opens OK in Acrobat Reader but the Open/Save dialog does not come up. As I stated in my email, the developers of Yahoo mail have somehow pulled off a hack that works as expected, I just can't seem to figure out how to replicate it. I've seen this used in teh xplanner project. Mark On 5 Jun 2004, at 11:52, Dean A. Hoover wrote: I have a java web application that allows an end-user in their browser to download a "file", which happens to be bytes stored in a database. In experimenting with how to do this, I have this snippet of code in my servlet: AttachmentListItem attachment = EmailSQL.getAttachmentListItem(connection, 3, 1); response.setContentType(attachment.getContentType()); byte[] data = EmailSQL.getAttachmentBytes(connection, 3, 1); response.setContentLength(data.length); response.setHeader("Content-Disposition", "attachment; filename=\"" + attachment.getFileName() + "\""); ServletOutputStream out = response.getOutputStream(); out.write(data); out.flush(); out.close(); To test this out, I hit the link in my IE browser which brings up a dialog box allowing me to "Open" or "Save" the file. If I save the file, it does the right thing. If I press the open button, Acrobat Reader opens up and then errors out with an alert box: "There was an error opening the document. The file does not exist." I have a yahoo email account that I tried a test on. I sent an email message with the same pdf file attached to that account. I wanted to see if yahoo figured out how to make this work. They did! (but I can't figure out how to replicate) Their header looks like this: Date: Thu, 03 Jun 2004 15:37:58 GMT P3P: policyref="http://p3p.yahoo.com/w3c/p3p.xml";, CP="CAO DSP COR CUR ADM DEV TAI PSA PSD IVAi IVDi CONi TELo OTPi OUR DELi SAMi OTRi UNRi PUBi IND PHY ONL UNI PUR FIN COM NAV INT DEM CNT STA POL HEA PRE GOV" Content-Disposition: attachment; filename=reference.pdf Connection: close Transfer-Encoding: chunked Content-Type: application/pdf; filename="foo.bar" .s4g--&v=1 There is also some other stuff I am seeing just after the header: .s4g-&v=1 which looks something like a query string, but I'm not sure. My header looks like this: HTTP/1.1 200 OK Date: Thu, 03 Jun 2004 15:35:15 GMT Server: Apache/2.0.40 (Red Hat Linux) mod_perl/1.99_07-dev Perl/v5.8.0 mod_jk/1.2.5 PHP/4.2.2 mod_python/3.0.1 Python/2.2.2 mod_ssl/2.0.40 OpenSSL/0.9.7a Set-Cookie: JSESSIONID=DD3D0938B780EEBEBDC1B558CCBAD095; Path=/ Pragma: No-cache Cache-Control: no-cache Expires: Thu, 01 Jan 1970 00:00:00 GMT Content-Disposition: attachment; filename="reference.pdf" Content-Length: 214982 Keep-Alive: timeout=15, max=100 Connection: Keep-Alive Content-Type: application/pdf;charset=UTF-8 Does anyone know how to work around this problem? I suppose there are actually 2 parts to this: 1) What is the magic in the HTTP header that allows this to work? 2) How can one create such a header in java? Thanks. Dean Hoover - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
HTTP header for dynamic pdf and IE6
I have a java web application that allows an end-user in their browser to download a "file", which happens to be bytes stored in a database. In experimenting with how to do this, I have this snippet of code in my servlet: AttachmentListItem attachment = EmailSQL.getAttachmentListItem(connection, 3, 1); response.setContentType(attachment.getContentType()); byte[] data = EmailSQL.getAttachmentBytes(connection, 3, 1); response.setContentLength(data.length); response.setHeader("Content-Disposition", "attachment; filename=\"" + attachment.getFileName() + "\""); ServletOutputStream out = response.getOutputStream(); out.write(data); out.flush(); out.close(); To test this out, I hit the link in my IE browser which brings up a dialog box allowing me to "Open" or "Save" the file. If I save the file, it does the right thing. If I press the open button, Acrobat Reader opens up and then errors out with an alert box: "There was an error opening the document. The file does not exist." I have a yahoo email account that I tried a test on. I sent an email message with the same pdf file attached to that account. I wanted to see if yahoo figured out how to make this work. They did! (but I can't figure out how to replicate) Their header looks like this: Date: Thu, 03 Jun 2004 15:37:58 GMT P3P: policyref="http://p3p.yahoo.com/w3c/p3p.xml";, CP="CAO DSP COR CUR ADM DEV TAI PSA PSD IVAi IVDi CONi TELo OTPi OUR DELi SAMi OTRi UNRi PUBi IND PHY ONL UNI PUR FIN COM NAV INT DEM CNT STA POL HEA PRE GOV" Content-Disposition: attachment; filename=reference.pdf Connection: close Transfer-Encoding: chunked Content-Type: application/pdf; filename="foo.bar" .s4g--&v=1 There is also some other stuff I am seeing just after the header: .s4g-&v=1 which looks something like a query string, but I'm not sure. My header looks like this: HTTP/1.1 200 OK Date: Thu, 03 Jun 2004 15:35:15 GMT Server: Apache/2.0.40 (Red Hat Linux) mod_perl/1.99_07-dev Perl/v5.8.0 mod_jk/1.2.5 PHP/4.2.2 mod_python/3.0.1 Python/2.2.2 mod_ssl/2.0.40 OpenSSL/0.9.7a Set-Cookie: JSESSIONID=DD3D0938B780EEBEBDC1B558CCBAD095; Path=/ Pragma: No-cache Cache-Control: no-cache Expires: Thu, 01 Jan 1970 00:00:00 GMT Content-Disposition: attachment; filename="reference.pdf" Content-Length: 214982 Keep-Alive: timeout=15, max=100 Connection: Keep-Alive Content-Type: application/pdf;charset=UTF-8 Does anyone know how to work around this problem? I suppose there are actually 2 parts to this: 1) What is the magic in the HTTP header that allows this to work? 2) How can one create such a header in java? Thanks. Dean Hoover - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
apache 2, tomcat 5, and ROOT application
Tomcat 5 uses ROOT for the root application, and whatever for other applications. For example, I am keeping my content in its own hierarchy: /home/tomcat/mywebsite/webapps/ROOT /home/tomcat/mywebsite/webapps/myapp I want apache to handle static content and tomcat to handle servlet related stuff (jsp, etc). I am wondering how to specify that in httpd.conf. If I set DocumentRoot to /home/mywebsite/webapps/ROOT/ that will work for http://mywebsite.com/ but it will not find myapp. If I set it to /home/mywebsite/webapps/ it can find http://mywebsite.com/myapp, but then I don't know how it can find the ROOT directory. Here's an httpd.conf snippet: #== ServerAdmin [EMAIL PROTECTED] ServerName www.mywebsite.com ServerAlias mywebsite.com DocumentRoot /home/tomcat/mywebsite.com/webapps/ROOT/ ErrorLog /home/tomcat/mywebsite.com/logs/error_log CustomLog /home/tomcat/mywebsite.com/logs/access_log common # Deny direct access to WEB-INF and META-INF # AllowOverride None deny from all # AllowOverride None deny from all JkMount /*.jsp mywebsite #= Any ideas? Dean Hoover - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Apache Tomcat/5.0.19 manager app
I just upgraded from 4.1.29 to 5.0.19. How does tomcat find the manager and admin apps? In the older versions, they used context fragments in the standard webapps directory that effectively pointed to ../server/webapps. I don't see this mechanism in 5.0.19 and want to know how it works. I need this because I am changing Host appBase to another location so that I can keep my apps separate from tomcats home. When I did this under 4.1.x, I simply put a manager.xml file in my webapps directory that pointed to the standard app, with an absolute path. That worked like a charm. I do not know how to do the same thing in 5.x. Any help? Thanks. Dean Hoover - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: ant emulation of "Upload a WAR file to install"
Shapira, Yoav wrote: Howdy, This says everything...Excerpt from http://www.devx.com/Java/Article/17908/0/page/4 "Tomcat does not detect changes to the WAR archive, so it does not automatically deploy new versions of an application when new WAR files are copied over old ones in the Tomcat deploy directory (except in the case of statically specified Tomcat applications in the server.xml configuration file)." Note that: - The DevX article writer would have done well to tell people about the Ant tasks tomcat supplies in order to deploy/undeploy/restart webapps, instead of encouraging people to write their own (possibly buggy, likely incompatible with future tomcat versions) tasks. - The article was written prior to the release of tomcat 5 stable, which contains behavioral changes in this area. Like what? I am using 4.1.29 and ant 1.6. All I want to do is emulate the behavior of the upload war file form in the browser manager. I do not seem to be able to do that with the ant manager tasks that come with 4.1.29. Are there more in 5.0? Yoav Shapira This e-mail, including any attachments, is a confidential business communication, and may contain information that is confidential, proprietary and/or privileged. This e-mail is intended only for the individual(s) to whom it is addressed, and may not be saved, copied, printed, disclosed or used by anyone else. If you are not the(an) intended recipient, please immediately delete this e-mail from your computer system and notify the sender. Thank you. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: ant emulation of "Upload a WAR file to install"
Thanks. I'll give that a try... when does tomcat notice the war file? Adam Hardy wrote: On 02/23/2004 03:04 PM Dean A. Hoover wrote: I am using ant 1.6 and tomcat 4.1.29. I have set my webapps directory to someplace other than the usual place. When I use the /manager/html/list application through my browser, I can use the "Upload a WAR file to install" form to put my war file in the webapps directory, unpack it and run it. This is exactly the behavior I would like to emulate in ant, but I do not see how. I have played around with the "install" and "deploy" tasks, but they do not operate the same as the upload form does. How can I do what the form does using ant? You just need ant to copy the war into your APPBASE directory. Then tomcat will do the rest, assuming that your host (in server.xml) is configured to autoDeploy="true" and unpackWARs="true". Adam - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
ant emulation of "Upload a WAR file to install"
I am using ant 1.6 and tomcat 4.1.29. I have set my webapps directory to someplace other than the usual place. When I use the /manager/html/list application through my browser, I can use the "Upload a WAR file to install" form to put my war file in the webapps directory, unpack it and run it. This is exactly the behavior I would like to emulate in ant, but I do not see how. I have played around with the "install" and "deploy" tasks, but they do not operate the same as the upload form does. How can I do what the form does using ant? Thanks. Dean Hoover - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
server.xml versioning
I have tomcat 4.1.x running on 2 different machines. I am using the manager application. On one machine, the server.xml file is "versioned", such as: server.xml.2004-02-22.09-13-01 on the other server it is not. What enables "versioning"? Dean Hoover - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
deploy with ant over https
I have used ant and tomcat 4.1 manager to deploy to my localhost, and it works just great. On a remote host, I have an apache/tomcat setup with manager only accessible over https. In a browser, I can get to the manager functions without any problem. However, when I try it through ant I get: build.xml:158: javax.net.ssl.SSLHandshakeException: java.security.cert.CertificateException: Couldn't find trusted certificate I assume I have to perform some magic on the client side. Does anyone know what that magic is? Regards. Dean Hoover - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: apache + tomcat virtual hostnames
OK, I am answering my own question here... The trick is to set: UseCanonicalName on in httpd.conf Dean A. Hoover wrote: I am using apache 2 and tomcat 4.1 connected with mod_jk. I have multiple virtual named hosts in the httpd.conf file, such as: ServerName www.myserver.com ServerAlias myserver.com ... set up so that apache serves up the static content, and tomcat will handle the servlet stuff. In my server.xml file I set the attribute "name" to "www.myserver.com" in the Host tagset. This works fine if I hit http://www.myserver.com but not for http://myserver.com. Apache handles both the same, but not tomcat. Is there something like ServerAlias in tomcat? Dean - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
apache + tomcat virtual hostnames
I am using apache 2 and tomcat 4.1 connected with mod_jk. I have multiple virtual named hosts in the httpd.conf file, such as: ServerName www.myserver.com ServerAlias myserver.com ... set up so that apache serves up the static content, and tomcat will handle the servlet stuff. In my server.xml file I set the attribute "name" to "www.myserver.com" in the Host tagset. This works fine if I hit http://www.myserver.com but not for http://myserver.com. Apache handles both the same, but not tomcat. Is there something like ServerAlias in tomcat? Dean - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
http, https, shared, and deployment
Suppose I want to create a website that has some dynamic content (served by tomcat) and some static content (served by apache). Also suppose that some of the pages on my website need to be https and some of the pages need to be http. Some stuff is shared (both http and https), like the logo GIF and css files. I have figured a way to do this "by hand", and am interested in comments on this approach. I am also interested in how one would go about deploying such a website, using ant. Maybe some more ideas on directory layout, if you have any. Thanks. Dean Hoover Here's what I am currently doing "by hand" (foo.com is obviously fictituous): httpd.conf: ... #-- ServerAdmin [EMAIL PROTECTED] ServerName www.foo.com ServerAlias foo.com DocumentRoot /home/tomcat/foo.com/http ErrorLog /home/tomcat/foo.com/logs/error_log CustomLog /home/tomcat/foo.com/logs/access_log common JkMount /*.jsp foo-http Alias /images/ /home/tomcat/foo.com/images/ AllowOverride None Deny from all #-- ServerAdmin [EMAIL PROTECTED] ServerName www.foo.com ServerAlias foo.com DocumentRoot /home/tomcat/foo.com/https ErrorLog /home/tomcat/foo.com/logs/error_log CustomLog /home/tomcat/foo.com/logs/access_log common JkMount /*.jsp foo-https Alias /images/ /home/tomcat/foo.com/images/ SSLEngine on SSLCertificateFile /home/tomcat/foo.com/foo.com.pem ... workers.properties: ps=/ workers.tomcat_home="/usr/jakarta-tomcat" workers.java_home="/usr/java/j2sdk1.4.2" worker.list=foo-http,foo-https worker.foo-http.port=8009 worker.foo-http.host=localhost worker.foo-http.type=ajp13 worker.foo-https.port=8010 worker.foo-https.host=localhost worker.foo-https.type=ajp13 server.xml: - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: tomcat and log4j
Did that, don't see any errors. How exactly does log4j know to configure itself under tomcat, just by dropping the log4j.properties file in the right place??? Shapira, Yoav wrote: Howdy, Add -Dlog4j.debug=true to your JAVA_OPTS and check the tomcat logs. If log4j runs into errors you'll see them there. Yoav Shapira Millennium ChemInformatics -Original Message----- From: Dean A. Hoover [mailto:[EMAIL PROTECTED] Sent: Wednesday, July 02, 2003 2:34 PM To: Tomcat Users List Subject: Re: tomcat and log4j OK, so I changed the file to /tmp/xxx.log and it still does not show up. Any other suggestions? Dean Shapira, Yoav wrote: Howdy, You're not going to have file write access to xxx.log from inside a war. Ensure the File parameter for your appender in log4j.properties points to a writeable location. Yoav Shapira Millennium ChemInformatics -Original Message----- From: Dean A. Hoover [mailto:[EMAIL PROTECTED] Sent: Monday, June 30, 2003 8:03 PM To: Tomcat Users List Subject: Re: tomcat and log4j Thanks for responding. I'm just going by what it says in the log4j manual: "The default log4j initialization is particularly useful in web-server environments. Under Tomcat 3.x and 4.x, you should place the |log4j.properties| under the |WEB-INF/classes| directory of your web-applications. Log4j will find the properties file and initialize itself. This is easy to do and it works." I am running jakarta-tomcat-4.1.24 on RH 9 using j2sdk1.4.1_02. I just did a jar tvf on my war file, which shows: [EMAIL PROTECTED] vendor]$ jar tvf build/vendor.war 0 Mon Jun 30 03:52:20 EDT 2003 META-INF/ 110 Mon Jun 30 03:52:20 EDT 2003 META-INF/MANIFEST.MF 0 Wed May 14 01:06:28 EDT 2003 images/ 0 Mon Jun 30 01:48:54 EDT 2003 include/ 0 Mon Jun 30 13:26:16 EDT 2003 css/ 1210 Wed May 14 01:06:28 EDT 2003 login.jsp 485 Fri Jun 27 15:32:30 EDT 2003 welcome.jsp 3008 Wed May 14 01:06:28 EDT 2003 images/email2.png 15284 Wed May 14 01:06:28 EDT 2003 images/email.jpg 1678 Mon Jun 30 02:16:40 EDT 2003 register2.jsp 6861 Mon Jun 30 01:48:54 EDT 2003 include/contactinfo.jspf 2287 Wed May 14 01:06:28 EDT 2003 contact.html 435 Fri Jun 27 15:38:58 EDT 2003 index.html 856 Mon Jun 30 13:25:12 EDT 2003 css/default.css 1729 Mon Jun 30 01:55:04 EDT 2003 register1.jsp 1181 Mon Jun 30 01:54:14 EDT 2003 register3.jsp 0 Mon Jun 30 03:52:22 EDT 2003 WEB-INF/ 0 Mon Jun 30 03:52:22 EDT 2003 WEB-INF/classes/ 3526 Mon Jun 30 02:58:14 EDT 2003 WEB-INF/classes/Login.class 7268 Mon Jun 30 03:03:26 EDT 2003 WEB-INF/classes/Register.class 333 Mon Jun 30 03:00:06 EDT 2003 WEB-INF/classes/log4j.properties 0 Mon Jun 30 03:52:22 EDT 2003 WEB-INF/lib/ 45386 Wed May 14 15:43:32 EDT 2003 WEB-INF/lib/activation.jar 305434 Wed May 14 15:43:32 EDT 2003 WEB-INF/lib/mail.jar 352668 Wed Jun 25 14:53:02 EDT 2003 WEB-INF/lib/log4j-1.2.8.jar 97589 Fri May 16 01:45:42 EDT 2003 WEB-INF/lib/universal-common.jar 12844 Fri Jun 27 03:06:54 EDT 2003 WEB-INF/lib/xxx.jar 352668 Mon Jun 30 03:52:06 EDT 2003 WEB-INF/lib/log4j-1.2.8.jar 1800 Wed May 21 09:53:30 EDT 2003 META-INF/context.xml 496 Wed May 14 02:08:08 EDT 2003 WEB-INF/web.xml This is what my log4j.properties file looks like: log4j.rootLogger=DEBUG, roll log4j.appender.roll=org.apache.log4j.RollingFileAppender log4j.appender.roll.File=xxx.log log4j.appender.roll.MaxFileSize=100KB log4j.appender.roll.MaxBackupIndex=1 log4j.appender.roll.layout=org.apache.log4j.PatternLayout log4j.appender.roll.layout.ConversionPattern=%d [%t] %-5p %F:%L - %m%n Everything compiles. I've used log4j in non-web apps. I have log statements in my servlet, and I cannot find a log file anywhere. What's up with that??? Yoav Shapira wrote: Howdy, It does work if you place logj4.properties in WEB-INF/classes and log4j.jar in WEB-INF/lib. If you could please be a bit more explicity when you say "This does not seem to be working" perhaps I could help more. Yoav Shapira --- "Dean A. Hoover" <[EMAIL PROTECTED]> wrote: I want to use log4j inside a tomcat application. According to the log4j short manual, all I have to do is drop my log4j.properties file into WEB-INF/classes and then I can just use it. This does not seem to be working. Can someone help? Thanks. Dean Hoover --- -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] = Yoav Shapira [EMAIL PROTECTED] __ Do you Yahoo!? SBC Yahoo! DSL - Now only $29.95 per month! http://sbc.yahoo.com - To unsubscribe, e-mail: [
Re: tomcat and log4j
OK, so I changed the file to /tmp/xxx.log and it still does not show up. Any other suggestions? Dean Shapira, Yoav wrote: Howdy, You're not going to have file write access to xxx.log from inside a war. Ensure the File parameter for your appender in log4j.properties points to a writeable location. Yoav Shapira Millennium ChemInformatics -Original Message- From: Dean A. Hoover [mailto:[EMAIL PROTECTED] Sent: Monday, June 30, 2003 8:03 PM To: Tomcat Users List Subject: Re: tomcat and log4j Thanks for responding. I'm just going by what it says in the log4j manual: "The default log4j initialization is particularly useful in web-server environments. Under Tomcat 3.x and 4.x, you should place the |log4j.properties| under the |WEB-INF/classes| directory of your web-applications. Log4j will find the properties file and initialize itself. This is easy to do and it works." I am running jakarta-tomcat-4.1.24 on RH 9 using j2sdk1.4.1_02. I just did a jar tvf on my war file, which shows: [EMAIL PROTECTED] vendor]$ jar tvf build/vendor.war 0 Mon Jun 30 03:52:20 EDT 2003 META-INF/ 110 Mon Jun 30 03:52:20 EDT 2003 META-INF/MANIFEST.MF 0 Wed May 14 01:06:28 EDT 2003 images/ 0 Mon Jun 30 01:48:54 EDT 2003 include/ 0 Mon Jun 30 13:26:16 EDT 2003 css/ 1210 Wed May 14 01:06:28 EDT 2003 login.jsp 485 Fri Jun 27 15:32:30 EDT 2003 welcome.jsp 3008 Wed May 14 01:06:28 EDT 2003 images/email2.png 15284 Wed May 14 01:06:28 EDT 2003 images/email.jpg 1678 Mon Jun 30 02:16:40 EDT 2003 register2.jsp 6861 Mon Jun 30 01:48:54 EDT 2003 include/contactinfo.jspf 2287 Wed May 14 01:06:28 EDT 2003 contact.html 435 Fri Jun 27 15:38:58 EDT 2003 index.html 856 Mon Jun 30 13:25:12 EDT 2003 css/default.css 1729 Mon Jun 30 01:55:04 EDT 2003 register1.jsp 1181 Mon Jun 30 01:54:14 EDT 2003 register3.jsp 0 Mon Jun 30 03:52:22 EDT 2003 WEB-INF/ 0 Mon Jun 30 03:52:22 EDT 2003 WEB-INF/classes/ 3526 Mon Jun 30 02:58:14 EDT 2003 WEB-INF/classes/Login.class 7268 Mon Jun 30 03:03:26 EDT 2003 WEB-INF/classes/Register.class 333 Mon Jun 30 03:00:06 EDT 2003 WEB-INF/classes/log4j.properties 0 Mon Jun 30 03:52:22 EDT 2003 WEB-INF/lib/ 45386 Wed May 14 15:43:32 EDT 2003 WEB-INF/lib/activation.jar 305434 Wed May 14 15:43:32 EDT 2003 WEB-INF/lib/mail.jar 352668 Wed Jun 25 14:53:02 EDT 2003 WEB-INF/lib/log4j-1.2.8.jar 97589 Fri May 16 01:45:42 EDT 2003 WEB-INF/lib/universal-common.jar 12844 Fri Jun 27 03:06:54 EDT 2003 WEB-INF/lib/xxx.jar 352668 Mon Jun 30 03:52:06 EDT 2003 WEB-INF/lib/log4j-1.2.8.jar 1800 Wed May 21 09:53:30 EDT 2003 META-INF/context.xml 496 Wed May 14 02:08:08 EDT 2003 WEB-INF/web.xml This is what my log4j.properties file looks like: log4j.rootLogger=DEBUG, roll log4j.appender.roll=org.apache.log4j.RollingFileAppender log4j.appender.roll.File=xxx.log log4j.appender.roll.MaxFileSize=100KB log4j.appender.roll.MaxBackupIndex=1 log4j.appender.roll.layout=org.apache.log4j.PatternLayout log4j.appender.roll.layout.ConversionPattern=%d [%t] %-5p %F:%L - %m%n Everything compiles. I've used log4j in non-web apps. I have log statements in my servlet, and I cannot find a log file anywhere. What's up with that??? Yoav Shapira wrote: Howdy, It does work if you place logj4.properties in WEB-INF/classes and log4j.jar in WEB-INF/lib. If you could please be a bit more explicity when you say "This does not seem to be working" perhaps I could help more. Yoav Shapira --- "Dean A. Hoover" <[EMAIL PROTECTED]> wrote: I want to use log4j inside a tomcat application. According to the log4j short manual, all I have to do is drop my log4j.properties file into WEB-INF/classes and then I can just use it. This does not seem to be working. Can someone help? Thanks. Dean Hoover - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] = Yoav Shapira [EMAIL PROTECTED] __ Do you Yahoo!? SBC Yahoo! DSL - Now only $29.95 per month! http://sbc.yahoo.com - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] This e-mail, including any attachments, is a confidential business communication, and may contain information that is confidential, proprietary and/or privileged. This e-mail is intended only for the individual(s) to whom it is addressed, and may not be saved, copied, printed, disclosed or used by anyone else. If you are not the(an) intended recipient, please immediately delete this e-mail from your computer system and notify the sender. Thank you. --
Re: tomcat and log4j
Thanks for responding. I'm just going by what it says in the log4j manual: "The default log4j initialization is particularly useful in web-server environments. Under Tomcat 3.x and 4.x, you should place the |log4j.properties| under the |WEB-INF/classes| directory of your web-applications. Log4j will find the properties file and initialize itself. This is easy to do and it works." I am running jakarta-tomcat-4.1.24 on RH 9 using j2sdk1.4.1_02. I just did a jar tvf on my war file, which shows: [EMAIL PROTECTED] vendor]$ jar tvf build/vendor.war 0 Mon Jun 30 03:52:20 EDT 2003 META-INF/ 110 Mon Jun 30 03:52:20 EDT 2003 META-INF/MANIFEST.MF 0 Wed May 14 01:06:28 EDT 2003 images/ 0 Mon Jun 30 01:48:54 EDT 2003 include/ 0 Mon Jun 30 13:26:16 EDT 2003 css/ 1210 Wed May 14 01:06:28 EDT 2003 login.jsp 485 Fri Jun 27 15:32:30 EDT 2003 welcome.jsp 3008 Wed May 14 01:06:28 EDT 2003 images/email2.png 15284 Wed May 14 01:06:28 EDT 2003 images/email.jpg 1678 Mon Jun 30 02:16:40 EDT 2003 register2.jsp 6861 Mon Jun 30 01:48:54 EDT 2003 include/contactinfo.jspf 2287 Wed May 14 01:06:28 EDT 2003 contact.html 435 Fri Jun 27 15:38:58 EDT 2003 index.html 856 Mon Jun 30 13:25:12 EDT 2003 css/default.css 1729 Mon Jun 30 01:55:04 EDT 2003 register1.jsp 1181 Mon Jun 30 01:54:14 EDT 2003 register3.jsp 0 Mon Jun 30 03:52:22 EDT 2003 WEB-INF/ 0 Mon Jun 30 03:52:22 EDT 2003 WEB-INF/classes/ 3526 Mon Jun 30 02:58:14 EDT 2003 WEB-INF/classes/Login.class 7268 Mon Jun 30 03:03:26 EDT 2003 WEB-INF/classes/Register.class 333 Mon Jun 30 03:00:06 EDT 2003 WEB-INF/classes/log4j.properties 0 Mon Jun 30 03:52:22 EDT 2003 WEB-INF/lib/ 45386 Wed May 14 15:43:32 EDT 2003 WEB-INF/lib/activation.jar 305434 Wed May 14 15:43:32 EDT 2003 WEB-INF/lib/mail.jar 352668 Wed Jun 25 14:53:02 EDT 2003 WEB-INF/lib/log4j-1.2.8.jar 97589 Fri May 16 01:45:42 EDT 2003 WEB-INF/lib/universal-common.jar 12844 Fri Jun 27 03:06:54 EDT 2003 WEB-INF/lib/xxx.jar 352668 Mon Jun 30 03:52:06 EDT 2003 WEB-INF/lib/log4j-1.2.8.jar 1800 Wed May 21 09:53:30 EDT 2003 META-INF/context.xml 496 Wed May 14 02:08:08 EDT 2003 WEB-INF/web.xml This is what my log4j.properties file looks like: log4j.rootLogger=DEBUG, roll log4j.appender.roll=org.apache.log4j.RollingFileAppender log4j.appender.roll.File=xxx.log log4j.appender.roll.MaxFileSize=100KB log4j.appender.roll.MaxBackupIndex=1 log4j.appender.roll.layout=org.apache.log4j.PatternLayout log4j.appender.roll.layout.ConversionPattern=%d [%t] %-5p %F:%L - %m%n Everything compiles. I've used log4j in non-web apps. I have log statements in my servlet, and I cannot find a log file anywhere. What's up with that??? Yoav Shapira wrote: Howdy, It does work if you place logj4.properties in WEB-INF/classes and log4j.jar in WEB-INF/lib. If you could please be a bit more explicity when you say "This does not seem to be working" perhaps I could help more. Yoav Shapira --- "Dean A. Hoover" <[EMAIL PROTECTED]> wrote: I want to use log4j inside a tomcat application. According to the log4j short manual, all I have to do is drop my log4j.properties file into WEB-INF/classes and then I can just use it. This does not seem to be working. Can someone help? Thanks. Dean Hoover - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] = Yoav Shapira [EMAIL PROTECTED] __ Do you Yahoo!? SBC Yahoo! DSL - Now only $29.95 per month! http://sbc.yahoo.com - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
tomcat and log4j
I want to use log4j inside a tomcat application. According to the log4j short manual, all I have to do is drop my log4j.properties file into WEB-INF/classes and then I can just use it. This does not seem to be working. Can someone help? Thanks. Dean Hoover - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: tomcat4-4.1.24-full.2jpp.noarch.rpm
Thanks anyway... I fell back to the tar.gz installation and everything went well. I would like to use rpm, but it does not seem quite ready for prime time to me. Dean brian janaszek wrote: Thanks Brian, that got me a bit closer. I became root user and ran # /etc/rc.d/init.d/tomcat4 start Starting tomcat4: [ OK ] as you explained. When I went to check it out with my browser at http://localhost:8080 got connection refused. HTTP Status 500 - No Context configured to process this request Obviously, Tomcat is up and running...you'll need to make some changes to your server.xml and web.xml files. Note: I have previously installed and used tomcat 4.0 from binary (not rpm) and was able to make progress. I wanted to go to 4.1 and use rpm. But it seems that documentation is nonexistent. Or am I missing something? Online docs are here: http://jakarta.apache.org/tomcat/tomcat-4.1-doc/index.html It's been awhile since I installed 4.1 via RPM, but I did have to tweak a couple things to get the default web app up and running. b - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: tomcat4-4.1.24-full.2jpp.noarch.rpm
Thanks Brian, that got me a bit closer. I became root user and ran # /etc/rc.d/init.d/tomcat4 start Starting tomcat4: [ OK ] as you explained. When I went to check it out with my browser at http://localhost:8080 got connection refused. HTTP Status 500 - No Context configured to process this request Note: I have previously installed and used tomcat 4.0 from binary (not rpm) and was able to make progress. I wanted to go to 4.1 and use rpm. But it seems that documentation is nonexistent. Or am I missing something? brian janaszek wrote: I downloaded tomcat4-4.1.24-full.2jpp.noarch.rpm and installed. I do not find startup.sh anywhere in the installation. Has the way to start completely changed and there is no documentation telling us how to run it? I'm assuming this is on linux? Check your /etc/rc.d/init.d directory for tomcat4. If it's there, you should just run: bash$ /etc/rc.d/init.d/tomcat4 start The RPM should have also installed in the startup scripts in /usr/bin or /usr/sbin. b - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
tomcat4-4.1.24-full.2jpp.noarch.rpm
I downloaded tomcat4-4.1.24-full.2jpp.noarch.rpm and installed. I do not find startup.sh anywhere in the installation. Has the way to start completely changed and there is no documentation telling us how to run it? Dean Hoover - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Configuring Tomcat to use a JDBC Realm
Isn't "mysql" a client program? If so, I can connect with the user/pw. Tarun Ramakrishna Elankath wrote: Seems like an access problem to me. Dean, did you try connecting to the server from a mysql client with the given username/password to check whether you are able to connect ? On Sat, 2003-03-29 at 07:50, Dean A. Hoover wrote: Can you be a little more specific? I'm not a mysql expert. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Configuring Tomcat to use a JDBC Realm
Can you be a little more specific? I'm not a mysql expert. Galbayar Dorjgotov wrote: check mysql port -Original Message- From: Dean A. Hoover [mailto:[EMAIL PROTECTED] Sent: Saturday, March 29, 2003 9:20 AM To: [EMAIL PROTECTED] Subject: Configuring Tomcat to use a JDBC Realm I am attempting to use JDBC Realm as described in the Apress book by James Goodwill. My os is RH 8.0. I'm using MySQL 4.0.12 and Connector/J 3.06. I am using Tomcat 4.0.6. I set up a tomcatusers database and a test user as per the book. I dropped mysql-connector-java-3.0.6-stable-bin.jar into $TOMCAT_HOME/common/lib I modified the server.xml file as follows: connectionURL="jdbc:mysql://localhost/tomcatusers?user=test;password=test" userTable="users" userNameCol="user_name" userCredCol="user_pass" userRoleTable="user_roles" roleNameCol="role_name" I then attempt to go to http://localhost:8080/apress/login.jsp in my mozilla browser. Nothing happens. I go to check for a clue in the logs. This is what I get: - Root Cause - java.sql.SQLException: Server configuration denies access to data source at com.mysql.jdbc.MysqlIO.doHandshake(MysqlIO.java:392) at com.mysql.jdbc.Connection.createNewIO(Connection.java:1511) at com.mysql.jdbc.Connection.(Connection.java:485) at com.mysql.jdbc.Driver.connect(Driver.java:341) at org.apache.catalina.realm.JDBCRealm.open(JDBCRealm.java:548) at org.apache.catalina.realm.JDBCRealm.start(JDBCRealm.java:613) at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1108) at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:343) at org.apache.catalina.core.StandardService.start(StandardService.java:388) at org.apache.catalina.core.StandardServer.start(StandardServer.java:506) at org.apache.catalina.startup.Catalina.start(Catalina.java:781) at org.apache.catalina.startup.Catalina.execute(Catalina.java:681) at org.apache.catalina.startup.Catalina.process(Catalina.java:179) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39 ) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl .java:25) at java.lang.reflect.Method.invoke(Method.java:324) at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:243) Anyone got any ideas how I can fix this? Thanks. Dean Hoover - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Configuring Tomcat to use a JDBC Realm
I am attempting to use JDBC Realm as described in the Apress book by James Goodwill. My os is RH 8.0. I'm using MySQL 4.0.12 and Connector/J 3.06. I am using Tomcat 4.0.6. I set up a tomcatusers database and a test user as per the book. I dropped mysql-connector-java-3.0.6-stable-bin.jar into $TOMCAT_HOME/common/lib I modified the server.xml file as follows: driverName="com.mysql.jdbc.Driver" connectionURL="jdbc:mysql://localhost/tomcatusers?user=test;password=test" userTable="users" userNameCol="user_name" userCredCol="user_pass" userRoleTable="user_roles" roleNameCol="role_name" I then attempt to go to http://localhost:8080/apress/login.jsp in my mozilla browser. Nothing happens. I go to check for a clue in the logs. This is what I get: - Root Cause - java.sql.SQLException: Server configuration denies access to data source at com.mysql.jdbc.MysqlIO.doHandshake(MysqlIO.java:392) at com.mysql.jdbc.Connection.createNewIO(Connection.java:1511) at com.mysql.jdbc.Connection.(Connection.java:485) at com.mysql.jdbc.Driver.connect(Driver.java:341) at org.apache.catalina.realm.JDBCRealm.open(JDBCRealm.java:548) at org.apache.catalina.realm.JDBCRealm.start(JDBCRealm.java:613) at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1108) at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:343) at org.apache.catalina.core.StandardService.start(StandardService.java:388) at org.apache.catalina.core.StandardServer.start(StandardServer.java:506) at org.apache.catalina.startup.Catalina.start(Catalina.java:781) at org.apache.catalina.startup.Catalina.execute(Catalina.java:681) at org.apache.catalina.startup.Catalina.process(Catalina.java:179) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:324) at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:243) Anyone got any ideas how I can fix this? Thanks. Dean Hoover - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]