Re: where is a text/html;charset= ?
You need to submit a valid HTTP request. Yours doesn't have the version at the end of the request line. Try: GET / HTTP/1.0 (Thats a two linefeeds: one marking the end of the request line and one blank line indiating the end of the http headers) You should then see the HTTP response, headers and all. If you want to submit HTTP/1.1 requests you need to submit some mandatory headers (Host and maybe Date) otherwise you get a 400 back. $ telnet telnet> open localhost 8080 Trying 127.0.0.1... Connected to localhost. Escape character is '^]'. GET / HTTP/1.1 HTTP/1.1 400 Bad Request Transfer-Encoding: chunked Date: Wed, 12 Oct 2005 17:26:36 GMT Server: Apache-Coyote/1.1 Connection: close 0 Alternatively you can use plug-ins for Mozilla/Firefox and IE which allow you to see the raw response: http://livehttpheaders.mozdev.org/ http://www.blunck.info/iehttpheaders.html HTH, Jon Mark wrote: Hi everybody, How can I see the complete output stream for each http request? I tried: -- $telnet localhost 8080 Trying 127.0.0.1... Connected to localhost. Escape character is '^]'. GET / Hello Test4 - Where is a "text/html;charset=..."? or I'm missing something? Thanks, Mark. __ Yahoo! Music Unlimited Access over 1 million songs. Try it free. http://music.yahoo.com/unlimited/ - 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: SessionListener invoked sometimes and not others
And possibly a HttpSessionActivationListener object as a session attibute. The sessionDidActivate() method on the object gets called if the session is still valid when tomcat restarts. You can use this to fix your state. HTH, Jon Mark Thomas wrote: From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] So after a restart of tomcat, I login and it appears the session is still valid, so it does not go through my session listener. I need to be aware of the web application lifecycle and want to grab a resource when the webapp starts and release when the web app goes away. How do I do that? Use a ServletContextListener. Mark - 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: precompiling JSPs -- how to resolve references normally resolved by apache?
Unless you have a directory ${TOP}/web/html/jsp/jsp your uribase/uriroot probably aren't right. [EMAIL PROTECTED] wrote: Hi, I am trying to get our JSPs to be precompiled as part of our ant build process to catch all syntax errors at compile time. The problem I have run into is that we are using apache + tomcat and we have set the following rules in apache httpd. conf: JkMount /servlets/* ajp13 JkMount /jsp/* ajp13 JkMount /controller/* cont JkMount /cgi-bin/java-rmi.cgi ajp13 Inside some of our servlets and JSPs, they refer to other jsps using the absolute URL "/jsp/" which works in deployed environment because apache redirects it. For example, in one JSP we have <%@ include file="/jsp/Header.jsp" %> I setup the tomcat-4.1.30 ant jspc task and it was giving a NPE. Then I tried the Ant Jspc optional task, and it gave me an error message: the file '\Status.jsp' generated the following general exceptionn: org.apache.jasper.JasperExeption: /Status.jsp(3,0) File "/jsp/Header.jsp" not found Is there any quick and dirty way to get the JspC to resolve the "/jsp/*.jsp" urls to "*.jsp" or is there no way? My alternative is to try to change all the "/jsp/*.jsp" references to "*.jsp" everywhere we do an <%@ include %> or or . I think that would be ok since those directices are handled on the tomcat side. Changing it would be kind of messy since we have a ton of JSPs in a large directory hierarchy, so some of those "/jsp/Header.jsp" references would have to be changed to "../../Header.jsp", etc. I know I can't get away from the "/jsp" mapping completely because we have URLs and HTTP redirects which depend on it. Here is the quick and dirty jspc ant target I created: Thanks for any advice, -Alex - 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: Wish: add a header in mail subject
If what you are after is a way to filter messages then use a good email client and filter on the message header "List-Id". For this list it is set to: List-Id: "Tomcat Users List" Seak, Teng-Fong wrote: It would be nice if this mailing-list could add a header to mails, something like [TC-user]. The announcement has the [ANN] header, so I think it won't be a problem for this to have a header. Regards, Seak - 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: ClassCastException while sharing objects accross applications
What Chuck says is right. This approach has a few gotchas though, especially if ClassX is complex and references many other objects loaded from the same (WebApp) classloader. You can end up with a lot of classes up in the common repository. >-o Make ClassX an interface, if you can. That way only the interface (and any referenced types) need go in common. Refactoring here we go :) HTH, Jon Caldarale, Charles R wrote: From: Andrés Glez. [mailto:[EMAIL PROTECTED] Subject: Re: ClassCastException while sharing objects accross applications What about using JNDI to share objects between webapps? Won't change anything, due to the previously noted classloader-specific casting issue. What should work (haven't tried it) is to put the defining class for the object of interest in shared/classes or shared/lib (if packaged in a jar), and remove it from each webapp. This will create the class under a classloader visible to both webapps. See: http://jakarta.apache.org/tomcat/tomcat-5.5-doc/class-loader-howto.html for more info. - Chuck THIS COMMUNICATION MAY CONTAIN CONFIDENTIAL AND/OR OTHERWISE PROPRIETARY MATERIAL and is thus for use only by the intended recipient. If you received this in error, please contact the sender and delete the e-mail and its attachments from all computers. - 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: FAQ? shutdown.bat not killing java process on Windows
Yep. It's a FAQ, but not in the FAQ. Tomcat not quitting generally means your webapp has started a non-daemon thread which does not exit when the webapp is destroyed. If so, shut them down in a ServletContextListener. If you aren't explicitly creating threads in your webapp then the usual culprits are database connections that haven't been closed (or any other client api to remote services that uses asynchronous messaging and/or keepalive semantics). To see a dump of the threads still active after you've run shutdown.bat do a CTRL-BREAK in the tomcat dos console. HTH, Jon Charles Fineman wrote: I started Tomcat using startup.bat. Everything goes fine. I use shutdown.batto bring it down. The server fields the request and shuts down a bunch of services (as evidenced by the messages I see). Sure enough, the server no longer responds to any requests. Unfortunately, the java process does not die. I have this problem whether I start Tomcat by hand or if I use the Sysdeo Eclipse plugin. This problem has been a thorn in my side for some time but since it only affects my development environment (we use it as a service in production and there are no problems) and I can kill the process by hand, I've not worried about it. It's annoying as heck though and I'm wondering if someone can shed some light. I searched around but (surprisingly!!) I didn't find anything similar to my situation. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Default Charset in Content-Type Header
Return binary content from a servlet using the ServletOutputStream and you should have no problem. This is the way we vend MMS data. (In fact all of our binary data.) HTH, Jon Alpay Ozturk wrote: Thanks Kerem , But I need to set the content-type of a servlet response as "application/vnd.wap.mms-message" without adding a charset header. Since some handsets do not accept the MMS response messages although the messsage is well-encoded. Anyway, thanks for your response. Regards, Alpay On Thu, 2005-09-22 at 13:51, KEREM ERKAN wrote: You may add the charset of your choice (probably Turkish) to your jsp by adding <%@ page contentType="text/html; charset=iso-8859-9" %> To the beginning of your jsp page. If you do not add this, Tomcat will always default to ISO-8859-1 or UTF-8 (I don't remember which one was default). Regards, Kerem -Original Message- From: Alpay Ozturk [mailto:[EMAIL PROTECTED] Sent: Thursday, September 22, 2005 12:37 PM To: Tomcat Users List Subject: Default Charset in Content-Type Header Hi, I am using Tomcat 4.1.29 in a production environment and I want tomcat not to add default charset in Content-Type response header. Is it possible? Thanks in advance. Alpay - 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: tomcat detecting http header
Of course, you could just call request.getRemoteAddr(); Tomcat is a Servlet Specification container. You don't get headers with CGI naming conventions. Check out the api documentation: http://java.sun.com/j2ee/1.4/docs/api/index.html It's the packages starting with javax.servlet that will be of most interest. Specifically, the docs for javax.servlet.ServletRequest give some info on methods that map to CGI variables. HTH, Jon Jason Bell wrote: Hi, When developing web app code I tend to enumerate on the headers coming in. Have a look at: public java.util.Enumeration getHeaderNames(); So: // get the header names Enumeration ee = request.getHeaderNames(); // then iterate through them for(;ee.hasMoreElements();){ String header = (String)ee.nextElement(); System.out.println(header + " = " + request.getHeader(header)); } It's just good to get an overall picture of what is being send in the headers. As for why the value is null, I don't know 100% but this link may or may not help. http://forum.java.sun.com/thread.jspa?threadID=507098&messageID=2404807 getHeader("REMOTE_ADDR"); and getting "null". I hope this helps in your quest. Kind regards Jason -- Jason Bell Lead Architect, SpikeSource Europe e: [EMAIL PROTECTED] w: http://www.spikesource.com b: http://jasonbell.blog-city.com m: +44 (0)787 529 2693 - 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: Do URL query strings with semi-colons work with TC ?
Aye. It just states for that, amongst others, amphersand and semi-colon are reserved characters within the query string. This got me looking coz I assumed that the structure of the http get query string was defined somewhere in rfc rather than just a convention. I found a few resources saying it was recommended to support ";" as a delimiter; http://www.w3.org/TR/1999/REC-html401-19991224/appendix/notes.html#h-B.2.2 But I also found the likely candidate in TC that does the parsing of the query string: http://cvs.apache.org/viewcvs.cgi/jakarta-tomcat-connectors/util/java/org/apache/tomcat/util/http/Parameters.java?rev=1.15&view=markup Just for my peace of mind does anyone know where the "standard" use of amphersand to delimit name-value pairs in a http get query string is defined? Jon Darryl L. Miles wrote: http://www.faqs.org/rfcs/rfc2396.html section 3.3 seems to be the best reference so far. This RFC only specifies correct URI syntax, it does not mandate how that URI is used under any scheme (like "http:") is to be used. Darryl L. Miles wrote: The reference you cite http://www.faqs.org/rfcs/rfc2616.html (el al) maybe you could also cite the section I should look at. A simple search for "param" or "semi" yeilds no related results. I have spent an hour looking into the issue over the weekend and found the specification that covers the URI scheme for "http:" from this angle it seems to leave the part after the ? to denote the start of a query string vague. Which lead me to a presumption that it was HTTP server dependant on its interpretation, since for example the CGI.pm modules changed over from & to ; as the standard param delimiter with generated URLs, providing the resulting URL talks back to itself (the CGI.pm module) all will be well in the world but if it links to a TC server then there would appear to be a problem. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Do URL query strings with semi-colons work with TC ?
In a URL the semi-colon indicates the start of path parameters (as opposed to the normal query parameters) as defined in rfc2616 (HTTP1.1 spec) et al. Thus, you can't tell tomcat to use it as a query string delimiter. JSESSIONID is a well known path parameter for Servlet 2.2+ Containers. To use a semi-colon within a url you'll need to url encode it as %3B To use it in the way you want you'll have to encode and parse the query string yourself. HTH, Jon Darryl L. Miles wrote: I swear I had application code working that was using semi-colons to delimit query string parameters. I'm sure I've also seen TC append a ";JSESSIONID=" at the end of the URL. But my own application code written like: String val = request.getParameters("name"); Yeilds: val="value;name2=foobar"; Is there an additional option to allow semi-colon usage, instead of & ? Running TC 5.5.9 Thanks. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: http404 error in tomcat5.5.9
I'm not sure the whitespace in your directory structure came out right so I'll make a few comments: web.xml should be in myapp/WEB-INF context.xml should be in myapp/META-INF (or rename it to myapp.xml and move it to the webapps directory) Your servlet class should be in a package. Have a look at : http://jakarta.apache.org/tomcat/faq/classnotfound.html and the "Http-status 500 error in Tomcat 4.1" thread on this list today. HTH, Jon Duan Xin wrote: hi , I have some questions in using tomcat 5.5.9: I create my web application under "myapp" directory (the structure of directory is below:) { myapp(dir)--- ---WEB-INF(dir)---classes(dir)---HelloWorld.class ---web.xml ---context.xml ---index.jsp web.xml: http://java.sun.com/dtd/web-app_2_3.dtd";> My Web Application A application for test. HelloWorld HelloWorld HelloWorld /servlet/HelloWorld context.xml } and deploy it under {catalina.home}/webapps directory . Then i restart tomcat and try to open my application by using http://localhost:8080/myapp/index.jsp but tomcat report a http404 error . After i added "" to the element of Host of server.xml file and restart tomcat ,the problem still existed. Also ,I fail to use "tomcat web application manager" to start the application : when I click the "Start" command ,the manager report: "FAIL - Application at context path /myapp could not be started" . I noticed that if I put my application under {catalina.home}/webapps /ROOT directory and using http://localhost:8080/myapp/index.jsp ,it can work.But when I try to test my servlet by using http://localhost:8080/myapp/servlet/HelloWorld ,the http404 error occured again . Who can tell me how to do? - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Cannot compile jsp pages with log4j statements -- Tomcat 5.5.9
One major change between the 4.1.x branch and the 5.x.x branch is packages in generated servlets. In tc4.1.x all the jsps were in the org.apache.jsp package irrespective of the structure of the site. From 5 onwards the jsp directory structure is also part of the package name. So, my guess is agent_report_all_in.jsp is in a different directory from the one that fails to compile. It works in 4.1 but needs to be imported in 5.x.x. Allistair Crossley wrote: Hi, It doesn't really matter if you did the app or not, it's irrelevant to this conversation and you asked a question. Anyway, yes an awful lot has changed between 4.1 and 5.5 including the Jasper compiler, see the change logs. However, I have tested your declaration on 5.5.9 and do not get this error therefore I think we can rule out the Jasper compiler. <%! static private org.apache.log4j.Logger logger = org.apache.log4j.Logger.getLogger(_5_jsp.class); %> Have you definately cross-checked the class filename in the tomcat_home/work/Catalina/localhost/_/org/apache/jsp location? Allistair. -Original Message- From: Gary Zhu [mailto:[EMAIL PROTECTED] Sent: 12 August 2005 17:08 To: Tomcat Users List Subject: RE: Cannot compile jsp pages with log4j statements -- Tomcat 5.5.9 First of all, I am not the one who did this app. Second, it is the case that the JSP file is called "agent_report_all_in.jsp". The question is: Why it runs perfect on Tomcat 4.1.30, and has issues with Tomcat 5.5.9? The JasperCompiler on Tomcat5.5.9 has introduced some bugs that JasperCompiler on Tomcat 4.1.30 does not have? Thanks. Gary -Original Message- From: Allistair Crossley [mailto:[EMAIL PROTECTED] Sent: August 12, 2005 11:46 AM To: Tomcat Users List Subject: RE: Cannot compile jsp pages with log4j statements -- Tomcat 5.5.9 I think Jon maybe onto something ... to use agent_report_all_in_jsp.class your JSP would need to be called agent_report_all_in.jsp Is that the case? Allistair/ -Original Message- From: Jon Wingfield [mailto:[EMAIL PROTECTED] Sent: 12 August 2005 16:44 To: Tomcat Users List Subject: Re: Cannot compile jsp pages with log4j statements -- Tomcat 5.5.9 It doesn't like the agent_report_all_in_jsp classname. I'm guessing that's supposed to be the name of the servlet class generated from the jsp. Are you sure it's correct? If it is then you may have to use a String argument instead of a class when calling the Logger factory method. Gary Zhu wrote: Thanks Allistair. Below is the snippet of the code, I indicated line 39 as well. <%@ page import="javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse, java.io.File, java.io.FileOutputStream, java.io.IOException, java.io.BufferedReader, java.io.FileInputStream, java.util.StringTokenizer, java.util.ArrayList, java.io.InputStreamReader, java.io.InputStream, java.io.OutputStream, com.timeicr.sysco.web.bean.AgentBean, com.timeicr.util.web.session.*, org.apache.log4j.*" %> <% response.setHeader("Cache-Control","no-cache"); //HTTP 1.1 response.setHeader("Pragma","no-cache"); //HTTP 1.0 response.setDateHeader("Expires", 0); //prevents caching at the proxy server %> (Line 39)<%! static private org.apache.log4j.Logger logger = org.apache.log4j.Logger.getLogger(agent_report_all_in_jsp.class); %> Gary -Original Message- From: Allistair Crossley [mailto:[EMAIL PROTECTED] Sent: August 12, 2005 11:20 AM To: Tomcat Users List Subject: RE: Cannot compile jsp pages with log4j statements -- Tomcat 5.5.9 Can you post the JSP directives, and the scriplet that calls log4j? Also, you have been given a line number 39 .. can you work out which line this is in the work directory. Allistair. -Original Message- From: Gary Zhu [mailto:[EMAIL PROTECTED] Sent: 12 August 2005 16:17 To: Tomcat Users List Subject: Cannot compile jsp pages with log4j statements -- Tomcat 5.5.9 Hi all, I am having difficulties to figure out the solution for this issue. Jsp pages with log4j logging statements that worked perfect on Tomcat 4.1.30 could not compile on Tomcat 5.5.9. I commented out the log4j statements for these problematic pages, then, tomcat 5.5.9 could compile them. Except commenting out all the log4j statements for the jsp pages in order to run on Tomcat 5.5.9, does anyone have any other solutions? Below is the JasperException message when attempting to compile JSP pages with log4j statements: org.apache.jasper.JasperException: Unable to
Re: Cannot compile jsp pages with log4j statements -- Tomcat 5.5.9
It doesn't like the agent_report_all_in_jsp classname. I'm guessing that's supposed to be the name of the servlet class generated from the jsp. Are you sure it's correct? If it is then you may have to use a String argument instead of a class when calling the Logger factory method. Gary Zhu wrote: Thanks Allistair. Below is the snippet of the code, I indicated line 39 as well. <%@ page import="javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse, java.io.File, java.io.FileOutputStream, java.io.IOException, java.io.BufferedReader, java.io.FileInputStream, java.util.StringTokenizer, java.util.ArrayList, java.io.InputStreamReader, java.io.InputStream, java.io.OutputStream, com.timeicr.sysco.web.bean.AgentBean, com.timeicr.util.web.session.*, org.apache.log4j.*" %> <% response.setHeader("Cache-Control","no-cache"); //HTTP 1.1 response.setHeader("Pragma","no-cache"); //HTTP 1.0 response.setDateHeader("Expires", 0); //prevents caching at the proxy server %> (Line 39)<%! static private org.apache.log4j.Logger logger = org.apache.log4j.Logger.getLogger(agent_report_all_in_jsp.class); %> Gary -Original Message- From: Allistair Crossley [mailto:[EMAIL PROTECTED] Sent: August 12, 2005 11:20 AM To: Tomcat Users List Subject: RE: Cannot compile jsp pages with log4j statements -- Tomcat 5.5.9 Can you post the JSP directives, and the scriplet that calls log4j? Also, you have been given a line number 39 .. can you work out which line this is in the work directory. Allistair. -Original Message- From: Gary Zhu [mailto:[EMAIL PROTECTED] Sent: 12 August 2005 16:17 To: Tomcat Users List Subject: Cannot compile jsp pages with log4j statements -- Tomcat 5.5.9 Hi all, I am having difficulties to figure out the solution for this issue. Jsp pages with log4j logging statements that worked perfect on Tomcat 4.1.30 could not compile on Tomcat 5.5.9. I commented out the log4j statements for these problematic pages, then, tomcat 5.5.9 could compile them. Except commenting out all the log4j statements for the jsp pages in order to run on Tomcat 5.5.9, does anyone have any other solutions? Below is the JasperException message when attempting to compile JSP pages with log4j statements: org.apache.jasper.JasperException: Unable to compile class for JSP An error occurred at line: 39 in the jsp file: /sysco/agent_report_all_in.jsp Generated servlet error: agent_report_all_in_jsp cannot be resolved or is not a type org.apache.jasper.compiler.DefaultErrorHandler.javacError(Defa ultErrorHa ndler.java:84) org.apache.jasper.compiler.ErrorDispatcher.javacError(ErrorDis patcher.ja va:328) org.apache.jasper.compiler.JDTCompiler.generateClass(JDTCompil er.java:39 7) org.apache.jasper.compiler.Compiler.compile(Compiler.java:288) org.apache.jasper.compiler.Compiler.compile(Compiler.java:267) org.apache.jasper.compiler.Compiler.compile(Compiler.java:255) org.apache.jasper.JspCompilationContext.compile(JspCompilation Context.ja va:556) org.apache.jasper.servlet.JspServletWrapper.service(JspServlet Wrapper.ja va:293) org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet .java:291) org.apache.jasper.servlet.JspServlet.service(JspServlet.java:241) javax.servlet.http.HttpServlet.service(HttpServlet.java:802) Thanks - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Shall jdom be handled differently?
That import statement looks ok but the error is being reported for line 21 in SyndFeedInput. Looking at the code (link below) it's a common or garden import statement. https://rome.dev.java.net/source/browse/rome/src/java/com/sun/syndication/io/SyndFeedInput.java?rev=1.5&view=auto&content-type=text/vnd.viewcvs-markup Not sure what is wrong so I would: 1) Check that the jdom jar is readable, non-corrupt and contains org.jdom.Document 2) Delete the work directory and restart tomcat. 3) Move the jsp out from under WEB-INF (tomcat shouldn't be directly serving pages from under there anyway) to see if that's the problem. 4) Tear hair out. etc, etc Jon Vernon wrote: Hi, Jon, Thank for your quick response. Here is more log messages: ERROR org.apache.catalina.core.ContainerBase.[Catalina].[localhost].[/icommunity].[jsp].invoke:704 - Servlet.service() for servlet jsp threw exception java.lang.Error: Unresolved compilation problems: The import org.jdom cannot be resolved Document cannot be resolved to a type at com.sun.syndication.io.SyndFeedInput.(SyndFeedInput.java:21) at com.xxx.web.rss.NewsFeedComponentController.doPerform(NewsFeedComponentController.java:39) ... ERROR org.apache.struts.taglib.tiles.InsertTag.doEndTag:920 - ServletException in '/WEB-INF/jsp/news/content1.jsp': Unresolved compilation problems: The import org.jdom cannot be resolved Document cannot be resolved to a type javax.servlet.ServletException: Unresolved compilation problems: The import org.jdom cannot be resolved Document cannot be resolved to a type at org.apache.jasper.runtime.PageContextImpl.doHandlePageException(PageContextImpl.java:848) at org.apache.jasper.runtime.PageContextImpl.handlePageException(PageContextImpl.java:781) at org.apache.jsp.WEB_002dINF.jsp.news.content1_jsp._jspService(org.apache.jsp.WEB_002dINF.jsp.news.content1_jsp:64) at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:97) ... Try to resolve this problem, I have insert an immport statement in the content1.jsp file as <%@ page import='org.jdom.*' %> That doesn't make any difference. --- Jon Wingfield <[EMAIL PROTECTED]> wrote: Works for me. Show us the snippet of the jsp with the import statement... Jon Vernon wrote: I have the jdom-1.0.jar in the application library directory, that is WEB-INF/lib, where other jar files are. The jar doesn't seem to be loaded. I get the following error: ERROR org.apache.catalina.core.ContainerBase.[Catalina].[localhost].[/icommunity].[jsp].invoke:704 - Servlet.service() for servlet jsp threw exception java.lang.Error: Unresolved compilation problems: The import org.jdom cannot be resolved Document cannot be resolved to a type Someone suggests that I need to place the jar file in some place else and create a class path for it. Is it the only solution? Thanks, Vernon - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Shall jdom be handled differently?
Works for me. Show us the snippet of the jsp with the import statement... Jon Vernon wrote: I have the jdom-1.0.jar in the application library directory, that is WEB-INF/lib, where other jar files are. The jar doesn't seem to be loaded. I get the following error: ERROR org.apache.catalina.core.ContainerBase.[Catalina].[localhost].[/icommunity].[jsp].invoke:704 - Servlet.service() for servlet jsp threw exception java.lang.Error: Unresolved compilation problems: The import org.jdom cannot be resolved Document cannot be resolved to a type Someone suggests that I need to place the jar file in some place else and create a class path for it. Is it the only solution? Thanks, Vernon Start your day with Yahoo! - make it your home page http://www.yahoo.com/r/hs - 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: sessions dropping with mod_ssl, mod_jk, mod_rewrite rules
I'm pretty sure Tomcat doesn't allow a session to migrate from a secure (ssl) channel to an insecure one. It does allow the session to be maintained in the other direction, however. The rationale for this behaviour is that if the login is supposed to be secure why allow the session cookie to be snooped on an insecure channel. Doing a cursory search of the archives I found these threads: http://marc.theaimsgroup.com/?l=tomcat-user&m=111470187706771&w=2 http://marc.theaimsgroup.com/?l=tomcat-user&m=106871784707053&w=2 HTH, Jon Seale, Deryl wrote: Hi, there. I have a problem whereby tomcat is getting confused with user sessions due to (I think) some mod_rewrite rules that switch a user in and out of SSL. The general requirement I have is to only use SSL in certain parts of our application (login, user administration, etc), and we use mod_rewrite rules to enforce this. The problem is that while we can correctly make sure a user login is properly redirected to SSL, when that user clicks on a link following login (ie: a non-SSL request), they are sent back to the login page. This is due, I think, to tomcat confusedly thinking the subsequent request comes from a new, unauthenticated user, possibly because the second request is not over SSL. When I run an HTTP tracer, I indeed see that there is a new session cookie placed for the subsequent request. Below is the relevant portion of our httpd.conf file, followed by the workes.properties file. I've followed the recommendations I've seen online regarding connector configuration, but perhaps there is something subtle that is missing, or our rewrite rules are screwed up. Any insight is appreciated. thanks. -d. httpd.conf (irrelevant sections omitted): # Load mod_jk # LoadModulejk_module libexec/mod_jk.so # Configure mod_jk # JkWorkersFile "conf/workers.properties" JkLogFile "logs/mod_jk.log" JkLogLevel info JkShmFile "logs/jk.shm" JkShmSize 10M # Map mod_ssl vars to JK vars so that tomcat can reference SSL info. JkExtractSSLOn JkOptions +ForwardKeySize +ForwardURICompat -ForwardDirectories JkHTTPSIndicatorHTTPS JkSESSIONIndicator SSL_SESSION_ID JkCIPHERIndicator SSL_CIPHER JkCERTSIndicatorSSL_CLIENT_CERT JkMount /tech/* tech_1 JkMount /tech tech_1 RewriteEngine on RewriteLog "/usr/local/apache/logs/rewrite.log" RewriteLogLevel 1 RewriteCond %{SERVER_PORT} 80 #redirect requests for index.html to login page RewriteCond %{REQUEST_URI} /index.html RewriteRule ^/(.*) https://tech-dev.classroom.com/tech/home.do #redirect requests for login page RewriteCond %{REQUEST_URI} /tech/home.do RewriteRule ^/(.*) https://tech-dev.classroom.com/tech/home.do # redirect requests for the trial page RewriteCond %{SERVER_PORT} 80 RewriteCond %{REQUEST_URI} /tech/trial.do RewriteRule ^/(.*) https://tech-dev.classroom.com/$1 # redirect requests for the profile RewriteCond %{SERVER_PORT} 80 RewriteCond %{REQUEST_URI} /tech/.*profile.* RewriteRule ^/(.*) https://tech-dev.classroom.com/$1 # redirect requests for activation RewriteCond %{SERVER_PORT} 80 RewriteCond %{REQUEST_URI} /tech/activation.* RewriteRule ^/(.*) https://tech-dev.classroom.com/$1 # redirect requests for admin RewriteCond %{SERVER_PORT} 80 RewriteCond %{REQUEST_URI} /tech/admin/.* RewriteRule ^/(.*) https://tech-dev.classroom.com/$1 # redirect requests for michigan state RewriteCond %{SERVER_PORT} 80 RewriteCond %{REQUEST_URI} /michigan RewriteRule ^/(.*) https://tech-dev.classroom.com/tech/home.do # redirect requests for CSR Tool RewriteCond %{SERVER_PORT} 80 RewriteCond %{REQUEST_URI} /subscription* RewriteRule ^/(.*) http://SERVER_CSR/subscription RewriteCond %{SERVER_PORT} 80 RewriteCond %{REQUEST_URI} /studentwork/.* RewriteRule ^/(.*) http://forumtecprd.classroom.com/$1 ## ## SSL Settings ## ## Listen 443 ## ## SSL Global Context ## ## All SSL configuration in this context applies both to ## the main server and all SSL-enabled virtual hosts. ## # # Some MIME-types for downloading Certificates and CRLs # AddType application/x-x509-ca-cert .crt AddType application/x-pkcs7-crl.crl # Pass Phrase Dialog: # Configure the pass phrase gathering process. # The filtering dialog program (`builtin' is a internal # terminal dialog) has to provide the pass phrase on stdout. SSLPassPhraseDialog builtin # Inter-Process Session Cache: # Configure the SSL Session Cache: First the mechanism # to use and second the expiring timeout (in seconds). SSLSessionCache dbm:/usr/local/apache/logs/ssl_scache SSLSessi
Re: [OT] JSP 1.2 JAR
For Servlet 2.3 containers both the JSP and Servlet APIs are in servlet.jar. It's only later they were split out into servlet-api.jar and jsp-api.jar Frank W. Zammetti wrote: Hi all... does anyone know where I can grab a copy of the JSP 1.2 spec JAR? I've checked iBiblio, they only have 2.0 in the Maven repository. I also looked in the entire directory tree of my Tomcat 4.1.31 install, which I believe is at that spec level, and I can't find it there (it clearly *must* be there, but it isn't named what I expect I guess). Thanks! - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Exception during the startup!
The key info in the stracktrace is: root cause java.lang.NoClassDefFoundError: org/apache/xalan/templates/OutputProperties at com.test.wmtool.gui.SessionHelper.saveState(Unknown Source) The SessionHelper class uses Xalan classes that the webapp classloader cannot find at runtime. This could be due Xalan versioning problems between development and deployment. The Tomcat release notes contain info on how to change the version of xalan that Tomcat uses: http://jakarta.apache.org/tomcat/tomcat-5.0-doc/RELEASE-NOTES.txt HTH, Jon Tewari,kuldeep wrote: Hi, When I try to run my jsp , I get following error message: javax.servlet.ServletException: org/apache/xalan/templates/OutputProperties at org.apache.jasper.runtime.PageContextImpl.handlePageException(PageContextImp l.java:680) at org.apache.jsp.index_jsp._jspService(index_jsp.java:739) at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:136) at javax.servlet.http.HttpServlet.service(HttpServlet.java:856) at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:3 20) at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:293) at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:240) at javax.servlet.http.HttpServlet.service(HttpServlet.java:856) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Application FilterChain.java:288) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterCh ain.java:206) at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.ja va:263) at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContex t.java:151) at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:561) at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:1018) at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.ja va:196) at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContex t.java:151) at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:561) at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:1018) at org.apache.catalina.core.StandardContext.invoke(StandardContext.java:2748) at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:186 ) at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContex t.java:151) at org.apache.catalina.valves.ErrorDispatcherValve.invoke(ErrorDispatcherValve. java:171) at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContex t.java:149) at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:172 ) at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContex t.java:149) at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:561) at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:1018) at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java :163) at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContex t.java:151) at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:561) at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:1018) at org.apache.coyote.tomcat5.CoyoteAdapter.service(CoyoteAdapter.java:199) at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:630) at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConne ction(Http11Protocol.java:463) at org.apache.tomcat.util.net.TcpWorkerThread.runIt(PoolTcpEndpoint.java:568) at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.jav a:631) at java.lang.Thread.run(Unknown Source) root cause java.lang.NoClassDefFoundError: org/apache/xalan/templates/OutputProperties at com.test.wmtool.gui.SessionHelper.saveState(Unknown Source) at org.apache.jsp.index_jsp._jspService(index_jsp.java:731) at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:136) at javax.servlet.http.HttpServlet.service(HttpServlet.java:856) at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:3 20) at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:293) at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:240) at javax.servlet.http.HttpServlet.service(HttpServlet.java:856) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Application FilterChain.java:288) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterCh ain.java:206) at org.apache.catalina.core.StandardWrapperValve.invoke(Stand
Re: loading resources from the servlet.
http://wiki.apache.org/jakarta-tomcat/HowTo#head-45c3314139cb900ddd43dde2ff671532e6e844bc HTH, Jon Maciej Stoszko wrote: I have a class X which needs to load a .properties file. Here is a code snippet: ClassLoader cl = this.getClass().getClassLoader(); InputStream stream = cl.getResourceAsStream(/data/x.properties); It works just fine from my JUnit test for X. Now, I would like this class to be called from the servlet, which would run inside Tomcat 5.5.9. The only way to get that to work is to place my x.properties file inside the package the class X lives in. Well, I'd rather not to mix properties with classfiles. Another way, I can load that file, is to use servlets getServletContext() method. However, that would mean I need to pass the InputStream from the servlets to my class X. Well, I'd rather not to change X to use its caller to get X's properties file. I guess, what I need to do is to add the WEB-INF or ROOT dir of my webapp to the classpath, so the classloader can find it. Or is there some other way of accomplishing it? I think I am missing something fundamental ... cos that doesn't seem to be too strange of a requirement ... Any ideas? Thanks, maciek - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: load on startup
Use a ServletContextListener, they were added to the Servlet 2.3 spec for this very purpose. You set up your object in the contextInitialized(...) method of your implementation and tear it down in contextDestroyed(...). For it to be used you need to add it to your web.xml. The container is free to init and destroy servlets as it sees fit after complying with load-on-startup directives. That's why use of load-on-startup for initialization of application scope objects is prone to error and unforeseen circumstances. my $0.02 and HTH, Jon Nicolas Schwartz wrote: Hi all, I need an object to be instanciated on the startup of my tomcat. So I did a servlet the creates an instance of it and put my servlet in the web.xml of a webapp with the loadOnStartup parameter. The constructor of my object is called twice so there must be 2 instances of it ... which is a problem. (when I call the url of the servlet that creates the instance, only one is created) Could someone explain me why the constructor is called twice (why do I have 2 instances ?) and/or could someone give me another solution to have one and only one instance of the object created on the tomcat startup ? Thanks, Nicolas - 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: Blog: JK1.2 load balancing as solution to 100% uptime
From one of Allistair's posts yesterday: www.adcworks.com/blog Mladen Turk wrote: Allistair Crossley wrote: Hi Chaps, If anyone is interested, I blogged last night on my experience setting up ... It would be great if you provide a link to your blog :) Regards, Mladen. - 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: Tomcat Configuration
Do you have a web.xml in WEB-INF? What do the tomcat logs say on startup? You can tweak the logger verbosity by increasing the debug attributes on elements within server.xml. What version of tomcat? Not sure Logger elements are supported in 5.5.x Jon PS: books are generally out of date by the time they are published ;) There are plenty of config changes between 4.0.x, 4.1.x, 5.0.x and 5.5.x versions Iin Nurhidayat wrote: yess --- "Raghupathy,Gurumoorthy" <[EMAIL PROTECTED]> wrote: Did you restart tomcat ? -Original Message- From: Iin Nurhidayat [mailto:[EMAIL PROTECTED] Sent: 14 July 2005 13:30 To: Tomcat Users List Subject: RE: Tomcat Configuration Hi Guru, i replced webapps but i have same problem also ... Thanks - IN - --- "Raghupathy,Gurumoorthy" <[EMAIL PROTECTED]> wrote: "myapplication" reloadable= "true " crossContext= "true " > Remove ( /webapps/ ) Regards Guru -Original Message- From: Iin Nurhidayat [mailto:[EMAIL PROTECTED] Sent: 14 July 2005 12:14 To: Tomcat Users List Subject: Tomcat Configuration Hi All, I have a problem with my deployment. I have some servlets and one Login.html. I will put my servlets and Login.html on /myapplication Based on book i have read : a) I configure the server.xml "/webapps/myapplication" reloadable= "true " crossContext= "true " > "org.apache.catalina.logger.FileLogger " prefix= "localhost_myapplication_log. " suffix= ".txt " timestamp= "true " / > b) I put Login.html under myapplication directory. $CATALINA_HOME\webapps\myapplication c) I put servlets under classes directory $CATALINA_HOME\webapps\myapplication\WEB-INF\classes. But, Tomcat response is can not find /myapplication (404). Please advice ... Thanks - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: error messages during tomcat 4.1 startup
It looks like your web.xml DOCTYPE definition is either missing or incorrect. Digester is using a validating parser and so barfs. Review your web.xml document(s). Jon Tewari,kuldeep wrote: Hi, I am getting following messages during tomcat 4.1 startup. What could be the cause? Jul 7, 2005 10:28:00 AM org.apache.coyote.http11.Http11Protocol init INFO: Initializing Coyote HTTP/1.1 on port 8080 Starting service Tomcat-Standalone Apache Tomcat/4.1.30 Jul 7, 2005 10:28:02 AM org.apache.commons.digester.Digester error SEVERE: Parse Error at line 8 column 219: Document root element "web-app", must match DOCTYPE root "null". org.xml.sax.SAXParseException: Document root element "web-app", must match DOCTYPE root "null". at org.apache.xerces.util.ErrorHandlerWrapper.createSAXParseException(Unknown Source) at org.apache.xerces.util.ErrorHandlerWrapper.error(Unknown Source) at org.apache.xerces.impl.XMLErrorReporter.reportError(Unknown Source) at org.apache.xerces.impl.XMLErrorReporter.reportError(Unknown Source) at org.apache.xerces.impl.dtd.XMLDTDValidator.rootElementSpecified(Unknown Source) at org.apache.xerces.impl.dtd.XMLDTDValidator.handleStartElement(Unknown Source) at org.apache.xerces.impl.dtd.XMLDTDValidator.startElement(Unknown Source) at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanStartElement(Unkno wn Source) at org.apache.xerces.impl.XMLDocumentScannerImpl$ContentDispatcher.scanRootElem entHook(Unknown Source) at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl$FragmentContentDispatc her.dispatch(Unknown Source) at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanDocument(Unknown Source) at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source) at org.apache.xerces.parsers.DTDConfiguration.parse(Unknown Source) at org.apache.xerces.parsers.XMLParser.parse(Unknown Source) at org.apache.xerces.parsers.AbstractSAXParser.parse(Unknown Source) at org.apache.commons.digester.Digester.parse(Digester.java:1548) at org.apache.catalina.startup.ContextConfig.applicationConfig(ContextConfig.ja va:282) at org.apache.catalina.startup.ContextConfig.start(ContextConfig.java:639) at org.apache.catalina.startup.ContextConfig.lifecycleEvent(ContextConfig.java: 243) at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSuppor t.java:166) at org.apache.catalina.core.StandardContext.start(StandardContext.java:3587) at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:8 21) at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:807) at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:595) at org.apache.catalina.core.StandardHostDeployer.install(StandardHostDeployer.j ava:307) at org.apache.catalina.core.StandardHost.install(StandardHost.java:788) at org.apache.catalina.startup.HostConfig.deployDirectories(HostConfig.java:559 ) at org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:401) at org.apache.catalina.startup.HostConfig.start(HostConfig.java:718) at org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java:358) at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSuppor t.java:166) at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1196) at org.apache.catalina.core.StandardHost.start(StandardHost.java:754) at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1188) at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:363) at org.apache.catalina.core.StandardService.start(StandardService.java:497) at org.apache.catalina.core.StandardServer.start(StandardServer.java:2190) at org.apache.catalina.startup.Catalina.start(Catalina.java:512) at org.apache.catalina.startup.Catalina.execute(Catalina.java:400) at org.apache.catalina.startup.Catalina.process(Catalina.java:180) 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:203) Jul 7, 2005 10:28:02 AM org.apache.commons.digester.Digester error SEVERE: Parse Error at line 8 column 219: Document is invalid: no grammar found. org.xml.sax.SAXParseException: Document is invalid: no grammar found. at org.apache.xerces.util.ErrorHandlerWrapper.createSAXParseException(Unknown Source) at org.apache.xerces.util.ErrorHandlerWrapper.error(Unknown Source) at org.apache.xerces.impl.XMLErrorReporter.reportError(Unk
Re: Caching static content -> Bug in Filter implementation?
I think that's expected behaviour: You can't set headers after the response has been committed (more body data has been written to the outputstream than the buffer size). In the case of the 200 response code the call to filterChain.doFilter(...) actually serves the content. Setting of the header after this is too late. Jon [EMAIL PROTECTED] wrote: Hello I do some further analysis in this problem and got following result: Precondition: The filter manipulates the HTTP header when returning a static resource (e.g. image). HTTP 200 In case of a HTTP 200 (OK) result the header is not added when the doFilter method is like following: filterChain.doFilter(request, response); response.setHeader(name, value); In contrast to it works when the code is like following: response.setHeader(name, value); filterChain.doFilter(request, response); In other words: When returning a HTTP 200 (OK) I must set the header before forwarding the request to the next filter. HTTP 304 In this case it doesn't mention whether setting the header is before or after forwarding the request. Any comments? JĂ¼rgen Dufner - Diese E-Mail enthaelt vertrauliche oder rechtlich geschuetzte Informationen. Wenn Sie nicht der beabsichtigte Empfaenger sind, informieren Sie bitte sofort den Absender und loeschen Sie diese E-Mail. Das unbefugte Kopieren dieser E-Mail oder die unbefugte Weitergabe der enthaltenen Informationen ist nicht gestattet. The information contained in this message is confidential or protected by law. If you are not the intended recipient, please contact the sender and delete this message. Any unauthorised copying of this message or unauthorised distribution of the information contained herein is prohibited. - 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: can a context log to windows event log?
No. You can configure log4j on a per context basis. http://jakarta.apache.org/tomcat/faq/logging.html#userWebapps For example: http://marc.theaimsgroup.com/?l=tomcat-user&m=108330970225012&w=2 Mark wrote: Yes, I know. But from what I have read, the configuration is more global. I want to only place audits from one context in the Event Log, not all of Tomcat's audits. On 7/6/05, Jon Wingfield <[EMAIL PROTECTED]> wrote: log4j has an appender which can write to the Event Log http://logging.apache.org/log4j/docs/api/index.html http://jakarta.apache.org/tomcat/faq/logging.html HTH, Jon Mark wrote: Is it possible for only one context to log to the Windows Event Log? What I want is for logs for the tomcat engine to be placed into a flat file, and my context's logs to go into the Event Log. thank you. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: can a context log to windows event log?
log4j has an appender which can write to the Event Log http://logging.apache.org/log4j/docs/api/index.html http://jakarta.apache.org/tomcat/faq/logging.html HTH, Jon Mark wrote: Is it possible for only one context to log to the Windows Event Log? What I want is for logs for the tomcat engine to be placed into a flat file, and my context's logs to go into the Event Log. 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: obscure tomcat 5.5 text file display bug? [Bugzilla candidate?]
I agree; it does the job :) There is an equivalent for IE: http://www.blunck.info/iehttpheaders.html Enjoy, Jon Woodchuck wrote: GB Developer, thanks so much for your suggestion, Live HTTP Headers is awesome! and my hunch was correct. the problem is Tomcat 5.5 does not produce any Content-Type information at all when serving back the .txt file. here is the relevant header info from Tomcat 4.1: HTTP/1.x 200 OK Etag: W/"1706-1120587147968" Last-Modified: Tue, 05 Jul 2005 18:12:27 GMT Content-Type: text/plain Content-Length: 1706 Date: Tue, 05 Jul 2005 20:59:46 GMT Server: Apache Coyote/1.0 Proxy-Connection: Keep-Alive and here is the relevant header info from Tomcat 5.5: If-Modified-Since: Sun, 03 Jul 2005 18:42:58 GMT If-None-Match: W/"1706-1120416178619" HTTP/1.x 304 Not Modified Server: Apache-Coyote/1.1 Date: Tue, 05 Jul 2005 19:57:35 GMT as it clearly shows, the header info produced by Tomcat 5.5 does not have any Content-Type or even Content-Length. is this a bug that i should enter into BugZilla? or is this something that can be fixed via Tomcat configuration? thanks in advance, woodchuck --- GB Developer <[EMAIL PROTECTED]> wrote: (i suspect it's the way Tomcat is telling the browser what type of file it's sending back... some kind of header info.. but i'm not sure how to go about debugging this) thx in advance, woodchuck I like using FireFox for debugging this type of thing, and the liveheaders plugin http://livehttpheaders.mozdev.org/ VERY handy. There is probably an IE equivalent of some sort, but haven't heard of a really good one. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] Yahoo! Sports Rekindle the Rivalries. Sign up for Fantasy Football http://football.fantasysports.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]
Re: Implementing my own realm
We've implemented our own realm. The step's are quite easy: 1) Implement your custom Realm, we subclassed RealmBase. 2) compile your Realm class with catalina.jar in the classpath 3) jar up your Realm class and any helper classes 4) deploy realm jar to server/lib The only thing you really need to worry about is classloader issues: try to keep any references to your webapp classes out of the Realm and just deal with standard types like Principal otherwise you could end up deploying half your webapp classes to common/lib. Not good. HTH, Jon Laurent FALLET wrote: Hi everybody, I'm planning to write my own realm, because the JDBCRealm doesn't suit me very well. I would like to implement something else which only needs 3 more lines. The problem is that I don't know if I have to: - add this new realm in Tomcat sources (create my own java file) - then recompile all Tomcat - and eventually use my new catalina.jar library into my running Tomcat or if it is possible to implement it outside the library and use it either in it own jar file or directly in the webapp. Any idea? Tell me if I wasn't clear, or if you need details. Regards, Laurent - 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: [OT] Sharing session with manual jsessionid
I commiserate. Only last week I tried to override the cookie header for an AJAX request using setRequestHeader. It didn't work :( Allistair Crossley wrote: Thanks for the info. I have been trying with ; but to no avail, so it must be the case (and it will be) that the parent page's session id is already a cookie AND I am passing it as a URL, so the cookie is winning. Since the XML requests are generated by JavaScript client-side objects, there is little scope for tampering with headers but I can look at the other JSP end to see if I can do anything I suppose. Thanks again. -Original Message----- From: Jon Wingfield [mailto:[EMAIL PROTECTED] Sent: 24 June 2005 15:13 To: Tomcat Users List Subject: Re: [OT] Sharing session with manual jsessionid The jsessionid would have to be a path parameter not a url parameter (append prefixed with a semi-colon rather than a question mark). There was a thread last week called "isRequestedSessionIdFromURL() returns false" which discussed what happens when the id is both in the url and a cookie: the cookie wins. You'll have to make sure the xml requests don't have the cookie header. (It sounds like that is the case as a new session is generated.) HTH, Jon Allistair Crossley wrote: Hi, We are using embedded XML requests within out browser and I would like to share information through 1 session since these XML requests create new requests with their own sessions. I am obtaining the outer session with session.getId and manually adding jsessionid=<%= session.getId() %> to the XML requests in the hope that the jsessionid will override the presence of cookies in the internal JSP that the XML request hits. However, it does not, and the internal JSP generates another session id. I don't think this can be helped can it? Cheers, Allistair --- QAS Ltd. Registered in England: No 2582055 Registered in Australia: No 082 851 474 --- - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: [OT] Sharing session with manual jsessionid
The jsessionid would have to be a path parameter not a url parameter (append prefixed with a semi-colon rather than a question mark). There was a thread last week called "isRequestedSessionIdFromURL() returns false" which discussed what happens when the id is both in the url and a cookie: the cookie wins. You'll have to make sure the xml requests don't have the cookie header. (It sounds like that is the case as a new session is generated.) HTH, Jon Allistair Crossley wrote: Hi, We are using embedded XML requests within out browser and I would like to share information through 1 session since these XML requests create new requests with their own sessions. I am obtaining the outer session with session.getId and manually adding jsessionid=<%= session.getId() %> to the XML requests in the hope that the jsessionid will override the presence of cookies in the internal JSP that the XML request hits. However, it does not, and the internal JSP generates another session id. I don't think this can be helped can it? Cheers, Allistair --- QAS Ltd. Registered in England: No 2582055 Registered in Australia: No 082 851 474 --- - 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: Version issue in coding
+1 on dev matching uat and production environments as closely as possible. As to the issue: IIRC the JDTCompiler shipping with 5.5.9 does not support J2SE 5 features in jsp scriptlets. This may be your problem. Jon Mark Benussi wrote: Well without wishing to sound petty Your development environment should replicate you server environment as closely as possible. Understandably you may develop on windows but run on UNIX but anything else such as Tomcat, JVM, and any 3rd party Jars should be of the same version. The problem is in a JSP I think which I guess you have worked out. -Original Message- From: Amrendra Kumar [mailto:[EMAIL PROTECTED] Sent: 23 June 2005 11:54 To: tomcat-user@jakarta.apache.org Subject: Version issue in coding hi we did coding in tomcat 5.0 on local machine, it's working fine. But when we uploaded to a remote site , i.e web server which has tomcat 5.5.9 and giving this error org.apache.jasper.compiler.DefaultErrorHandler.javacError(DefaultErrorHandle r.java:84) org.apache.jasper.compiler.ErrorDispatcher.javacError(ErrorDispatcher.java:3 28) org.apache.jasper.compiler.JDTCompiler.generateClass(JDTCompiler.java:397) org.apache.jasper.compiler.Compiler.compile(Compiler.java:288) org.apache.jasper.compiler.Compiler.compile(Compiler.java:267) org.apache.jasper.compiler.Compiler.compile(Compiler.java:255) org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:5 56) org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:2 93) org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:291) org.apache.jasper.servlet.JspServlet.service(JspServlet.java:241) javax. where I had gone wrong version issue or something else Regards -- Amrendra Kumar - 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]
Re: New user, help!
You need some JkMount directives to tell Apache which requests to forward to Tomcat. http://jakarta.apache.org/tomcat/tomcat-4.1-doc/jk2/config/apache.html Jon Katherine Faella wrote: I am a new user of Apache and of Tomcat. I am using a Redhat AS 4.0 system. I am running Apache V2.0.54 and my version of Tomcat is 5.5.9. I believe my apache installation is okay because when I go to localhost I see the apache welcome screen. When I go to localhost:8080 I see the Tomcat welcome screen. For a short while, when I went to localhost I actually saw the Tomcat welcome screen and could run the samples there. The only thing missing were the Tomcat icons etc. However, I have "improved" my installation to the point where tomcat is no longer serving for apache, ie. at localhost I see the apache welcome screen. When I peer around at various log files I do not see any obvious errors. Needless to say - I am going nowhere! Can anyone help me? Point me in the right direction at least?! Thanks in advance, Kathy Faella University of Rhode Island a netstat -ln returns: Active Internet connections (only servers) Proto Recv-Q Send-Q Local Address Foreign Address State tcp0 0 0.0.0.0:111 0.0.0.0:* LISTEN tcp0 0 127.0.0.1:631 0.0.0.0:* LISTEN tcp0 0 127.0.0.1:250.0.0.0:* LISTEN tcp0 0 :::127.0.0.1:8005 :::* LISTEN tcp0 0 :::8009 :::* LISTEN tcp0 0 :::80 :::* LISTEN tcp0 0 :::8080 :::* LISTEN tcp0 0 :::22 :::* LISTEN udp0 0 0.0.0.0:111 0.0.0.0:* udp0 0 0.0.0.0:631 0.0.0.0:* udp0 0 198.168.1.76:1230.0.0.0:* udp0 0 131.128.1.76:1230.0.0.0:* udp0 0 127.0.0.1:123 0.0.0.0:* udp0 0 0.0.0.0:123 0.0.0.0:* udp0 0 :::123 :::* Active UNIX domain sockets (only servers) Proto RefCnt Flags Type State I-Node Path unix 2 [ ACC ] STREAM LISTENING 5899 /dev/gpmctl unix 2 [ ACC ] STREAM LISTENING 5986 /tmp/.font-unix/fs7100 unix 2 [ ACC ] STREAM LISTENING 5515 /var/run/acpid.socket unix 2 [ ACC ] STREAM LISTENING 6062 /var/run/dbus/system_bus_socket *** To the default httpd.conf I added: LoadModule jk_module modules/mod_jk.so # # Configure mod_jk*** kmf *** # JkWorkersFile "/usr/local/apache2/conf/workers.properties" JkLogFile "/usr/local/apache2/logs/mod_jk.log" JkLogLevel info JkShmFile "/var/log/httpd/jkshmfile" JkShmSize 20M *** my workers.properties *** # workers.properties.minimal - # # This file provides minimal jk configuration properties needed to # connect to Tomcat. # # The workers that jk should create and work with # worker.list=loadbalancer # # Defining a worker named ajp13w and of type ajp13 # Note that the name and the type do not have to match. # worker.ajp13w.type=ajp13 worker.ajp13w.host=localhost worker.ajp13w.port=8009 # add any new workers to the list here to have them balanced worker.loadbalancer.type=lb worker.loadbalancer.balanced_workers=ajp13w workers.tomcat_home=/usr/local/src/jakarta-tomcat-5.5.9 workers.java_home=/usr/java/jdk1.5.0_03 - 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: isRequestedSessionIdFromURL() returns false
Something like this maybe: String url = request.getRequestURL().toString(); if (url.indexOf("jsessionid")>-1 && url.indexOf(request.getRequestedSessionId())>-1) { // do redirect } Jon Michael Jouravlev wrote: If both methods return true, they would identify the first request after session has been established with browser which supports cookies. I try to keep GET requests clean to encourage browser to keep its page history from growing. When I detect this request, I perform a redirect to the same location to clean URL up. After redirection URL will be clean, because session ID will be contained in cookie only. I need to do this only once. With isRequestedSessionIdFromURL() returning false I cannot do what I need :-( Any ideas? Michael. Interesting question. The Servlet 2.3 spec says: " public boolean isRequestedSessionIdFromURL() Checks whether the requested session ID came in as part of the request URL. Returns: true if the session ID came in as part of a URL; otherwise, false" I would interpret it this way: if the session id, which should be used was extracted from the URL, then return true. If however the cookie contains the same id and was checked first (which is default I think) then the requested session id came from the cookie! Imagine what would happen if always both would be checked and URL and cookie would contain 2 different ids. - 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: Getting DBCP Exception
Ajay, That's a mySQL error message. In the jdbc url you can add parameters to automate reconnection: autoReconnect should the driver attempt to re-connect if the connection dies? (true/false) -> false maxReconnects if autoReconnect is enabled, how many times should the driver attemt to reconnect? -> 3 initialTimeout if autoReconnect is enabled, the initial time to wait between re-connects (seconds) -> 2 If you've already have this set, do you see the Exceptions when/after you bounce the database? I think you can also see this error message if an admin kills a running database query from the processlist - the client thinks the database has gone away. If the above aren't the problem then maybe the communication between the client and mysql server isn't "fast enough". You may have to tweak the client and server connection timeout parameters (in my.cnf in the server). You can also configure DBCP to give a pooled connection a kick to stop it timing out (mysql times out idle connections after, IIRC, 8hrs by default). The parameter you need to set is validationQuery as per: http://jakarta.apache.org/commons/dbcp/configuration.html HTH, Jon Anto Paul wrote: On 6/14/05, ajay kumar <[EMAIL PROTECTED]> wrote: Hi Everybody, This is Ajay Kumar.I implemented DBCP through tomcat container.Some times when i run the webpages it is giving the following Exception: org.apache.commons.dbcp.DbcpException: java.sql.SQLException: Server connection failure during transaction. Attempted reconnect 3 times. Giving up What database you are using ? Read this doc http://jakarta.apache.org/tomcat/tomcat-5.5-doc/jndi-datasource-examples-howto.html#Common%20Problems - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: JMX implementation - Tomcat 5.0.28
That's because it's hardcoded to look for jmx.jar. One jar, singular. Sitting on my local dev machine I've got a jmx.jar which is a concatenation of mx4j.jar and mx4j-tools.jar. It's a bit horrible but it works. There are other ways to do it: 1) Add your jars to the bootstrap classpath by modifying setclasspath.bat (assuming you're using the scripts not the service to start and stop tc). 2) According to the release notes you can also change the manifest file in the bootstrap.jar to point to your own jmx implementations. http://jakarta.apache.org/tomcat/tomcat-5.0-doc/RELEASE-NOTES.txt (just above the "Tomcat 5.0 and XML Parsers" section) HTH, Jon Jimmy Ray wrote: I was ruinning 5.0.28 on Windows, but now it wont start. I get this message: Due to new licensing guidelines mandated by the Apache Software Foundation Board of Directors, a JMX implementation can no longer be distributed with the Apache Tomcat binaries. As a result, you must download a JMX 1.2 implementation (such as the Sun Reference Implementation) and copy the JAR containing the API and implementation of the JMX specification to: ${catalina.home}/bin/jmx.jar I have downlaoded the implementation and placed th files in the correct bin directory, but I still get this error. Any one else tackled this issue. Regards, Jimmy Ray __ Discover Yahoo! Stay in touch with email, IM, photo sharing and more. Check it out! http://discover.yahoo.com/stayintouch.html - 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: AW: Logging the HTTP headers
You can also just watch these on the fly with browser plug-ins: IE: google for ieHTTPHeaders Mozilla/FireFox: http://livehttpheaders.mozdev.org/index.html Both have been very useful to us. Jon Bernhard Slominski wrote: Hi Cristi, they are in the Apache Logfile anyway, why do you want to log them again? Bernhard -UrsprĂ¼ngliche Nachricht- Von: cristi [mailto:[EMAIL PROTECTED] Gesendet: Donnerstag, 2. Juni 2005 10:04 An: Tomcat Users List Betreff: Logging the HTTP headers Hello all Is there any posibility of logging the HTTP headers ? Thx. Cristi - 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]
Re: not catching errors? Tomcat 4.1.31
You should check tomcat's logs to see if there are any warnings. The last error-page def'n is invalid. It should be: java.lang.Exception /error.jsp Maybe tomcat is ignoring all the error-page definitions due to the parsing error. Jon David Johnson wrote: Hi all I've added the following to my web.xml (thanks for the help) 500 /error.jsp 404 /error.jsp java.lang.Exception /error.jsp the problem is when I cause an error (like stopping the database then trying to hit it or reloading a page that should cause an error 500), I'm not seeing my error page. am I forgetting something? - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: sending redirects to relative/absolute URLs
Section 14.30 of the http spec. rfc2616 http://www.faqs.org/rfcs/rfc2616.html Jon Angelov, Rossen wrote: Len, Can you point me a place where I can read about these HTTP requirements? I thought this might be the case but I couldn't find anything helpful online. Probably didn't search enough. -Original Message- From: Len Popp [mailto:[EMAIL PROTECTED] Sent: Friday, May 20, 2005 9:28 AM To: Tomcat Users List Subject: Re: sending redirects to relative/absolute URLs No, because the HTTP protocol requires an absolute URL in redirect responses. On 5/20/05, Angelov, Rossen <[EMAIL PROTECTED]> wrote: Hi, Does anybody know why Tomcat always redirects to absolute links? I looked at the implementation and the sendRedirect calls the toAbsolute method which always constructs an absolute URL. Is there any way to make Tomcat return relative URLs the way they were requested for redirecting? Ross "This communication is intended solely for the addressee and is confidential and not for third party unauthorized distribution." - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] "This communication is intended solely for the addressee and is confidential and not for third party unauthorized distribution." - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Tomcat banner
The ability to change the Server header in a filter depends on the connector. The Coyote connector uses the response.addHeader(..., ...) variant so you get your custom header AND coyote's: HTTP/1.1 304 Not Modified Server: IMP/4.1 Date: Tue, 17 May 2005 08:54:10 GMT Server: Apache-Coyote/1.1 A custom Valve may be able to correct this, the RequestDumperValve log shows both values, because it can execute late enough in the response chain. In production we have Apache in front of Tomcat connected using mod_jk2 and the client never sees our custom header. I haven't yet looked into whether the final setting of the header occurs on the apache side or on the tomcat side. (I'm assuming it's the Apache side.) Jon Jason Bainbridge wrote: On 5/16/05, Rick Beton <[EMAIL PROTECTED]> wrote: André Cruz wrote: Hello! Is there anyway to remove the tomcat banner that appears in the header of all pages served by tomcat? I don't want to disclose that information to my users. The standard webapps (ROOT, manager, admin etc) include the Tomcat banner. If it's also in your own webapp, then perhaps someone put it there. That's where I'd suggest you need to have a look. I think by banner the OP was referring to the HTTP Header for Server, which I don't believe you can change without making changes to the source or maybe a filter would be able to change it? Regards, - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: [Slightly OT] CLASSPATH variable in catalina.sh
Sorry. Didn't see your previous post relating to the use of the -security flag. I'm not sure why it should make a difference in this case but in the past I've found that using CATALINA_OPTS=-Djava.security.debug=access,failure and starting tomcat at the command line with: catalina run -security 2> access.err > access.out to be useful for debugging security issues. J Jon Wingfield wrote: I don't think ${catalina.home}/common/classes/log4j.properties is a valid classpath element. An excerpt from the java tools doc says: "How the Java Launcher Finds User Classes: User classes are classes which build on the Java platform. To find user classes, the launcher refers to the user class path -- a list of directories, JAR archives, and ZIP archives which contain class files." So - if you *really* want to go this road - ${catalina.home}/common/classes would probably be better. However, since (IIRC) tomcat doesn't ship with axis you probably have it in your webapp's WEB-INF/lib. WEB-INF/classes takes precedence so if the properties file is there it should be picked up first. Ultimately, I guess it all depends on the relative places in the classloader hierarchy of the log4j and axis jars. http://jakarta.apache.org/tomcat/tomcat-5.0-doc/class-loader-howto.html HTH, Jon Robert Bateman wrote: While debugging a log4j problem this afternoon... I happened to attempt to rearrange the contents of my CLASSPATH on my Fedora Core 2 machine in order to insure a correct log4j.properties file is being loaded by TC. To insure the proper file is loaded, I placed ${catalina.home}/common/classes/log4j.properties as the *first* entry in the CLASSPATH that catalina.sh passes into the bootstrap process. Looking at 'ps -aef | grep java' I see my properties file listed first in the classpath. HOWEVER, it appears that classloader sun.misc.Launcher$AppClassLoader in Java 1.4.2_05 doesn't honor the -classpath in it's entirety - as 1.4.2_05 *never* loads the log4j.properties file that's in the classpath. Instead - it decides to load the log4j.properties file that is contained in the axis-ant.jar file. Am I crazy Or did I do something wrong??? Bob - 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]
Re: [Slightly OT] CLASSPATH variable in catalina.sh
I don't think ${catalina.home}/common/classes/log4j.properties is a valid classpath element. An excerpt from the java tools doc says: "How the Java Launcher Finds User Classes: User classes are classes which build on the Java platform. To find user classes, the launcher refers to the user class path -- a list of directories, JAR archives, and ZIP archives which contain class files." So - if you *really* want to go this road - ${catalina.home}/common/classes would probably be better. However, since (IIRC) tomcat doesn't ship with axis you probably have it in your webapp's WEB-INF/lib. WEB-INF/classes takes precedence so if the properties file is there it should be picked up first. Ultimately, I guess it all depends on the relative places in the classloader hierarchy of the log4j and axis jars. http://jakarta.apache.org/tomcat/tomcat-5.0-doc/class-loader-howto.html HTH, Jon Robert Bateman wrote: While debugging a log4j problem this afternoon... I happened to attempt to rearrange the contents of my CLASSPATH on my Fedora Core 2 machine in order to insure a correct log4j.properties file is being loaded by TC. To insure the proper file is loaded, I placed ${catalina.home}/common/classes/log4j.properties as the *first* entry in the CLASSPATH that catalina.sh passes into the bootstrap process. Looking at 'ps -aef | grep java' I see my properties file listed first in the classpath. HOWEVER, it appears that classloader sun.misc.Launcher$AppClassLoader in Java 1.4.2_05 doesn't honor the -classpath in it's entirety - as 1.4.2_05 *never* loads the log4j.properties file that's in the classpath. Instead - it decides to load the log4j.properties file that is contained in the axis-ant.jar file. Am I crazy Or did I do something wrong??? Bob - 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: error-page in web.xml and cache-control
Sounds like the message IE gives when you hit back to a page served in response to a POST request. http://theserverside.com/news/thread.tss?thread_id=28366 http://theserverside.com/news/thread.tss?thread_id=29758 Anto Paul wrote: On Apr 6, 2005 1:46 PM, Pawson, David <[EMAIL PROTECTED]> wrote: I'm using response.setHeader("cache-control","no-cache"); and tomcat is correctly telling me that the page has expired when I use the browser back button. I can't find out what error (if any) this is, to trap it using the element. Is it possible to trap this error please? Regards DaveP. What is the exact message you get when clicking back button in browser ?. What browser you use ?. I think it is issued by browser not Tomcat. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Overriding the browser language setting?
One solution would be to map a Filter to whichever URLs you wish to override the browser settings. In the Filter wrap the request, using a sub-class of javax.servlet.http.HttpServletRequestWrapper, before passing the request to the rest of the chain. In your wrapper sub-class override the methods getLocale() and getLocales() and you should be set. see: http://java.sun.com/j2ee/sdk_1.3/techdocs/api/index.html HTH, Jon Kurt Overberg wrote: Hi there all! I'm trying to override the default struts/tomcat code that chooses an ApplicationResources.properties file based on the user's browser language setting. I'd like to manage which language to serve up on my own (or based on an item in the user's session). Does anyone have any pointers on how to do this? Normally I would bash my head against an issue like this for weeks and weeks before finally posting, but in this case, its an emergency and time is short. Thank you for any and all help any of you incredibly talented and intelligent people could provide. /kurt - 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: Servlet pops up as download
Mozilla doesn't understand how to deal with wml. But you can get a plug-in: http://wmlbrowser.mozdev.org/ Nick Wolters wrote: In mozilla the download window says: text/vnd.wap.wml The file itself begins with the following: http://www.wapforum.org/DTD/wml_1.1.xml";> . In web.xml I found the following: wml text/vnd.wap.wml Didn't write the servlet myself though. Nick -Original Message- From: Parsons Technical Services [mailto:[EMAIL PROTECTED] Sent: donderdag 17 maart 2005 15:59 To: Tomcat Users List Subject: Re: Servlet pops up as download What is your content type set to? Doug - Original Message - From: "Nick Wolters" <[EMAIL PROTECTED]> To: Sent: Thursday, March 17, 2005 9:51 AM Subject: Servlet pops up as download Hello, Having some issues with an ensim tomcat 4 installation. Whenever I surf to www.mysite.com/servlet/MyServlet my browser pops up a download dialog instead of showing the page. It downloads MyServlet which does contain all the code it should normally display in the browser. I don't have much experience yet with tomcat, planning to read-up on it next month, but could someone help me with this for now? What things should I check ? Kind regards, Nick - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Trouble with JDBC (I need a little help)
It's a NullPointerException causing all your woes. In the Connect method of DBConnection you are assigning to a local variable of type Connection instead of the instance variable. The instance variable is always null, which causes issues in the QueryDataBase and TotalRows methods. The code as it stands is rather flaky, I'm afraid. Look into connection pooling (docs on the tomcat site and many posts related to it on this list) and defensive programming (checking for null values etc, etc). Also, Wolfgang's advice is good: always close ResultSets and Statements after you're done with them (and connections for that matter). HTH, Jon Maxime wrote: Hello Everybody; I'am asking for help because I have a problem that it's making me crazy. To do some query to the Database, I am using a Class named DBConnection. It's like around 1 week, I didn't do anything on the code (perhaps I did because it doesn't working now). Well... , in order to find the problem I did some test function, but I still can't find it. Here we go, it's not very long, it's just some basic code and 2 logs This the JSP where my test start. Test.jsp DataBase Test! DataBase Test Button http://localhost:8080/Training/TEST2";> DataBase Test Button2 http://localhost/Training/TEST3";> We have 2 button to access on servlet Test2 and Test3 Here they go : TEST3.java : package Training; import java.io.*; import javax.servlet.*; import javax.servlet.http.*; import java.sql.*; import java.sql.DriverManager; public class TEST3 extends HttpServlet { public void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { response.setContentType("text/html"); PrintWriter out = response.getWriter(); // New Instance : DBConnection DBConnection db = new DBConnection(); String req ="Select * FROM User_Table"; try{ db.Connect(); out.println(" DRIVERS JDBC : OK!"); out.println(" Connexion TO DB : OK!"); ResultSet Result = db.QueryDataBase(req); // This part was added to see if we can catch the total row int col = db.TotalRows(Result); if (col == 0) { out.println("Query to DB is not ok!"); } else{ out.println(col); } } catch (ClassNotFoundException e) { out.println("PB with Drivers"); } catch (Exception x) { out.println(x); } } } DBConnection.java package Training; import java.sql.*; import java.sql.DriverManager; public class DBConnection{ Connection connection; Statement stmt; ResultSet result; public DBConnection(){ } public void Connect() throws Exception, SQLException{ String url = "jdbc:mysql://localhost:3306/HeroDB"; String user = "Login"; String password = "Password"; try { // Load JDBC Drivers Class.forName("com.mysql.jdbc.Driver"); // make the connection with the database The problem's right here: Connection connection = DriverManager.getConnection(url,user,password); } catch(SQLException sqle){ System.out.println(sqle.getMessage()); } catch(Exception e){ System.out.println("The Connection Failed !"+ e.getMessage()); } } public ResultSet QueryDataBase(String SQLFunc)throws SQLException, Exception{ try{ stmt = connection.createStatement(); result = stmt.executeQuery(SQLFunc); } catch(SQLException sqle){ System.out.println("Problem with getting Result1!"+ sqle.getMessage()); System.out.println("Problem with getting Result2!"+ sqle.getSQLState()); System.out.println("Problem with getting Result3!"+ sqle.getErrorCode()); } catch(Exception e){ System.out.println("Problem with getting Result4!"+ e.getMessage()); } return result; } public int TotalRows (ResultSet rs) throws SQLException, Exception { int numRows = 0; try{ rs.last(); numRows = rs.getRow(); rs.first(); } catch(SQLException sqle) { System.out.println("Problem with getting Row1"+ sqle.getMessage()); System.out.println("Problem with getting Row2"+ sqle.getSQLState()); System.out.println("Problem with getting Row3"+ sqle.getErrorCode()); } catch(Exception e){ System.out.println("Problem with getting getting Row4!"+ e.getMessage()); } return numRows; } } - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Servlet Streaming file to client: Can't override file name
What happens in FireFox if you do this: response.setHeader("Content-Disposition", "attachment; filename=\"" + theFile.getName() + "\""); The relevant spec is here: http://www.ietf.org/rfc/rfc2183.txt And for the definition of 'value' it references: http://www.ietf.org/rfc/rfc2045.txt The filename parameter must be quoted if it contains spaces. Jon Mark Leone wrote: Thanks. That's exactly what I needed, and it did the trick. Firefox browser just grabs the first non-whitespace part of the name, but in IE the entire name shows up. Thanks again. -Mark Chris Hyzer wrote: Servlet Streaming file to client: Can't override file name 123049 by: Mark Leone Its an HTTP header you are looking for, try this: response.setHeader("Content-Disposition", "attachment; filename=" + theFile.getName()); Chris - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: R: Tomcat 5 java.lang.outOfMemory
Tomcat doesn't pick up CATALINA_OPTS when run as a service. The arguments for the service are held in the registry. More details here: http://jakarta.apache.org/tomcat/tomcat-5.5-doc/windows-service-howto.html and in the archives of this list. HTH, Jon PS: you should still profile your app, though ;) Francesco Pellegrini wrote: Thanks for your answers, I want to upgrade Tomcat, but wich version can I use? Thanks. -Messaggio originale- Da: Allistair Crossley [mailto:[EMAIL PROTECTED] Inviato: martedì 8 marzo 2005 17.46 A: Tomcat Users List Oggetto: RE: Tomcat 5 java.lang.outOfMemory Hi, The answer is not always to throw more memory at your application. The best answer is to test whether you actually need more memory or whether you are leaking it somehow. So find a profiler, get it to talk to Tomcat, and then run your JSP and watch the method call tree, heap monitor and hot spots etc... You will need to grab something like JProfiler, JProbe or others ... they usually know how to connect to Tomcat 5 for you, it's not too hard. Also, you may want to upgrade your Tomcat I think 5.0.19 had an issue anyway with memory, and finally you'll want to ensure when dealing with database connectivity that you are freeing up resources like result sets and so on with close() calls (depending on what you are doing). Allistair. -Original Message- From: Francesco Pellegrini [mailto:[EMAIL PROTECTED] Sent: 08 March 2005 16:39 To: Tomcat-User-ML Subject: Tomcat 5 java.lang.outOfMemory Hi all, I have an environment with Tomcat 5.0.19 and java 1.4.02, on windows 2000 server platform. Tomcat 5 was installed with Services. I have changed in catalina.bat : set CATALINA_OPTS=" -server -Xmx1200m -Xms1200m -Xss256k" Usually the sistem works fine, but when I try to find a lot of data (in the database) using jsp, i got this error: javax.servlet.ServletException org.apache.jasper.runtime.PageContextImpl.doHandlePageExceptio n(PageContextI mpl.java:867) org.apache.jasper.runtime.PageContextImpl.handlePageException( PageContextImp l.java:800) org.apache.jsp.pannelli.telematica.visconsumi_jsp._jspService( visconsumi_jsp .java:810) org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:133) javax.servlet.http.HttpServlet.service(HttpServlet.java:856) org.apache.jasper.servlet.JspServletWrapper.service(JspServlet Wrapper.java:3 11) org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet .java:301) org.apache.jasper.servlet.JspServlet.service(JspServlet.java:248) javax.servlet.http.HttpServlet.service(HttpServlet.java:856) root cause java.lang.OutOfMemoryErrorHow can I solve this issue?Thanks in advanceFrancesco. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Very Straneg problem with MySQL-Connector
Have you got the right permissions set up in the database? log into mysql. switch to the mysql database and look in the user table. You'll need to have an entry for host=monkinetwork, user=root. If you don't refer to the mysql admin docs for assigning privileges: http://dev.mysql.com/doc/mysql/en/user-account-management.html HTH, Jon monkiboy wrote: Hello, Thank you for the answer but it's look like the parameter "skip-networking" is not present. I am really getting hard time. Here's my "my.cnf" : AND THE HTML PAGE in order to access to the Servlet : ERROR MESSAGE Message: Invalid authorization specification message from server: "Access denied for user 'root'@'monkinetwork' (using password: YES)" SQLState: 28000 ErrorCode: 1045 Well, the web.xml file is well configured. Anyway : I already tried with class: org.gjt.mm.mysql.driver, but I have the same message error ! By the way, it's very strange that I can play with MySQL under the terminal but not throught tomcat. Any suggestions please , because it's giving me a very hard time ! ? Thank you ! ++ monkiboy - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Tomcat & IE on a stand-alone PC
I work with a similar setup when I'm at home. It should all be fine. Check the File menu in IE. Does the Work Offline item have a tick next to it? If so, click it and then hover over the link again. Should be available. Jon Clyde, Judy, Robert & Kate Thomson wrote: Hi, I have Tomcat 4.1.12 installed on a stand-alone PC running w2000 without an internet connection. I can enter http://localhost:8080/index.jsp and get the Jakarta Project page displayed successfully. In fact, I have a DBMS installed and can access that via Tomcat. What puzzles me is what settings should I have for IE5. On the project page there are the JSP samples, but when I try to click on a link for execute or source, a hand appears, with a small black circle & a diagonal line through it. Then I get a web page unavailable offline message. Regards, Clyde Thomson - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: bug? invalid url-pattern - 'schemas/content.xsd'
What about a leading slash? Giving a mapping of: /schemas/content.xsd Jon Robert Koberg wrote: Caldarale, Charles R wrote: From: Robert Koberg [mailto:[EMAIL PROTECTED] Subject: Re: bug? invalid url-pattern - 'schemas/content.xsd' Do you really have "sevlet" in the tags, or is your r-key a little sticky? ufff... I have been working too long today... Yes, I have servlet not sevlet. The web.xml is valid according to the public web-app_2_4.xsd. - Chuck THIS COMMUNICATION MAY CONTAIN CONFIDENTIAL AND/OR OTHERWISE PROPRIETARY MATERIAL and is thus for use only by the intended recipient. If you received this in error, please contact the sender and delete the e-mail and its attachments from all computers. - 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]
Re: TC Drops bytes when client uses Chunked Encoding AND specifying Content-Length at the same time.
Section 4.4 of rfc2616 (HTTP1.1 spec) has rules for message-length processing. Rules 2 and 3 seem most pertinent. 2.If a Transfer-Encoding header field (section 14.41) is present and has any value other than "identity", then the transfer-length is defined by use of the "chunked" transfer-coding (section 3.6), unless the message is terminated by closing the connection. 3.If a Content-Length header field (section 14.13) is present, its decimal value in OCTETs represents both the entity-length and the transfer-length. The Content-Length header field MUST NOT be sent if these two lengths are different (i.e., if a Transfer-Encoding header field is present). If a message is received with both a Transfer-Encoding header field and a Content-Length header field, the latter MUST be ignored. Looks like a bug in both TC and the client: TC should ignore the Content-Length as per rule 3. The client shouldn't be sending both headers as the lengths of the entity and transfer are different. Jon Ian Huynh wrote: We are using TC 5.0.28 on JDK 1.4.2 We have a client who POST to TC using header "Transfer-encoding: chunked" and at the same time specify the "Content-Length" header when posting to us. It seems that if the Content-Length is specified, TC is dropping the last few bytes..?? This same customer claims that his code works with the Jetty Servlet (which is the old embedded servlet in JBoss 3.2.1 and earlier). We have done some prelim testing and confirmed that a) if Content-Length is NOT specified and Chunked encoding is used, TC works as specified. b) Jetty works either way (with or without Content-Length). My questions are: 1. what is the correct behavior in HTTP 1.1? I've read through the spec but am unable to ascertain whether or not Content-Lenght should NOT be used when chunked encoding is used. 2. Is this a bug in TC? Unfortunately, our client isn't able to modify the code to NOT include the Content-Length or NOT use Chunk encoding Thanks in advance - 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: New Babie query - pls pls help me
Argh. Triple hijack! This thread started as "JSP expressions are displayed as string", became "Do not allow browsing the root directory to tomcat", then "problem starting tomcat 5.5/jdk1.3.1_11" and now "New Babie query - pls pls help me". For the sake of the archives and those of us using thread-aware mail clients, please start a new thread instead of replying to a completely unrelated topic. Ta, Jon Antony Paul wrote: You need to create a mapping in web.xml to invoke the servlet. Look at the elements and elements in the example/WEB-INF/web.xml. Create a similar one and restart Tomcat. rgds Antony Paul - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Sessions on restart
Yep. Read the docs more carefully ;) The activation/passivation methods are called on objects that implement the listener AND are attributes of the session to be activated/passivated. Tomcat works as Yoav described. HTH, Jon Mark O'Driscoll wrote: Well, as you can see my listener implements this interface but the activation/ passivation methods are never called :-( I have flagged the class as a in m web.xml. Is there anything else I have to do? TIA Mark - Original Message - From: "Shapira, Yoav" <[EMAIL PROTECTED]> To: "Tomcat Users List" <[EMAIL PROTECTED]> Sent: Thursday, November 18, 2004 3:14 PM Subject: RE: Sessions on restart Hi, Now when tomcat restarts, the sessions persist OK but I have no way of knowing the list of active sessions. There will be an activation event for each session restored from disk. If your listener implemented HttpSessionActivationListener, you'd get this event. By monitoring session creation, activation, passivation, and destruction, you will be able to maintain the list of active sessions. I am sure that in the 4.0.x days, sessionCreated was called on restart for >all the persisted sessions. That doesn't seem to be happening with 5.0.28. This behavior was a bug if it indeed existed. Yoav Shapira http://www.yoavshapira.com 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] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
[OT] Re: wrong time in Java Applications to my location (new Date())
The default timezone of a Sun JVM is determined by user locale settings. If the runtime can't determine a sensible timezone from those it defaults to GMT, which is 3hrs off from Brazilia time, i think. Looking at the source of TimeZone it uses the following system properties: user.timezone user.country java.home If user.timezone is not set then a native call is made using user.country and java.home. I'm not sure what happens for a multi-timezone country like Brazil ;) So you could: 1) pass in the user.timezone system property to the runtime. 2) Set your servers default timezone in code: TimeZone.setDefault(TimeZone.getTimeZone(id)); where id is one of: Brazil/DeNoronha America/Sao_Paulo (probably the one you want or maybe Brazil/East) America/Boa_Vista Brazil/Acre or America/Rio_Branco Are you running Tomcat as a service? If so, you may also want to check that the regional settings for the user running the service are also set to Brazilia. I would also check what is actually being determined by the JVM. Do something like: System.out.println(TimeZone.getDefault()); System.getProperties().list(System.out); HTH, Jon AcĂ¡cio Furtado Costa wrote: Hi everybody We have a Tom Cat application Server 5.0.19 running in a Windows 2003 with a Sun JDK 1.4.2. We are having problems with time of our Applications . The time is correct under SO but we have 3 hours of difference in the applications (+3). Our offset time is Brasilia -3:00 in the Windows 2003 and Regional settings is Portuguese, Brazil. The method TO GET SYSTEM TIME is new Date() Any suggestion, How we setup server parameters or application (JVM) parameters to solve this problem? Thanks a lot in advance Acacio Furtado Costa Pesquisa e Tecnologia GIA - Magnesita S/A *(0xx31) 3368-1349 * [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Use of Referer header
Also from Section 14.36 of rfc2616: The Referer field MUST NOT be sent if the Request-URI was obtained from source that does not have its own URI, such as input from the user keyboard. So you can't rely on it being present. Shapira, Yoav wrote: Hi, But I have 2 questions: 1. Where are these header values defined I've not beeen able to find a good source. See the HTTP protocol RFC itself for common headers like referrer. Other servers and routers may add custom headers along the way. Your app and other apps can also use custom headers if they wish. 2. It worked when coming from my pages but I then tried going to another page (e.g www.sun.com) and then pasting in the url and it just returned null. Does referer only apply when hyperlink from another page ? Some browsers, including IE, are known to have bugs regarding the referrer header. Sometimes it's null or not included in the request at all. So your app, if it uses the referrer header, must be tolerant of these bugs. What about a history.go(-1) alternative to the referrer header? Yoav 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: SSL on tomcat breaks file download
Archives: http://marc.theaimsgroup.com/?l=tomcat-user&m=109818070801385&w=2 http://marc.theaimsgroup.com/?l=tomcat-user&m=105966032518910&w=2 Jon Dobson Paul L Contr OO-ALC/LGFBR wrote: I created a JSP web application that allows user to dynamically generate and download excel files using POI/HSSF. I use the following lines to store the excel file in my application directory under a directory titled "xlsreports": nextXLSName = MiscUtil.getNextXLSName(); //gets the next file name by querying the database. report.writeFile(WebappPrefs.getRptPath(session.getServletContext()) + nextXLSName); The above lines seem to work because I find the generated file in the correct folder with the correct time stamp of when I tested the JSP. I then use the following line of code to send the user the file: " /> This has always worked flawlessly until I implemented SSL on Tomcat. Now, IE tells me that the requested site is either unavailable or cannot be found. Any ideas why implementing SSL would break this or how to fix it? Thanks a million in advance. --Paul - 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: can not run a servlet that generates a pdf
You are calling getWriter in your catch clause after you have already called getOutputStream. That's illegal. You could set up an error page in web.xml to report the exception instead of catching it. Jon Lina MarĂa Rojas Barahona wrote: Hello: I am trying to write a PDF using a servlet in Apache Tomcat/5.0.27 , and It doesn´t work. I just call the servlet in an html page, I never use a response.getWriter, so I dont undestand why I can not use response.getOutputStream in the servlet, SmartJPrint_PDFServlet1--- package demo.activetree.print.webapps; import com.activetree.print.*; import com.activetree.utils.AtStringUtil; import com.activetree.resource.AtImageList; import java.io.*; import java.awt.*; import javax.servlet.*; import javax.servlet.http.*; import javax.swing.table.TableModel; import javax.swing.table.DefaultTableModel; import javax.swing.*; public class SmartJPrint_PDFServlet1 extends HttpServlet { public void doGet(HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException { //TODO-1: Use your own license key here SmartJPrint.setLicenseKey("8FE6-D08A-68A5-191A"); //Set header first response.setHeader("Cache-Control", "max-age=30"); response.setContentType("application/pdf"); //TODO-3: Use "inline" for directly opening in the browser window. //String inline = "inline; filename=\"smartjprint_" + System.currentTimeMillis() + ".pdf\""; //response.setHeader("Content-disposition", inline); //TODO-2: Use "attachment" for doing a SaveAs... in the browser. String attachment = "attachment; filename=\"smartjprint_" + System.currentTimeMillis() + ".pdf\""; response.setHeader("Content-disposition", attachment); //Prepare the data. AtBook book = new AtBook(); Color fgColor = SystemColor.black; Color bgColor = SystemColor.white; //Produce lines of Styled/Plain text, icons, 2D line data. produceRandomData(book); //Table-1. TableModel tabularData = createSampleTabularData(); Font titleFont = new Font("Arial", Font.BOLD, 20); book.append(new AtStringElement("\nPermanent Employees\n", titleFont, AtPrintConstants.GENERAL_HEADER_FG1)); Font normalBoldFont = new Font("Arial", Font.BOLD, 12); book.append(new AtStringElement("Table-1\n", normalBoldFont)); Font font = new Font("Arial", Font.PLAIN, 12); book.append(tabularData, font, fgColor, bgColor); //Page Break - to put things next in a new page. book.append(new AtStringElement("\nPage Break (applied next to this line)\n", titleFont, AtPrintConstants.GENERAL_HEADER_FG1)); book.append(AtElement.PAGE_BREAK); //show in next page. //Table-2. tabularData = createSampleTabularData(); book.append(new AtStringElement("\nContract Employees\n", titleFont, AtPrintConstants.GENERAL_HEADER_FG1)); book.append(new AtStringElement("Table-2\n", normalBoldFont)); book.append(tabularData, font, fgColor, bgColor); //We are done with our data, now write to the client. try { ServletOutputStream outStream = response.getOutputStream(); AtPdfPrinter pdfPrinter = new AtPdfPrinter(); pdfPrinter.print(book, outStream); outStream.flush(); outStream.close(); }catch(Throwable t) { response.setContentType("text/html"); PrintWriter out = response.getWriter(); out.write("Got exception when doing a AtGenericPrinter.print(book, pdfStream) "); out.write(AtStringUtil.getStackTrace(t)); out.write(""); out.close(); } } public TableModel createSampleTabularData() { String[] cols = {"Employee Name", "SS No.", "Date Of Birth", "Position", "Salary"}; String[][] data = new String[5][cols.length]; //Create same data for the table. String name = "Employee Name - "; String ssn = "SS No - "; String dob = "Birth Date - "; String position = "Position - "; String annualSalary = "Employee Salary - "; for (int row=0; row < data.length; row++) { data[row][0] = name + row; data[row][1] = ssn + row; data[row][2] = dob + row; data[row][3] = position + row; data[row][4] = annualSalary + row; } DefaultTableModel tableModel = new DefaultTableModel(data, cols); return tableModel; } public void produceRandomData(AtBook book) { Font titleFont = new Font("Arial", Font.BOLD, 20); Color titleColor = AtPrintConstants.GENERAL_HEADER_FG1; ImageIcon bullet = AtImageList.IMAGE_LIST.RIGHT_ARROW_16; AtStringElement note = new AtStringElement("Note: ", new Font("Helvitica", 3, 12)); //3 == BOLD + ITALIC book.write(note); book.write(new AtStringElement("This PDF document is generated using Smart JPrint (AtGenericPrinter class).\n", new Font("Helvetica", Font.ITALIC, 12))); book.write(new AtLineElement(200, 1, At
Re: What's a sealing violation please?
It's part of the core java security model. If a package is sealed within a jar then packages of the same name cannot be defined in another jar, or elsewhere on the classpath. Within the manifest file of the jar file which is being loaded by your putpr servlet you'll probably have a couple of lines like: Name: nu/xom Sealed: true The XOM jar that I have (xom-1.0d8.jar) doesn't seal its packages. So, you need to find the jar which is sealing the nu.xom package and stop it doing so. (Or work out your xom dependencies) Regards, Jon Pawson, David wrote: From the log 2004-11-02 09:24:51 StandardContext[/servlets-examples]SessionListener: contextInitialized() 2004-11-02 09:25:52 StandardWrapperValve[putpr]: Servlet.service() for servlet putpr threw exception java.lang.SecurityException: sealing violation: can't seal package nu.xom: already loaded at java.net.URLClassLoader.defineClass(URLClassLoader.java:234) at java.net.URLClassLoader.access$100(URLClassLoader.java:55) at java.net.URLClassLoader$1.run(URLClassLoader.java:194) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(URLClassLoader.java:187) Any help appreciated. Regards DaveP. snip here * - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Fw: Internet Explorer Bug under SSL Connection
Tomcat adds (or at least did in the 4.1 branch) certain response headers, directives to clients and proxy caches to not cache the data, when it is to serve something within a security-constraint. (log examples at end of post) [It seems that] When IE downloads something with a mime-type it thinks it can handle (probably via a plug-in) it caches the data and then passes it over to the plug-in. With SSL and the Pragma header set to no-cache this seems to fail with the error message described in the original post. Our entire site is SSL also and we've seen this error (and our hack resolves it) for csv, excel, pdf files. Downloading with the content-type set to application/octet-stream doesn't trigger the error in our experience (we also provide this option on the download pages but users generally want to see the data directly). Jon Examples from my 4.1.29 logs when the RequestDumperValve is commented in: Response for index.jsp (inside security-constraint): authType=null contentLength=-1 contentType=null cookie=JSESSIONID=EB28F372EF5D5FC5C2908C57766010BA; domain=null; path=/ header=Pragma=No-cache header=Cache-Control=no-cache header=Expires=Thu, 01 Jan 1970 00:00:00 GMT header=Set-Cookie=JSESSIONID=EB28F372EF5D5FC5C2908C57766010BA; Path=/ header=Location=http://localhost:8080/login.jsp;jsessionid=EB28F372EF5D5FC5C2908C57766010BA message=null remoteUser=null status=302 Response for bgdot.gif (outside security-constraint): authType=null contentLength=77 contentType=image/gif;charset=ISO-8859-1 header=Server=IMP/4.0.20 header=ETag=W/"77-109810668" header=Last-Modified=Mon, 18 Oct 2004 13:38:00 GMT message=null remoteUser=null status=200 David Wall wrote: Our web site is entirely SSL. Most users have IE. Our application is used to securely transfer and digitally sign attached files that must be downloaded. Yet, we've never seen this problem. Who is putting in the "Pragma" header in the response in the first place that you have to change it this way? And why does the Pragma setting have the negative effect described? Thanks, David ----- Original Message - From: "Jon Wingfield" <[EMAIL PROTECTED]> To: "Tomcat Users List" <[EMAIL PROTECTED]> Sent: Friday, October 15, 2004 9:57 AM Subject: Re: Internet Explorer Bug under SSL Connection Yep. This comes up every so often on the list. Whenever IE downloads content we change the Pragma response header to be public instead of no-cache: String userAgent = request.getHeader("user-agent"); if (response.containsHeader("Pragma") && userAgent!=null && userAgent.toUpperCase().indexOf("MSIE")>-1) { response.setHeader("Pragma", "public"); } HTH, Jon - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Internet Explorer Bug under SSL Connection
Yep. This comes up every so often on the list. Whenever IE downloads content we change the Pragma response header to be public instead of no-cache: String userAgent = request.getHeader("user-agent"); if (response.containsHeader("Pragma") && userAgent!=null && userAgent.toUpperCase().indexOf("MSIE")>-1) { response.setHeader("Pragma", "public"); } HTH, Jon Edouard Dalla-Costa wrote: Hi, I am using a servlet that open an excel file from an output stream which is working very well. However, I want to use it under SSL connection which looks to be quite easy. I made the change in tomcat and it is working very well. However when I try to open my excel file using Internet Explorer under SSL connection, I am having a strange error: impossible to open: https://myURL I am using exactley the same URL with non SSL connection and it is working fine. But the funniest thing is that it is really well working using FireFox or Opera explorer. It makes me crazy. So if somebody as already see encounter this problem or know what to do. PLEASE HELP ME Thank you very Much regards Edouard - 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: Servlet caching?
One thing you might want to check is that whatever PrintService SPI implementation is looking up your printers doesn't cache the result for the lifetime of the JVM. Does your command line app show new printers and then exit? If so, you might want to change it so you can: 1) list the printers 2) install the new printer while the app is still running 3) list the printers I just did a (rather noddy) check on my workstation: I brought up the print dialog in JEdit and saw just one printer. I installed a new printer then opened the print dialog again and saw just one printer. I restarted JEdit and voila: two printers. I assume JEdit is using the default PrintService discovery mechanism supplied by the JVM. On my workstation that's sun.print.Win32PrintServiceLookup as defined in META-INF/services. If the default implementation is caching then you are out of luck unless you want to write your own PrintServiceLookup. Jon Shapira, Yoav wrote: Hi, I would think that after reloading the servlet all the classes that it had used would cease to exist. That is, any class that had been instantiated or used by the servlet would not remain instantiated after I reload the servlet. Under most instances, but not all. For example, if the library you're using the find the list of printers is in common/lib or shared/lib, your thought above is false. Yoav - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: method level synchronization doesn't work
I'd be surprised if synchronization was broken. Given one assumption I think I can explain what you are seeing. Assumption: The two concurrent requests are handled by two different instances of a jsp servlet. If there are two instances then each request will be able to sucsessfully obtain the monitor when calling the synchronized methods. So, why does using a synchronized block work? It works because you are synchronizing on a literal string. Literal strings get interned into a pool of objects by the jvm. So the mutex reference actually points to the same piece of memory for both instances of your jsp. Hence the synchronization works. Jon Malia Noori wrote: Actually, the data that I am modifying requires a transaction and synchronization. It increments a counter stored in the database. So, I have to do a select to get the current value, increment the counter, and then insert the new value. So if two threads are accessing it at the same time, the counter will not be properly incremented. What's puzzling is that method level synchronization does not work while synchronizing on a block of code inside a method works. Thanks, Malia -Original Message- From: Peter Lin [mailto:[EMAIL PROTECTED] Sent: Thursday, September 30, 2004 10:26 AM To: Tomcat Users List; [EMAIL PROTECTED] Subject: Re: method level synchronization doesn't work am I missing something, but looks like you're trying to build some kind of web cache. why not use Hibernate or something that already does caching for you instead? the only time I can see a need to sync, is if the request contains data that requires a transaction. Which in that case, you're better off doing an insert, then a second select query with the same connection. or is the scenario a distributed objects setup? peter On Thu, 30 Sep 2004 10:05:41 -0400, Malia Noori <[EMAIL PROTECTED]> wrote: Hi, I am using Tomcat 4.1 and I am accessing MS SQL Server database via JDBC. I have a JSP that calls a web bean. This web bean has a section of code that I want to synchronize, but when I synchronize the method, Tomcat doesn't actually synchronize the threads. (I tried this by having 2 users access my JSP at the same time). When I synchronize the code in the method by using a mutex, it works. So, doing this doesn't work: public synchronized void amethod() { //some code that access the database and needs to be synchronized } But doing this works: public void amethod() { String mutex = ""; synchronize(mutex) { //some code that access the database and needs to be synchronized } } Why does synchronization on the method doesn't work? Does Tomcat not allow locking of object caused by method level synchronization? Any help will be appreciated. Thanks, Malia - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: cannot deploy the war file..Tomcat 4.1.30 --- please suggest...
Ok. cool. Here's a copy of a Context tag I use for a war file using a custom Realm and other assorted goodies: directory="logs" prefix="services_log." suffix=".txt" timestamp="true"/> allowLinking="true"/> type="com.mkodo.web.services.RemoteServiceLocator"/> factory org.apache.naming.factory.BeanFactory This is in a services.xml file in webapps along with my services.war. So change your docBase to be your war file and hopefully you should be set. Jon Shilpa Nalgonda wrote: Thanks, now i get this error --\ : Doc base must point to a WAR file at org.apache.naming.resources.WARDirContext.setDocBase(WARDirContext.java:172) at org.apache.catalina.core.StandardContext.resourcesStart(StandardContext.java :3349) at org.apache.catalina.core.StandardContext.start(StandardContext.java:3479) at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1188) at org.apache.catalina.core.StandardHost.start(StandardHost.java:754) at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1188) at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:363) at org.apache.catalina.core.StandardService.start(StandardService.java:497) I have this entry in server.xml, i have closed the Context too. factory org.apache.commons.dbcp.BasicDataSourceFactory
Re: Tomcat Problems - Any help is appreciated
Suddenly? ;) The error message tends to imply there is no DOCTYPE (at all) in one of your web.xml files. The parser fails when validating the doc with this rather strange error message. HTH, Jon Wilson, Allen wrote: Hello... I am running 4.1.18 and I suddenly started having problems with Tomcat. Here is the information that is in the catalina.out file (as added it as an attachment)...if someone can point me in the right direction to fix this...I would appreciate it Thanks you Allen ** Information in file * Starting service Tomcat-Standalone Apache Tomcat/4.1.18 org.xml.sax.SAXParseException: Document root element "web-app", must match DOCTYPE root "null". at org.apache.xerces.util.ErrorHandlerWrapper.createSAXParseException(Error HandlerWrapper.java:232) at org.apache.xerces.util.ErrorHandlerWrapper.error(ErrorHandlerWrapper.jav a:173) at org.apache.xerces.impl.XMLErrorReporter.reportError(XMLErrorReporter.jav a:371) at org.apache.xerces.impl.XMLErrorReporter.reportError(XMLErrorReporter.jav a:305) at org.apache.xerces.impl.dtd.XMLDTDValidator.rootElementSpecified(XMLDTDVa lidator.java:1526) at org.apache.xerces.impl.dtd.XMLDTDValidator.handleStartElement(XMLDTDVali dator.java:1804) at org.apache.xerces.impl.dtd.XMLDTDValidator.startElement(XMLDTDValidator. java:724) at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanStartElement(X MLDocumentFragmentScannerImpl.java:759) at org.apache.xerces.impl.XMLDocumentScannerImpl$ContentDispatcher.scanRoot ElementHook(XMLDocumentScannerImpl.java:957) at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl$FragmentContentDis patcher.dispatch(XMLDocumentFragmentScannerImpl.java:1544) at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanDocument(XMLDo cumentFragmentScannerImpl.java:329) at org.apache.xerces.parsers.DTDConfiguration.parse(DTDConfiguration.java:5 25) at org.apache.xerces.parsers.DTDConfiguration.parse(DTDConfiguration.java:5 81) at org.apache.xerces.parsers.XMLParser.parse(XMLParser.java:152) at org.apache.xerces.parsers.AbstractSAXParser.parse(AbstractSAXParser.java :1175) at org.apache.commons.digester.Digester.parse(Digester.java:1495) at org.apache.catalina.startup.ContextConfig.applicationConfig(ContextConfi g.java:282) at org.apache.catalina.startup.ContextConfig.start(ContextConfig.java:639) at org.apache.catalina.startup.ContextConfig.lifecycleEvent(ContextConfig.j ava:243) at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSu pport.java:166) at org.apache.catalina.core.StandardContext.start(StandardContext.java:3567 ) at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.ja va:821) at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:807) at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:579) at org.apache.catalina.core.StandardHostDeployer.install(StandardHostDeploy er.java:257) at org.apache.catalina.core.StandardHost.install(StandardHost.java:772) at org.apache.catalina.startup.HostConfig.deployDirectories(HostConfig.java :569) at org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:411) at org.apache.catalina.startup.HostConfig.start(HostConfig.java:879) at org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java:36 8) at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSu pport.java:166) at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1196) at org.apache.catalina.core.StandardHost.start(StandardHost.java:738) at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1188) at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:347) at org.apache.catalina.core.StandardService.start(StandardService.java:497) at org.apache.catalina.core.StandardServer.start(StandardServer.java:2189) at org.apache.catalina.startup.Catalina.start(Catalina.java:512) at org.apache.catalina.startup.Catalina.execute(Catalina.java:400) at org.apache.catalina.startup.Catalina.process(Catalina.java:180) at java.lang.reflect.Method.invoke(Native Method) at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:203) [ERROR] Digester - -Parse Error at line 1 column 10: Document root element "web-app", must match DOCTYPE root "null". org.xml.sax.SAXParseException: Document is invalid: no grammar found. at org.apache.xerces.util.ErrorHandlerWrapper.createSAXParseException(Error HandlerWrapper.java:232) at org.apache.xerces.util.ErrorHandlerWrapper.error(ErrorHandlerWrapper.jav a:173) at org.apache.xerces.impl.XMLErrorReporter.reportError(XMLErrorReporter.jav a:371) at org.apache.xerces.impl.XMLErrorRepor
Re: IE6 and download problem using tomcat java servlet
IE feels the need to cache the content before saving it to the desired location. You probably have some headers in the response designed to stop caching. You could comment in the RequestDumperValve to confirm this. Add to your code: response.setHeader("Pragma", "public"); We saw similar problems for downloads from urls within our security-constraint. They went away when we added this header. HTH, Jon Terry Orechia wrote: I am having a problem downloading a jpeg file from a tomcat java servlet to Internet Explorer 6.0. I have changed the file extension to "zzz" to force the download prompt. If I restart tomcat(version 4.1.x), the download works fine the first time. The correct filename "video.zzz" appears on the prompt and I can hit save and it will prompt me as ti where I want to save the file. However, after the first time I get a download prompt with an incorrect filename (the filename is the http query request). If I select "save",then it does not prompt for a location to save and I immediately get error "Internet explorer was not able to open the requested site". Is there something else that needs to be set in the http header? Here is the piece of the java servlet that is issueing the download: response.setContentType("APPLICATION/OCTET-STREAM"); response.setHeader("Content-Disposition", "Attachment;Filename=\"video"+videoid+".zzz\""); String size=Integer.toString((int)file.length()); response.setHeader("Content-Length",Integer.toString((int)file.length())); try { out = response.getWriter(); // transfer the file byte-by-byte to the response object File fileToDownload = new File("c:\video.zzz"); FileInputStream fileInputStream = newFileInputStream(fileToDownload); int i; while ((i=fileInputStream.read())!=-1) { out.write(i); } fileInputStream.close(); out.close(); }catch(Exception e) // file IO errors { e.printStackTrace(); } Thanks, Terry - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Can't get servlet to work on tomcat5.0.x.
You need a for your servlet. The Invoker servlet, which gives you a configuration shortcut, has been disabled since Tomcat 4.1.12. http://jakarta.apache.org/tomcat/faq/misc.html#invoker nyhgan wrote: Hi, I finished the apach2 and tomcat5.0.27 integration today, The JSP is fine, but the servlets are not working. When I try to login to my application, I got the "this page cannot be displayed" message. There are no error messages in catalina.out I have the invoker servlet turn on. My serlets are package in a jar file, place under my WEB-INF/lib directory. Here are the related configurations --- web.xml - "http://java.sun.com/dtd/web-app_2_3.dtd";> loginHandler site.music.servlet.LoginHandler workers2.properties # Uri mapping for jsp [uri:127.0.0.1/*.jsp] group=ajp13:localhost:8009 # Uri mapping for jsp [uri:127.0.0.1/servlet/*] group=ajp13:localhost:8009 - Do you Yahoo!? Read only the mail you want - Yahoo! Mail SpamGuard. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Where to put Listener & Realm instead of server.xml?
If you're using 4.1.x you can place a .xml file in the webapps (appBase) directory. It contains the Context element that would have gone in server.xml. The custom Realm classes still need to be in the common classloader. http://jakarta.apache.org/tomcat/tomcat-4.1-doc/config/host.html#Automatic%20Application%20Deployment Shapira, Yoav wrote: Hi, If you're using Tomcat 5.x, you can put these in the context.xml file (in the META-INF directory of your application / WAR). They don't go in web.xml, as they're not portable, but rather they are Tomcat-specific. If you're using Tomcat 4.x, consider this another reason to upgrade ;) Note however that Realm implementations need to be visible to the common classloader. So if the "..." in your message is a custom Realm implementation, you're SOL as far as self-containment goes. Yoav Shapira Millennium Research Informatics -Original Message- From: Wendy Smoak [mailto:[EMAIL PROTECTED] Sent: Monday, August 23, 2004 12:23 PM To: Tomcat Users List Subject: Where to put Listener & Realm instead of server.xml? We're going to try out a third-party report generation tool, and the installation instructions involve replacing server.xml. They assume they will be the only webapp running, which is not the case here. Can I put their changes somewhere else? They need: and also I don't really want to edit my server.xml, since I don't need to for any of my own webapps. But I'm not sure if these tags can go in web.xml, or if not, I seem to remember maybe putting a file in the 'webapps' directory which will get picked up. Can someone enlighten me or point me in the right direction? Thanks! -- Wendy Smoak - 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. - 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: How to write a Valve that can inspect the HTTP Body, without damaging the InputStream?
Can't you use a java.io.PushbackInputStream? You could write a Filter instead of a Valve. In the Filter wrap the ServletRequest and provide a custom ServletInputStream which uses the PushbackInputStream around the real ServletInputStream. Once security checks have passed you can push back the used bytes and pass on your wrapped ServletRequest down the Filter chain to the 3rd party servlets. HTH, Jon Betts, Chris wrote: Hi Folks, I want to write a tomcat security Valve that does content checking of the HTTP body, before anything else happens (e.g. 3rd party destination servlets I have no control over are called). However, to read the body data I 'use up' the inputStream, and can't find any way to put it back - the result is the final servlet gets an empty body. Unfortunately, the data is actually HTTP POST data containing SOAP/XML, otherwise I could use the servlet request parameter methods. Since it is SOAP/XML though, I really have to get the body data directly, as no parameters are set. I've tried mark() and reset() on both the input stream and the reader methods, but no luck (not implemented and no effect respectively). And, coyote doc not withstanding, 'setStream()' is actually a no-op - the source code shows it is an empty method - so I can't reset the stream that way. I'm getting a 'you can't get there from here feeling' at this stage; does anyone have any clues? I'm using tomcat 4.0.29 at the moment, but the code seems pretty similar in tomcat 5 as well so I don't think switching will help... thanks heaps in advance :-), - Chris Dr Christopher Betts Web Services Security Computer Associates - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: docBase attribute in context element doesn't recognize c$
You may want to watch the status of the following bug: >> Hi, >> There's a known escaping issue there, >> http://issues.apache.org/bugzilla/show_bug.cgi?id=28219. >> Yoav Shapira >> Millennium Research Informatics HTH, Jon Sun House wrote: Chuck , YOU ARE THE MAN Escaping the dollar sign doesn't work, BUT double $$ do works: As my grandma used to say the more $ you have, the less headache you have Have a beautiful day Sun House "Caldarale, Charles R" <[EMAIL PROTECTED]> wrote: From: Sun House [mailto:[EMAIL PROTECTED] Subject: RE: docBase attribute in context element doesn't recognize c$ still i the tomcat somehow parses > docBase=\\my-computer\c$\temp ... > as \\my-computer\c\temp . Have you tried simply escaping the dollar sign, perhaps by useing $$? - Chuck THIS COMMUNICATION MAY CONTAIN CONFIDENTIAL AND/OR OTHERWISE PROPRIETARY MATERIAL and is thus for use only by the intended recipient. If you received this in error, please contact the sender and delete the e-mail and its attachments from all computers. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - Do you Yahoo!? New and Improved Yahoo! Mail - 100MB free storage! - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: JSP WhiteSpace
I've used a Filter to strip out redundant whitespace from text/html output. I wrapped the ServletResponse so that a custom ServletOutputStream filters out empty and recurring linefeeds. Works pretty well. As for mod_gzip, I would be very surprised if it didn't respect the Accept-Encoding header the user-agent sends in the request. No header or gzip not specified shouldn't lead to a compressed response. Jon A wrote: I know its not part of the spec - what is the workaround / is there a workaround current developers have used. Thank you --- Hiroshi Iwatani <[EMAIL PROTECTED]> wrote: Read JSP 1.2 spec 2.3.7 'White Space'. A wrote: In the compiled JSP page - I dont want to remove white space from the code for the sake of readability --- Schalk Neethling <[EMAIL PROTECTED]> wrote: Are you talking about about white spaces in the code or the rendered page itself? Parsons Technical Services wrote: Then they are using a very odd or out dated browser. Thus a very small percentage of the users will have problems. Doug Parsons www.parsonstechnical.com - Original Message - From: "A" <[EMAIL PROTECTED]> To: "Tomcat Users List" <[EMAIL PROTECTED]> Sent: Saturday, August 21, 2004 12:22 PM Subject: Re: JSP WhiteSpace Well what happens if your users cannot accept zipped content - your pretty much screwed then if you choose this method. I woul dprefer a way of doing this without compressing the output. Any ideas? --- Tim Funk <[EMAIL PROTECTED]> wrote: Use mod_gzip. (If using apache, or tomcat 5 also supports compressing on the HTTP connector) The whitespace becomes a non-issue and your *really* save bandwidth. -Tim Jack Kada wrote: Developers, I have completed a JSP project but when i view the source of the HTML pages there are loads of whitespace in between tables rows. I am using Tomcat 5 and in the mailing list read that there is a parameter called trimSpaces(). I tried this but it had no effect on the webpage. If i could remove whitespace without touching JSP code i would save a lot of bandwidth. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] ___ Do you Yahoo!? Win 1 of 4,000 free domain names from Yahoo! Enter now. http://promotions.yahoo.com/goldrush - 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] -- Kind Regards Schalk Neethling Web Developer.Designer.Programmer.President Volume4.Development.Multimedia.Branding emotionalize.conceptualize.visualize.realize Tel: +27125468436 Fax: +27125468436 email:[EMAIL PROTECTED] web: www.volume4.co.za This message contains information that is considered to be sensitive or confidential and may not be forwarded or disclosed to any other party without the permission of the sender. If you received this message in error, please notify me immediately so that I can correct and delete the original email. Thank you. === message truncated === __ Do You Yahoo!? Tired of spam? Yahoo! Mail has the best spam protection around http://mail.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]
Re: explorer can't open protected files but mozilla can
This has come up several times recently. It's all to do with how IE handles content. It seems, whenever a plug-in is used (excel, word, acrobat etc) IE has to download the content to its cache before the plug-in can be passed the content. So, when content is served from a protected area Tomcat adds http headers so that the content is not cached at proxy or browser level. This causes IE problems ;) We've solved this by selectively changing the http headers that go with content served to IE. This solution is detailed in the thread titled 'Tomcat 4.1.30 adding no-cache to http headers' on this list from last week. You'll have to write and deploy a Filter to modify the headers but it's not hard. HTH, Jon Janko Harej wrote: Hi! I have a web application with a protected folder and some files in it. My webapp structure is: testapp login.jsp \ WEB-INF \ protected a.gif archive.zip text.txt word.doc When I try to access any file in "protected" directory, browser opens login.jsp and asks for username and password - everything ok. The problem is with internet explorer - when I try to open a.gif or text.txt explorer opens them, !!! but if I try to open archive.zip or word.doc, it fails and says that file does not exists or archive is corupted. !!! If I use Mozilla everything works perfectly. I've tried to user tomcat 5.19 and 5.27 on windows xp and linux. It always works on mozilla 1.4 but not in internet explorer 6.0 and 5.5. So is anything wrong with my app, or is this internet explorer fault (so this is wrong user list?). Thanks for any advice Janko - 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: security-constraint in web.xml
Not sure you can do this with Tomcat alone (but would be happy to be shown the error of my ways). This is because every ssl connection uses the same SSLSocketFactory configuration irrespective of requested URI. The mod_ssl module for Apache has support for this type of config, though: http://www.modssl.org/docs/2.8/ssl_howto.html#ToC8 HTH (or prompts another answer), Jon [EMAIL PROTECTED] wrote: I need help to configure a secure application. I'm trying to request a client certificate in one page only (the rest should be accesible without presenting a certificate) and force to use SSL in the entire application. I put the following in the web.xml certificates /certificates/add.action GET POST * CONFIDENTIAL CLIENT-CERT If I add a new url pattern, this page will request client certificate too. How can I force to use SSL without requiring a client certificate but still require it in a specific page? Thanks in advance. regards, fabian - 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: Tomcat 4.1.30 adding no-cache to http headers
I'm sure I said use a Filter mapped to your download urls ;) The filter gets executed before tomcat's default servlet serves the content. The Filter itself would be pretty trivial, just place the code I posted in its doFilter(...) method and map it to *.doc in your members context. Maybe it's more work than you were hoping for but considerably less than rewriting Tomcat's default servlet or tinkering with the code of the SingleSignOn feature. Good luck, Jon Brad Hafichuk wrote: I agree that that would work, but I'm not using any servlets to download the files, and thus have no where to place the code. I've basically just set up a folder, threw the word documents into it, and put a WEB-INF/web.xml (with security) in it as well. I was using apache's .htaccess before, but needed to move things to tomcat to use the single-signon. Any other solutions out there? Cheers, Brad ----- Original Message - From: "Jon Wingfield" <[EMAIL PROTECTED]> To: "Tomcat Users List" <[EMAIL PROTECTED]> Sent: Thursday, August 12, 2004 6:09 AM Subject: Re: Tomcat 4.1.30 adding no-cache to http headers Yep. Tomcat (reasonably) adds these headers when the requested url is within a security constraint defined within the web.xml. In all places on our site where pdf, excel, word docs etc can be downloaded we have the following code: final String userAgent = request.getHeader("user-agent"); if (response.containsHeader("Pragma") && userAgent!=null && userAgent.toUpperCase().indexOf("MSIE")>-1) { response.setHeader("Pragma", "public"); } This seems to have solved the issue for us. You could put the above code in a Filter mapped to your download urls in the members context. HTH, Jon - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Tomcat 4.1.30 adding no-cache to http headers
Yep. Tomcat (reasonably) adds these headers when the requested url is within a security constraint defined within the web.xml. In all places on our site where pdf, excel, word docs etc can be downloaded we have the following code: final String userAgent = request.getHeader("user-agent"); if (response.containsHeader("Pragma") && userAgent!=null && userAgent.toUpperCase().indexOf("MSIE")>-1) { response.setHeader("Pragma", "public"); } This seems to have solved the issue for us. You could put the above code in a Filter mapped to your download urls in the members context. HTH, Jon Brad Hafichuk wrote: The problem I'm facing is that I have MSWord (*.doc) files in a webapp that required basic auth to access. The problem I've come across is that when downloading (viewing) the files in IE, word can't find the file (it's not cached http://support.microsoft.com/?kbid=317208). I've checked out the headers using wget and it looks like tomcat is adding the Pragma and Cache-Control headers (which causes the IE problem). Note that I'm running apache infront of tomcat. [EMAIL PROTECTED] PVIMS]# wget -S "http://username:[EMAIL PROTECTED]/members/acclaim/PVIMS/Section 10.doc" --15:49:58-- http://username:[EMAIL PROTECTED]/members/acclaim/PVIMS/Section%2010.doc => `Section 10.doc.5' Resolving www.nationalengineering.ca... 142.59.91.190 Connecting to www.nationalengineering.ca[142.59.91.190]:80... connected. HTTP request sent, awaiting response... 1 HTTP/1.1 200 OK 2 Date: Wed, 11 Aug 2004 21:44:17 GMT 3 Server: Apache/2.0.50 (Fedora) 4 Pragma: No-cache 5 Cache-Control: no-cache 6 Expires: Thu, 01 Jan 1970 00:00:00 GMT 7 Set-Cookie: JSESSIONIDSSO=74C58A3FE66679CF322FE867EE6469CC; Path=/ 8 Set-Cookie: JSESSIONID=48B55A59C96C5DA1BDBE5CA6D781FF88; Path=/members 9 ETag: W/"41984-1092171072000" 10 Last-Modified: Tue, 10 Aug 2004 20:51:12 GMT 11 Content-Type: application/msword 12 Content-Length: 41984 13 Connection: close 100%[=>] 41,984--.--K/s 15:49:58 (1.37 MB/s) - `Section 10.doc.5' saved [41984/41984] Is there anyway I can remove these headers for the /members context. I'm basically using tomcat in place of Apache's .htaccess files, since I need to use tomcat's single-signon for other *real* applications. Thanks, Brad Brad Hafichuk Azus Technologies Inc. www.azus.net (403) 710-8079 - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Tomcat error
The 49.0 is a magic number within the class bytecode. This type of error typically means the class was compiled using a newer version of the jdk than the runtime that is interpreting the bytecode. So, did you, say, compile the lawSearch class using jdk 1.5 but are running Tomcat against jdk 1.4? Resolution: recompile lawSearch against jdk 1.4 http://java.sun.com/docs/books/vmspec/2nd-edition/html/ClassFile.doc.html#75883 HTH, Jon Schalk Neethling wrote: Hey there all I get the following line when running my servlet on Tomcat version 5.0.25: java.lang.UnsupportedClassVersionError: org/volume4/searchEngine/lawSearch (Unsupported major.minor version 49.0) What exactly does this mean and how do I go about fixing this? Thanks! - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Rewriting URLs in Tomcat
sendRedirect(...) tells the browser to use a resource in a different location. That location can be same webapp, different webapp, different server. forward(...) is for the same server only. In context: servletContext.getRequestDispatcher(path).forward(...); Out of context: servletContext.getContext(foreignContextName).getRequestDispatcher(path).forward(...); For forwarding to a different context you have to have the relevant permissions or the servletContext.getContext(foreignContextName) call will return null. In tomcat the context doing the forwarding has to be marked as crossContext: http://jakarta.apache.org/tomcat/tomcat-4.1-doc/config/context.html Jon PS the chained invocations above are illustrative only, not as I would normally code it ;) Jacob Weber wrote: Tim Funk <[EMAIL PROTECTED]> wrote: At http://funkman.home.comcast.net/ I have a project called ServletUtils. You can use either RedirectFilter or ForwardFilter. They both can use regex's. "Robert Harper" <[EMAIL PROTECTED]> wrote: Have you tried the HttpServletResponse .sendRedirect( String url ) method? Correct me if I'm wrong, but I think both of these approaches would require the URL I'm requesting to be part of the same application as the one I'm redirecting to. So, for example, I couldn't redirect from: http://www.myserver.com/first_app/path to http://www.myserver.com/second_app/path Or am I missing something? This is what I'm trying to do. Thanks, Jacob - 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: Mysterious null pointer exception
Your instance variable conn will always be null. In your init method you are assigning the result of the ds.getConnection() to a local variable. Change it from >Connection conn = ds.getConnection(); to >conn = ds.getConnection(); and you may be ok. Of course, conn may also be null if your servlet can't find the jdbc/empdb datasource... HTH, Jon Vamsee Kanakala wrote: Hello list users, Maybe this is not the best place to ask a general servlet doubt, but I'm hoping someone can point out the mistake I'm making. I'm attaching a servlet file (FetchEmployeeServlet.java), which for some strange reason, gives a Null-Pointer Exception when accessing a function. This tells me that the class is not instantiated or something, but I'm new to servlets, so I can't figure out why. TIA, Vamsee. package com.vamsee.empdb; import javax.servlet.*; import javax.servlet.http.*; import java.io.*; import java.sql.*; import javax.sql.*; import java.util.*; import javax.naming.*; public class FetchEmployeeServlet extends HttpServlet { private Connection conn = null; private ServletContext context; private PreparedStatement pstmt = null; public void init(ServletConfig config) throws ServletException { super.init(config); context = config.getServletContext(); try { Context initContext = new InitialContext(); Context envContext = (Context)initContext.lookup("java:comp/env"); if (envContext == null) throw new Exception("Panic: No Context!"); DataSource ds = (DataSource)envContext.lookup("jdbc/empdb"); if (ds != null) { Connection conn = ds.getConnection(); } } catch (Exception e) { e.printStackTrace(); } } public void service(HttpServletRequest req, HttpServletResponse res) throws ServletException, IOException { String jsp; String cmd = req.getParameter("cmd"); String idString = req.getParameter("id"); int id; try { id = Integer.parseInt(idString); } catch (NumberFormatException e) { id = 0; } if ("get".equals(cmd)) { EmployeeBean bean = this.fetchEmployee(id); req.setAttribute("employee", bean); jsp = "/employee.jsp"; } else { List list = this.fetchAll(); req.setAttribute("list", list); jsp = "/list.jsp"; } RequestDispatcher dispatcher; dispatcher = context.getRequestDispatcher(jsp); dispatcher.forward(req, res); } public EmployeeBean makeBean(ResultSet results) throws SQLException { EmployeeBean bean = new EmployeeBean(results.getInt("id")); bean.setFirstName(results.getString("fname")); bean.setLastName(results.getString("lname")); bean.setEmail(results.getString("email")); bean.setDepartment(results.getString("department")); bean.setImage(results.getString("image")); return bean; } public EmployeeBean fetchEmployee(int id) { EmployeeBean bean = null; try { ResultSet results; String sql = "select * from people_table where id = ?"; PreparedStatement pstmt = conn.prepareStatement(sql); synchronized (pstmt) { pstmt.clearParameters(); pstmt.setInt(1, id); results = pstmt.executeQuery(); } if (results.next()) bean = makeBean(results); if (results != null) results.close(); } catch (SQLException se) { se.printStackTrace(); } return bean; } public List fetchAll() { List list = new ArrayList(); try { ResultSet results; Statement st = conn.createStatement(); System.out.println("Okay until create statement"); results = st.executeQuery("select * from people_table"); System.out.println("Okay until execute query"); while (results.next()) list.add(makeBean(results)); } catch (SQLException se) { se.printStackTrace(); } return list; } public void destroy() { try { if (conn != null) conn.close(); } catch (SQLException e) { } } } - 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: tomcat hangs, top displays 99%
Just a thought. Does your error page also have header.jsp included? Have you got yourself into an infinite loop of "Session already invalidated" IllegalStateExceptions? Jon Hans Wichman wrote: Hi, while stresstesting my application using tomcat 4.1.29, oracle, dbcp connection pooling and a stresstest tool, I see the amount of my connections in my pool fluctuate (as expected). At a certain while I still have plenty connections left in the pool, errors start occuring: org.apache.jasper.JasperException: setAttribute: Session already invalidated and after this has happened for a while (some processing proceeds normally), I get: org.apache.jasper.JasperException: at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:254) at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:295) at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:241) ... root cause ... javax.servlet.ServletException: at org.apache.jasper.runtime.PageContextImpl.handlePageException(PageContextImpl.java:536) at org.apache.jsp.header_jsp._jspService(header_jsp.java:293) at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:137) at this point tomcat hangs. If I shutdown the stresstest tool, tomcat still displays at 99% when running top (freebsd). Does anybody know why these errors occur, and why after stopping the stresstest, tomcat is still at 99%? I don't see any out of memory errors or something like that, and don't really know where to start exploring the problem. thanks in advance Hans W - 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: Tomcat logging and the referer
Extract from the HTTP spec: "The Referer field MUST NOT be sent if the Request-URI was obtained from a source that does not have its own URI, such as input from the user keyboard." http://www.w3.org/Protocols/rfc2616/rfc2616.txt So unless someone links to your index page you'll probably never get a referer. Jon RJ wrote: Hello all: After my wonderful experience getting standalone tomcat with SSL running non-root today, there's only one hitch: I'm using the combined log format, and it seems to be OK, except that on the first hit on my site (to the static index.html page) the referer field is always "-". Subsequent hits from pages within the site show the correct referer, but my main interest is that initial one. Anybody have any thoughts on how I can get that to show? rj - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Pass info between Tomcat Valve and Filter
Cool. I guess a Valve is good for that type of thing :) I think Carl and Ralph are right about the ClassClassException being a ClassLoader issue. I've seen similar things before when using custom Realms, JNDI resources etc. Our build process generates a minimal jar for deploying to common/lib which contains all the classes needed by the container classloaders. These classes are excluded from the webapp jars and all is happy. You have to be really careful about dependencies though or virtually all your webapp ends up in common/lib. Try jarring up your info object and putting in common/lib (or common/classes). Or you could use reflection as I've just read in your reply to Ralph ;) Good weekend all, Jon Rui Zhang wrote: Jon, To answer your query, I'm using a custom valve to instrument Tomcat with response time monitoring, as part of the project I'm working on... http://web.comlab.ox.ac.uk/oucl/research/areas/softeng/eWLM/ Cheers, Rui On Fri, 21 May 2004, Jon Wingfield wrote: An invocation of a Tomcat Valve gives you a Request object. This is a facade to a ServletRequest, which you can access via the getRequest() method. You could set your info object as an attribute on the ServletRequest. This should then be visible to your filter. http://jakarta.apache.org/tomcat/tomcat-4.1-doc/catalina/docs/api/index.html Just curious, why the custom Valve? Jon Rui Zhang wrote: > Hi all, > > I'm trying to pass some info (say, as an Object) between a valve and a > filter. Is anyone aware of a effective way to do this within the context > of Tomcat? > > Many thanks. > > Best, > > Rui > - 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]
Re: Pass info between Tomcat Valve and Filter
An invocation of a Tomcat Valve gives you a Request object. This is a facade to a ServletRequest, which you can access via the getRequest() method. You could set your info object as an attribute on the ServletRequest. This should then be visible to your filter. http://jakarta.apache.org/tomcat/tomcat-4.1-doc/catalina/docs/api/index.html Just curious, why the custom Valve? Jon Rui Zhang wrote: > Hi all, > > I'm trying to pass some info (say, as an Object) between a valve and a > filter. Is anyone aware of a effective way to do this within the context > of Tomcat? > > Many thanks. > > Best, > > Rui > - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: ClassCastException with own Principal interface and implementation
This is probably a classloader issue. The Realm will load classes from the server classloader. Your webapp will also load the same classes in its own classloader. The two types of CrmPrincipal are not assignable so a ClassCastException results. Try placing the CrmPrincipal class in common/lib and removing it from your webapp. HTH, Jon ralf lorenz wrote: hi there, i've written my own realm 'CrmJDBCRealm' which extends the 'JDBCRealm' one of catalina. this realm creates and returns a principal of type 'CrmPrincipalImpl' which extends 'GenericPrincipal' and implements 'CrmPrincipal'. 'CrmPrincipal' has getter for an 'id' and getter and setter for a 'currentRole' field and extends 'Principal' as well as 'GenericPrincipal' does. 'CrmJDBCRealm', 'CrmPrincipalImpl' and 'CrmPrincipal' are packed together into a .jar and placed under %CATALINA_HOME%/server/lib on the other side the application only has the 'CrmPrincipal' included, so it doesn't know about 'CrmPrincipalImpl'. (even if it does nothing changed!) in my application i have a 'ChangeRoleAction' that is supposed to update the 'currentRole' if the user decides to have, only application-wide, another role. again that's nothing to do with the roles of the user that are known by the server via the 'GenericPrincipal'. when i try the following i get an ClassCastException CrmPrincipal principal = (CrmPrincipal) request.getUserPrincipal(); printing out the name of the class the request gives the 'CrmPrincipalImpl' will be stated. so the realm works fine but the cast can't be done. any help? ralf - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Tomcat does not start !
Download the binary not the source zip: http://jakarta.apache.org/site/binindex.cgi If you execute "catalina run" instead of startup you'll see the error in the same shell. HTH, Jon [EMAIL PROTECTED] wrote: Hi, I have installed Tomcat on my windows machine and set the CATALINA_HOME and JAVA_HOME as per installation instruction when i try to start my tomcat ser ver i get following output in the dos prompt and a new window get initiate d and that get exited instantly. can anyone tell me what can be the problem i cant see anthing when i access http://locaslhost:8080 the output on the dos prompt is :-- *C:\Tomcat\catalina\src\bin>startup* *Using CATALINA_BASE: C:\Tomcat\catalina\src* *Using CATALINA_HOME: C:\Tomcat\catalina\src* *Using CATALINA_TMPDIR: C:\Tomcat\catalina\src\temp* *Using JAVA_HOME: C:\jsdk1.4.2* *C:\Tomcat\catalina\src\bin>* *what can be the problem * *thanks * */rgds /* Birendar Singh Waldiya *"Ralph Einfeldt" <[EMAIL PROTECTED]>* 19-04-04 05:44 PM Please respond to "Tomcat Users List" <[EMAIL PROTECTED]> To "Tomcat Users List" <[EMAIL PROTECTED]> cc Subject RE: Tomcat , APache , Jserv - Tomcat is a servlet and jsp engine. - Tomcat can be used as a stand alone webserver - Apache is a webserver (with different features than tomcat, if it is better depends on the requirements) - Apache can be integrated with tomcat by mod_jk[2] (So Apache replaces tomcats own http stack) - jserv is a predessor of tomcat (historical, only in parts technical) and had no own http stack. -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Sent: Monday, April 19, 2004 2:03 PM To: Tomcat Users List Subject: Tomcat , APache , Jserv 1. Is Tomcat a separate servlet engine and webserver ? 2. Is Apache a webserver only ? 3. Can we integrate Tomcat and Apache ?? What i understood was Tomcat is a separate webser & servlet engine , Apache is a better webserver , we can have use Tomcat servlet engine and Apache Web server , And waht is Jserve??? It will help me in making my basic strong - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] ForwardSourceID:NT4506 DISCLAIMER: The information contained in this message is intended only and solely for the addressed individual or entity indicated in this message and for the exclusive use of the said addressed individual or entity indicated in this message (or responsible for delivery of the message to such person) and may contain legally privileged and confidential information belonging to Tata Consultancy Services. It must not be printed, read, copied, disclosed, forwarded, distributed or used (in whatsoever manner) by any person other than the addressee. Unauthorized use, disclosure or copying is strictly prohibited and may constitute unlawful act and can possibly attract legal action, civil and/or criminal. The contents of this message need not necessarily reflect or endorse the views of Tata Consultancy Services on any subject matter. Any action taken or omitted to be taken based on this message is entirely at your risk and neither the originator of this message nor Tata Consultancy Services takes any responsibility or liability towards the same. Opinions, conclusions and any other information contained in this message that do not relate to the official business of Tata Consultancy Services shall be understood as neither given nor endorsed by Tata Consultancy Services or any affiliate of Tata Consultancy Services. If you have received this message in error, you should destroy this message and may please notify the sender by e-mail. 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: Connecting the HTTP Server and Tomcat
Assuming the connector is working, what effect does adding an additional mapping of /portal ajp13 to your existing /portal/* ajp13 mapping have? I just double-checked on our dev box where jk is definitely up. I got a 404 from apache for / but //stuff got routed through to tomcat. Jon Wilson, Allen wrote: No you are not way off...at least not from my point of view because that is what I thought would work. But unless I specify the port (http://myserver.com:8080/portal) it will not get there... It makes me think that the connector is not function correctly but I do not know how to tell..when I check the running ports I see the 8009 port running but it does not hand to Tomcat -Original Message- From: Jon Wingfield [mailto:[EMAIL PROTECTED] Sent: Wednesday, April 07, 2004 2:09 PM To: Tomcat Users List Subject: Re: Connecting the HTTP Server and Tomcat I may be way off but... I don't think http://myserver.com/portal maps to /portal/* ajp13 http://myserver.com/portal/ or http://myserver.com/portal/whatever.jsp probably will, though. Give it a go, may work, Jon Wilson, Allen wrote: Bill..thanks for the reply... I will read through the link you provide but isn't that what the connector is supposed to do. My understanding what that the Apache HTTP server would detect what the request was (Java or not) and pass it on to Tomcat. Is this not what the specification of /portal/* ajp13 in the configuration does. This is what I got from the document at: http://jakarta.apache.org/tomcat/tomcat-4.1-doc/jk2/jk.quickhowto.html Here is a little from one of the pages in that area... ( http://jakarta.apache.org/tomcat/tomcat-4.1-doc/jk2/jk/aphowto.html ) In a nutshell a web server is waiting for client HTTP requests. When these requests arrive the server does whatever is needed to serve the requests by providing the necessary content. Adding a servlet container may somewhat change this behavior. Now the web server needs also to perform the following: Load the servlet container adapter library and initialize it (prior to serving requests). When a request arrives, it needs to check and see if a certain request belongs to a servlet, if so it needs to let the adapter take the request and handle it. The adapter on the other hand needs to know what requests it is going to serve, usually based on some pattern in the request URL, and to where to direct these requests. Is this not correct...or am I misunderstanding it -Original Message- From: Bill Bruns [mailto:[EMAIL PROTECTED] Sent: Wednesday, April 07, 2004 12:26 PM To: Tomcat Users List Subject: RE: Connecting the HTTP Server and Tomcat Allen, do you have the web server configured to throw the requests over to Tomcat? In other words, have either Proxy support or else URL Rewriting turned on in the web server? Otherwise your HTTP requests default to port 80, so they will be eaten by the web server and never reach Tomcat, since Tomcat is listening on ports that the HTTP requests do not come to by default. Have you looked at http://jakarta.apache.org/tomcat/tomcat-4.1-doc/proxy-howto.html - Bill -Original Message- From: Wilson, Allen [mailto:[EMAIL PROTECTED] Sent: Wednesday, April 07, 2004 8:54 AM To: Tomcat Users List Subject: RE: Connecting the HTTP Server and Tomcat Okay...that looks similar to the tomcat 4 information I haveis your connector working correctly? -Original Message- From: Emerson Cargnin [mailto:[EMAIL PROTECTED] Sent: Tuesday, April 06, 2004 6:06 PM To: Tomcat Users List Subject: Re: Connecting the HTTP Server and Tomcat My configuration is for tomcat 5: ... ... Wilson, Allen wrote: Here are the lines. maxProcessors="75" enableLookups="true" redirectPort="8443" acceptCount="100" debug="0" connectionTimeout="2" /> Let me know if there is something that is incorrect. -Original Message- From: Emerson Cargnin [mailto:[EMAIL PROTECTED] Sent: Tuesday, April 06, 2004 4:28 PM To: Tomcat Users List Subject: Re: Connecting the HTTP Server and Tomcat You said you can connect through port 8009 through the browser??? The jk protocol is not http, so if the configuration was allright you can't connect through 8009 as http. Maybe the error is at your server.xml... Wilson, Allen wrote: Thanks but this is on a Windows system and will not help...I am on a Solaris and I have looked at documents like this before and they still do not give me a definitive way of setting everything and testing it... Right now I have the HTTP server (port 80), Tomcat (port 8080), and the connector (8009) running. I even looked at the netstat to see if each port was available...and they were. When a do the home page request (http://myserver.com) it works fine...but if I request the page for the
Re: Connecting the HTTP Server and Tomcat
I may be way off but... I don't think http://myserver.com/portal maps to /portal/* ajp13 http://myserver.com/portal/ or http://myserver.com/portal/whatever.jsp probably will, though. Give it a go, may work, Jon Wilson, Allen wrote: Bill..thanks for the reply... I will read through the link you provide but isn't that what the connector is supposed to do. My understanding what that the Apache HTTP server would detect what the request was (Java or not) and pass it on to Tomcat. Is this not what the specification of /portal/* ajp13 in the configuration does. This is what I got from the document at: http://jakarta.apache.org/tomcat/tomcat-4.1-doc/jk2/jk.quickhowto.html Here is a little from one of the pages in that area... ( http://jakarta.apache.org/tomcat/tomcat-4.1-doc/jk2/jk/aphowto.html ) In a nutshell a web server is waiting for client HTTP requests. When these requests arrive the server does whatever is needed to serve the requests by providing the necessary content. Adding a servlet container may somewhat change this behavior. Now the web server needs also to perform the following: Load the servlet container adapter library and initialize it (prior to serving requests). When a request arrives, it needs to check and see if a certain request belongs to a servlet, if so it needs to let the adapter take the request and handle it. The adapter on the other hand needs to know what requests it is going to serve, usually based on some pattern in the request URL, and to where to direct these requests. Is this not correct...or am I misunderstanding it -Original Message- From: Bill Bruns [mailto:[EMAIL PROTECTED] Sent: Wednesday, April 07, 2004 12:26 PM To: Tomcat Users List Subject: RE: Connecting the HTTP Server and Tomcat Allen, do you have the web server configured to throw the requests over to Tomcat? In other words, have either Proxy support or else URL Rewriting turned on in the web server? Otherwise your HTTP requests default to port 80, so they will be eaten by the web server and never reach Tomcat, since Tomcat is listening on ports that the HTTP requests do not come to by default. Have you looked at http://jakarta.apache.org/tomcat/tomcat-4.1-doc/proxy-howto.html - Bill -Original Message- From: Wilson, Allen [mailto:[EMAIL PROTECTED] Sent: Wednesday, April 07, 2004 8:54 AM To: Tomcat Users List Subject: RE: Connecting the HTTP Server and Tomcat Okay...that looks similar to the tomcat 4 information I haveis your connector working correctly? -Original Message- From: Emerson Cargnin [mailto:[EMAIL PROTECTED] Sent: Tuesday, April 06, 2004 6:06 PM To: Tomcat Users List Subject: Re: Connecting the HTTP Server and Tomcat My configuration is for tomcat 5: ... ... Wilson, Allen wrote: Here are the lines. maxProcessors="75" enableLookups="true" redirectPort="8443" acceptCount="100" debug="0" connectionTimeout="2" /> Let me know if there is something that is incorrect. -Original Message- From: Emerson Cargnin [mailto:[EMAIL PROTECTED] Sent: Tuesday, April 06, 2004 4:28 PM To: Tomcat Users List Subject: Re: Connecting the HTTP Server and Tomcat You said you can connect through port 8009 through the browser??? The jk protocol is not http, so if the configuration was allright you can't connect through 8009 as http. Maybe the error is at your server.xml... Wilson, Allen wrote: Thanks but this is on a Windows system and will not help...I am on a Solaris and I have looked at documents like this before and they still do not give me a definitive way of setting everything and testing it... Right now I have the HTTP server (port 80), Tomcat (port 8080), and the connector (8009) running. I even looked at the netstat to see if each port was available...and they were. When a do the home page request (http://myserver.com) it works fine...but if I request the page for the Jetspeed Portal (http://myserver.com/portal), I get an error. If I request the portal page through port 8080 it works fine. If I request the same page on 8009 it works fine. In all cases there were no entries in my mod_jk.log. I am looking for something that will outline the steps for me on a Solaris machine or at least give me a better way to diagnose what I am doing wrong -Original Message- From: kwilding [mailto:[EMAIL PROTECTED] Sent: Tuesday, April 06, 2004 10:55 AM To: 'Tomcat Users List' Subject: RE: Connecting the HTTP Server and Tomcat http://www.greenfieldresearch.ca/technical/jk2_config.html This was a really good starting point. Ignore the fact it talks abut windows, I imstaled on SuSE8.2 using apache2.0.48 and both tomcat 4 and 5 Kevan -Original Message- From: Wilson, Allen [mailto:[EMAIL PROTECTED] Sent: 06 April 2004 16:42 To: Tomcat Users List Subject: Connecting the HTTP Server and Tomcat Good morning C
Re: Where to set JAVA_OPTS
No need to change the script. I normally set an Environment variable in the same place I define JAVA_HOME Go to Control Panel \ System \ Advanced tab \ Environment variables... Well, that's where it is on XP, which i'm currently running. HTH, Jon Giorgio Ponza wrote: [EMAIL PROTECTED] ha scritto: Hi, Where do I need to set JAVA_OPTS (Should I edit catalina.bat file?). I am using Win 2k Pro and Tomcat 5. Thank you, Best Regards, Uma Hi usually i put my JAVA_OPTS in catalina.sh (in windows is catalina.bat) like this REM set JAVA_OPTS=-server -Xms128m -Xmx128m -verbose:gc -Xrunhprof:cpu=times,depth=6,thread=y,file=C:\log.txt set JAVA_OPTS=-server -Xms64m -Xmx64m echo Using CATALINA_BASE: %CATALINA_BASE% echo Using CATALINA_HOME: %CATALINA_HOME% echo Using CATALINA_TMPDIR: %CATALINA_TMPDIR% echo Using JAVA_HOME: %JAVA_HOME% echo using JAVA_OPTS: %JAVA_OPTS% it is used later in lines like %_EXECJAVA% %JAVA_OPTS% %CATALINA_OPTS% Hope i helped u bye Giorgio - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Tomcat Java OutOfMemory Error
JAVA_OPTS only works for standalone startup not as a service. Found this by googling. http://forum.java.sun.com/thread.jsp?thread=290568&forum=33&message=1211179 Solution is about six down and by user dfortae HTH, Jon shyam wrote: Hi, I not sure about tomcat 3.2.1. In tomcat 4 I have used the JAVA_OPTS . I set JAVA_OPTS as my environmental variable and that was it. Hope this helps you shyam -Original Message- From: Baldacchini Marco [mailto:[EMAIL PROTECTED] Sent: Tuesday, April 06, 2004 5:41 AM To: [EMAIL PROTECTED] Subject: Tomcat Java OutOfMemory Error Hi, I'm running Tomcat 3.2.1 on Windows 2000 Server as service with jk_nt_service.exe utility. I receive java.lang.OutOfMemory error in my JSP page. I need to increment memory for JVM to 512 MB by setting -Xms512m -Xmx512m. Where I do it? Thanks in advance. Marco - 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]
Re: Problem with UserTransaction reference within Servlet code.
And of course: http://jakarta.apache.org/tomcat/tomcat-4.1-doc/jndi-datasource-examples-howto.html#Tyrex%20Connection%20Pool Although I'm not sure how actively maintained Tyrex is these days. http://sourceforge.net/projects/tyrex/ Jon Jon Wingfield wrote: There is always a way ;) Saw this the other day: http://www.theserverside.com/discussions/thread.tss?thread_id=24879 Googled for this for JTA integration with tomcat: http://www.onjava.com/pub/a/onjava/2003/07/30/jotm_transactions.html JNDI config for tomcat: http://jakarta.apache.org/tomcat/tomcat-4.1-doc/jndi-resources-howto.html Have fun, Jon Hassan Sajjad wrote: Jon Wingfield, thanks for your reply. My application is a Web Application (.war) only, no ejb's etc. However, since I'm using Composite View Pattern (aka Templating), I want different parts to be combined into One View, all in one transaction. This is done in a Servlet. Now if Tomcat doesn't provide a reference to an implementation of javax.transaction.UserTransaction, through JNDI lookup, then I believe there must be some other of doing this. e.g. Using a third party package that provides the implementation of javax.transaction api and plugging it in the application. Do you know of any? Remember, after all this is on the Web Tier, Tomcat tier, there must be a way of doing it! Thanks Hassan - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Problem with UserTransaction reference within Servlet code.
There is always a way ;) Saw this the other day: http://www.theserverside.com/discussions/thread.tss?thread_id=24879 Googled for this for JTA integration with tomcat: http://www.onjava.com/pub/a/onjava/2003/07/30/jotm_transactions.html JNDI config for tomcat: http://jakarta.apache.org/tomcat/tomcat-4.1-doc/jndi-resources-howto.html Have fun, Jon Hassan Sajjad wrote: Jon Wingfield, thanks for your reply. My application is a Web Application (.war) only, no ejb's etc. However, since I'm using Composite View Pattern (aka Templating), I want different parts to be combined into One View, all in one transaction. This is done in a Servlet. Now if Tomcat doesn't provide a reference to an implementation of javax.transaction.UserTransaction, through JNDI lookup, then I believe there must be some other of doing this. e.g. Using a third party package that provides the implementation of javax.transaction api and plugging it in the application. Do you know of any? Remember, after all this is on the Web Tier, Tomcat tier, there must be a way of doing it! Thanks Hassan - Original Message ----- From: "Jon Wingfield" <[EMAIL PROTECTED]> To: "Tomcat Users List" <[EMAIL PROTECTED]> Sent: Tuesday, April 06, 2004 11:25 AM Subject: Re: Problem with UserTransaction reference within Servlet code. The answer's in the question ;) Tomcat is not a J2EE Server but an implementation of the Servlet Specification (which is but a part of the whole J2EE spec). Tomcat's JNDI lookups are in-process only. Need an open source J2EE container? Have a look at JBoss... Hassan Sajjad wrote: Hi Can anyone help! Problem with UserTransaction reference within Servlet code. When you reference UserTransaction object in your Servlet Code, as from J2EE Specification: The J2EE Product Provider is responsible for providing an appropriate object as required There's a code snippet. Context initCtx = new InitialContext(); UserTransaction tx = (UserTransaction)initCtx.lookup("java:comp/UserTransaction"); This works fine on J2EE Impementation Servers but fails on Tomcat 4.1.3. Exception: javax.naming.NameNotFoundException: Name javax.transaction.UserTransaction is not bound in this Context at org.apache.naming.NamingContext.lookup(NamingContext.java:811) at org.apache.naming.NamingContext.lookup(NamingContext.java:194) at org.apache.naming.SelectorContext.lookup(SelectorContext.java:183) at javax.naming.InitialContext.lookup(InitialContext.java:347) Thanks Hassan PREMIER HOUSEWARES Premier Business Park, 55 Jordanvale Avenue Whiteinch Glasgow G14 0QP UK - 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]
Re: Problem with UserTransaction reference within Servlet code.
The answer's in the question ;) Tomcat is not a J2EE Server but an implementation of the Servlet Specification (which is but a part of the whole J2EE spec). Tomcat's JNDI lookups are in-process only. Need an open source J2EE container? Have a look at JBoss... Hassan Sajjad wrote: Hi Can anyone help! Problem with UserTransaction reference within Servlet code. When you reference UserTransaction object in your Servlet Code, as from J2EE Specification: The J2EE Product Provider is responsible for providing an appropriate object as required There's a code snippet. Context initCtx = new InitialContext(); UserTransaction tx = (UserTransaction)initCtx.lookup("java:comp/UserTransaction"); This works fine on J2EE Impementation Servers but fails on Tomcat 4.1.3. Exception: javax.naming.NameNotFoundException: Name javax.transaction.UserTransaction is not bound in this Context at org.apache.naming.NamingContext.lookup(NamingContext.java:811) at org.apache.naming.NamingContext.lookup(NamingContext.java:194) at org.apache.naming.SelectorContext.lookup(SelectorContext.java:183) at javax.naming.InitialContext.lookup(InitialContext.java:347) Thanks Hassan PREMIER HOUSEWARES Premier Business Park, 55 Jordanvale Avenue Whiteinch Glasgow G14 0QP UK - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Unix utils for Windows?
http://www.cygwin.com/ I'm using grep, tail and scp on windows xp all the time :) I also like gVim on windows. http://www.vim.org/ Shaw, Laurence wrote: Does anyone know where I can find a workable version awk for Windows,( and for that matter most common [U}[Lin]ix utilities) that will run on a windows 2000 box? I was attempting to run the makefile for Apache Server using MS C++ but at the end of the build it tries to execute an awk script to build the config file for the server and errors because awk can not be found in my environment. I'd prefer not to have to run in a unix shell on a windows box, but... Thanks, Laurence - 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: Getting Context Parameters from server.xml
Oops. Sent too soon. That code would only work if your parameters were set up in you web.xml not server.xml ie companyName MyCompany The original code was looking up the servlet's init parameter, which should be defined: param-servlet com.MyCompany.ParamServlet companyName MyCompany These are portable ways (servlet spec compliant) to pass parameters to webapps. The tags within server.xml are related to Resources (Data Sources etc) and probably not what you want. Jon Jon Wingfield wrote: If you had String name = config.getInitParameter("companyName"); it might work ;) HTH, Jon Michael Jones wrote: Hello- I'm trying to store some values in my server.xml and then get them with my Servlet. I followed the instructions at: http://jakarta.apache.org/tomcat/tomcat-4.0-doc/config/context.html under the "Context Parameters" section. In my servlet I got all init params and iterated over the enumeration. The parameter I defined in server.xml did not show up. Has anyone gotten this feature to work? Am I missing something? Here are a few code snippets: server.xml in the tag for my webapp from my servlet ServletConfig config = getServletConfig(); String name = getInitParameter("companyName"); System.err.println("CompanyName = '" + name + "'"); Enumeration enum = config.getInitParameterNames(); while(enum.hasMoreElements()) { System.err.println(enum.nextElement()); } Thanks- Michael - 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]
Re: Getting Context Parameters from server.xml
If you had String name = config.getInitParameter("companyName"); it might work ;) HTH, Jon Michael Jones wrote: Hello- I'm trying to store some values in my server.xml and then get them with my Servlet. I followed the instructions at: http://jakarta.apache.org/tomcat/tomcat-4.0-doc/config/context.html under the "Context Parameters" section. In my servlet I got all init params and iterated over the enumeration. The parameter I defined in server.xml did not show up. Has anyone gotten this feature to work? Am I missing something? Here are a few code snippets: server.xml in the tag for my webapp from my servlet ServletConfig config = getServletConfig(); String name = getInitParameter("companyName"); System.err.println("CompanyName = '" + name + "'"); Enumeration enum = config.getInitParameterNames(); while(enum.hasMoreElements()) { System.err.println(enum.nextElement()); } Thanks- Michael - 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.1 for windows,pl
I just looked at the code you posted. I think it's a NullPointerException within line 33 of your LoginServlet int kode = Integer.parseInt(request.getParameter("kode")); This will throw an NPE if the "kode" parameter is not set... Is your MIDLet TextField empty when you get this error? If not, check that your MIDLet code is properly generating an HTTP POST request (you're not setting the content-length header, there needs to be a blank line between http headers and the body etc). Turn on the RequestDumperValve in your tomcat's server.xml to check what tomcat receives... HTH, Jon yuni indrasary wrote: --- Parsons Technical Services <[EMAIL PROTECTED]> wrote: Try this And give it another try. Thank you very much for the help Doug, but it still give an error message that was start with: Apache Tomcat/4.1.29-Error report HTTP Status 500-Exception report message description The Server encountered an internal error that prevented it from fulfilling this request exception javax.servlet.ServletException: null at LoginServlet.doPost(LoginServlet.java:59) and continued with what I enclosed in my previous message Put some checks in your code for the return of a null connection. do you mean the connection between the J2ME emulator and tomcat or between tomcat and the database management system? When I checked the web descryptor of the example application in tomcat, I found it also contained filter directive while mine doesn't,could it possibly be a problem? The more I read this lists, the more I convinced, that this lists is filled with person with a strong will to help others to grow their knowledge. Thank you for advance everybody :) __ Do you Yahoo!? Yahoo! Finance Tax Center - File online. File on time. http://taxes.yahoo.com/filing.html - 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: webapps\ROOT\WEB-INF\classes
I'm fairly certain classes deployed to \WEB-INF\classes have to be in packages. So your Fruit class should be deployed to \WEB-INF\classes\com\stevensons if the Fruit class is in the com.stevensons package. In your jsp you also MUST import the class you want to use. eg: <%@ page import="com.stevensons.Fruit" %> see the following (non-exhaustive) list for more details: http://jakarta.apache.org/tomcat/tomcat-5.0-doc/appdev/index.html http://www.jcp.org/aboutJava/communityprocess/final/jsr154/ HTH, Jon Colin McKinstry wrote: I've tried setting the class_path to \webapps\ROOT\WEB_INF\classes in the Windows environment variables, but that hasn't improved matters :-( Anyone got any ideas? -Original Message- From: Wendy Smoak [mailto:[EMAIL PROTECTED] Sent: Wednesday, 10 March 2004 8:57 a.m. To: Tomcat Users List Subject: RE: webapps\ROOT\WEB-INF\classes From: Colin McKinstry [mailto:[EMAIL PROTECTED] The only thing I've done configuration wise is define CATALINA_HOME & base. I also had to create the classes directory in WEB-INF since it wasn't there. Did you restart after creating the 'classes' directory and putting your class in it? AFAIK, Tomcat builds its classpath at startup, so if the directory wasn't there then, it might not be seeing the contents now. -- Wendy Smoak Application Systems Analyst, Sr. ASU IA Information Resources Management - 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]
Re: The purpose of WEB-INF\classes ?
WEB-INF/classes takes precedence over WEB-INF/lib in the servlet spec: 2.3fcs, section "SRV.9.5 Directory Structure". If WebLogic 6.1 behaves differently then it's another spec violation ;) Jon Justin Ruthenbeck wrote: To you (the end-user), there's no purpose for it other than convenience. One thing to keep in mind is that classes in the /classes directory take precedence over those in jars found in the /lib directory (in Tomcat -- is this a spec thing? I'm assuming not as WL61 at lease doesn't do this), which is an important distinction that makes the difference more useful. As for why it's useful, if you're developing an app and are constantly compiling and testing, why should you have to jar them up each time you compile the classes? Just stick them in the /classes dir. On the other hand, releasing and versioning code is much easier as a jar. Give people flexibility and they'll come up with new and wonderous things... justin At 05:45 PM 3/1/2004, you wrote: This is not a question to fix a problem other then one in my head. I am not sure what the difference is putting a jar in a \WEB-INF\lib and setting up a \WEB-INF\classes. Since a jar usually just includes class files if we put a jar in the webapp's \WEB-INF\lib what would be the purpose of setting the tree of classes expanded in WEB-INF\classes? Let me give an example. In Tomcat 4.1.30 there is a server folder. Under this exists webapps. And then under this are two folders admin and manager. Looking at the admin webapp you will find its WEB-INF and under that it has a lib and a classes folder. The lib folder contains just one jar, ie: struts.jar. But the classes folder contains the tree of what looks to me is the structure of a jar ie; org | apache | webapp | admin| ... I am not sure if this is just an expanded struts.jar but it looks to be. If not struts.jar then likely some other jar. So my question is what is the purpose of having an extracted jar structure under a classes folder? I have made my own webapp but I do not have a classes folder under that because I have yet to come across the purpose of when it is necessary? Thanks. -- George Hester __ - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] __ Justin Ruthenbeck Software Engineer, NextEngine Inc. justinr - AT - nextengine DOT com Confidential. See: http://www.nextengine.com/confidentiality.php __ - 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: using jar files in place of class files
Also make sure that the user running tomcat has write permissions to $CATALINA_TMPDIR. That's where the JVM does its temporary io work. HTH, Jon Evgeny Gesin wrote: I set ownership tomcatUser:tomcatUser and permission 770 to the entire path $CATALINA_HOME/webapps/app/WEB-INF/lib, including jar files under 'lib', and then got that exception again. More advice? Evgeny Gesin Javadesk --- "Filip Hanik (lists)" <[EMAIL PROTECTED]> wrote: - Root Cause - java.io.IOException: Permission denied at java.io.UnixFileSystem.createFileExclusively(Native you have a permission issue on your filesystem, make sure the entire tomcat tree is owned by the user running tomcat Filip -Original Message- From: Evgeny Gesin [mailto:[EMAIL PROTECTED] Sent: Sunday, February 22, 2004 8:46 AM To: Tomcat Users List Subject: Re: using jar files in place of class files When I add any JAR in the WEB-INF/lib I got the following exception. Any advice? Evgeny Gesin Javadesk 2004-02-22 18:38:09 WebappLoader[/myapp]: Deploying class repositories to work directory /usr/java/tomcat/work/Catalina/127.0.0.1:80/myapp 2004-02-22 18:38:09 WebappLoader[/myapp]: Deploy JAR /WEB-INF/lib/myapp.jar to /usr/java/tomcat/webapps/myapp/WEB-INF/lib/myapp.jar 2004-02-22 18:38:10 ContextConfig[/myapp] Exception processing JAR at resource path /WEB-INF/lib/myapp.jar javax.servlet.ServletException: Exception processing JAR at resource path /WEB-INF/lib/myapp.jar at org.apache.catalina.startup.ContextConfig.tldScanJar(ContextConfig.java:930) at org.apache.catalina.startup.ContextConfig.tldScan(ContextConfig.java:868) at org.apache.catalina.startup.ContextConfig.start(ContextConfig.java:647) at org.apache.catalina.startup.ContextConfig.lifecycleEvent(ContextConfig.java: 243) at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSuppor t.java:166) at org.apache.catalina.core.StandardContext.start(StandardContext.java:3582) at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1188) at org.apache.catalina.core.StandardHost.start(StandardHost.java:754) at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1188) at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:363) at org.apache.catalina.core.StandardService.start(StandardService.java:497) at org.apache.catalina.core.StandardServer.start(StandardServer.java:2190) at org.apache.catalina.startup.Catalina.start(Catalina.java:512) at org.apache.catalina.startup.Catalina.execute(Catalina.java:400) at org.apache.catalina.startup.Catalina.process(Catalina.java:180) 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:203) - Root Cause - java.io.IOException: Permission denied at java.io.UnixFileSystem.createFileExclusively(Native Method) at java.io.File.checkAndCreate(File.java:1314) at java.io.File.createTempFile(File.java:1402) at java.io.File.createTempFile(File.java:1439) at sun.net.www.protocol.jar.URLJarFile$1.run(URLJarFile.java:169) at java.security.AccessController.doPrivileged(Native Method) at sun.net.www.protocol.jar.URLJarFile.retrieve(URLJarFile.java:164) at sun.net.www.protocol.jar.URLJarFile.getJarFile(URLJarFile.java:42) at sun.net.www.protocol.jar.JarFileFactory.get(JarFileFactory.java:68) at sun.net.www.protocol.jar.JarURLConnection.connect(JarURLConnection.java:85) at sun.net.www.protocol.jar.JarURLConnection.getJarFile(JarURLConnection.java:6 9) at org.apache.catalina.startup.ContextConfig.tldScanJar(ContextConfig.java:906) at org.apache.catalina.startup.ContextConfig.tldScan(ContextConfig.java:868) at org.apache.catalina.startup.ContextConfig.start(ContextConfig.java:647) at org.apache.catalina.startup.ContextConfig.lifecycleEvent(ContextConfig.java: 243) at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSuppor t.java:166) at org.apache.catalina.core.StandardContext.start(StandardContext.java:3582) at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1188) at org.apache.catalina.core.StandardHost.start(StandardHost.java:754) at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1188) at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:363) at org.apache.catalina.core.StandardService.start(StandardService.java:497) at org.apache.catalina.core.StandardServer.start(StandardServer.java:2190) at org.apache.catalina.startup.Catalina.start(Catalina.java:512) at org.apache.catalina.startup.Catalina.execute(Catalina.java:400) a
Re: collated phone profiles site
oops. wrong list. Jon Wingfield wrote: http://w3development.de/rdf/uaprof_repository/ This list is not exhaustive bay any means. I will talk you through what the data means and what other information we need to gather. Jon - 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]
collated phone profiles site
http://w3development.de/rdf/uaprof_repository/ This list is not exhaustive bay any means. I will talk you through what the data means and what other information we need to gather. Jon - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: IOException while loading persisted sessions continued..
Did you read as far as the NotSerializableException bit? ;) If you don't want to make MyLinks serializable but want Tomcat to serialize sessions you could (amongst other things) implement a HttpSessionActivationListener. Add this object to the session at the same time as your MyLinks object. When tomcat serializes the session to disk the sessionWillPassivate() method will be called. In that method you could remove the MyLinks object from the session. When the session is restored you could re-init MyLinks in the sessionDidActivate() implementation. HTH, Jon Allistair Crossley wrote: It says "Classes that do not implement this interface will not have any of their state serialized or deserialized" So, to me that means I do not have to put Serializable if I do not want my MyLinks class to be persisted. But Tomcat is throwing an error which means it thinks MyLinks "should" be Serialized for some reason. I do not want MyLinks to be Serializable. Why does Tomcat throw an error for this object and for no others? Thanks ADC -Original Message- From: Yiannis Mavroukakis [mailto:[EMAIL PROTECTED] Sent: 30 January 2004 09:50 To: 'Tomcat Users List' Subject: RE: IOException while loading persisted sessions continued.. No this is Java specific, not Tomcat. See http://java.sun.com/j2se/1.4.2/docs/api/java/io/Serializable.html Yiannis -Original Message- From: Allistair Crossley [mailto:[EMAIL PROTECTED] Sent: 30 January 2004 09:43 To: TOMCAT USER (E-mail) Subject: IOException while loading persisted sessions continued.. Yes, but I don't want to may this object Serializable - is this Tomcat specific? I have plenty of other objects in session but they don't have these errors thrown?? Cheers, ADC -- snip -- When tomcat persists sessions, it will try to serialize all objects stored in your sessions to disk. In order to be successful, all the objects must be serializable. In this example, the class com.comp.newmedia.intranet.iq.dto.myiq.mylinks.Link is not serializable - it does not implement the Serializable interface. Vitor -- snip -- Allistair Crossley wrote: Hi, I quite often but not always get a huge stack trace thrown when Tomcat boots up the top part of which is the following. I'm not sure why it thinks it needs to be loading anything to do with my bean here from persisted sessions. Is that a setting that I have switched on that I need to switch off? Like I say, only happens on every 3rd or 4th reboot (development instance) and it does not stop TC5.0.18 working either. SEVERE: IOException while loading persisted sessions: java.io.WriteAbortedExcept ion: writing aborted; java.io.NotSerializableException: com.comp.newmedia.intranet.iq.dto.myiq.mylinks.Link java.io.WriteAbortedException: writing aborted; java.io.NotSerializableException : com.comp.newmedia.intranet.iq.dto.myiq.mylinks.Link at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1278) at java.io.ObjectInputStream.readObject(ObjectInputStream.java:324) at java.util.LinkedList.readObject(LinkedList.java:702) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl. java:39) - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]