Re: Embedding with Tomcat 9

2020-02-18 Thread Thad Humphries
On Tue, Feb 18, 2020 at 6:29 PM Mark Thomas  wrote:

> On 18/02/2020 23:13, Thad Humphries wrote:
> > On Tue, Feb 18, 2020 at 5:41 PM Mark Thomas  wrote:
> >> On 18/02/2020 22:32, calder wrote:
> >>> On Tue, Feb 18, 2020, 14:12 Thad Humphries 
>
> 
>
> >>>> However although this runs it returns a 404 on /employee. Why?
> >>
> >> There aren't (doesn't appear to be)  any Servlets mapped.
> >>
> >> Are there any web applications in the appBase?
> >>
> >
> > There is a servlet
> > in src/main/java/com/example/employees, EmployeeServlet.java, with the
> > annotation
> >
> >   @WebServlet(
> > name = "EmployeeServlet",
> > urlPatterns = {"/employee"}
> >   )
>
> OK. That will be relying on the StandardJarScanner finding that class -
> which it should.
>
> > In src/main/webapp is the file index.jsp which redirects to /employee:
>
> OK. Maven is copying that to META-INF/resources and hoping that Tomcat
> will treat the entire JAR as a resource JAR. That should work.
>
> > <%@ page info="sample index page" %>
> > 
> > 
> > Hello World!
> > 
> > 
> > 
> >
> > With Tomcat 7.0.57, I can run `java -jar
> > employees-app-1.0-SNAPSHOT-jar-with-dependencies.jar` in target, and load
> > the page at http://localhost:/.  With Tomcat 9.0.31, I get a 404
>
> Not sure which part is failing at this point. Using a purely static JSP
> without the forward and accessing /employee directly should tell you which.


If I comment out the jsp:forward, http://localhost:/ loads. However
http://localhost:/employee
still returns a 404.

I'd then recommend debugging your way though the Tomcat start process to
>
see where whichever element is failing is going wrong.
>

I'll see if I can figure out how to do that. Eclipse and I are not on the
best of terms. Frankly, loading JSPs is not something I need to do for how
I envision using embedded Tomcat. But I figure I need to know what's
happening because if I don't, I'm sure to run into problems down the road
when I'm dealing with something more complex.

-- 
"Hell hath no limits, nor is circumscrib'd In one self-place; but where we
are is hell, And where hell is, there must we ever be" --Christopher
Marlowe, *Doctor Faustus* (v. 111-13)


Re: Embedding with Tomcat 9

2020-02-18 Thread Thad Humphries
On Tue, Feb 18, 2020 at 5:41 PM Mark Thomas  wrote:

> On 18/02/2020 22:32, calder wrote:
> > On Tue, Feb 18, 2020, 14:12 Thad Humphries 
> wrote:
> >
> >> I am trying to understand how to build and run an app from local with
> >> Tomcat 9 embedded using Java 8. I've started with this example written
> for
> >> Tomcat 7:
> >>
> >>
> https://www.oracle.com/webfolder/technetwork/tutorials/obe/java/basic_app_embedded_tomcat/basic_app-tomcat-embedded.html#overview
> >>
> >> I am able to get it to run with Tomcat 9 after a few changes to the
> pom.xml
> >> and one addition to the main() method:
> >>
> >> public static void main(String[] args) throws Exception {
> >>
> >
> >
> >   String contextPath = "" ;
> >>
> >
> > May not be the issue, cause there's other code to consider, but should
> the
> > above line be
> >
> > String contextPath = "/" ;
>
> No. "" is the correct path for the ROOT context.
>
>
> >>   String appBase = ".";
> >>   Tomcat tomcat = new Tomcat();
> >>   tomcat.setPort(Integer.valueOf(PORT.orElse("") ));
> >>   // next line added for Tomcat 9
> >>   tomcat.setConnector(tomcat.getConnector());
> >>
> >>   tomcat.setHostname(HOSTNAME.orElse("localhost"));
> >>   tomcat.getHost().setAppBase(appBase);
> >>   tomcat.addWebapp(contextPath, appBase);
> >>   tomcat.start();
> >>   tomcat.getServer().await();
> >> }
> >>
> >> However although this runs it returns a 404 on /employee. Why?
>
> There aren't (doesn't appear to be)  any Servlets mapped.
>
> Are there any web applications in the appBase?
>

There is a servlet
in src/main/java/com/example/employees, EmployeeServlet.java, with the
annotation

  @WebServlet(
name = "EmployeeServlet",
urlPatterns = {"/employee"}
  )

In src/main/webapp is the file index.jsp which redirects to /employee:

<%@ page info="sample index page" %>


Hello World!




With Tomcat 7.0.57, I can run `java -jar
employees-app-1.0-SNAPSHOT-jar-with-dependencies.jar` in target, and load
the page at http://localhost:/.  With Tomcat 9.0.31, I get a 404

-- 
"Hell hath no limits, nor is circumscrib'd In one self-place; but where we
are is hell, And where hell is, there must we ever be" --Christopher
Marlowe, *Doctor Faustus* (v. 111-13)


Embedding with Tomcat 9

2020-02-18 Thread Thad Humphries
I am trying to understand how to build and run an app from local with
Tomcat 9 embedded using Java 8. I've started with this example written for
Tomcat 7:
https://www.oracle.com/webfolder/technetwork/tutorials/obe/java/basic_app_embedded_tomcat/basic_app-tomcat-embedded.html#overview

I am able to get it to run with Tomcat 9 after a few changes to the pom.xml
and one addition to the main() method:

public static void main(String[] args) throws Exception {
  String contextPath = "" ;
  String appBase = ".";
  Tomcat tomcat = new Tomcat();
  tomcat.setPort(Integer.valueOf(PORT.orElse("") ));
  // next line added for Tomcat 9
  tomcat.setConnector(tomcat.getConnector());

  tomcat.setHostname(HOSTNAME.orElse("localhost"));
  tomcat.getHost().setAppBase(appBase);
  tomcat.addWebapp(contextPath, appBase);
  tomcat.start();
  tomcat.getServer().await();
}

However although this runs it returns a 404 on /employee. Why?

I've tried variations on other Tomcat 9 examples (such as
https://nkonev.name/post/101). There main() methods are considerably more
involved, and I don't follow all that's going on. I've had no success. Some
don't run, or, in the nkonev example earlier, JSPs aren't processed
(probably because of "tomcat.setAddDefaultWebXmlToWebapp(false);" but if I
commnent that out, the Jar won't run).

What's the minimum to get the above main() to serve /employee?

-- 
"Hell hath no limits, nor is circumscrib'd In one self-place; but where we
are is hell, And where hell is, there must we ever be" --Christopher
Marlowe, *Doctor Faustus* (v. 111-13)


Re: Setting samesite attribute on JSESSIONID

2019-10-11 Thread Thad Humphries
On Thu, Oct 10, 2019 at 2:08 PM David Cleary  wrote:

> Have a customer asking about this. I see Tomcat supports it here.
> https://tomcat.apache.org/tomcat-9.0-doc/config/cookie-processor.html
>
> We currently use defaults, so I'm looking for an XML fragment and the file
> it goes in to add the samesite attribute to the JSESSIONID. I'm assuming
> they want it globally for all webapps.
>

After Christopher Schultz pointed me in the right direction, I added the
following line to $CATALINA_BASE/conf/context.xml



This allowed my JAMstack app to set a JSESSIONID from a REST app running
under Tomcat on a different server.

-- 
"Hell hath no limits, nor is circumscrib'd In one self-place; but where we
are is hell, And where hell is, there must we ever be" --Christopher
Marlowe, *Doctor Faustus* (v. 111-13)


Re: Chome Canary and SameSite cookie setting

2019-08-18 Thread Thad Humphries
On Sat, Aug 17, 2019 at 9:23 PM Christopher Schultz <
ch...@christopherschultz.net> wrote:

> -BEGIN PGP SIGNED MESSAGE-
> Hash: SHA256
>
> Thad,
>
> On 8/17/19 17:06, Thad Humphries wrote:
> > I have installed Tomcat 8.5.43 as a server under Eclipse 2019-06
> > (4.12.0). I've encountered a problem with Chrome Canary Version
> > 78.0.3886.0 which installed today, August 17th, 2019.
> >
> > When beginning the session with my server, Chrome will not honor
> > the JSESSIONID cookie. In the Chrome console is the warning:
> >
> >
> > "[Deprecation] A cookie associated with a cross-site resource at
> > http://localhost/ was set without the `SameSite` attribute. A
> > future release of Chrome will only deliver cookies with cross-site
> > requests if they are set with `SameSite=None`. You can review
> > cookies in developer tools under Application>Storage>Cookies and
> > see more details at
> > https://www.chromestatus.com/feature/5088147346030592.;
> >
> >
> > Chrome 76 (the stable release) works fine, and Canary works if I
> > disable the "SameSite by default cookies"
> > (chrome://flags/#same-site-by-default-cookies). However the link in
> > the deprecation warning notes that this feature will be enabled by
> > default in Chrome 80.
> >
> > I've read the CookieProcessor docs (
> > https://tomcat.apache.org/tomcat-8.5-doc/config/cookie-processor.html)
> >
> >
> which leads me to believe that sameSiteCookies is set to none by default
> .
> > However I don't see that in Chrome's DevTools, nor in the
> > JSESSIONID I receive when testing my server app with Insomnia
> > v6.6.2. I have tried setting the CookieProcessor explicitly by
> > adding
> >
> > 
> >
> >
> > to conf/context.xml but to no effect.
>
> The default is "none". When it's set to "none" (or not set it all,
> because it's the default, then you get "none".
>
> > BTW, I'm using https://github.com/eBay/cors-filter for my CORS
> > filters. I don't think my apps will be run in something other than
> > Tomcat's, but can't say that for certain (certainly my boss and
> > customer support manager want me to stay as generic as possible).
> >
> > Am I missing something? How can I fix this issue?
>
> When the value is "none", then no SameSite attribute is sent. At all.
> It doesn't send "SameSite=none" to the browser. It sends nothing.
> Chrome is complaining about the SameSite attribute not being sent. If
> you want Chrome to stop complaining, then set the sameSite attribute
> to something *other than* "none".
>
> - -chris
>

Ah! Thank you. Setting sameSiteCookies="lax" works with the default or with
explicitly enabling it.

I thought I'd tried this before, but maybe that was before I installed
Tomcat 8.5.43. Or maybe I was editing the wrong context.xml among the
different Tomcat's on my server. Whatever, it's working now. Thanks again.

-- 
"Hell hath no limits, nor is circumscrib'd In one self-place; but where we
are is hell, And where hell is, there must we ever be" --Christopher
Marlowe, *Doctor Faustus* (v. 111-13)


Chome Canary and SameSite cookie setting

2019-08-17 Thread Thad Humphries
I have installed Tomcat 8.5.43 as a server under Eclipse 2019-06 (4.12.0).
I've encountered a problem with Chrome Canary Version 78.0.3886.0 which
installed today, August 17th, 2019.

When beginning the session with my server, Chrome will not honor the
JSESSIONID cookie. In the Chrome console is the warning:


"[Deprecation] A cookie associated with a cross-site resource at
http://localhost/ was set without the `SameSite` attribute. A future
release of Chrome will only deliver cookies with cross-site requests if
they are set with `SameSite=None`. You can review cookies in developer
tools under Application>Storage>Cookies and see more details at
https://www.chromestatus.com/feature/5088147346030592.;


Chrome 76 (the stable release) works fine, and Canary works if I disable
the "SameSite by default cookies"
(chrome://flags/#same-site-by-default-cookies).
However the link in the deprecation warning notes that this feature will be
enabled by default in Chrome 80.

I've read the CookieProcessor docs (
https://tomcat.apache.org/tomcat-8.5-doc/config/cookie-processor.html)
which leads me to believe that sameSiteCookies is set to none by default.
However I don't see that in Chrome's DevTools, nor in the JSESSIONID I
receive when testing my server app with Insomnia v6.6.2. I have tried
setting the CookieProcessor explicitly by adding




to conf/context.xml but to no effect.

BTW, I'm using https://github.com/eBay/cors-filter for my CORS filters. I
don't think my apps will be run in something other than Tomcat's, but can't
say that for certain (certainly my boss and customer support manager want
me to stay as generic as possible).

Am I missing something? How can I fix this issue?

-- 
"Hell hath no limits, nor is circumscrib'd In one self-place; but where we
are is hell, And where hell is, there must we ever be" --Christopher
Marlowe, *Doctor Faustus* (v. 111-13)


Re: Tomcat on macOS

2017-05-18 Thread Thad Humphries
On Wed, May 17, 2017 at 9:25 PM, Israel Timoteo  wrote:

> Hi all,
>
> My environment is Tomcat 8.5.12, Java 1.8.0_112 running on macOS 10.12 and
> planning to update Tomcat to 8.5.15.
>
> I’m wondering if I can get comments from the community for my questions
> below?
>
>
> 1) What tools is the community using for simultaneous applications
> deployment on several servers, let’s say more than 20?
>
> 2) Would having the logs located outside of the Tomcat home directory, if
> possible, affect Tomcat operation?
>
> 3) Are there any recommendations/best practices for installing and running
> Tomcat 8.5.15 on macOS 10.12?
>

On #2 and #3, setup up separate CATALINA_HOME and CATALINA_BASE directories
as described in RUNNING.txt. This will keep logs out of CATALINA_HOME and
make upgrading to new releases of Tomcat fairly easy.

My Macs aren't production, so you may need to adapt this. I unpack Tomcat
releases to /Library/Tomcat. I remove all but ./bin and ./lib, and rename
./conf to ./conf-ORIG. I diff this ./conf-ORIG with the ./conf-ORIG from
the last release, making tweaks to my $CATALINA_BASE/conf files as
required. Then I create a link

$ cd /Library/Tomcat
$ tar zxvf ~/Downloads/apache-tomcat-8.5.11.tar.gz
... // remove subdirectories...
$ rm catalina
$ ln -s /Library/Tomcat/apache-tomcat-8.5.11 catalina

and in ~/.bash_profile `export CATALINA_HOME=/Library/Tomcat/catalina` (I
also set CATALINA_HOME and CATALINA_BASE in my org.apache.tomcat plist).
Now restart Tomcat.


>
> 4) Is JAVA_OPTS required?
>
>
>
> Thanks for your comments.
>
> Israel
>
>
>
>


-- 
"Hell hath no limits, nor is circumscrib'd In one self-place; but where we
are is hell, And where hell is, there must we ever be" --Christopher
Marlowe, *Doctor Faustus* (v. 121-24)


Re: Tomcat 8.5 NullPointerException on getSubmittedFileName() with HTTP/2

2016-06-16 Thread Thad Humphries
For the record, this problem has been fixed in Tomcat 8.5.3 (see
https://bz.apache.org/bugzilla/show_bug.cgi?id=59564).

I have also been able to upload files using Apache Commons FileUpload 1.3.1.

On Fri, May 6, 2016 at 12:32 PM, Thad Humphries <thad.humphr...@gmail.com>
wrote:

> I have lifted from the GlassFish tutorial a simple file upload servlet
> example. When I run this with Tomcat 8.5 and HTTPS (Http11NioProtocol), it
> works fine, uploading a file to the /tmp directory:
>
>   ...
>   protected void processRequest(HttpServletRequest request,
> HttpServletResponse response)
>   throws ServletException, IOException {
>
> response.setContentType("text/html;charset=UTF-8");
>
> // Create path components to save the file
> final String path = request.getParameter("destination");
> final Part filePart = request.getPart("file");
> final String fileName = filePart.getSubmittedFileName();
> ...
>
> However when I add  className="org.apache.coyote.http2.Http2Protocol" /> to the  in
> servlet.xml, the servlet fails with a NullPointerException on
> filePart.getSubmittedFileName().
>
> Surprised, I tried uploading a .WAR through the Tomcat Manager with HTTP/2
> enabled. Sure enough, it failed with the message "FAIL - File upload
> failed, no file". When I track this down in the 8.5 source, I find the
> error at line #239 of org.apache.catalina.manager.HTMLManagerServlet, which
> indicates that request.getPart("deployWar") is returning null.
>
> Has anyone else seen this?
>
> I'm am running Tomcat 8.5, Java 1.8.0_91, MacOS 10.10.5, and Chrome 50.
>
> --
> "Hell hath no limits, nor is circumscrib'd In one self-place; but where we
> are is hell, And where hell is, there must we ever be" --Christopher
> Marlowe, *Doctor Faustus* (v. 121-24)
>



-- 
"Hell hath no limits, nor is circumscrib'd In one self-place; but where we
are is hell, And where hell is, there must we ever be" --Christopher
Marlowe, *Doctor Faustus* (v. 121-24)


Re: Multipart form submission does not work over SSL HTTP2 on Tomcat 9

2016-05-11 Thread Thad Humphries
I am getting a null returned from HttpServletRequest.getParts() HTTP/2 and
multipart (see http://bit.ly/1TzXd9k). This happens in my own code, as well
as when I try to upload a *.WAR though the manager/html web page. Other
than configuring the connector and the upgrade protocol (see below), what
must be done?



  
  

  



On Tue, Mar 22, 2016 at 5:32 PM, Violeta Georgieva 
wrote:

> Hi,
>
> 2016-03-19 23:21 GMT+02:00 Ajay Verma :
> >
> > Hello,
> > I'm trying to get multipart forms working in Tomcat 9 over HTTP2 (with
> TLS enabled).
> >
> > The SSL Connector configuration in server.xml (Tomcat 9) is given
> below protocol="org.apache.coyote.http11.Http11AprProtocol"  maxThreads="150"
> SSLEnabled="true">
> > 
> > 
> >  > certificateFile="conf/2_toeflmadeeasy.com.crt"  />
> >   Multipart form submission does not work (the form
> variable values are not retrieved on server in the servlet) with above
> connector.The sample multipart form html code is given below name="multiPartForm" method="post" enctype="multipart/form-data">
> >  name="form_submission_type" value="test">
> > File 1:
> > File 2:
> > 
> > 
> > I am trying to get form parameters by using the
> getParameter("form_submission_type") method on HttpServletRequest, and it
> returns null under HTTP2. If I remove the line  className="org.apache.coyote.http2.Http2Protocol" />) it works. But now I
> am not on HTTP2.
> >
> > Anyone have any ideas how I can get it to work on HTTP2?
>
> Is it possible for you to test your configuration with the manager
> application that comes with Tomcat distribution?
> It uses multipart.
>
> I tested it on my side and the manager application is working with HTTP/2
> and multipart.
>
> Regards,
> Violeta
>
> > Thanks in advance for any suggestions and comments.
> > Ajay
>



-- 
"Hell hath no limits, nor is circumscrib'd In one self-place; but where we
are is hell, And where hell is, there must we ever be" --Christopher
Marlowe, *Doctor Faustus* (v. 121-24)


Tomcat 8.5 NullPointerException on getSubmittedFileName() with HTTP/2

2016-05-06 Thread Thad Humphries
I have lifted from the GlassFish tutorial a simple file upload servlet
example. When I run this with Tomcat 8.5 and HTTPS (Http11NioProtocol), it
works fine, uploading a file to the /tmp directory:

  ...
  protected void processRequest(HttpServletRequest request,
HttpServletResponse response)
  throws ServletException, IOException {

response.setContentType("text/html;charset=UTF-8");

// Create path components to save the file
final String path = request.getParameter("destination");
final Part filePart = request.getPart("file");
final String fileName = filePart.getSubmittedFileName();
...

However when I add  to the  in
servlet.xml, the servlet fails with a NullPointerException on
filePart.getSubmittedFileName().

Surprised, I tried uploading a .WAR through the Tomcat Manager with HTTP/2
enabled. Sure enough, it failed with the message "FAIL - File upload
failed, no file". When I track this down in the 8.5 source, I find the
error at line #239 of org.apache.catalina.manager.HTMLManagerServlet, which
indicates that request.getPart("deployWar") is returning null.

Has anyone else seen this?

I'm am running Tomcat 8.5, Java 1.8.0_91, MacOS 10.10.5, and Chrome 50.

-- 
"Hell hath no limits, nor is circumscrib'd In one self-place; but where we
are is hell, And where hell is, there must we ever be" --Christopher
Marlowe, *Doctor Faustus* (v. 121-24)


Tomcat 8.5 NullPointerException on getSubmittedFileName() with HTTP/2

2016-04-29 Thread Thad Humphries
I have lifted from the GlassFish tutorial a simple file upload servlet
example. When I run this with Tomcat 8.5 and HTTPS (Http11NioProtocol), it
works fine, uploading a file to the /tmp directory:

  ...
  protected void processRequest(HttpServletRequest request,
HttpServletResponse response)
  throws ServletException, IOException {

response.setContentType("text/html;charset=UTF-8");

// Create path components to save the file
final String path = request.getParameter("destination");
final Part filePart = request.getPart("file");
final String fileName = filePart.getSubmittedFileName();
...

However when I add  to the  in
servlet.xml, the servlet fails with a NullPointerException on
filePart.getSubmittedFileName().

Has anyone else seen this?

I'm am running Tomcat 8.5, Java 1.8.0_91, MacOS 10.10.5, and Chrome 50.

-- 
"Hell hath no limits, nor is circumscrib'd In one self-place; but where we
are is hell, And where hell is, there must we ever be" --Christopher
Marlowe, *Doctor Faustus* (v. 121-24)


Re: Tomcat 8.5 and TLS

2016-04-06 Thread Thad Humphries
On Wed, Apr 6, 2016 at 12:17 PM, Coty Sutherland <csuth...@redhat.com>
wrote:

> Hi Thad,
>
> Hopefully I can help clear up some confusion here. I'd also suggest
> watching the 8.5 connector video that markt presented here
> <https://www.youtube.com/watch?v=LBSWixIwMmU> for more information on the
> connector changes introduced by 8.5. I found the bits on the SSL change
> particularly informative as it was my first exposure to how tomcat9 handles
> TLS, if you're interested in moving to the way that tomcat 9 handles SSL
> with the upgrade to 8.5. Otherwise, you can use the same Connector tags
> that you had before without change (I think).
>
> In any case, I'll reply to your last inquiries in line below. I'm using
> Tomcat 8.5.0.Beta and OpenJDK 8.
>
> > Are you saying that to make the second  work I must remove
> either clientAuth or sslProtocol? (No, I must be mistaken--remove either/or
> and Tomcat still fails to start).
>
> Yes; you should remove _both_ of them and move that configuration into the
> SSLHostConfig. You can find the replacements for them in the docs for
> clientAuth and sslProtocol here
> <
> https://tomcat.apache.org/tomcat-8.5-doc/config/http.html#SSL_Support_-_Connector_-_NIO_and_NIO2
> >;
> I've tested this and it works for me. I believe that the reason behind this
> (although I am no expert) is that tomcat is taking the old Connector
> configuration that you have in place and creating a default SSLHostConfig
> behind the scenes; this action causes a conflict with your defined
> SSLHostConfig hence the exception about the multiple non-unique host names
> and such.
>
> > "BTW sslProtocol is really useless." does make sense. If so, I think I'm
> hearing
> that I should not use the sslProtocol="TLS" attribute or the
>  element. Is that right?
>
> You don't need the sslProtocol attribute because you're just setting the
> default value for TLS. As far as the SSLHostConfig goes, I think that's up
> to you. For now, tomcat will take your old Connector configuration and
> translate it behind the scenes into what it needs to function. If you do
> use the SSLHostConfig tag, then you'll need to move all of the attributes
> from the Connector to the SSLHostConfig that belong there; this is
> basically upgrading your connector from the tomcat 8.0 syntax to tomcat 9's
> syntax.
>
> > This confuses me. The 8.5 server.xml uses  in its
> commented examples while the 8.0 server.xml does not. And if SSL*
> attributes are going away, why is  now the example?
>
> Tomcat 8.5 was forked from tomcat/trunk (tomcat9), which is where that
> comes from. I think that the example was left there to encourage movement
> to the tomcat 9 syntax because the older connector syntax will eventually
> be removed. I do notice that the ssl-howto docs still refer to the tomcat8
> syntax, so it doesn't seem like there is a unified message regarding which
> one is the preferred method (they're both still correct and will work when
> the hosts don't conflict).
>
> > And without SSL*, how do I specify the certificates in an APR connector
> like this one (which is the first I got working):
>
> All of the SSL* attributes from the connector were migrated to the
> SSLHostConfig and it's new tags.
>
> Let me know if any of my response was vague and I'll try and clarify.
>

Thank you, Coty. I think that answered my questions (the video was useful,
too).

So, for the record--and I hope I've labeled them correctly--I have gotten
the configurations below to come up on Mac OSX 10.10.5 with Java 1.8.0_77.
My OpenSSL is 1.0.2g 1 Mar 2016, and my Tomcat native library is 1.2.5,
both installed with Homebrew.

  
  


  

  

  
  


  

  

  
  


  

  

Now to see if this breaks any of my apps. :)


>
> On Tue, Apr 5, 2016 at 4:57 PM, Thad Humphries <thad.humphr...@gmail.com>
> wrote:
>
> > On Tue, Apr 5, 2016 at 4:25 PM, Rémy Maucherat <r...@apache.org> wrote:
> >
> > > 2016-04-05 15:11 GMT-05:00 Thad Humphries <thad.humphr...@gmail.com>:
> > >
> > > > My primary interest in Tomcat 8.5 is HTTP/2, so I must set up HTTPS
> and
> > > > TLS.
> > > >
> > > > Since I eventually must demonstrate the various HTTPS approaches to
> > > others,
> > > > I have tried both the APR and the NIO implementation, as well as the
> > > > different  layouts in the docs (
> > > >
> > > >
> > >
> >
> http://tomcat.apache.org/tomcat-8.5-doc/ssl-howto.html#Edit_the_Tomcat_Configuration_File
> > > > ),
> > > > and the $CATALINA_BASE/conf/server.xml comment

Re: Tomcat 8.5 and TLS

2016-04-05 Thread Thad Humphries
On Tue, Apr 5, 2016 at 4:25 PM, Rémy Maucherat <r...@apache.org> wrote:

> 2016-04-05 15:11 GMT-05:00 Thad Humphries <thad.humphr...@gmail.com>:
>
> > My primary interest in Tomcat 8.5 is HTTP/2, so I must set up HTTPS and
> > TLS.
> >
> > Since I eventually must demonstrate the various HTTPS approaches to
> others,
> > I have tried both the APR and the NIO implementation, as well as the
> > different  layouts in the docs (
> >
> >
> http://tomcat.apache.org/tomcat-8.5-doc/ssl-howto.html#Edit_the_Tomcat_Configuration_File
> > ),
> > and the $CATALINA_BASE/conf/server.xml comments.  I've gotten APR is
> > working both ways, but not quite NIO.
> >
> > When I use the following connector for NIO (from the docs), my SSL works:
> >
> >  >protocol="org.apache.coyote.http11.Http11NioProtocol"
> >port="8443" maxThreads="200" compression="on"
> >scheme="https" secure="true" SSLEnabled="true"
> >keystoreFile="conf/foo.jks" keystorePass="changeit"
> >clientAuth="false" sslProtocol="TLS">
> >/>
> > 
> >
> > However when I try the approach in the server.xml comments, Tomcat does
> not
> > start:
> >
> >  > protocol="org.apache.coyote.http11.Http11NioProtocol"
> >maxThreads="200" SSLEnabled="true"
> >scheme="https" secure="true" clientAuth="false"
> >sslProtocol="TLS">
> >/>
> >   
> >  >  certificateKeystoreType="JKS"
> >  certificateKeystorePassword="changeit"
> >  certificateKeyAlias="tomcat"
> >  type="RSA" />
> >   
> > 
> >
> > The error at the top of catalina.out is below. I'm trying to understand
> > why, both for myself and so that I can explain it to others. The "Caused
> > by: java.lang.IllegalArgumentException: Multiple SSLHostConfig elements
> > were provided for the host name [_default_]. Host names must be unique."
> > has me stumped as I have only the one uncommented SSLHostConfig in
> > server.xml.
> >
> > (Once I have this second  working, I must make a write-up for
> > folks here, a write-up which I hope will be clearer and more direct than
> > the docs. I would be happy to offer that write-up to the wiki or docs.)
> >
>
> You still have some attributes which should go into SSLHostConfig, so you
> have two SNI for the default host (clientAuth and sslProtocol). BTW
> sslProtocol is really useless.
>
> Rémy
>

I'm sorry, I'm not following you. Are you saying that to make the second
 work I must remove either clientAuth or sslProtocol? (No, I
must be mistaken--remove either/or and Tomcat still fails to start).

"BTW sslProtocol is really useless." does make sense. If so, I think I'm
hearing that I should not use the sslProtocol="TLS" attribute or the

element. Is that right?

The 8.5 docs say
"As of Tomcat 9, the majority of the SSL configuration attributes in the
Connector are deprecated. If specified, they will be used to configure a
SSLHostConfig and Certificate for the sslDefaultHost. Note that if an
explicit SSLHostConfig element also exists for the sslDefaultHost then that
will be treated as a configuration error. It is expected that Tomcat 10
will drop support for the SSL configuration attributes in the Connector."

This confuses me. The 8.5 server.xml uses  in its commented
examples while the 8.0 server.xml does not. And if SSL* attributes are
going away, why is  now the example? And without SSL*, how
do I specify the certificates in an APR connector like this one (which is
the first I got working):


  



>
> >
> > 05-Apr-2016 15:32:42.642 SEVERE [main]
> > org.apache.tomcat.util.digester.Digester.endElement End event threw
> > exception
> >  java.lang.reflect.InvocationTargetException
> > at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> > at
> >
> >
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
> > at
> >
> >
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
> > at java.lang.reflect.Method.invoke(Method.java:498)
> > at
> >
> >
> org.apache.tomcat.util.IntrospectionUti

Tomcat 8.5 and TLS

2016-04-05 Thread Thad Humphries
My primary interest in Tomcat 8.5 is HTTP/2, so I must set up HTTPS and TLS.

Since I eventually must demonstrate the various HTTPS approaches to others,
I have tried both the APR and the NIO implementation, as well as the
different  layouts in the docs (
http://tomcat.apache.org/tomcat-8.5-doc/ssl-howto.html#Edit_the_Tomcat_Configuration_File),
and the $CATALINA_BASE/conf/server.xml comments.  I've gotten APR is
working both ways, but not quite NIO.

When I use the following connector for NIO (from the docs), my SSL works:


  


However when I try the approach in the server.xml comments, Tomcat does not
start:


  
  

  


The error at the top of catalina.out is below. I'm trying to understand
why, both for myself and so that I can explain it to others. The "Caused
by: java.lang.IllegalArgumentException: Multiple SSLHostConfig elements
were provided for the host name [_default_]. Host names must be unique."
has me stumped as I have only the one uncommented SSLHostConfig in
server.xml.

(Once I have this second  working, I must make a write-up for
folks here, a write-up which I hope will be clearer and more direct than
the docs. I would be happy to offer that write-up to the wiki or docs.)

05-Apr-2016 15:32:42.642 SEVERE [main]
org.apache.tomcat.util.digester.Digester.endElement End event threw
exception
 java.lang.reflect.InvocationTargetException
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at
org.apache.tomcat.util.IntrospectionUtils.callMethod1(IntrospectionUtils.java:377)
at org.apache.tomcat.util.digester.SetNextRule.end(SetNextRule.java:145)
at org.apache.tomcat.util.digester.Digester.endElement(Digester.java:966)
at
com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.endElement(AbstractSAXParser.java:609)
at
com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanEndElement(XMLDocumentFragmentScannerImpl.java:1783)
at
com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl$FragmentContentDriver.next(XMLDocumentFragmentScannerImpl.java:2970)
at
com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl.next(XMLDocumentScannerImpl.java:606)
at
com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanDocument(XMLDocumentFragmentScannerImpl.java:510)
at
com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:848)
at
com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:777)
at
com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(XMLParser.java:141)
at
com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.parse(AbstractSAXParser.java:1213)
at
com.sun.org.apache.xerces.internal.jaxp.SAXParserImpl$JAXPSAXParser.parse(SAXParserImpl.java:643)
at org.apache.tomcat.util.digester.Digester.parse(Digester.java:1461)
at org.apache.catalina.startup.Catalina.load(Catalina.java:578)
at org.apache.catalina.startup.Catalina.load(Catalina.java:629)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.apache.catalina.startup.Bootstrap.load(Bootstrap.java:311)
at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:494)
Caused by: java.lang.IllegalArgumentException: Multiple SSLHostConfig
elements were provided for the host name [_default_]. Host names must be
unique.
at
org.apache.tomcat.util.net.AbstractEndpoint.addSslHostConfig(AbstractEndpoint.java:201)
at
org.apache.coyote.http11.AbstractHttp11Protocol.addSslHostConfig(AbstractHttp11Protocol.java:398)
at
org.apache.catalina.connector.Connector.addSslHostConfig(Connector.java:876)
... 26 more


-- 
"Hell hath no limits, nor is circumscrib'd In one self-place; but where we
are is hell, And where hell is, there must we ever be" --Christopher
Marlowe, *Doctor Faustus* (v. 121-24)


Re: Tomcat 8.5 documentation question

2016-04-05 Thread Thad Humphries
On Tue, Apr 5, 2016 at 2:53 AM, Mark Thomas <ma...@apache.org> wrote:

> On 04/04/2016 23:10, Thad Humphries wrote:
> > In docs/config/http.xml, lines #1430 and #1648 use
> "certificateValidation".
> > However when I go to "#SSL_Support_-_SSLHostConfig" I find the attribute
> > "certificateVerification", *not *"certificate*Validation*".  I think one
> or
> > the other is an error (and I think "certificateVerification" is the
> correct
> > attribute based on the "certificateVerificationDepth" attribute name).
>
> Thanks for pointing that out.
>
> I've fixed this for 9.0.x and 8.5.x and it will be included in the next
> release of both.
>
> For the record, certificateVerification was the correct one.
>
> Mark
>

You're welcome. I would have put it in a pull request, but I was unsure
which was which.

-- 
"Hell hath no limits, nor is circumscrib'd In one self-place; but where we
are is hell, And where hell is, there must we ever be" --Christopher
Marlowe, *Doctor Faustus* (v. 121-24)


Tomcat 8.5 documentation question

2016-04-04 Thread Thad Humphries
In docs/config/http.xml, lines #1430 and #1648 use "certificateValidation".
However when I go to "#SSL_Support_-_SSLHostConfig" I find the attribute
"certificateVerification", *not *"certificate*Validation*".  I think one or
the other is an error (and I think "certificateVerification" is the correct
attribute based on the "certificateVerificationDepth" attribute name).

-- 
"Hell hath no limits, nor is circumscrib'd In one self-place; but where we
are is hell, And where hell is, there must we ever be" --Christopher
Marlowe, *Doctor Faustus* (v. 121-24)


Re: WebEx meeting rescheduled: Introducing Apache Tomcat 8.5

2016-03-31 Thread Thad Humphries
On Fri, Mar 25, 2016 at 6:13 PM, Mark Thomas  wrote:

> Hello,
> Mark Thomas changed the time for this WebEx meeting.
>
> *Introducing Apache Tomcat 8.5*
> Wednesday, 30 March 2016
> 10:00  |  GMT Summer Time (London, GMT+01:00)  |  1 hr
>
> *Join WebEx meeting*
> 
> Meeting number: 641 864 861
>
> Add this meeting
> 
> to your calendar. (Cannot add from mobile devices.)
>
> Can't join the meeting? Contact support.
> 
>
> IMPORTANT NOTICE: Please note that this WebEx service allows audio and
> other information sent during the session to be recorded, which may be
> discoverable in a legal matter. By joining this session, you automatically
> consent to such recordings. If you do not consent to being recorded,
> discuss your concerns with the host or do not join the session.
>
>
> -
> To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
> For additional commands, e-mail: users-h...@tomcat.apache.org
>


Will this be up on YouTube soon? When it is, please let us know.

-- 
"Hell hath no limits, nor is circumscrib'd In one self-place; but where we
are is hell, And where hell is, there must we ever be" --Christopher
Marlowe, *Doctor Faustus* (v. 121-24)


Re: loading images through a Servlet

2015-10-01 Thread Thad Humphries
The servlet that gets the image is the src for the image. The servlet
should return the correct MIME type for the image (image/jpeg, image/png,
etc). Update the src attribute and the image should update. That's how I do
it. However I'm not writing straight JavaScript. You should put your
question to Stackoverflow.

On Thu, Oct 1, 2015 at 5:52 PM, Bill Ross  wrote:

> Please let me know if there is a better place to ask Servlet/javascript
> interface questions.
>
> I have a slide show web page that does the logical equivalent of:
>
> var img = new Image();
> img.src = "/images/" + /servlet/getnextfile(params)
> img.[onload]: document["image"].src = img.src; resizeImage();
>
> Rather than using the 'getnextfile' servlet to get a file name and then
> load it, I would like to have getnextfile return a stream of bytes from the
> database which seems feasible (streaming a BLOB I assume), but I don't know
> how to receive that into an Image (which wouldn't have 'src' set - ?).
>
> One motivation is to reduce the round trips to the server for faster
> response time.
> Another motivation is to keep the filename from the user.
>
> Thanks,
> Bill
>
> -
> To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
> For additional commands, e-mail: users-h...@tomcat.apache.org
>
>


-- 
"Hell hath no limits, nor is circumscrib'd In one self-place; but where we
are is hell, And where hell is, there must we ever be" --Christopher
Marlowe, *Doctor Faustus* (v. 121-24)


Re: -Djava.awt.headless=true JVM parameter

2015-01-11 Thread Thad Humphries
On Sun, Jan 11, 2015 at 10:18 AM, Felix Schumacher 
felix.schumac...@internetallee.de wrote:

 Am 11.01.2015 um 12:24 schrieb Christoph P.U. Kukulies:

 I'm installing OpenCms 9.5.0 (www.opencms.org) under tomcat 6.0.32 and
 during setup I'm getting a  warning saying that


 Your system uses components which have not been tested to work with
 Alkacon OpenCms. It is possible that OpenCms will not run on your system.

 |-Djava.awt.headless=true| JVM parameter or X-Server may be missing.
 *You can continue the setup, but image processing will be disabled.*


This warning overstates the effect of setting headless to true. You can
still do a lot with AWT and other imaging software. My servlets can, for
example, create a BufferedImage, draw to it, and send the result as a PNG
to the browser. They can uncompress TIFFs with JAI, create TIFF and JPEG
images with Commons-Imaging, create PDFs with iText, and many other imaging
tasks. What they can't do is anything that requires the DISPLAY environment
variable, like get FontMetrics.

I set headless to true on development and test machines because we've found
systems where the Tomcat user does not always have access to the DISPLAY
variable. Other times Tomcat maybe installed on a truly headless server.
But there is still lots that can be done graphically.



 Is this an issue that I can fix with setting Tomcats' startup parameters
 (Service under Windows 7)?

  You should be able to set the headless parameter in CATALINA_OPTS.

 Regards
  Felix


 -
 To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
 For additional commands, e-mail: users-h...@tomcat.apache.org




-- 
Hell hath no limits, nor is circumscrib'd In one self-place; but where we
are is hell, And where hell is, there must we ever be --Christopher
Marlowe, *Doctor Faustus* (v. 121-24)


Re: Can ClientAbortException be circumvented?

2013-03-28 Thread Thad Humphries
On Wed, Mar 27, 2013 at 6:09 PM, Christopher Schultz 
ch...@christopherschultz.net wrote:

 -BEGIN PGP SIGNED MESSAGE-
 Hash: SHA256

 Thad,

 On 3/27/13 5:20 PM, Thad Humphries wrote:
  On Tue, Mar 26, 2013 at 3:56 PM, Christopher Schultz 
  ch...@christopherschultz.net wrote:
 
  Thad,
 
  Coming a little late to the party...
 
  On 3/24/13 4:30 PM, Thad Humphries wrote:
  I have a web-app that uses a servlet for downloading files
  from a repository--PDF, Office, images, zip, etc. It works
  with desktop browsers--IE, Firefox, Chrome, and Safari--on
  their various platforms. It also works fine with Firefox from
  Android (2.3 and 4.x tested). However when I try with
  Android's default WebKit browser, the servlet fails
  immediately with
  org.apache.catalina.connector.ClientAbortException (so says
  the stderr log).
 
  This smells like it might be a Range request issue. Is the client
  sending a Range header along with the request? Are you respecting
  it?
 
 
  I don't see a Range header from my servlet. Here's the request;
 
  GET
 
 /myapp/webclient/copyObjectServlet?tag=0oATVXQD1B_l4Vzpw9n1X1EeKIXTKk6dname=grilled_romaine.doc
 
 
 HTTP/1.1
  Host: 10.1.2.1:8080 Accept-Encoding: gzip Accept-Language: en-US
  x-wap-profile:
  http://www.htcmms.com.tw/Android/Common/Ace/A9192-1.0.xml Cookie:
  JSESSIONID=0AACB4E188B2B68605FE0189C007F7BB Accept-Charset:
  utf-8, iso-8859-1, utf-16, *;q=0.7 Referer:
  http://10.1.2.1:8080/myapp/?id=ipadref=267 Keep-Alive: 115
  User-Agent: Mozilla/5.0 (Linux; U; Android 2.3.5; en-us;
  HTC-A9192/1.0 Build/GRJ90) AppleWebKit/533.1 (KHTML, like Gecko)
  Version/4.0 Mobile Safari/533.1 x-att-deviceid: HTC-A9192/1.0
  Connection: keep-alive Accept:
 
 application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5
 
   Here's the response:
 
  HTTP/1.1 200 OK Server: Apache-Coyote/1.1 Expires: 0
  Cache-Control: private Pragma: cache Content-Disposition:
  attachment; filename=grilled_romaine.doc Content-Type:
  application/msword Content-Length: 12288 Date: Wed, 27 Mar 2013
  20:46:02 GMT

 Hmm... and this particular request/response pair resulted in a
 ClientAbortException?

 Any idea how many bytes were sent before the exception?

 - -chris


Yes, that's what I'm seeing, at least when I use a *mobile* WebKit browser.
Desktop Chrome and Safari are fine. So I don't think the problem is Tomcat.
However I raised the issue here in case someone had seen this and had a
Tomcat work around (I dunno any of our customers who are using something
other than Tomcat).

As for how many bytes are sent, in the Wireshark capture I have up now for
a file of 72,704 byte, I see the servlet request, the TCP response with
HTTP header, another TCP, an ACK, two more TCP, a FIN ACK, ACK, and four
RSTs from my Android phone, well before the file is finished.

I'm running Tomcat 7.0.32 with Java 1.7.0_15 on both Windows 7 (64-bit) and
openSUSE 12.3 Linux (32-bit). I'm using straight Tomcat, port 8080, on both
(though I see the same behavior on Linux if I go through Apache 2.4.2 and
mod_jk 1.2.37). Both fail in the same fashion--same sequence when I watch
the wire--but I can see the servlet fail with ClientAbortException in the
Windows tocat7-stderr.*.log (from Commons Daemon procrun since I run Tomcat
as a service). I've cleared the log directory immediately before starting
Tomcat, so I believe the resets I see in Wireshark and the
ClientAbortException are related.

It seems pretty definite that the problem is *not* with Tomcat, but with
mobile WebKit. Guess I'll look into Howard's suggestion about a mail-to
option.

Thanks for y'all's interest. And thanks to Mark for the tip on Wireshark.
It sure beats tcpdump.

-- 
Hell hath no limits, nor is circumscrib'd In one self-place; but where we
are is hell, And where hell is, there must we ever be --Christopher
Marlowe, *Doctor Faustus* (v, 121-24)


Re: Can ClientAbortException be circumvented?

2013-03-27 Thread Thad Humphries
On Tue, Mar 26, 2013 at 3:56 PM, Christopher Schultz 
ch...@christopherschultz.net wrote:

 -BEGIN PGP SIGNED MESSAGE-
 Hash: SHA256

 Thad,

 Coming a little late to the party...

 On 3/24/13 4:30 PM, Thad Humphries wrote:
  I have a web-app that uses a servlet for downloading files from a
  repository--PDF, Office, images, zip, etc. It works with desktop
  browsers--IE, Firefox, Chrome, and Safari--on their various
  platforms. It also works fine with Firefox from Android (2.3 and
  4.x tested). However when I try with Android's default WebKit
  browser, the servlet fails immediately with
  org.apache.catalina.connector.ClientAbortException (so says the
  stderr log).

 This smells like it might be a Range request issue. Is the client
 sending a Range header along with the request? Are you respecting it?


I don't see a Range header from my servlet. Here's the request;

GET
/myapp/webclient/copyObjectServlet?tag=0oATVXQD1B_l4Vzpw9n1X1EeKIXTKk6dname=grilled_romaine.doc
HTTP/1.1
Host: 10.1.2.1:8080
Accept-Encoding: gzip
Accept-Language: en-US
x-wap-profile: http://www.htcmms.com.tw/Android/Common/Ace/A9192-1.0.xml
Cookie: JSESSIONID=0AACB4E188B2B68605FE0189C007F7BB
Accept-Charset: utf-8, iso-8859-1, utf-16, *;q=0.7
Referer: http://10.1.2.1:8080/myapp/?id=ipadref=267
Keep-Alive: 115
User-Agent: Mozilla/5.0 (Linux; U; Android 2.3.5; en-us; HTC-A9192/1.0
Build/GRJ90) AppleWebKit/533.1 (KHTML, like Gecko) Version/4.0 Mobile
Safari/533.1
x-att-deviceid: HTC-A9192/1.0
Connection: keep-alive
Accept:
application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5

Here's the response:

HTTP/1.1 200 OK
Server: Apache-Coyote/1.1
Expires: 0
Cache-Control: private
Pragma: cache
Content-Disposition: attachment; filename=grilled_romaine.doc
Content-Type: application/msword
Content-Length: 12288
Date: Wed, 27 Mar 2013 20:46:02 GMT


 I wouldn't be surprised if what's happening is that you are getting a
 Range request (maybe for the first few hundred bytes) and you are
 ignoring it, returning the entire file. Once the client gets enough
 bytes, it simply closes the connection and the rest of the bytes in
 transit fall on the floor.

 If the next request is for the last few hundred bytes (frequently,
 this will happen with ZIP and PDF files, since there is critical
 information at the /end/ of the file) and you return the whole file,
 the client may give up at any point (which IMO is silly) in the same way.

  I suspect this is a problem with mobile WebKit, and that
  circumventing the abort might be a bad thing even if it's
  possible. However I thought I'd inquire here if there is a Tomcat
  way around it. If not, it seems my alternatives are (1) use Java
  Mail to mail the user the file, since mail apps open their
  attachments; and (2) write iOS and Android apps file query and
  downloading. Neither prospect thrills me.

 If the problem truly is Range-related, you may be able to alter your
 servlet to respect the Range request. Of primary benefit will be that
 you will (probably) be sending fewer bytes over the network, which can
 significantly improve performance. Obviously, the secondary benefit
 will be that you don't get these errors anymore.

 Of course, coping with Range requests is non-trivial. Be sure to read
 the RFPs very closely.

 - -chris
 -BEGIN PGP SIGNATURE-
 Version: GnuPG/MacGPG2 v2.0.17 (Darwin)
 Comment: GPGTools - http://gpgtools.org
 Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/

 iQIcBAEBCAAGBQJRUf1zAAoJEBzwKT+lPKRYrUIQAITTszTQujDkBaKWTVVDlbB6
 xm3m2K6hQls4T743dTY4hGOSWrTPB3ovBpkkfgm1kGxJQsSsRhrD5t8+BhHIIpE7
 Iax24MBD4XTrvPzEuYlx3DSqx2JZK/iDfkffMfmg6Fq74/j3LoStZdTnmts2nQ0l
 BCi5jtU3TMTZdwkNpVMmEiwomY205QBXqAaIEcjs+BtOtvTQakL80XQS3F1FDaPz
 315pW2cx9JqwWyjmA+5dqPY9zEQVO1JBou7fwMROO1BJ9wo74UxUFDGGETko6ODm
 4TGd9QpU4Lwnbu9NrK7PxiEnbNGiUC8JGuADpr9lp/jrgg4PyMtFZIVRNUqX5Vkg
 YDnwZFYlcyfmXVa4xHtYogL+qdPb3E0DM+RFfaFy9ka2Q7gwvGVLpHYNancTCicd
 GkU7Hb4mUSZDyR7AAXfJoaLlHVODs2tue8zix8K8y02Rqb49Bc+YS1BB2WgqQSFC
 0PJ+Z3kWHbZfiTUcz5ZT7SoQsgPtSuagI9SNBBBeFqn2zOdkNkJcgcQ4OKoqDt71
 g3ocpV2PaBtV0cDoL30DiNwy9byrsUKmjlF2b3oyHh4BfxO9UzKPGfd8kgMDg/X0
 Tq7SbPSBwkoOHUVyNCfzMicS4zz/octolUxCS+k+7kC4rqfz98Ke2t7003OLbRqc
 UOO6QgF6KV62ETx5zBve
 =mn1G
 -END PGP SIGNATURE-

 -
 To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
 For additional commands, e-mail: users-h...@tomcat.apache.org




-- 
Hell hath no limits, nor is circumscrib'd In one self-place; but where we
are is hell, And where hell is, there must we ever be --Christopher
Marlowe, *Doctor Faustus* (v, 121-24


Re: Can ClientAbortException be circumvented?

2013-03-25 Thread Thad Humphries
On Sun, Mar 24, 2013 at 4:46 PM, Konstantin Kolinko
knst.koli...@gmail.comwrote:

 2013/3/25 Thad Humphries thad.humphr...@gmail.com:
  I have a web-app that uses a servlet for downloading files from a
  repository--PDF, Office, images, zip, etc. It works with desktop
  browsers--IE, Firefox, Chrome, and Safari--on their various platforms. It
  also works fine with Firefox from Android (2.3 and 4.x tested). However
  when I try with Android's default WebKit browser, the servlet fails
  immediately with org.apache.catalina.connector.ClientAbortException (so
  says the stderr log).

 1. Is this issue specific to some kind of files, or it occurs with all of
 them?


All of them--PDF, XLS, DOC, DOCX, TIFF, ZIP, etc. Every file type I've
tried.


 2. If client aborts a connection, there is nothing much a server can
 do. It is issue in your web browser.


Yeah, I suspected that.


  The servlet is sending proper headers, including the correct MIME type,
  Content-Disposition attachment, file size, etc. I even took to adding the
  file's name as the last GET parameter. No dice.

 3. Maybe the browser does not like Content-Disposition attachment?
 Maybe it cannot save the file?


These same file types can be downloaded if the servlet is called by
Firefox, or if the file is requested from a directory listing or in an
email attachment. In these cases, with Android they go to the Downloads
directory on the memory card; on iPad, DOCs open in Pages, PDFs in a
viewer, etc.


 4. Does it depend on file size? How the file is served? (What
 connector implementation are you using? Do you use compression, do you
 use sendfile?)


Size does not matter, a few K or a several hundred K.

 Safari on iPad, iPhone, and iPod Touch also fail. Although I don't have
 one
  with me at this moment to test, I suspect their failure is also caused
 by a
  ClientAbortException: Safari is also WebKit and *I've Google'd numerous
  complaints about this exception when using mobile WebKit browsers*.
 While I
  can tell Android users to try Firefox, there is no Firefox for iPhone.
 
  I'm expecting a file to open in a local viewer app, like Acrobat Reader,
  QuickOffice, Pages, etc. I can open files in these apps via Firefox, an
  email client, or via the WebKit browser when viewing a directory listing
 in
  my public_html directories and similar locations.
 
  I suspect this is a problem with mobile WebKit, and that circumventing
 the
  abort might be a bad thing even if it's possible. However I thought I'd
  inquire here if there is a Tomcat way around it. If not, it seems my
  alternatives are (1) use Java Mail to mail the user the file, since mail
  apps open their attachments; and (2) write iOS and Android apps file
 query
  and downloading. Neither prospect thrills me.
 

 -
 To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
 For additional commands, e-mail: users-h...@tomcat.apache.org




-- 
Hell hath no limits, nor is circumscrib'd In one self-place; but where we
are is hell, And where hell is, there must we ever be --Christopher
Marlowe, *Doctor Faustus* (v, 121-24)


Re: Can ClientAbortException be circumvented?

2013-03-25 Thread Thad Humphries
On Mon, Mar 25, 2013 at 10:02 AM, Brett Delle Grazie 
brett.dellegra...@gmail.com wrote:

 On 25 March 2013 13:00, Thad Humphries thad.humphr...@gmail.com wrote:

  On Sun, Mar 24, 2013 at 4:46 PM, Konstantin Kolinko
  knst.koli...@gmail.comwrote:
 
   2013/3/25 Thad Humphries thad.humphr...@gmail.com:
I have a web-app that uses a servlet for downloading files from a
repository--PDF, Office, images, zip, etc. It works with desktop
browsers--IE, Firefox, Chrome, and Safari--on their various
 platforms.
  It
also works fine with Firefox from Android (2.3 and 4.x tested).
 However
when I try with Android's default WebKit browser, the servlet fails
immediately with org.apache.catalina.connector.ClientAbortException
 (so
says the stderr log).
  
   1. Is this issue specific to some kind of files, or it occurs with all
 of
   them?
  
 
  All of them--PDF, XLS, DOC, DOCX, TIFF, ZIP, etc. Every file type I've
  tried.
 
 
   2. If client aborts a connection, there is nothing much a server can
   do. It is issue in your web browser.
  
 
  Yeah, I suspected that.
 
 
The servlet is sending proper headers, including the correct MIME
 type,
Content-Disposition attachment, file size, etc. I even took to adding
  the
file's name as the last GET parameter. No dice.
  
   3. Maybe the browser does not like Content-Disposition attachment?
   Maybe it cannot save the file?
  
 
  These same file types can be downloaded if the servlet is called by
  Firefox, or if the file is requested from a directory listing or in an
  email attachment. In these cases, with Android they go to the Downloads
  directory on the memory card; on iPad, DOCs open in Pages, PDFs in a
  viewer, etc.
 
 
   4. Does it depend on file size? How the file is served? (What
   connector implementation are you using? Do you use compression, do you
   use sendfile?)
  
 
  Size does not matter, a few K or a several hundred K.
 
   Safari on iPad, iPhone, and iPod Touch also fail. Although I don't have
   one
with me at this moment to test, I suspect their failure is also
 caused
   by a
ClientAbortException: Safari is also WebKit and *I've Google'd
 numerous
complaints about this exception when using mobile WebKit browsers*.
   While I
can tell Android users to try Firefox, there is no Firefox for
 iPhone.
   
I'm expecting a file to open in a local viewer app, like Acrobat
  Reader,
QuickOffice, Pages, etc. I can open files in these apps via Firefox,
 an
email client, or via the WebKit browser when viewing a directory
  listing
   in
my public_html directories and similar locations.
   
I suspect this is a problem with mobile WebKit, and that
 circumventing
   the
abort might be a bad thing even if it's possible. However I thought
  I'd
inquire here if there is a Tomcat way around it. If not, it seems my
alternatives are (1) use Java Mail to mail the user the file, since
  mail
apps open their attachments; and (2) write iOS and Android apps file
   query
and downloading. Neither prospect thrills me.
 

 Is this over HTTPS or standard HTTP?


Standard HTTP.

The servlet opens the file from the repository using the repository's API,
sends the HTTP header, then reads the file (again with the API) and sends
the bytes to ServletOutputStream. The file is read and written in blocks
of response.getBufferSize() or 8K if that call returns zero.

-- 
Hell hath no limits, nor is circumscrib'd In one self-place; but where we
are is hell, And where hell is, there must we ever be --Christopher
Marlowe, *Doctor Faustus* (v, 121-24)


Can ClientAbortException be circumvented?

2013-03-24 Thread Thad Humphries
I have a web-app that uses a servlet for downloading files from a
repository--PDF, Office, images, zip, etc. It works with desktop
browsers--IE, Firefox, Chrome, and Safari--on their various platforms. It
also works fine with Firefox from Android (2.3 and 4.x tested). However
when I try with Android's default WebKit browser, the servlet fails
immediately with org.apache.catalina.connector.ClientAbortException (so
says the stderr log).

The servlet is sending proper headers, including the correct MIME type,
Content-Disposition attachment, file size, etc. I even took to adding the
file's name as the last GET parameter. No dice.

Safari on iPad, iPhone, and iPod Touch also fail. Although I don't have one
with me at this moment to test, I suspect their failure is also caused by a
ClientAbortException: Safari is also WebKit and *I've Google'd numerous
complaints about this exception when using mobile WebKit browsers*. While I
can tell Android users to try Firefox, there is no Firefox for iPhone.

I'm expecting a file to open in a local viewer app, like Acrobat Reader,
QuickOffice, Pages, etc. I can open files in these apps via Firefox, an
email client, or via the WebKit browser when viewing a directory listing in
my public_html directories and similar locations.

I suspect this is a problem with mobile WebKit, and that circumventing the
abort might be a bad thing even if it's possible. However I thought I'd
inquire here if there is a Tomcat way around it. If not, it seems my
alternatives are (1) use Java Mail to mail the user the file, since mail
apps open their attachments; and (2) write iOS and Android apps file query
and downloading. Neither prospect thrills me.

Thoughts?

-- 
Hell hath no limits, nor is circumscrib'd In one self-place; but where we
are is hell, And where hell is, there must we ever be --Christopher
Marlowe, *Doctor Faustus* (v, 121-24)


Re: Unable to build tomcat-connectors

2012-06-05 Thread Thad Humphries
On Sun, Jun 3, 2012 at 10:10 AM, Sharon S Sreedh sharonkai...@gmail.comwrote:

 I already run the configure script --with-apxs2=/path/to/apxs
 --with-apache=/path/to/apache and header file are in the directory
 apache/include

 when I compile with ./configure -with-apxs2=/path/to/apxs  alone I got,
 configure: error: Cannot find the WebServer
 then I compiled with -with-apxs2=/path/to/apxs
 --with-apache=/path/to/apache this time compilation completed succefully
 but build faild with above error.


I'm not familiar with a switch --with-apxs2=. When I run ./configure
--help, I see --with-apxs[=FILE], but not an apxs2.

On Sun, Jun 3, 2012 at 6:01 PM, Thad Humphries thad.humphr...@gmail.com
 wrote:

  On Sun, Jun 3, 2012 at 2:44 AM, Sharon S Sreedh sharonkai...@gmail.com
  wrote:
 
   Hi,
  
   I was tring to build tomcat-connectors but it doesnt come in success. I
   tried a number of times.. But all the time it ends up error. Please
  sugest
   me a way to make this win.
  
  
   -
   Linux Kernel version: 2.6.18-308.el5.028stab099.3
   GCC version : gcc-4.1.2-52.el5_8.1
  
   Server version: Apache/2.4.2 (Unix)
   Server built:   Jun  3 2012 16:46:17
   Server's Module Magic Number: 20120211:3
   Server loaded:  APR 1.4.6, APR-UTIL 1.4.1
   Compiled using: APR 1.4.6, APR-UTIL 1.4.1
   Architecture:   32-bit
   Server MPM: event
 threaded: yes (fixed thread count)
   forked: yes (variable process count)
   Server compiled with
-D APR_HAS_SENDFILE
-D APR_HAS_MMAP
-D APR_HAVE_IPV6 (IPv4-mapped addresses enabled)
-D APR_USE_SYSVSEM_SERIALIZE
-D APR_USE_PTHREAD_SERIALIZE
-D SINGLE_LISTEN_UNSERIALIZED_ACCEPT
-D APR_HAS_OTHER_CHILD
-D AP_HAVE_RELIABLE_PIPED_LOGS
-D DYNAMIC_MODULE_LIMIT=256
-D HTTPD_ROOT=/usr/local/apache
-D SUEXEC_BIN=/usr/local/apache/bin/suexec
-D DEFAULT_PIDLOG=logs/httpd.pid
-D DEFAULT_SCOREBOARD=logs/apache_runtime_status
-D DEFAULT_ERRORLOG=logs/error_log
-D AP_TYPES_CONFIG_FILE=conf/mime.types
-D SERVER_CONFIG_FILE=conf/httpd.conf
  
   ==
  
   tomcat-connectors
   -
   tomcat-connectors-1.2.37-src
   
   Build error
   ---
   .
   .
   .
   .
   /usr/local/src/httpd-2.4.2/include/ap_hooks.h:39:17: error: apr.h: No
  such
   file or directory
   /usr/local/src/httpd-2.4.2/include/ap_hooks.h:40:23: error:
 apr_hooks.h:
   No such file or directory
   /usr/local/src/httpd-2.4.2/include/ap_hooks.h:41:32: error:
   apr_optional_hooks.h: No such file or directory
   In file included from
 /usr/local/src/httpd-2.4.2/include/ap_config.h:136,
from mod_jk.c:29:
   /usr/local/src/httpd-2.4.2/os/unix/os.h:31:17: error: apr.h: No such
 file
   or directory
   mod_jk.c:30:21: error: apr_lib.h: No such file or directory
   mod_jk.c:31:22: error: apr_date.h: No such file or directory
   mod_jk.c:32:27: error: apr_file_info.h: No such file or directory
   mod_jk.c:33:25: error: apr_file_io.h: No such file or directory
   In file included from /usr/local/src/httpd-2.4.2/include/httpd.h:47,
from mod_jk.c:34:
   /usr/local/src/httpd-2.4.2/include/ap_release.h:25:41: error:
   apr_general.h: No such file or directory
   In file included from mod_jk.c:34:
   /usr/local/src/httpd-2.4.2/include/httpd.h:51:24: error: apr_tables.h:
 No
   such file or directory
   /usr/local/src/httpd-2.4.2/include/httpd.h:52:23: error: apr_pools.h:
 No
   such file or directory
   /usr/local/src/httpd-2.4.2/include/httpd.h:53:22: error: apr_time.h: No
   such file or directory
   /usr/local/src/httpd-2.4.2/include/httpd.h:54:28: error:
  apr_network_io.h:
   No such file or directory
   /usr/local/src/httpd-2.4.2/include/httpd.h:55:25: error: apr_buckets.h:
  No
   such file or directory
   /usr/local/src/httpd-2.4.2/include/httpd.h:56:22: error: apr_poll.h: No
   such file or directory
   /usr/local/src/httpd-2.4.2/include/httpd.h:57:29: error:
   apr_thread_proc.h: No such file or directory
   In file included from /usr/local/src/httpd-2.4.2/include/httpd.h:61,
from mod_jk.c:34:
   .
   .
   .
   Attaching Full Build Output with this. Please help me to resolve this.
  
   Thanks  Regards
   Sharon Sreedh
  
 
  Just my guess:  In running the configure script, did you
  include --with-apxs[=FILE], where FILE is the full path to apxs? If apxs
 is
  your path, are the include directory and the ap_*.h headers nearby, as in
  if apxs is at [foo]/apache2/bin/axpx are the include files
  at [foo]/apache2/include  ?
 
  I prefer to build Apache myself, so I always point my configure script at
  the apxs I've built in whatever I'm running. Line #28 of
  tomcat-connectors-1.2.xx-src/native/BUILDING.txt has made my life simple
 in
  this regard:
 
  ./configure -with-apxs=/home2/local

Re: Unable to build tomcat-connectors

2012-06-03 Thread Thad Humphries
On Sun, Jun 3, 2012 at 2:44 AM, Sharon S Sreedh sharonkai...@gmail.comwrote:

 Hi,

 I was tring to build tomcat-connectors but it doesnt come in success. I
 tried a number of times.. But all the time it ends up error. Please sugest
 me a way to make this win.


 -
 Linux Kernel version: 2.6.18-308.el5.028stab099.3
 GCC version : gcc-4.1.2-52.el5_8.1

 Server version: Apache/2.4.2 (Unix)
 Server built:   Jun  3 2012 16:46:17
 Server's Module Magic Number: 20120211:3
 Server loaded:  APR 1.4.6, APR-UTIL 1.4.1
 Compiled using: APR 1.4.6, APR-UTIL 1.4.1
 Architecture:   32-bit
 Server MPM: event
   threaded: yes (fixed thread count)
 forked: yes (variable process count)
 Server compiled with
  -D APR_HAS_SENDFILE
  -D APR_HAS_MMAP
  -D APR_HAVE_IPV6 (IPv4-mapped addresses enabled)
  -D APR_USE_SYSVSEM_SERIALIZE
  -D APR_USE_PTHREAD_SERIALIZE
  -D SINGLE_LISTEN_UNSERIALIZED_ACCEPT
  -D APR_HAS_OTHER_CHILD
  -D AP_HAVE_RELIABLE_PIPED_LOGS
  -D DYNAMIC_MODULE_LIMIT=256
  -D HTTPD_ROOT=/usr/local/apache
  -D SUEXEC_BIN=/usr/local/apache/bin/suexec
  -D DEFAULT_PIDLOG=logs/httpd.pid
  -D DEFAULT_SCOREBOARD=logs/apache_runtime_status
  -D DEFAULT_ERRORLOG=logs/error_log
  -D AP_TYPES_CONFIG_FILE=conf/mime.types
  -D SERVER_CONFIG_FILE=conf/httpd.conf

 ==

 tomcat-connectors
 -
 tomcat-connectors-1.2.37-src
 
 Build error
 ---
 .
 .
 .
 .
 /usr/local/src/httpd-2.4.2/include/ap_hooks.h:39:17: error: apr.h: No such
 file or directory
 /usr/local/src/httpd-2.4.2/include/ap_hooks.h:40:23: error: apr_hooks.h:
 No such file or directory
 /usr/local/src/httpd-2.4.2/include/ap_hooks.h:41:32: error:
 apr_optional_hooks.h: No such file or directory
 In file included from /usr/local/src/httpd-2.4.2/include/ap_config.h:136,
  from mod_jk.c:29:
 /usr/local/src/httpd-2.4.2/os/unix/os.h:31:17: error: apr.h: No such file
 or directory
 mod_jk.c:30:21: error: apr_lib.h: No such file or directory
 mod_jk.c:31:22: error: apr_date.h: No such file or directory
 mod_jk.c:32:27: error: apr_file_info.h: No such file or directory
 mod_jk.c:33:25: error: apr_file_io.h: No such file or directory
 In file included from /usr/local/src/httpd-2.4.2/include/httpd.h:47,
  from mod_jk.c:34:
 /usr/local/src/httpd-2.4.2/include/ap_release.h:25:41: error:
 apr_general.h: No such file or directory
 In file included from mod_jk.c:34:
 /usr/local/src/httpd-2.4.2/include/httpd.h:51:24: error: apr_tables.h: No
 such file or directory
 /usr/local/src/httpd-2.4.2/include/httpd.h:52:23: error: apr_pools.h: No
 such file or directory
 /usr/local/src/httpd-2.4.2/include/httpd.h:53:22: error: apr_time.h: No
 such file or directory
 /usr/local/src/httpd-2.4.2/include/httpd.h:54:28: error: apr_network_io.h:
 No such file or directory
 /usr/local/src/httpd-2.4.2/include/httpd.h:55:25: error: apr_buckets.h: No
 such file or directory
 /usr/local/src/httpd-2.4.2/include/httpd.h:56:22: error: apr_poll.h: No
 such file or directory
 /usr/local/src/httpd-2.4.2/include/httpd.h:57:29: error:
 apr_thread_proc.h: No such file or directory
 In file included from /usr/local/src/httpd-2.4.2/include/httpd.h:61,
  from mod_jk.c:34:
 .
 .
 .
 Attaching Full Build Output with this. Please help me to resolve this.

 Thanks  Regards
 Sharon Sreedh


Just my guess:  In running the configure script, did you
include --with-apxs[=FILE], where FILE is the full path to apxs? If apxs is
your path, are the include directory and the ap_*.h headers nearby, as in
if apxs is at [foo]/apache2/bin/axpx are the include files
at [foo]/apache2/include  ?

I prefer to build Apache myself, so I always point my configure script at
the apxs I've built in whatever I'm running. Line #28 of
tomcat-connectors-1.2.xx-src/native/BUILDING.txt has made my life simple in
this regard:

./configure -with-apxs=/home2/local/apache/bin/apxs

-- 
Hell hath no limits, nor is circumscrib'd In one self-place; but where we
are is hell, And where hell is, there must we ever be --Christopher
Marlowe, *Doctor Faustus* (v, 121-24)


Re: crash with mod_jk 1.2.33

2012-03-15 Thread Thad Humphries
On Thu, Mar 15, 2012 at 11:12 AM, Christopher Schultz 
ch...@christopherschultz.net wrote:

 -BEGIN PGP SIGNED MESSAGE-
 Hash: SHA1

 Thad,

 On 3/15/12 9:39 AM, Thad Humphries wrote:
  Thanks. I hope I did this right. (Google is my friend, correct?) If
  not, please tell me what I should have done.

 Looks great. I'm not the best resource for debugging mod_jk crashes,
 but it definitely looks like either a problem directly in mod_jk or a
 problem that mod_jk does not detect and crashes anyway:

  Program terminated with signal 11, Segmentation fault. #0
  0xb720288c in jk_map_to_storage () from
  /srv/apache2/modules/mod_jk.so (gdb) backtrace #0  0xb720288c in
  jk_map_to_storage () from /srv/apache2/modules/mod_jk.so #1
  0x08081478 in ap_run_map_to_storage () [...]

 Would you mind logging a bug in bugzilla:

 https://issues.apache.org/bugzilla/enter_bug.cgi?product=Tomcat%20Connectors

 Please attach everything you have here in this post: the httpd log
 file, the mod_jk log file, and the text-rendering of the core dump.
 Keep the core file around in case someone wants to inspect it, but
 don't attach it to the bug just yet -- it's probably useless in its
 binary form.

 Thanks,
 - -chris


Thanks. I've submitted Bug
52921https://issues.apache.org/bugzilla/show_bug.cgi?id=52921.
(The version is marked as unspecified because Bugzilla did not yet have an
option for 1.2.33.)

-- 
Hell hath no limits, nor is circumscrib'd In one self-place; but where we
are is hell, And where hell is, there must we ever be --Christopher
Marlowe, *Doctor Faustus* (v, 121-24)


crash with mod_jk 1.2.33

2012-03-14 Thread Thad Humphries
Since October of last year, I have run the mod_jk connector v. 1.2.32. I
built the connector myself using Apache 2.2.15's apxs (I also built Apache
myself).

Today I downloaded, built, and installed the latest mod_jk connector, v.
1.2.33 (
http://mail-archives.apache.org/mod_mbox/tomcat-users/201203.mbox/%3C4F608246.4060601%40apache.org%3E
).

This version causes my Apache server to crash when serving most any page
I've tried--HTML, cgi-bin/test-cgi, GIF, etc. The only exceptions I've
found are Apache's htdocs/index.html page, server-info, and Tomcat served
pages. In the Apache error_log I see entries such as

[Wed Mar 14 14:54:45 2012] [notice] child pid 7729 exit signal Segmentation
fault (11)

I am running openSUSE Linux 11.4. From the connector's config.log:
uname -m = i686
uname -r = 2.6.37.6-0.11-desktop
uname -s = Linux
uname -v = #1 SMP PREEMPT 2011-12-19 23:39:38 +0100

Initially I tried building the connector using --with-apxs set to the apxs
in my copy of Apache 2.2.15. When that failed, I downloaded, built, and
installed Apache 2.2.22, then built mod_jk 1.2.33 with the apxs from that
version. Again, Apache (this time 2.2.22) crashes with mod_jk 1.2.33, but
runs fine with the 1.2.32 connector.

Any thoughts or ideas?

-- 
Hell hath no limits, nor is circumscrib'd In one self-place; but where we
are is hell, And where hell is, there must we ever be --Christopher
Marlowe, *Doctor Faustus* (v, 121-24)


Re: tomcat manager/status question

2011-11-14 Thread Thad Humphries
Did you restart Tomcat after changing/adding the tomcat-users.xml file?

On Mon, Nov 14, 2011 at 2:18 PM, Justin Larose justin.lar...@nexweb.orgwrote:

 Question:  I upgraded my Tomcat version to 6.0 using the
 apache-tomcat-6.0.33.exe file and I am trying to access the manager and the
 status pages here:  localhost:port\index.jsp
 I get to the default Tomcat page and select status and I get a login
 prompt. After entering the username and password that I have configured in
 the \conf\tomcat-users.xml
 file it just asks for the password again and again. After the 3rd attempt
 it will default to the 401 page that talks about configuring the
 tomcat-users.xml file. I also get the same error after selecting the
 manager link as well.

 Do I need to install another portion of Tomcat to get this feature to work?



 Thanks,
 Justin LaRose
 Database  Web Services Administrator
 NEXCOM
 (757) 631-3443
 justin.lar...@nexweb.org


 **
 This email and any files transmitted with it are intended solely for
 the use of the individual or agency to whom they are addressed.
 If you have received this email in error please notify the Navy
 Exchange Service Command e-mail administrator. This footnote
 also confirms that this email message has been scanned for the
 presence of computer viruses.

 Thank You!
 *
 **
 *




-- 
Hell hath no limits, nor is circumscrib'd In one self-place; but where we
are is hell, And where hell is, there must we ever be --Christopher
Marlowe, *Doctor Faustus* (v, 121-24)


Re: How to return jpg from another disk location

2011-09-13 Thread Thad Humphries
Ask your programmer to write a servlet that reads the image and writes it to
the output stream (ServletResponse.getOutputStream()). They should call
ServletResponse.setContentType(image/jpeg) before they write (or whatever
the MIME type is--image/png, image/gif, etc.).

I recommend they also check the value returned by
ServletResponse.getBufferSize() and read/write the image in chunks that
size. If getBufferSize() returns zero, I use 8K chunks.

On Tue, Sep 13, 2011 at 1:21 PM, Jeffrey Janner jeffrey.jan...@polydyne.com
 wrote:

 Assume Tomcat 6/Java 6 and must be OS agnostic.

 Our app currently is not distributable as a war file due to some decisions
 made long ago (properties files that need to be modified stored in WEB-INF,
 etc.).  I have found ways to work around most of the issues, mostly
 involving moving things from properties files or web.xml to the context.xml
 file.  However, there is one sticking point that is a problem.
 We allow the end user to replace a JPG file with one of their own, so that
 it gets displayed on certain pages instead of the default one we provide (a
 logo file).  It currently resides in a sub-directory of the exploded war
 file.  Rather than have the customer replace the file after every upgrade, I
 thought it would be nice to somehow define a location where the file exists,
 and the app could go get it when requested (sort of like a sym-link).  I
 don't have a problem making the location a path to a directory that contains
 the file and then have it send from there if the file exists, like a
 sym-link to the directory.  And I am sure I can get the developers to change
 the code to reference the new location (It currently resides in a directory
 with a lot of other graphics).  Also, the app is backended by a DB that
 supports BLOBS, so that could possibly be another possiblility.

 I am open to lots of suggestions and wonder if anyone has done this before.
  Also interested in potential security issues.

 As a windows example: http://somedomain.com/app/cust_graphics/logo.jpgwill be 
 delivered from C:/Program Files/mycompany/Customized
 information/logo.jpg.


 __

 Confidentiality Notice:  This Transmission (including any attachments) may
 contain information that is privileged, confidential, and exempt from
 disclosure under applicable law.  If the reader of this message is not the
 intended recipient you are hereby notified that any dissemination,
 distribution, or copying of this communication is strictly prohibited.

 If you have received this transmission in error, please immediately reply
 to the sender or telephone (512) 343-9100 and delete this transmission
 from your system.




-- 
Hell hath no limits, nor is circumscrib'd In one self-place; but where we
are is hell, And where hell is, there must we ever be --Christopher
Marlowe, *Doctor Faustus* (v, 121-24)


Re: Tomcat Versions

2011-07-21 Thread Thad Humphries
http://tomcat.apache.org/whichversion.html

On Thu, Jul 21, 2011 at 1:27 PM, Dark Before Dawn 
dark.before.d...@gmail.com wrote:

 Hi guys,
 I am reading this list for a few weeks now. And I wonder where the
 differences between different Tomcat versions ie 5.X , 6.X and 7.X are.
 Since versions for Tomcat 5 and 6 are still released from time to time. Are
 these maintenance releases only or for some linux distributions?
 Cheers Darky


-- 
Hell hath no limits, nor is circumscrib'd In one self-place; but where we
are is hell, And where hell is, there must we ever be --Christopher
Marlowe, *Doctor Faustus* (v, 121-24)


Re: RedHat and mod_jk

2011-07-16 Thread Thad Humphries
On Sat, Jul 16, 2011 at 12:09 AM, Christopher Schultz 
ch...@christopherschultz.net wrote:

 -BEGIN PGP SIGNED MESSAGE-
 Hash: SHA1

 Thad,

 On 7/15/2011 9:59 PM, Thad Humphries wrote:
  If you rely on RedHat, Novell, OpenSuSE, Unbuntu, etc. you can wait
  for some things until you are old and gray.

 Sing it. We're stuck on MySQL 5.0 in production because of this very
 fact. Sometimes I pine for the days of Gentoo. Only sometimes.

  Worse is to have some update that you haven't screened stomp on
  something you need.


Right, but when I roll my own, I can more easily keep multiple versions of a
program--Apache, Tomcat, Java, Firebird RDBMS, etc. and switch between them
if need be. (Life, however, has become easier since someone else here took
over the database stuff. Now I just run whatever version of Firebird
OpenSuSE is installing, and let production worry the final version.)


 Most package managers have provisions for holding a package (or the
 whole repo) at a certain level.

 Actually, the really nice thing about Debian, for instance, is that
 their releases are all stable (assuming you don't follow Sid like an
 idiot): you should never get stomped with anything. The bad news is that
 you have to wait for a major upgrade in order to get that next version
 of whatever - like MySQL 5.1 :(

 - -chris


-- 
Hell hath no limits, nor is circumscrib'd In one self-place; but where we
are is hell, And where hell is, there must we ever be --Christopher
Marlowe, *Doctor Faustus* (v, 121-24)


Re: How to send binary data in a form field via Java

2011-07-15 Thread Thad Humphries
If you are sending binary data--say because you user is downloading a file,
or your servlet is writing a image--you need to open a
javax.servlet.ServletOutputStream (
http://download.oracle.com/javaee/6/api/javax/servlet/ServletOutputStream.html
).

On Fri, Jul 15, 2011 at 11:23 AM, Paritosh Patel xygnu...@gmail.com wrote:

 I apologize in advance if this is not the correct mail list for such a
 question, but this is the closest one I could find.

 (I am using Tomcat 6.0.26 but my question is generic in nature)

 I have a Java client that talks to a servlet using several text fields. I
 now wanted to add a field that includes binary data (in this case a protocol
 buffer byte array). The data gets to the servlet, but the bytes are changed.
 Specifically, it appears that the encoding/decoding of bytes  127 are not
 the same as the original bytes.

 The client specified content-type to be application/x-www-form-urlencoded
 right now, but I have tried several others. Then, for encoding, I have tried
 encoding the bytes using URLEncoder

ByteArrayOutputStream osBytes = new ByteArrayOutputStream();
byte[] val = ...  // My binary data
String valStr = new String((byte[]) val);
osBytes.write(URLEncoder.encode(valStr, UTF-8).getBytes());

DataOutputStream  os = new
 DataOutputStream(urlConn.getOutputStream());
os.write(osBytes.toByteArray());

 Now, on the servlet side, I do a request.getParameter() to get the field.
 It is already decoded (I assume URL decoding) by the servlet container. Do I
 have control over the decoding?

 A portion of the byte array at the client is as follows...
 31 12  e  8 ac e2 cb 8c 90 26 10 90

 There are several variables, that I need to get right at the same time.
 1) content-type... what is the correct content type
 2) encoder... is URLEncoder the correct encoder?
 3) encode string... UTF-8 and US-ASCII do not work.
 4) do I have control over the decoding on the servlet side?
 5) anything else I need to worry about?

 Any help would be greatly appreciated.

 - Tosh




-- 
Hell hath no limits, nor is circumscrib'd In one self-place; but where we
are is hell, And where hell is, there must we ever be --Christopher
Marlowe, *Doctor Faustus* (v, 121-24)


Re: RedHat and mod_jk

2011-07-15 Thread Thad Humphries
It's been my experience that it's best *not* to rely on the distro for any
mission critical piece of software. Either download the binary from a
trusted source or build it yourself.  If you rely on RedHat, Novell,
OpenSuSE, Unbuntu, etc. you can wait for some things until you are old and
gray. Worse is to have some update that you haven't screened stomp on
something you need.

On Fri, Jul 15, 2011 at 5:27 PM, Mark Eggers its_toas...@yahoo.com wrote:

 ...
 Sounds like this is a topic that could be brought up on the Fedora
 development IRC (or mailing list). I imagine the immediate response would
 be, If you're interested, why don't you build and maintain the package.

 I can't see any technical reason for RedHat not to provide a package. The
 RPMs required for building it already exist in the distribution, the actual
 software build is trivial, and they already provide RPMs for things like
 mod_perl, mod_python, and svn.
 ...


-- 
Hell hath no limits, nor is circumscrib'd In one self-place; but where we
are is hell, And where hell is, there must we ever be --Christopher
Marlowe, *Doctor Faustus* (v, 121-24)


Re: Uploading large files and session timeout

2011-07-08 Thread Thad Humphries
How large are the files in question, and how long until the timeout? My app
does *a lot* of file uploading (and downloading), and I have not run across
this in the years I've used Tomcat. That's been since v3, but maybe I've
just never hit that limit.

Also, are you using a library like the Apache Common's FileUpload (
http://commons.apache.org/fileupload/) or have you written your own?

On Fri, Jul 8, 2011 at 10:25 AM, Sai Pullabhotla 
sai.pullabho...@jmethods.com wrote:

 We have an application that uploads files using a Servlet deployed in
 Tomcat 6. While this works most of the times, occasionally we run into
 issues uploading large files. If the upload takes longer then the
 session timeout, the session gets invalidated right after the upload.
 Tis means no further requests are accepted unless the user logs back
 in. Is this the expected behavior? Is there any way to work around
 this and keep the session active? I guess one way to fix this is to
 have a large session timeout like an hour or two, but we prefer not to
 do that for obvious reasons.

 Thanks in advance for your help.

 Sai Pullabhotla

 -
 To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
 For additional commands, e-mail: users-h...@tomcat.apache.org




-- 
Hell hath no limits, nor is circumscrib'd In one self-place; but where we
are is hell, And where hell is, there must we ever be --Christopher
Marlowe, *Doctor Faustus* (v, 121-24)


Re: Uploading large files and session timeout

2011-07-08 Thread Thad Humphries
So your images are being stored to a database. As blobs? That's a difference
between our apps: I store the images to a repository and keep a short record
of the in a database.

I can't advise you on Tomcat, but if the database is the bottleneck, a
workaround might be to write your images to temporary files, and use a
separate process to move those images into the database.

On Fri, Jul 8, 2011 at 3:03 PM, Sai Pullabhotla 
sai.pullabho...@jmethods.com wrote:

 Just to give more details...

 The session timeout setting is stored in our application's database.
 Admins can change the session timeout from the UI we provide. We did
 this to make it easy for our customers to set the desired timeout
 rather than telling them going into web.xml and updating the timeout.

 After a successful login we create the session, and set the timeout on
 each session that is created using a HTTPSessionListener that is
 attached to the context.

 As far as I know, the session's lastAccessTime gets updated on each
 request from the client (by the container), and there is no public API
 to update the last access time. Perhaps can be done if we find the
 Tomcat's internal session object, but prefer not to do it. Am I
 correct or am I missing something?

 Sai Pullabhotla



 On Fri, Jul 8, 2011 at 9:31 AM, André Warnier a...@ice-sa.com wrote:
  Sai Pullabhotla wrote:
 
  We have an application that uploads files using a Servlet deployed in
  Tomcat 6. While this works most of the times, occasionally we run into
  issues uploading large files. If the upload takes longer then the
  session timeout, the session gets invalidated right after the upload.
  Tis means no further requests are accepted unless the user logs back
  in. Is this the expected behavior? Is there any way to work around
  this and keep the session active? I guess one way to fix this is to
  have a large session timeout like an hour or two, but we prefer not to
  do that for obvious reasons.
 
  Responding in the absolute,
  if there is a session timeout functionality, then it must be based on
  a) a timeout value (a number of seconds e.g.)
  b) somewhere, an indicator of when the session was last active, which
 gets
  updated at some point
 
  So the problem would boil down to knowing where this last active time
 is
  stored, and update it regularly during the file upload.
 
  -
  To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
  For additional commands, e-mail: users-h...@tomcat.apache.org
 
 

 -
 To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
 For additional commands, e-mail: users-h...@tomcat.apache.org




-- 
Hell hath no limits, nor is circumscrib'd In one self-place; but where we
are is hell, And where hell is, there must we ever be --Christopher
Marlowe, *Doctor Faustus* (v, 121-24)


Re: mod_jk restarting during uploads of large files

2011-07-07 Thread Thad Humphries
André,

I believe the file upload you are talking about is the FileUpload project
from the Apache Commons: http://commons.apache.org/fileupload/

This does indeed have a disk-based implementation of an upload file. The
package is org.apache.commons.fileupload.disk and it implements the
project's org.apache.commons.fileupload.FileItem interface.

Y'all can check the JavaDoc for DiskFileItem and DiskFileItemFactory. There
are some good, out-of-the-box-ready examples, too. Suffice it to say that
DiskFileItemFactory.DEFAULT_SIZE_THRESHOLD--The default threshold above
which uploads will be stored on disk.--is 10K.

I'm using FileUpload v1.2.1 and it has worked flawlessly, both as is or with
a FileCleaningTracker from the Commons I/O project. We've tested it with
files a couple hundred bytes to over an MB, and it's worked fine on Linux,
Sun, MacOS, and Windows, with and without mod_jk, with and without SSL.

On Thu, Jul 7, 2011 at 10:27 AM, André Warnier a...@ice-sa.com wrote:

 Hi.

 Since this concerns large files upload, I wonder if something along these
 lines is happening :

 A file upload is a POST request, usually with an
 enctype=multipart/form-data format (similar to an email with attachments).
 Furthermore, for sending this file, the browser is going to encode the file
 using Base64 encoding, which increases the brutto size by at least 1/3.  So
 your 500 MB file becomes something like 700 MB in the POST.

 Now let's imagine that by default Tomcat is buffering this in memory until
 it has read the whole POST and can start parsing it.  That could easily
 cause some memory issues.

 I seem to remember that there existed a parameter somewhere telling Tomcat
 how much it should buffer in memory before it starts offloading that to
 disk, but I do not remember where.  Maybe it was in the former FileUpload
 project though..



 mar...@alt-v.co.uk wrote:

 Yeh, I've worked out what was happening, seems that tomcat was being
 killed by the system running out of memory, which was happening without any
 log messages on the system at all, which was rather unhelpful and left me
 completely stumped for a while.  However adding extra swap space and memory
 seem to fix the problem.

 Thanks anyway for the reply

 Quoting Rainer Jung rainer.j...@kippdata.de:

  It seems it is not a mod_jk problem. mod_jk never shuts down Tomcat, but
 obviously your Tomcat shuts down during processing the request.

 I would

 - update Tomcat *and* the service wrapper (jdvc) to the most recent
 patch update (e.g. Tomcat 5.5.33).

 - run Tomcat once without the service wrapper to decide, whether the
 problem comes from the wrapper or from Tomcat respectively your web
 application.

 Regards,

 Rainer

 On 04.07.2011 18:27, mar...@alt-v.co.uk wrote:

 Hi
 I have a problem when uploading files to tomcat through mod_jk.  When
 uploading smaller files (100kb) everything seems to work fine, but when
 uploading files of about 1.5Mb it seems as if the server is restarting
 and causing a 503 error.  I've tried modifying timeouts in both apache
 and tomcat, still i get this output on the catalina.err file: (sorry for
 long log files)


 04/07/2011 15:19:31 7211 jsvc.exec error: Shutdown or reload already
 scheduled
 04/07/2011 15:19:31 7211 jsvc.exec error: Shutdown or reload already
 scheduled
 04/07/2011 15:19:31 7211 jsvc.exec error: Shutdown or reload already
 scheduled
 04/07/2011 15:19:31 7211 jsvc.exec error: Shutdown or reload already
 scheduled
 04/07/2011 15:19:31 7211 jsvc.exec error: Shutdown or reload already
 scheduled
 04/07/2011 15:19:31 7211 jsvc.exec error: Shutdown or reload already
 scheduled
 04/07/2011 15:19:31 7211 jsvc.exec error: Shutdown or reload already
 scheduled
 04/07/2011 15:19:31 7211 jsvc.exec error: Shutdown or reload already
 scheduled
 04/07/2011 15:19:31 7211 jsvc.exec error: Shutdown or reload already
 scheduled
 04/07/2011 15:19:31 7211 jsvc.exec error: Shutdown or reload already
 scheduled
 04/07/2011 15:19:31 7211 jsvc.exec error: Shutdown or reload already
 scheduled
 04/07/2011 15:19:31 7211 jsvc.exec error: Shutdown or reload already
 scheduled
 04/07/2011 15:19:31 7211 jsvc.exec error: Shutdown or reload already
 scheduled
 04/07/2011 15:19:31 7211 jsvc.exec error: Shutdown or reload already
 scheduled
 04/07/2011 15:19:31 7211 jsvc.exec error: Shutdown or reload already
 scheduled
 04/07/2011 15:19:31 7211 jsvc.exec error: Shutdown or reload already
 scheduled
 04/07/2011 15:19:31 7211 jsvc.exec error: Shutdown or reload already
 scheduled
 04/07/2011 15:19:31 7211 jsvc.exec error: Shutdown or reload already
 scheduled
 04/07/2011 15:19:31 7211 jsvc.exec error: Shutdown or reload already
 scheduled
 04/07/2011 15:19:31 7211 jsvc.exec error: Shutdown or reload already
 scheduled
 04/07/2011 15:19:31 7211 jsvc.exec error: Shutdown or reload already
 scheduled
 04/07/2011 15:19:31 7211 jsvc.exec error: Shutdown or reload already
 scheduled
 04/07/2011 15:19:31 7211 jsvc.exec error: Shutdown or reload 

Re: What the packages needed to install tomcat5 core using yum in Fedora 14

2011-05-10 Thread Thad Humphries
All Tomcat requires is the Java JRE. For the versions, see
http://tomcat.apache.org/whichversion.html

My recommendation is to save yourself a lot of grief by not relying on your
Linux distro for either Java or Tomcat. Pick the versions of each that you
want/require, download them from Oracle and Apache, install each, set your
environment, and go. This way  updates are not applied inadvertently. I'm
dealing with a known set-up that I can replicate elsewhere, and I'm better
able to pinpoint an error when something goes wrong.

On Mon, May 9, 2011 at 9:48 PM, Varuna Seneviratna 
varunasenevira...@gmail.com wrote:

 What the packages needed to install tomcat5 core using yum

 [Code:]

 yum search tomcat5

  Loaded plugins: langpacks, presto, refresh-packagekit
 Adding en_GB to language list
 === Matched: tomcat5
 ===
 jakarta-commons-collections-tomcat5.i686 : Jakarta Commons Collection
 dependency
 : for Tomcat5
 struts-webapps-tomcat5.i686 : Sample struts webapps for tomcat5
 tomcat5-jasper-javadoc.noarch : Javadoc generated documentation for
  : tomcat5-jasper
 glite-security-trustmanager-tomcat5.noarch : Java trustmanager interface
   : supporting a GSI grid name
 space
 jakarta-commons-dbcp-tomcat5.noarch : DBCP dependency for Tomcat5
 jakarta-commons-pool-tomcat5.i686 : Pool dependency for Tomcat5
 tomcat5-jasper.noarch : Compiler JARs and associated scripts for tomcat5
 tomcat5-jsp-2.0-api-javadoc.noarch : Javadoc generated documentation for
   : tomcat5-jsp-2.0-api
 tomcat5-servlet-2.4-api-javadoc.noarch : Javadoc generated documentation
 for
   : tomcat5-servlet-2.4-api
 tomcat5.noarch : Apache Servlet/JSP Engine, RI for Servlet 2.4/JSP 2.0 API
 tomcat5-admin-webapps.noarch : Administrative web applications for Apache
 Tomcat
 tomcat5-common-lib.noarch : Libraries needed to run the Tomcat Web
 container
  : (part)
 tomcat5-jasper-eclipse.noarch : Jasper OSGi Eclipse plugin
 tomcat5-jsp-2.0-api.noarch : Apache Tomcat Servlet and JSP implementation
   : classes
 tomcat5-server-lib.noarch : Libraries needed to run the Tomcat Web
 container
  : (part)
 tomcat5-servlet-2.4-api.noarch : Apache Tomcat Servlet implementation
 classes
 tomcat5-webapps.noarch : Web applications for Apache Tomcat

 [Code/]
 From the above what are the packages which should be installed to to
 get tomcat5 core installed?

 -
 To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
 For additional commands, e-mail: users-h...@tomcat.apache.org




-- 
Hell hath no limits, nor is circumscrib'd In one self-place; but where we
are is hell, And where hell is, there must we ever be --Christopher
Marlowe, *Doctor Faustus* (v, 121-24)


Re: storing images

2011-05-06 Thread Thad Humphries
I'd store the image to java.io.tmpdir and retrieve it with a servlet. I
doing this now with my Ajax application.

On Thu, May 5, 2011 at 2:19 PM, alexis alz...@gmail.com wrote:

 Hello all, im facing an issue, ive been testing for a while different
 approaches without success.

 I have a servlet that basically does

 . creates an image
 . store the image on disk
 . returns an html img tag pointing to the stored image.

 reason why the servlet doesnt returns the image directly using a response
 type image/png is the servlet is called from an ajax script, this ajax
 script renders the inner text inside a div on a jsp page on the same context
 that the server runs. ajax can only render html on divs, there's no way to
 return binary content (the image) from the servlet to the ajax script.


 So, i have to create the image on the servlet (done) , store the image on
 the disk (done), and return the img tab also done. Thing is, where im able
 to store the image from the servlet im not able to read it from the jsp.

 I tried with /tmp, i tried with servletcontext.getpath to store the file on
 that dir, nothing seems to work. where should i store and reference those
 images to be written by the servlet and read by the jsp?

 thanks in advance


 -
 To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
 For additional commands, e-mail: users-h...@tomcat.apache.org




-- 
Hell hath no limits, nor is circumscrib'd In one self-place; but where we
are is hell, And where hell is, there must we ever be --Christopher
Marlowe, *Doctor Faustus* (v, 121-24)


Re: Global Default Error Page

2011-03-22 Thread Thad Humphries
Just a guess, but maybe by adding it to
$CATALINA_HOME/webapps/ROOT/WEB-INF/web.xml and putting the error page in
$CATALINA_HOME/webapps/ROOT

On Tue, Mar 22, 2011 at 10:54 AM, Jonathan Rosenberg shmol...@gmail.comwrote:

 How can I create a custom 404 error page for the case where the URL
 maps to a non-existent webapp?

 I know how to do this for an individual webapp, but can't figure put
 where the global default error page comes from.


-- 
Hell hath no limits, nor is circumscrib'd In one self-place; but where we
are is hell, And where hell is, there must we ever be --Christopher
Marlowe, *Doctor Faustus* (v, 121-24)


Re: ssl application

2011-02-01 Thread Thad Humphries
While doing some SSL research last week, I stumbled on this:
https://confluence.sakaiproject.org/display/DOC/Sakai+Admin+Guide+-+Advanced+Tomcat++%28and+Apache%29+Configuration

If you wish to secure the entire tomcat installation (which can be done
regardless of how you provide SSL), add the following to
TOMCAT_HOME/conf/web.xml inside the web-app tags:

!-- redirect all traffic to the SSL port --
security-constraint
  web-resource-collection
web-resource-nameAutomatic SLL Forwarding/web-resource-name
url-pattern/*/url-pattern
  /web-resource-collection
  user-data-constraint
transport-guaranteeCONFIDENTIAL/transport-guarantee
  /user-data-constraint
/security-constraint

It worked for me (Linux, Tomcat 6.0.30, JRE 1.5.0_22).

On Tue, Feb 1, 2011 at 1:31 PM, robert.jen...@surecomp.com wrote:

 Hello all...

 I have configured ssl on tomcat 7 and I am able to access my application
 via ssl and non-ssl. What I am trying to figure out is how to configure
 tomcat so that my application is only available via ssl. Is there a way to
 do this? I have read the tomcat 7 document on ssl, but, did not take note of
 anything indicating how to do this.

 Thanks

 Bob Jenkin

 This mail was sent via Mail-SeCure System.





-- 
Hell hath no limits, nor is circumscrib'd In one self-place; but where we
are is hell, And where hell is, there must we ever be --Christopher
Marlowe, *Doctor Faustus* (v, 121-24)


Re: SSL not working

2011-01-28 Thread Thad Humphries
I've been fooling around *a lot* lately with SSL, so I thought I'd give this
a try.  I'm not very experienced, but I'll offer my two cents.

First of all, what version of Tomcat, Java, etc. are you running? Such a
statement is *de rigueur* for practically any question to this forum. My
system looks like

** Server: SuSE 11.3 (2.6.34.7-0.7-desktop #1 SMP PREEMPT 2010-12-13
11:13:53 +0100 i686 i686 i386 GNU/Linux)
** Tomcat 6.0.30
** Java:  JRE 1.5.0_22 (though my keystore was self-generated with JDK
1.6.0_23)

That said, the connector you describe is working for me, even when I
intentionally misname my keyAlias.  However I have only one entry in my
keystore.  I'm guessing that it can screw up if you have more than one and
you give the wrong alias.

You're using a JSSE implementation, correct? Run

$ keytool -list -keystore $CATALINA_HOME/conf/keystore.jks -v

and see what you get.


(BTW, my self-generated openssl can be read with

$ keytool -printcert -file /srv/apache2/conf/server.crt -v

I say this only because I've also been fiddling, successfully, with the APR
and mod_jk connector.)

On Fri, Jan 28, 2011 at 8:06 AM, spr...@gmx.eu wrote:

 Hi,

 I did it now so many times - it always worked - configuring tomcat for SSL.

 Today: New server, new certificate.

 Create new keystore, imported root, intermediate and server certificate,
 configured the connector, same as usual.

 But... http does not work. No error in tomcats log, nothing. Browser says
 that it cannot load the page due to a connection problem, maybe security
 issue.

 How can I debug this ssl problem?

  Connector
SSLEnabled=true
clientAuth=want
maxThreads=150
port=8443
protocol=org.apache.coyote.http11.Http11NioProtocol
scheme=https
secure=true
sslProtocol=TLS
keystoreFile=conf/tomcat.jks
keystoreType=JKS
keyAlias=tomcat
keystorePass=changeit
/

 Thank you


 -
 To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
 For additional commands, e-mail: users-h...@tomcat.apache.org




-- 
Hell hath no limits, nor is circumscrib'd In one self-place; but where we
are is hell, And where hell is, there must we ever be --Christopher
Marlowe, *Doctor Faustus* (v, 121-24)


Re: web.xml cant load because of listener

2010-11-03 Thread Thad Humphries
Is listener in the proper place? I think order matters in web.xml.  I load
2 listeners after my app's description and before my servlet tags.

On Wed, Nov 3, 2010 at 12:14 AM, Will Sumekar will.sume...@gmail.comwrote:

 Hi

 When I put these lines:

  listener
listener-class

  org.springframework.web.context.ContextLoaderListener
/listener-class
  /listener

 my appln can't load at all. When I go to http://localhost:8080/app it's
 not
 loaded. But when I remove those lines it loads correctly. I've put the
 necessary lib containing
 org.springframework.web.context.ContextLoaderListener in ./app/WEB-INF/lib.

 My setup is Tomcat 5.5.31. Context-param is set:

  context-param
param-namecontextConfigLocation/param-name


param-valueclasspath:springContext.xml/param-value
  /context-param

 No stack trace is shown. The error message in log is:

 03-Nov-2010 10:21:48  INFO HostConfig:863 - Deploying web application
 archive
 wma.war
 03-Nov-2010 10:21:49 ERROR StandardContext:4253 - Error listenerStart
 03-Nov-2010 10:21:49 ERROR StandardContext:4280 - Context [/wma] startup
 failed
 due to previous errors
 When I set the logging to DEBUG level, I don't see anything extra ordinary.


 Thanks

 Will




-- 
Hell hath no limits, nor is circumscrib'd In one self-place; but where we
are is hell, And where hell is, there must we ever be --Christopher
Marlowe, *Doctor Faustus* (v, 121-24)


Re: Java update from Apple broke Tomcat

2010-11-01 Thread Thad Humphries
There's a Mac mini in our QA shop that is running this version of Java with
Tomcat 6.0.26 and testing my app without a problem.

On Mon, Nov 1, 2010 at 1:55 PM, Rob Tanner rtan...@linfield.edu wrote:

 Hi,

 While I run production on Linux servers, I do my development on my iMac.
 Last week, I ran the most recent Apple Java upgrade , and now Tomcat (which
 is a critical part of my development environment) won't start up.  I get
 the
 error:

 Nov 1, 2010 8:58:54 AM org.apache.catalina.startup.Bootstrap
 initClassLoaders
 SEVERE: Class loader creation threw exception
 java.lang.NoSuchFieldError: IS_DIR
 at
 org.apache.catalina.startup.Bootstrap.createClassLoader(Bootstrap.java:167)
 at
 org.apache.catalina.startup.Bootstrap.initClassLoaders(Bootstrap.java:92)
 at org.apache.catalina.startup.Bootstrap.init(Bootstrap.java:207)
 at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:391)

 Other details:

 java version 1.6.0_22
 Java(TM) SE Runtime Environment (build 1.6.0_22-b04-307-10M3261)
 Java HotSpot(TM) 64-Bit Server VM (build 17.1-b03-307, mixed mode)

 Tomcat version:  6.0.18 and 6.0.29 ‹ both fail to start, throwing the same
 exception

 From the error, it appears that things are missing from the update (or at
 least one field is).  Has anyone else seen this?  Is there a known
 work-around?

 Thanks,

 Rob Tanner
 Linfield College




-- 
Hell hath no limits, nor is circumscrib'd In one self-place; but where we
are is hell, And where hell is, there must we ever be --Christopher
Marlowe, *Doctor Faustus* (v, 121-24)


Re: tomcat caching of static files

2010-08-05 Thread Thad Humphries
Are you sure it's Tomcat doing the caching?  I've found that both Firefox
and IE will cache CGI, JSP, servlet, and other dynamic results.  This has
been true going back to when the old Mozilla 1.x had a preference for
*never* caching.

For GET calls were the results underlying content might change and the
browser not see it, I've taken to adding a bozo param just so the URL is
different:  myServlet+?...+bozo= + System.currentTimeMillis()

On Thu, Aug 5, 2010 at 4:42 PM, swoodbury swoodb...@att.net wrote:


 Hi.

 I have a tomcat - struts web application.

 I have a thread which creates a static datafile each night.   when the user
 accesses the corresponding .do action, that action reads the static file
 and
 presents formatted output.  if the file isn't there for whatever reason, it
 creates it dynamically and then presents the formatted output (still by
 reading the file it just created).

 My problem is that the nightly re-creation works fine, i can see changes in
 the file, and the mod time of the file is updated.  but Tomcat is evidently
 caching the old contents because the old content is still presented to the
 user.  But if i remove the static file and thus force the action to
 re-create it, the new data is presented to the user.  things also work if i
 manually edit the file (say with vi) and save it, the user again gets
 updated information.  but if the thread creates the data, the action never
 sees it.

 Also, both the thread and the action call the same method when generating
 the static data.

 any ideas?
 --
 View this message in context:
 http://old.nabble.com/tomcat-caching-of-static-files-tp29356390p29356390.html
 Sent from the Tomcat - User mailing list archive at Nabble.com.


 -
 To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
 For additional commands, e-mail: users-h...@tomcat.apache.org




-- 
Hell hath no limits, nor is circumscrib'd In one self-place; but where we
are is hell, And where hell is, there must we ever be --Christopher
Marlowe, *Doctor Faustus* (v, 121-24)


Re: PDF to acrobat

2010-06-29 Thread Thad Humphries
What happens on the browser end is entirely up to the user.  It's subject to
the browser they are using, whatever browser plug-ins they've installed, and
how they've set those plug-ins.

On Tue, Jun 29, 2010 at 3:08 PM, Dola Woolfe dolac...@yahoo.com wrote:

 Hi,

 I set

 response.setContentType(application/pdf);


 as a result, the served up content triggers a Download rather than
 opening acrobat within browser window.


 Do I get to control what happens at client end? I want acrobat to open
 within browser.

 How do I achieve that?

 Thanks,

 Dola




 -
 To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
 For additional commands, e-mail: users-h...@tomcat.apache.org




-- 
Hell hath no limits, nor is circumscrib'd In one self-place; but where we
are is hell, And where hell is, there must we ever be --Christopher
Marlowe, 'Doctor Faustus' (v, 121-24)


Re: PDF to acrobat

2010-06-29 Thread Thad Humphries
Comment inline below.

On Tue, Jun 29, 2010 at 3:23 PM, Zachary Valentiner
zvalenti...@gmail.comwrote:

 Hi Dola,

 Setting the content type to application/octet-stream will force a
 download. If I recall my headers correclty, setting application/pdf is as
 close as you can get to telling it to open in the browser without embedding
 it in an HTML file directly and thereby forcing the browser to use a plugin
 to render the PDF.


 application/octet-stream is one way, but it's by no means bullet-proof.
If the file name has an extension, some version of IE will blow off the MIME
type and do what they damn well please based on the extension.


 Someone might have some other tip, but this is also somewhat browser/plugin
 dependent, e.g., I notice different behavior between Firefox and Chrome,
 even when opening the same links to the same PDFs.

 Good luck,

 Zach


A while back I did some digging around and found that for all browsers I
should call response.addHeader(Content-Disposition, attachment;
filename=myfile.pdf).  Then for IE I call
response.setContentType(application/force-download; name=myfile.pdf)
while for Firefox and Safari I use
response.setContentType(application/octet-stream; name=myfile.pdf) works
best.

-- 
Hell hath no limits, nor is circumscrib'd In one self-place; but where we
are is hell, And where hell is, there must we ever be --Christopher
Marlowe, 'Doctor Faustus' (v, 121-24)


Re: Keeping tomcat up-to-date on linux

2010-05-19 Thread Thad Humphries
Exactly right, Hassan. I think it is extremely unwise to leave any critical
portion of one's system--personal, development, or production--at the hands
of the distro. I've used Linux for over a decade, and install Apache, Java,
Tomcat, etc. by hand. ALWAYS. Oft times I build Apache myself.

On Wed, May 19, 2010 at 10:25 PM, Hassan Schroeder 
hassan.schroe...@gmail.com wrote:

 On Wed, May 19, 2010 at 7:03 PM, Dale Ogilvie
 dale.ogil...@trimble.co.nz wrote:

  What do people do to keep their tomcat patched up?

 I watch this list for announcements of new releases and install them :-)

 Of course, reading the release notes lets me decide how urgently that
 needs to happen and/or how much testing I want to do before going to
 production with a new version.

 FWIW,


-- 
Hell hath no limits, nor is circumscrib'd In one self-place; but where we
are is hell, And where hell is, there must we ever be --Christopher
Marlowe, 'Doctor Faustus' (v, 121-24)


Re: best practice for resources folder

2010-05-17 Thread Thad Humphries
Rainer,

I wasn't aware of this library, but it looks very handy.  Currently I a
properties file in my WAR file.  Being able to make changes to an external
file with fallback to this one would be good.  My questions where one might
put that external file where it could be found by a servlet.  The System
property user.home is the one place I can think that would be available
regardless of the servlet engine the customer site uses. Do you have other
ideas?

Thanks.

On Mon, May 17, 2010 at 12:29 PM, Rainer Jung rainer.j...@kippdata.dewrote:

 ...
 I should also mention commons-configuration, which is a very powerful
 framework for configuration files. It supports many things out-of-the-box,
 like interpolation of system poperties, reloading changed files, including
 config files in other config files etc.


 Regards,

 Rainer
 ...



-- 
Hell hath no limits, nor is circumscrib'd In one self-place; but where we
are is hell, And where hell is, there must we ever be --Christopher
Marlowe, 'Doctor Faustus' (v, 121-24)


Re: Where do compiled JSP - java files go?

2010-04-28 Thread Thad Humphries
On my Mac (10.5.8), I'd find it in
/Library/Tomcat/work/Catalina/localhost/[my-web-app]/org/apache/jsp

On Wed, Apr 28, 2010 at 9:41 AM, laredotornado laredotorn...@gmail.comwrote:


 Hi,

 I'm using Tomcat 6.0.26 on Mac 10.6.3.  I'm troubleshooting a
 NullPointerException occurring in one of my JSPs and all I'm told from the
 stack trace is what line of the compiled Java file it occurred in.
  However,
 I can't find this file anywhere on my file system.  Where do they usually
 get kept and how can I tell Tomcat to keep them around, assuming it is
 deleting them after a certain point.

 Thanks, - Dave


 java.lang.NullPointerException
at

 org.apache.jsp.WEB_002dINF.views.meetings.results_jsp._jspService(results_jsp.java:866)
at
 org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
at

 org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:377)
at
 org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:313)
at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:260)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)

 --
 View this message in context:
 http://old.nabble.com/Where-do-compiled-JSP--%3E-java-files-go--tp28387967p28387967.html
 Sent from the Tomcat - User mailing list archive at Nabble.com.


 -
 To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
 For additional commands, e-mail: users-h...@tomcat.apache.org




-- 
Hell hath no limits, nor is circumscrib'd In one self-place; but where we
are is hell, And where hell is, there must we ever be --Christopher
Marlowe, 'Doctor Faustus' (v, 121-24)


Re: Installing Java Advanced Imaging In Tomcat.

2010-04-26 Thread Thad Humphries
That was me, but I had a different problem.  (1) I was running Tomcat
6.0.26; and (2) my servlet could find the classes, but the
IteratorImageReader returned by ImageIO.
getImageReadersByFormatName(tiff) returned false for hasNext().

On Mon, Apr 26, 2010 at 6:49 PM, Stephen Souness sou...@hotmail.com wrote:

 ...

 I think someone reported something similar a few weeks back.

 The response that worked for them was:

 Try disabling the JreMemoryLeakPreventionListener in conf/server.xml, just
 in
 case it was interfering with the JAI registration.



-- 
Hell hath no limits, nor is circumscrib'd In one self-place; but where we
are is hell, And where hell is, there must we ever be --Christopher
Marlowe, 'Doctor Faustus' (v, 121-24)


Re: Installing Java Advanced Imaging In Tomcat.

2010-04-23 Thread Thad Humphries
I agree with Pidster--remove the other JAI jars.

I use JAI and JAI ImageIO in my application.  I have three JAI jar files in
my WEB-INF/lib directory:  jai_codec.jar, jai_core.jar, and jai_imageio.jar

If you need JAI in $JAVA_HOME, I recommend you install a second copy of the
JDK without JAI, and use this for launching Tomcat.  While I have JAI
installed in my Java 6 tree, I start Tomcat with a Java 5 tree that does not
have JAI installed.  At the start of $CATALINA_HOME/bin/catalina.sh, I've
added

JAVA_HOME=/local/jdk1.5.0_noJAI
JRE_HOME=$JAVA_HOME/jre
JAVA_OPTS=-Djava.awt.headless=true -Dcom.sun.management.jmxremote=true
-Xmx256m

This second JDK could be Java 6, but I run Tomcat with Java 5 (and set javac
source and target to 1.5) because my application must run on older
Macintoshes that do not support Java 6.  (Headless is set because my
application also must run on systems without a DISPLAY.)

My application installs and runs in Tomcat on Linux, Mac, and Windows.

On Fri, Apr 23, 2010 at 4:48 PM, Pid p...@pidster.com wrote:

 On 23/04/2010 21:31, aditya siram wrote:
  Hi all,
  I am having issues using jai [1]  with a Tomcat webapp. I am running
  the tomcat6 package installed from the Ubuntu repos.
 
  The webapp does some image decompression and is unable to detect
  CLibJpegImageReader which is a class in the jai_imageio.jar.
 
  I have copied this jar file to my WEB-INF/lib directory and also to
  /var/lib/tomcat6/lib and /usr/share/tomcat6/lib hoping that it would
  work from one of these locations. Additionally it is in my
  JAVA_HOME/jre/lib/ext directory so it should be available after the
  bootstrap phase.
 
  I know that JAI is installed correctly because a stand-alone app is
  able to access the required class.

 The jar should only be present in one location at any given time,
 multiple locations will almost certainly produce unexpected conditions.

 Which version of Java are you using?


 p

  [1] http://java.sun.com/javase/technologies/desktop/media/jai/
 
  -
  To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
  For additional commands, e-mail: users-h...@tomcat.apache.org
 





-- 
Hell hath no limits, nor is circumscrib'd In one self-place; but where we
are is hell, And where hell is, there must we ever be --Christopher
Marlowe, 'Doctor Faustus' (v, 121-24)


Re: The question of automatic restart Tomcat

2010-04-13 Thread Thad Humphries
This looks to be a feature of Java HotSpot, and available since v1.4:
http://java.sun.com/javase/technologies/hotspot/vmoptions.jsp

On Tue, Apr 13, 2010 at 4:19 PM, Gregor Schneider rc4...@googlemail.comwrote:

 On Tue, Apr 13, 2010 at 7:46 PM, Jon Brisbin
 jon.bris...@npcinternational.com wrote:
  We use automatic restarts on OutOfMemory errors and it works
 fantastically. I don't do it the way described here, though. I use the JVM's
 -XX:OnOutOfMemoryError option. I add the following to CATALINA_OPTS:
 
  -XX:OnOutOfMemoryError=/usr/sbin/restart_tcserver
 
 I'm not aware of that option within my standard sun jdk 1.6.x - what
 Java-version are you running offering this really useful feature?

 Cheers

 Gregor


-- 
Hell hath no limits, nor is circumscrib'd In one self-place; but where we
are is hell, And where hell is, there must we ever be --Christopher
Marlowe, 'Doctor Faustus' (v, 121-24)


Problems with ImageIO

2010-04-07 Thread Thad Humphries
I believe I'm seeing the same problem that Simone (msg #210515) is having
(this after running Tomcat for YEARS without a hitch).

I use JAI and JAI-IMAGE I/O in various servlets.  I'm running Java 1.5.17
without the JAI or JAI-IMAGE I/O installed.  I've put jai_codec.jar,
jai_core.jar, and jai_imageio.jar in my application's WEB-INF/lib directory.

My application runs without a hitch on Tomcat 6.0.14 on a Linux server (and
has run fine for over a year).  I have also run it on a Macintosh with
Tomcat 6.0.20.

Today I installed Tomcat 6.0.26 on Linux and tried running my webapp.  Under
this version of Tomcat, IteratorImageReader returned by
ImageIO.getImageReadersByFormatName(tiff) returns false for hasNext().
What gives?

Are you seeing this, Simone?

-- 
Hell hath no limits, nor is circumscrib'd In one self-place; but where we
are is hell, And where hell is, there must we ever be --Christopher
Marlowe, 'Doctor Faustus' (v, 121-24)


Re: Problems with ImageIO

2010-04-07 Thread Thad Humphries
JreLeakPreventionListener ?  I'm sorry, I don't follow.  Is there a
monitor I can run?

If you mean the Find leaks button in the Manager webpage (
http://localhost:8080/manager/html/findleaks), no, none are found.

On Wed, Apr 7, 2010 at 3:24 PM, Mark Thomas ma...@apache.org wrote:

 On 07/04/2010 19:38, Thad Humphries wrote:

 I believe I'm seeing the same problem that Simone (msg #210515) is having
 (this after running Tomcat for YEARS without a hitch).

 I use JAI and JAI-IMAGE I/O in various servlets.  I'm running Java 1.5.17
 without the JAI or JAI-IMAGE I/O installed.  I've put jai_codec.jar,
 jai_core.jar, and jai_imageio.jar in my application's WEB-INF/lib
 directory.

 My application runs without a hitch on Tomcat 6.0.14 on a Linux server
 (and
 has run fine for over a year).  I have also run it on a Macintosh with
 Tomcat 6.0.20.

 Today I installed Tomcat 6.0.26 on Linux and tried running my webapp.
  Under
 this version of Tomcat, IteratorImageReader  returned by
 ImageIO.getImageReadersByFormatName(tiff) returns false for hasNext().
 What gives?


 JreLeakPreventionListener ?

 Mark



 -
 To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
 For additional commands, e-mail: users-h...@tomcat.apache.org




-- 
Hell hath no limits, nor is circumscrib'd In one self-place; but where we
are is hell, And where hell is, there must we ever be --Christopher
Marlowe, 'Doctor Faustus' (v, 121-24)


Re: Problems with ImageIO

2010-04-07 Thread Thad Humphries
Ah! Gotcha.

Thanks, Chuck, Mark.  That fixed it.

(Sorry for being so dense.  Since Tomcat moved from v3.2 to v4, it's been
about the most trouble-free app I use.  I haven't fussed with configuration
in YEARS.)

On Wed, Apr 7, 2010 at 3:48 PM, Caldarale, Charles R 
chuck.caldar...@unisys.com wrote:

  From: Thad Humphries [mailto:thad.humphr...@gmail.com]
  Subject: Re: Problems with ImageIO
 
  JreLeakPreventionListener ?

 I believe Mark was suggesting that you try disabling the
 JreMemoryLeakPreventionListener in conf/server.xml, just in case it was
 interfering with the JAI registration.

  - 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: users-unsubscr...@tomcat.apache.org
 For additional commands, e-mail: users-h...@tomcat.apache.org




-- 
Hell hath no limits, nor is circumscrib'd In one self-place; but where we
are is hell, And where hell is, there must we ever be --Christopher
Marlowe, 'Doctor Faustus' (v, 121-24)


Re: Problems with ImageIO

2010-04-07 Thread Thad Humphries
Chuck,

Setting the JreMemoryLeakPreventionListener attribute
appContextProtection=false also fixes the problem.

My read of documentation makes me think

(1) This leak situation may arise when I use stop or reload on my
webapp.
(2) It can also be prevented by placing my JAI and JAI-IMAGE I/O jars in
CATALINA_HOME/lib or JAVA_HOME/jre/lib/ext vs my WEB-INF/lib.

Is this read correct? Regarding #2, javax.imageio.ImageIO is part of the
JDK, but the readers for TIFF are loaded from jai_imageio.jar
I prefer to keep the jars in my WEB-INF/lib as it's less intrusive to the
server manager.

--Thad

On Wed, Apr 7, 2010 at 4:05 PM, Caldarale, Charles R 
chuck.caldar...@unisys.com wrote:

  From: Thad Humphries [mailto:thad.humphr...@gmail.com]
  Subject: Re: Problems with ImageIO
 
  Thanks, Chuck, Mark.  That fixed it.

 There are several attributes that can be toggled on and off in the
 listener; you could try those one by one, rather than disabling everything.
  I suspect it's this one: appContextProtection.

 Doc is near the bottom of this page:
 http://tomcat.apache.org/tomcat-6.0-doc/config/listeners.html

  - 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: users-unsubscr...@tomcat.apache.org
 For additional commands, e-mail: users-h...@tomcat.apache.org




-- 
Hell hath no limits, nor is circumscrib'd In one self-place; but where we
are is hell, And where hell is, there must we ever be --Christopher
Marlowe, 'Doctor Faustus' (v, 121-24)