Filter behaviour ( settinf Content-Length header )

2014-02-27 Thread Jose María Zaragoza
Hello:

I'm using Tomcat 6.0.24 and I'm testing how to return Content-Length header
So I've defined a Filter and declared in web.xml of my web application

If I do this:

HttpServletResponse httpResponse = (HttpServletResponse) response;
chain.doFilter(request, response);
httpResponse.setHeader(Content-Length, 200);

doesn't work ( it doesn't set the header and
Transfer-Encoding:chunked is returned )
)

but

HttpServletResponse httpResponse = (HttpServletResponse) response;
httpResponse.setHeader(Content-Length, 200);
chain.doFilter(request, response);

does and it works OK

Why ?
Does anyone use a filter to set Content-Length header ?
Must I declared in web.xml of Tomcat ?


Regards

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



[Ticket #603] Filter behaviour ( settinf Content-Length header )

2014-02-27 Thread Innoviti IT Support
This is a notification from the Help Desk.
Ticket was assigned to Sudhindra Rao.



On Feb 27, 2014 @ 02:10 pm, it Support wrote:
Assigned to Sudhindra Rao.


==Ticket History==

On Feb 27, 2014 @ 01:43 pm, demablo...@gmail.com wrote:
Hello:

I'm using Tomcat 6.0.24 and I'm testing how to return Content-Length header
So I've defined a Filter and declared in web.xml of my web application

If I do this:

HttpServletResponse httpResponse = (HttpServletResponse) response;
chain.doFilter(request, response);
httpResponse.setHeader(Content-Length, 200);

doesn't work ( it doesn't set the header and
Transfer-Encoding:chunked is returned )
)

but

HttpServletResponse httpResponse = (HttpServletResponse) response;
httpResponse.setHeader(Content-Length, 200);
chain.doFilter(request, response);

does and it works OK

Why ?
Does anyone use a filter to set Content-Length header ?
Must I declared in web.xml of Tomcat ?


Regards

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

--
This is an automated response.  Your issue has been noted.  We'll be in touch 
soon.



Please reply to this email or visit the URL below with any additional details.

http://swithelp.innoviti.com/portal/view-help-request/603



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

[Ticket #603] Filter behaviour ( settinf Content-Length header )

2014-02-27 Thread Innoviti IT Support
This is a notification from the Help Desk.
Ticket closed by Sudhindra Rao.



On Feb 27, 2014 @ 02:16 pm, Sudhindra Rao wrote:
Ticket closed.


==Ticket History==

On Feb 27, 2014 @ 02:10 pm, it Support wrote:
Assigned to Sudhindra Rao.

--
On Feb 27, 2014 @ 01:43 pm, demablo...@gmail.com wrote:
Hello:

I'm using Tomcat 6.0.24 and I'm testing how to return Content-Length header
So I've defined a Filter and declared in web.xml of my web application

If I do this:

HttpServletResponse httpResponse = (HttpServletResponse) response;
chain.doFilter(request, response);
httpResponse.setHeader(Content-Length, 200);

doesn't work ( it doesn't set the header and
Transfer-Encoding:chunked is returned )
)

but

HttpServletResponse httpResponse = (HttpServletResponse) response;
httpResponse.setHeader(Content-Length, 200);
chain.doFilter(request, response);

does and it works OK

Why ?
Does anyone use a filter to set Content-Length header ?
Must I declared in web.xml of Tomcat ?


Regards

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

--
This is an automated response.  Your issue has been noted.  We'll be in touch 
soon.



Please reply to this email or visit the URL below with any additional details.

http://swithelp.innoviti.com/portal/view-help-request/603



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

Re: the latest tomcat 7.0.50 has a problem when used through osgi (like eclipse)

2014-02-27 Thread Johan Compagner
i just tested this under 7.0.52 that should have the fix (from 51 on
according to the change log)

but its still this: (if i look into apache-tomcat-7.0.52-src.zip)

 private static String idFor(String url) {
URL id = ServletContext.class.getResource(resources/ + url);
if (id == null) {
id = ServletContext.class.getResource(jsp/resources/ + url);
}
return id.toExternalForm();
}


so it still fails for me.



On 22 January 2014 13:02, Mark Thomas ma...@apache.org wrote:

 On 22/01/2014 11:56, Johan Compagner wrote:
  this is because tomcat expects that the 2 jars servlet-api.jar and
  jsp-api.jar are in the same classloader

 https://issues.apache.org/bugzilla/show_bug.cgi?id=56016

 http://svn.us.apache.org/repos/asf/tomcat/tc7.0.x/trunk/webapps/docs/changelog.xml

 Mark


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




-- 
Johan Compagner
Servoy


Re: the latest tomcat 7.0.50 has a problem when used through osgi (like eclipse)

2014-02-27 Thread Mark Thomas
On 27/02/2014 10:58, Johan Compagner wrote:
 i just tested this under 7.0.52 that should have the fix (from 51 on
 according to the change log)
 
 but its still this: (if i look into apache-tomcat-7.0.52-src.zip)

Still what? The code you quote below is the code from 7.0.52 which is
not the same as the code in 7.0.50. The 7.0.52 code is only looking at
resources from the JAR that the ServletContext class is located in.

  private static String idFor(String url) {
 URL id = ServletContext.class.getResource(resources/ + url);
 if (id == null) {
 id = ServletContext.class.getResource(jsp/resources/ + url);
 }
 return id.toExternalForm();
 }
 
 
 so it still fails for me.

How does it fail? Are you sure you are using 7.0.52?

Mark


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



Issue while deploying a war file using Tomcat 7.0.52

2014-02-27 Thread Neha Munjal
Hi All,

I am using Tomcat7.0.52 on Windows 7 64 Bit.

The issue I am facing is that when I try to deploy a war file, I receive
the following exception:
*Caused by: java.lang.ClassCastException:
org.hornetq.jms.client.HornetQJMSConnectionFactory cannot be cast to
javax.jms.ConnectionFactory*

The set up is as follows:

We have an implementation of HornetQServer that basically starts up some
JMS threads for application specific tasks. The client side implementation
has a class org.hornetq.jms.client.HornetQJMSConnectionFactory that
implements the interface javax.jms.ConnectionFactory. (jms-api.jar).


As part of our customized ant target that we run to start the Tomcat, we
have set the classpath that points to the location where we have
jms-api.jar, which implies that these would be taken care of by the
Bootstrap Loader.
Additionally, we have added a location to common.loader setting in
catalina.properties that contains some HornetQspecific jars that should be
available to all deployables of our application.
These would be taken care of by Common classloader.

At the same time, we have jms-api.jar file in the /WEB-INF/lib directory of
our deployable as well.

Now when we deploy this war file, we get the above mentioned exception.

I tried the same set up on Tomcat7.0.50 as well and there, no such
exception is encountered.

I would like to know the probable cause of this issue and why this is
working fine on Tomcat7.0.50 and not 7.0.52. Any feedback wold be greatly
appreciated.

Thanks


Re: Filter behaviour ( settinf Content-Length header )

2014-02-27 Thread Konstantin Kolinko
2014-02-27 12:18 GMT+04:00 Jose María Zaragoza demablo...@gmail.com:
 Hello:

 I'm using Tomcat 6.0.24 and I'm testing how to return Content-Length header
 So I've defined a Filter and declared in web.xml of my web application

 If I do this:

 HttpServletResponse httpResponse = (HttpServletResponse) response;
 chain.doFilter(request, response);
 httpResponse.setHeader(Content-Length, 200);

 doesn't work ( it doesn't set the header and
 Transfer-Encoding:chunked is returned )
 )

 but

 HttpServletResponse httpResponse = (HttpServletResponse) response;
 httpResponse.setHeader(Content-Length, 200);
 chain.doFilter(request, response);

 does and it works OK

 Why ?
 Does anyone use a filter to set Content-Length header ?
 Must I declared in web.xml of Tomcat ?



1. Why are you using such an old build of 6.0.x?
2. You cannot set headers when any part of the response has already
been sent to client. At that time headers have already been sent over
the wire.
See ServletResponse.isCommitted().
3. You should be careful with that header. If you set it to a wrong
value you may break something.

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



Re: Issue while deploying a war file using Tomcat 7.0.52

2014-02-27 Thread Konstantin Kolinko
2014-02-27 15:36 GMT+04:00 Neha Munjal neha.munj...@gmail.com:
 Hi All,

 I am using Tomcat7.0.52 on Windows 7 64 Bit.

 The issue I am facing is that when I try to deploy a war file, I receive
 the following exception:
 *Caused by: java.lang.ClassCastException:
 org.hornetq.jms.client.HornetQJMSConnectionFactory cannot be cast to
 javax.jms.ConnectionFactory*

 The set up is as follows:

 We have an implementation of HornetQServer that basically starts up some
 JMS threads for application specific tasks. The client side implementation
 has a class org.hornetq.jms.client.HornetQJMSConnectionFactory that
 implements the interface javax.jms.ConnectionFactory. (jms-api.jar).


 As part of our customized ant target that we run to start the Tomcat, we
 have set the classpath that points to the location where we have
 jms-api.jar, which implies that these would be taken care of by the
 Bootstrap Loader.
 Additionally, we have added a location to common.loader setting in
 catalina.properties that contains some HornetQspecific jars that should be
 available to all deployables of our application.
 These would be taken care of by Common classloader.

 At the same time, we have jms-api.jar file in the /WEB-INF/lib directory of
 our deployable as well.

 Now when we deploy this war file, we get the above mentioned exception.

 I tried the same set up on Tomcat7.0.50 as well and there, no such
 exception is encountered.

 I would like to know the probable cause of this issue and why this is
 working fine on Tomcat7.0.50 and not 7.0.52. Any feedback wold be greatly
 appreciated.


So, of the two copies of jms-api.jar what are your expectations on
which one will be effective?

Also,
https://issues.apache.org/bugzilla/show_bug.cgi?id=56180#c2

Best regards,
Konstantin Kolinko

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



Re: Issue while deploying a war file using Tomcat 7.0.52

2014-02-27 Thread Neha Munjal
Hi Konstanti,

In my opinion, The Bootstrap classloader should be effective and since the
jar is present there, it should consider it and not throw this exception.

Thanks
Neha


On Thu, Feb 27, 2014 at 5:26 PM, Konstantin Kolinko
knst.koli...@gmail.comwrote:

 2014-02-27 15:36 GMT+04:00 Neha Munjal neha.munj...@gmail.com:
  Hi All,
 
  I am using Tomcat7.0.52 on Windows 7 64 Bit.
 
  The issue I am facing is that when I try to deploy a war file, I receive
  the following exception:
  *Caused by: java.lang.ClassCastException:
  org.hornetq.jms.client.HornetQJMSConnectionFactory cannot be cast to
  javax.jms.ConnectionFactory*
 
  The set up is as follows:
 
  We have an implementation of HornetQServer that basically starts up some
  JMS threads for application specific tasks. The client side
 implementation
  has a class org.hornetq.jms.client.HornetQJMSConnectionFactory that
  implements the interface javax.jms.ConnectionFactory. (jms-api.jar).
 
 
  As part of our customized ant target that we run to start the Tomcat, we
  have set the classpath that points to the location where we have
  jms-api.jar, which implies that these would be taken care of by the
  Bootstrap Loader.
  Additionally, we have added a location to common.loader setting in
  catalina.properties that contains some HornetQspecific jars that should
 be
  available to all deployables of our application.
  These would be taken care of by Common classloader.
 
  At the same time, we have jms-api.jar file in the /WEB-INF/lib directory
 of
  our deployable as well.
 
  Now when we deploy this war file, we get the above mentioned exception.
 
  I tried the same set up on Tomcat7.0.50 as well and there, no such
  exception is encountered.
 
  I would like to know the probable cause of this issue and why this is
  working fine on Tomcat7.0.50 and not 7.0.52. Any feedback wold be greatly
  appreciated.
 

 So, of the two copies of jms-api.jar what are your expectations on
 which one will be effective?

 Also,
 https://issues.apache.org/bugzilla/show_bug.cgi?id=56180#c2

 Best regards,
 Konstantin Kolinko

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




Are these CVEs fixed in tomcat 7 ?

2014-02-27 Thread Christian Rustøen
Hi

Based on the apache security reports i dont see any mention of these CVEs b=
eing fixed in tomcat, and as they have a very high score i would like to kn=
ow if they have been fixed.
These are almost 3-4 years old but as i dont see any mention on them in the=
 security reports i would still like to know as im planning to use this con=
tainer in an environment where security is very important.

CVE-2011-1571
CVE-2010-0557


--
BR,
chris


Re: Are these CVEs fixed in tomcat 7 ?

2014-02-27 Thread Mark Thomas
On 27/02/2014 12:49, Christian Rustøen wrote:
 Hi
 
 Based on the apache security reports i dont see any mention of these CVEs b=
 eing fixed in tomcat, and as they have a very high score i would like to kn=
 ow if they have been fixed.
 These are almost 3-4 years old but as i dont see any mention on them in the=
  security reports i would still like to know as im planning to use this con=
 tainer in an environment where security is very important.
 
 CVE-2011-1571

The above issue is a Liferay vulnerability, not an Apache Tomcat
vulnerability.

 CVE-2010-0557

The above issue is a IBM Cognos Express vulnerability, not an Apache
Tomcat vulnerability.

Since neither of the above issues is a vulnerability in Apache Tomcat
you won't find any information on these vulnerabilities at the ASF.

Mark


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



RE: Are these CVEs fixed in tomcat 7 ?

2014-02-27 Thread Christian Rustøen
Ok, thanks for your quick reply.



--
BR,
chris

From: Mark Thomas ma...@apache.org
Sent: Thursday, February 27, 2014 1:53 PM
To: Tomcat Users List
Subject: Re: Are these CVEs fixed in tomcat 7 ?

On 27/02/2014 12:49, Christian Rustøen wrote:
 Hi

 Based on the apache security reports i dont see any mention of these CVEs b=
 eing fixed in tomcat, and as they have a very high score i would like to kn=
 ow if they have been fixed.
 These are almost 3-4 years old but as i dont see any mention on them in the=
  security reports i would still like to know as im planning to use this con=
 tainer in an environment where security is very important.

 CVE-2011-1571

The above issue is a Liferay vulnerability, not an Apache Tomcat
vulnerability.

 CVE-2010-0557

The above issue is a IBM Cognos Express vulnerability, not an Apache
Tomcat vulnerability.

Since neither of the above issues is a vulnerability in Apache Tomcat
you won't find any information on these vulnerabilities at the ASF.

Mark


-
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



Re: the latest tomcat 7.0.50 has a problem when used through osgi (like eclipse)

2014-02-27 Thread Johan Compagner
i download here:

http://archive.apache.org/dist/tomcat/tomcat-7/

.50 and .52

i look into org.apache.tomcat.util.descriptor.DigesterFactory

those 2 files are for the piece that is wrong exactly the same for me:

private static String idFor(String url) {
URL id = ServletContext.class.getResource(resources/ + url);
if (id == null) {
id = ServletContext.class.getResource(jsp/resources/ + url);
}
return id.toExternalForm();
}

both have that, but it should be:

private static String idFor(String url) {
URL id = ServletContext.class.getResource(resources/ + url);
if (id == null) {
id = JspContext.class.getResource(resources/ + url);
}
return id.toExternalForm();
}


i need to patch this before it works for me (because we are running tomcat
also in a OSGI enviroment and then
jsp-api and servlet-api jars are not the same classloader

They are bundles of there own. So you can't load jsp related xml files
(from the jsp-api jar) through the ServletContext.class
the id == null for me

johan




On 27 February 2014 12:07, Mark Thomas ma...@apache.org wrote:

 On 27/02/2014 10:58, Johan Compagner wrote:
  i just tested this under 7.0.52 that should have the fix (from 51 on
  according to the change log)
 
  but its still this: (if i look into apache-tomcat-7.0.52-src.zip)

 Still what? The code you quote below is the code from 7.0.52 which is
 not the same as the code in 7.0.50. The 7.0.52 code is only looking at
 resources from the JAR that the ServletContext class is located in.

   private static String idFor(String url) {
  URL id = ServletContext.class.getResource(resources/ + url);
  if (id == null) {
  id = ServletContext.class.getResource(jsp/resources/ +
 url);
  }
  return id.toExternalForm();
  }
 
 
  so it still fails for me.

 How does it fail? Are you sure you are using 7.0.52?

 Mark


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




-- 
Johan Compagner
Servoy


can i have programatically access to the ServerContainer (websocket) in tomcat 7?

2014-02-27 Thread Johan Compagner
Like what is described here?

http://dev.eclipse.org/mhonarc/lists/jetty-dev/msg01999.html


 ServerContainer container =
(ServerContainer)context.getAttribute(javax.websocket.server.ServerContainer
);
try
{
container.addEndpoint(EchoSocket.class);


i need a way to add fully programatically a Websocket endpoint to the
context/container

i also can't use the ApplicationConfig because that one also needs to be
scanned by tomcat first
the classes are not in the web app. they are coming from osgi and are
provided by the system
So i need a way to add them on the fly to a context

this is what i just tried:

Catalina catalina = new Catalina();
catalina.setParentClassLoader(new
OSGIWebappClassLoader(TomcatStarter.class.getClassLoader()));
catalina.load();
 Service[] services = catalina.getServer().findServices();
for (Service service : services) {
Container[] containers = service.getContainer().findChildren();
 for (Container host : containers) {
Container[] contexts = host.findChildren();
for (Container container : contexts) {
 StandardContext sc = (StandardContext) container;
ServletContext context = sc.getServletContext();
 ServerContainer serverContainer =
(ServerContainer)context.getAttribute(javax.websocket.server.ServerContainer);
System.err.println(serverContainer);

But that attribute doesn't seem to be there at least at that time

Any body an idea?

(it doesn't have to be a standard servlet way, i can use the tomcat api
itself if needed)

johan
-- 
Johan Compagner
Servoy


Re: the latest tomcat 7.0.50 has a problem when used through osgi (like eclipse)

2014-02-27 Thread Mark Thomas
On 27/02/2014 13:58, Johan Compagner wrote:
 i download here:
 
 http://archive.apache.org/dist/tomcat/tomcat-7/
 
 .50 and .52
 
 i look into org.apache.tomcat.util.descriptor.DigesterFactory
 
 those 2 files are for the piece that is wrong exactly the same for me:
 
 private static String idFor(String url) {
 URL id = ServletContext.class.getResource(resources/ + url);
 if (id == null) {
 id = ServletContext.class.getResource(jsp/resources/ + url);
 }
 return id.toExternalForm();
 }
 
 both have that, but it should be:
 
 private static String idFor(String url) {
 URL id = ServletContext.class.getResource(resources/ + url);
 if (id == null) {
 id = JspContext.class.getResource(resources/ + url);
 }
 return id.toExternalForm();
 }

Sorry, I got confused about what changed between which 7.0.x and 8.0.x
versions. There was a lot of rapid changes over a short period of time
as folks reported different issues.

The solution you propose is not acceptable as it causes other problems:
https://issues.apache.org/bugzilla/show_bug.cgi?id=56045

The solution in 7.0.x (and released in 7.0.51) was to place all of the
necessary schema in the Servlet JAR.

 i need to patch this before it works for me (because we are running tomcat
 also in a OSGI enviroment and then
 jsp-api and servlet-api jars are not the same classloader
 
 They are bundles of there own. So you can't load jsp related xml files
 (from the jsp-api jar) through the ServletContext.class
 the id == null for me

What code path is trying to load JSP XML files from jsp-api.jar? Tomcat
should be loading them all from servlet-api.jar

Mark


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



Re: can i have programatically access to the ServerContainer (websocket) in tomcat 7?

2014-02-27 Thread Mark Thomas
On 27/02/2014 14:03, Johan Compagner wrote:
 Like what is described here?
 
 http://dev.eclipse.org/mhonarc/lists/jetty-dev/msg01999.html
 
 
  ServerContainer container =
 (ServerContainer)context.getAttribute(javax.websocket.server.ServerContainer
 );
 try
 {
 container.addEndpoint(EchoSocket.class);

You can do it exactly like that.

snip/

 this is what i just tried:
 
 Catalina catalina = new Catalina();
 catalina.setParentClassLoader(new
 OSGIWebappClassLoader(TomcatStarter.class.getClassLoader()));
 catalina.load();
  Service[] services = catalina.getServer().findServices();
 for (Service service : services) {
 Container[] containers = service.getContainer().findChildren();
  for (Container host : containers) {
 Container[] contexts = host.findChildren();
 for (Container container : contexts) {
  StandardContext sc = (StandardContext) container;
 ServletContext context = sc.getServletContext();
  ServerContainer serverContainer =
 (ServerContainer)context.getAttribute(javax.websocket.server.ServerContainer);
 System.err.println(serverContainer);
 
 But that attribute doesn't seem to be there at least at that time
 
 Any body an idea?

You haven't started the Context so the attributes won't have been populated.

Try adding a ContextListener to the context and use that to set up the
endpoints using the programmatic API.

Mark

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



Re: the latest tomcat 7.0.50 has a problem when used through osgi (like eclipse)

2014-02-27 Thread Johan Compagner
On 27 February 2014 15:16, Mark Thomas ma...@apache.org wrote:

 Sorry, I got confused about what changed between which 7.0.x and 8.0.x
 versions. There was a lot of rapid changes over a short period of time
 as folks reported different issues.

 The solution you propose is not acceptable as it causes other problems:
 https://issues.apache.org/bugzilla/show_bug.cgi?id=56045

 The solution in 7.0.x (and released in 7.0.51) was to place all of the
 necessary schema in the Servlet JAR.

  i need to patch this before it works for me (because we are running
 tomcat
  also in a OSGI enviroment and then
  jsp-api and servlet-api jars are not the same classloader
 
  They are bundles of there own. So you can't load jsp related xml files
  (from the jsp-api jar) through the ServletContext.class
  the id == null for me

 What code path is trying to load JSP XML files from jsp-api.jar? Tomcat
 should be loading them all from servlet-api.jar


ahh

the servlet-api.jar that now ships with tomcat has now also a copy of the
same resources the jsp-api.jar also has
So the
  if (id == null) {
id = JspContext.class.getResource(resources/ + url);
  }

should never be hit anymore in a real tomcat install

The problem why i still have it is because i use a servlet-api bundle osgi
bundle not coming from tomcat.
(i would need to patch the manifest file to be able to use it as a real
osgi bundle in eclipse)

But i understand now that the fix was differently applied and why i still
had problems with it.

(tomcat kind of changed the standard, jsr api lib ;) )

johan




-- 
Johan Compagner
Servoy


Re: Filter behaviour ( settinf Content-Length header )

2014-02-27 Thread Jose María Zaragoza
Thanks


And what do you recommend to me for forcing to return  a Content-Type ?
Some weird clients require it

If I cannot do it with a Filter , where can I do it ?

2014-02-27 12:41 GMT+01:00 Konstantin Kolinko knst.koli...@gmail.com:
 2014-02-27 12:18 GMT+04:00 Jose María Zaragoza demablo...@gmail.com:
 Hello:

 I'm using Tomcat 6.0.24 and I'm testing how to return Content-Length header
 So I've defined a Filter and declared in web.xml of my web application

 If I do this:

 HttpServletResponse httpResponse = (HttpServletResponse) response;
 chain.doFilter(request, response);
 httpResponse.setHeader(Content-Length, 200);

 doesn't work ( it doesn't set the header and
 Transfer-Encoding:chunked is returned )
 )

 but

 HttpServletResponse httpResponse = (HttpServletResponse) response;
 httpResponse.setHeader(Content-Length, 200);
 chain.doFilter(request, response);

 does and it works OK

 Why ?
 Does anyone use a filter to set Content-Length header ?
 Must I declared in web.xml of Tomcat ?



 1. Why are you using such an old build of 6.0.x?
 2. You cannot set headers when any part of the response has already
 been sent to client. At that time headers have already been sent over
 the wire.
 See ServletResponse.isCommitted().
 3. You should be careful with that header. If you set it to a wrong
 value you may break something.

 -
 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



ManagerBase.generateSessionId() gives me a NullPointerException

2014-02-27 Thread Lorenzo Fini
Hi,
I get this error:

java.lang.NullPointerException

org.apache.catalina.session.ManagerBase.generateSessionId(ManagerBase.java:807)

org.apache.catalina.session.ManagerBase.createSession(ManagerBase.java:653)
org.apache.catalina.connector.Request.doGetSession(Request.java:2956)
org.apache.catalina.connector.Request.getSession(Request.java:2320)

org.apache.catalina.connector.RequestFacade.getSession(RequestFacade.java:899)

org.apache.catalina.connector.RequestFacade.getSession(RequestFacade.java:911)
com.myfilter.AuthenticationFilter.doFilter(AuthenticationFilter.java:47)

at the line 47 of AuthenticationFilter the only action I do is
((HttpServletRequest) request).getSession()


I use Tomcat 7.0.50 on a 64 bit machine with the basic configuration.
This only happens sometimes, and is hard to reproduce.
I have a filter that uses the session to check if the user is logged,
after undeploying and deploying, sometimes the webapp shows the
exception.
I've traced it down to ManagerBase.java - generateSessionId() method.

I have seen that when I get this error I get it on different browsers
so it is not about a wrong state in the current session.

I have noticed that waiting 10 minutes in some cases can fix the problem.


Error using same server.xml from a RedHat box on a Windows 2008 R2 box

2014-02-27 Thread Mike Johnson
Hi all,

New to this listserv. I had jumped the gun and submitted a bug, as I really
do think it is a bug, but I was told to come here first. So I am here :D

Anyway,

Here's the issue that I'm looking for insight on(I did a workaround that
seems to work fine, just doesn't make sense why it works differently on OS
if Tomcat is portable across OS).

Tomcat 7.0.47

Using SSL on a connector, defining the connector like so...

Connector port=443
   maxThreads=150 minSpareThreads=25 maxSpareThreads=75
   enableLookups=false disableUploadTimeout=true
   acceptCount=101 debug=0 scheme=https secure=true
   SSLEnabled=true keyAlias=MyAlias
   keystoreFile=relative path to file cert file.pfx
   keystoreType=pkcs12
   keystorePass=mypassword
   clientAuth=false sslProtocol=TLS
 /

Seems as though on Linux, works like a charm...

When I recreate this install on a Windows 2008 R2 box, I get an error

SEVERE: Failed to initialize end point associated with ProtocolHandler [...]
java.lang.Exception: Connector attribute SSLCertificateFile must be defined
when using SSL with APR

I have to take out the following line from the server.xml
Listener className=org.apache.catalina.core.AprLifecycleListener
SSLEngine=on /

Now, from what I'm reading(far from an expert here) it looks like APR is
OpenSSL and if you comment this out, it defaults to JSSE's SSL stuff.

When I google further, it seems that people are having this issue and they
think it's related to how the .pfx file is being read in, text vs binary.

Anyway, I've contacted a few colleagues that do the same thing as me at
other organizations, and they have been able to reproduce this problem.

It just doesn't seem right that I can't do the same thing on a Windows box.

Anyone have any thoughts?

Mike.


-- 
Mike Johnson
Datatel Programmer/Analyst
Northern Ontario School of Medicine
955 Oliver Road
Thunder Bay, ON   P7B 5E1
Phone: (807) 766-7331
Email: mike.john...@nosm.ca


Re: the latest tomcat 7.0.50 has a problem when used through osgi (like eclipse)

2014-02-27 Thread Mark Thomas
On 27/02/2014 14:29, Johan Compagner wrote:
 On 27 February 2014 15:16, Mark Thomas ma...@apache.org wrote:
 
 Sorry, I got confused about what changed between which 7.0.x and 8.0.x
 versions. There was a lot of rapid changes over a short period of time
 as folks reported different issues.

 The solution you propose is not acceptable as it causes other problems:
 https://issues.apache.org/bugzilla/show_bug.cgi?id=56045

 The solution in 7.0.x (and released in 7.0.51) was to place all of the
 necessary schema in the Servlet JAR.

 i need to patch this before it works for me (because we are running
 tomcat
 also in a OSGI enviroment and then
 jsp-api and servlet-api jars are not the same classloader

 They are bundles of there own. So you can't load jsp related xml files
 (from the jsp-api jar) through the ServletContext.class
 the id == null for me

 What code path is trying to load JSP XML files from jsp-api.jar? Tomcat
 should be loading them all from servlet-api.jar

 
 ahh
 
 the servlet-api.jar that now ships with tomcat has now also a copy of the
 same resources the jsp-api.jar also has
 So the
   if (id == null) {
 id = JspContext.class.getResource(resources/ + url);
   }
 
 should never be hit anymore in a real tomcat install
 
 The problem why i still have it is because i use a servlet-api bundle osgi
 bundle not coming from tomcat.
 (i would need to patch the manifest file to be able to use it as a real
 osgi bundle in eclipse)
 
 But i understand now that the fix was differently applied and why i still
 had problems with it.
 
 (tomcat kind of changed the standard, jsr api lib ;) )

I'd argue that a servlet-api.jar that doesn't include the JSP XML
schemas is broken (which is why we changed it) since:
- Servlet has no declared dependency on JSP
- You can't validate XML documents against the schemas used by the
Servlet spec without the JSP schemas

Therefore the JSP schemas have to be included in the servlet-api.jar

Mark

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



Re: Filter behaviour ( settinf Content-Length header )

2014-02-27 Thread Lorenzo Fini
Did you try in the servlet?


2014-02-27 15:31 GMT+01:00 Jose María Zaragoza demablo...@gmail.com:

 Thanks


 And what do you recommend to me for forcing to return  a Content-Type ?
 Some weird clients require it

 If I cannot do it with a Filter , where can I do it ?

 2014-02-27 12:41 GMT+01:00 Konstantin Kolinko knst.koli...@gmail.com:
  2014-02-27 12:18 GMT+04:00 Jose María Zaragoza demablo...@gmail.com:
  Hello:
 
  I'm using Tomcat 6.0.24 and I'm testing how to return Content-Length
 header
  So I've defined a Filter and declared in web.xml of my web application
 
  If I do this:
 
  HttpServletResponse httpResponse = (HttpServletResponse) response;
  chain.doFilter(request, response);
  httpResponse.setHeader(Content-Length, 200);
 
  doesn't work ( it doesn't set the header and
  Transfer-Encoding:chunked is returned )
  )
 
  but
 
  HttpServletResponse httpResponse = (HttpServletResponse) response;
  httpResponse.setHeader(Content-Length, 200);
  chain.doFilter(request, response);
 
  does and it works OK
 
  Why ?
  Does anyone use a filter to set Content-Length header ?
  Must I declared in web.xml of Tomcat ?
 
 
 
  1. Why are you using such an old build of 6.0.x?
  2. You cannot set headers when any part of the response has already
  been sent to client. At that time headers have already been sent over
  the wire.
  See ServletResponse.isCommitted().
  3. You should be careful with that header. If you set it to a wrong
  value you may break something.
 
  -
  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




Re: ManagerBase.generateSessionId() gives me a NullPointerException

2014-02-27 Thread Mark Thomas
On 27/02/2014 14:35, Lorenzo Fini wrote:
 Hi,
 I get this error:
 
 java.lang.NullPointerException
   
 org.apache.catalina.session.ManagerBase.generateSessionId(ManagerBase.java:807)
   
 org.apache.catalina.session.ManagerBase.createSession(ManagerBase.java:653)
   org.apache.catalina.connector.Request.doGetSession(Request.java:2956)
   org.apache.catalina.connector.Request.getSession(Request.java:2320)
   
 org.apache.catalina.connector.RequestFacade.getSession(RequestFacade.java:899)
   
 org.apache.catalina.connector.RequestFacade.getSession(RequestFacade.java:911)
   com.myfilter.AuthenticationFilter.doFilter(AuthenticationFilter.java:47)
 
 at the line 47 of AuthenticationFilter the only action I do is
 ((HttpServletRequest) request).getSession()
 
 
 I use Tomcat 7.0.50 on a 64 bit machine with the basic configuration.
 This only happens sometimes, and is hard to reproduce.
 I have a filter that uses the session to check if the user is logged,
 after undeploying and deploying, sometimes the webapp shows the
 exception.
 I've traced it down to ManagerBase.java - generateSessionId() method.

No, there is no bug there.

To repeat what you have already been told:

This is either an application bug or a bug in
com.abovo.gc.plata.filter.AuthenticationFilter that is retaining and
using a reference to a request object from a previous request rather
than using the request object for the current request.

Mark

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



Re: Error using same server.xml from a RedHat box on a Windows 2008 R2 box

2014-02-27 Thread Daniel Mikusa
On Feb 27, 2014, at 9:40 AM, Mike Johnson mike.john...@nosm.ca wrote:

 Hi all,
 
 New to this listserv. I had jumped the gun and submitted a bug, as I really
 do think it is a bug, but I was told to come here first. So I am here :D

Best to always start here.

 
 Anyway,
 
 Here's the issue that I'm looking for insight on(I did a workaround that
 seems to work fine, just doesn't make sense why it works differently on OS
 if Tomcat is portable across OS).
 
 Tomcat 7.0.47
 
 Using SSL on a connector, defining the connector like so...
 
Connector port=443
   maxThreads=150 minSpareThreads=25 maxSpareThreads=75
   enableLookups=false disableUploadTimeout=true
   acceptCount=101 debug=0 scheme=https secure=true
   SSLEnabled=true keyAlias=MyAlias
   keystoreFile=relative path to file cert file.pfx
   keystoreType=pkcs12
   keystorePass=mypassword
   clientAuth=false sslProtocol=TLS
 /
 
 Seems as though on Linux, works like a charm...
 
 When I recreate this install on a Windows 2008 R2 box, I get an error

By default Tomcat will look for the APR libraries and if it finds them, it will 
use them.  In this case, it seems like it’s not finding them on your Linux 
environment and it is finding them on your Windows environment.

 SEVERE: Failed to initialize end point associated with ProtocolHandler [...]
 java.lang.Exception: Connector attribute SSLCertificateFile must be defined
 when using SSL with APR

SSL configuration when APR is enabled is different.  See here.

  
https://tomcat.apache.org/tomcat-7.0-doc/config/http.html#SSL_Support_-_APR/Native

 
 I have to take out the following line from the server.xml
 Listener className=org.apache.catalina.core.AprLifecycleListener
 SSLEngine=on /

If you don’t want APR enabled I guess that would work.  APR does perform better 
though, especially when using SSL.  I’d suggest you just configure it properly.

Dan

 
 Now, from what I'm reading(far from an expert here) it looks like APR is
 OpenSSL and if you comment this out, it defaults to JSSE's SSL stuff.
 
 When I google further, it seems that people are having this issue and they
 think it's related to how the .pfx file is being read in, text vs binary.
 
 Anyway, I've contacted a few colleagues that do the same thing as me at
 other organizations, and they have been able to reproduce this problem.
 
 It just doesn't seem right that I can't do the same thing on a Windows box.
 
 Anyone have any thoughts?
 
 Mike.
 
 
 -- 
 Mike Johnson
 Datatel Programmer/Analyst
 Northern Ontario School of Medicine
 955 Oliver Road
 Thunder Bay, ON   P7B 5E1
 Phone: (807) 766-7331
 Email: mike.john...@nosm.ca


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



Re: ManagerBase.generateSessionId() gives me a NullPointerException

2014-02-27 Thread Lorenzo Fini
Hi Mark,

if I am just doing request.getSession() on the request that I receive, how
can it be an application error?
I do no store any request or session..



2014-02-27 15:55 GMT+01:00 Mark Thomas ma...@apache.org:

 On 27/02/2014 14:35, Lorenzo Fini wrote:
  Hi,
  I get this error:
 
  java.lang.NullPointerException
 
 org.apache.catalina.session.ManagerBase.generateSessionId(ManagerBase.java:807)
 
 org.apache.catalina.session.ManagerBase.createSession(ManagerBase.java:653)
 
 org.apache.catalina.connector.Request.doGetSession(Request.java:2956)
org.apache.catalina.connector.Request.getSession(Request.java:2320)
 
 org.apache.catalina.connector.RequestFacade.getSession(RequestFacade.java:899)
 
 org.apache.catalina.connector.RequestFacade.getSession(RequestFacade.java:911)
 
 com.myfilter.AuthenticationFilter.doFilter(AuthenticationFilter.java:47)
 
  at the line 47 of AuthenticationFilter the only action I do is
  ((HttpServletRequest) request).getSession()
 
 
  I use Tomcat 7.0.50 on a 64 bit machine with the basic configuration.
  This only happens sometimes, and is hard to reproduce.
  I have a filter that uses the session to check if the user is logged,
  after undeploying and deploying, sometimes the webapp shows the
  exception.
  I've traced it down to ManagerBase.java - generateSessionId() method.

 No, there is no bug there.

 To repeat what you have already been told:

 This is either an application bug or a bug in
 com.abovo.gc.plata.filter.AuthenticationFilter that is retaining and
 using a reference to a request object from a previous request rather
 than using the request object for the current request.

 Mark

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




Re: Error using same server.xml from a RedHat box on a Windows 2008 R2 box

2014-02-27 Thread Mark Thomas
On 27/02/2014 14:40, Mike Johnson wrote:
 Here's the issue that I'm looking for insight on(I did a workaround that
 seems to work fine, just doesn't make sense why it works differently on OS
 if Tomcat is portable across OS).

If you use different configurations - on the same OS or across different
OSes - you will get different behaviour. If you want the same behaviour,
start by using the same configuration.

 Tomcat 7.0.47

Not related to this question but you need to upgrade.

 Using SSL on a connector, defining the connector like so...
 
 Connector port=443
maxThreads=150 minSpareThreads=25 maxSpareThreads=75
enableLookups=false disableUploadTimeout=true
acceptCount=101 debug=0 scheme=https secure=true
SSLEnabled=true keyAlias=MyAlias
keystoreFile=relative path to file cert file.pfx
keystoreType=pkcs12
keystorePass=mypassword
clientAuth=false sslProtocol=TLS
  /
 
 Seems as though on Linux, works like a charm...
 
 When I recreate this install on a Windows 2008 R2 box, I get an error
 
 SEVERE: Failed to initialize end point associated with ProtocolHandler [...]
 java.lang.Exception: Connector attribute SSLCertificateFile must be defined
 when using SSL with APR

If you had used protocol=org.apache.coyote.http11.Http11Protocol then
you'd see the same (working) behaviour on Linux and Windows.

If you had used protocol=org.apache.coyote.http11.Http11AprProtocol
then you'd see the same (broken) behaviour on Linux and Windows.

 I have to take out the following line from the server.xml
 Listener className=org.apache.catalina.core.AprLifecycleListener
 SSLEngine=on /

This disables the APR/native library.

 Now, from what I'm reading(far from an expert here) it looks like APR is
 OpenSSL and if you comment this out, it defaults to JSSE's SSL stuff.

Not quite. Disabling that listener disables APR support. In turn, that
removes the possibility of auto switching as described under the
protocol attribute in
http://tomcat.apache.org/tomcat-8.0-doc/config/http.html#Common_Attributes
 
 When I google further, it seems that people are having this issue and they
 think it's related to how the .pfx file is being read in, text vs binary.

Then those people would be wrong.

 Anyway, I've contacted a few colleagues that do the same thing as me at
 other organizations, and they have been able to reproduce this problem.
 
 It just doesn't seem right that I can't do the same thing on a Windows box.

You didn't do the same thing, hence you got a different result.

 Anyone have any thoughts?

On Linux you didn't installed the APR/native library so you will be
using the HTTP BIO connector which uses JSSE style configuration for SSL
which is how you configured the HTTPS connector so it works.

On Windows you did install the APR/native library so you will be using
the HTTP APR connector which uses OpenSSL style configuration for SSL
which is not how you configured the HTTPS connector so it fails.

Mark

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



Re: ManagerBase.generateSessionId() gives me a NullPointerException

2014-02-27 Thread Mark Thomas
On 27/02/2014 15:01, Lorenzo Fini wrote:
 Hi Mark,
 
 if I am just doing request.getSession() on the request that I receive, how
 can it be an application error?

That would depend on where the object named request was obtained from.

 I do no store any request or session..

In which case, I refer you to the answer I provided earlier:

 This is either an application bug or a bug in
 com.abovo.gc.plata.filter.AuthenticationFilter that is retaining and
 using a reference to a request object from a previous request rather
 than using the request object for the current request.

The application code was not the only possible source of the bug.

Strictly, since you failed to provide the full stack trace, there is a
third option that some as yet undisclosed component is retaining the
reference to the request object.

Mark

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



Re: ManagerBase.generateSessionId() gives me a NullPointerException

2014-02-27 Thread Lorenzo Fini
Hi,
as I told you I'm not a wizard in configuring log4j.
using this configuration for log4j:

log4j.logger.org.apache=FINE, logApache
log4j.additivity.org.apache.catalina.util.LifecycleBase=false

log4j.appender.logApache=org.apache.log4j.DailyRollingFileAppender
log4j.appender.logApache.File=../logs/ApacheFine.log
log4j.appender.logApache.DatePattern='.'-MM-dd
log4j.appender.logApache.layout=org.apache.log4j.PatternLayout
log4j.appender.logApache.layout.ConversionPattern=[%p] %d %c %M - %m%n


outputs:


[DEBUG] 2014-02-27 16:27:48,063
org.apache.ibatis.datasource.pooled.PooledDataSource forceCloseAll -
PooledDataSource forcefully closed/removed all connections.
[DEBUG] 2014-02-27 16:34:10,937 org.apache.ibatis.logging.LogFactory
setImplementation - Logging initialized using 'class
org.apache.ibatis.logging.log4j.Log4jImpl' adapter.
[DEBUG] 2014-02-27 16:34:10,937
org.apache.ibatis.datasource.pooled.PooledDataSource forceCloseAll -
PooledDataSource forcefully closed/removed all connections.
[DEBUG] 2014-02-27 16:34:10,937
org.apache.ibatis.datasource.pooled.PooledDataSource forceCloseAll -
PooledDataSource forcefully closed/removed all connections.
[DEBUG] 2014-02-27 16:34:10,937
org.apache.ibatis.datasource.pooled.PooledDataSource forceCloseAll -
PooledDataSource forcefully closed/removed all connections.
[DEBUG] 2014-02-27 16:34:10,937
org.apache.ibatis.datasource.pooled.PooledDataSource forceCloseAll -
PooledDataSource forcefully closed/removed all connections.
[DEBUG] 2014-02-27 16:36:05,254 org.apache.ibatis.logging.LogFactory
setImplementation - Logging initialized using 'class
org.apache.ibatis.logging.log4j.Log4jImpl' adapter.
[DEBUG] 2014-02-27 16:36:05,270
org.apache.ibatis.datasource.pooled.PooledDataSource forceCloseAll -
PooledDataSource forcefully closed/removed all connections.
[DEBUG] 2014-02-27 16:36:05,270
org.apache.ibatis.datasource.pooled.PooledDataSource forceCloseAll -
PooledDataSource forcefully closed/removed all connections.
[DEBUG] 2014-02-27 16:36:05,270
org.apache.ibatis.datasource.pooled.PooledDataSource forceCloseAll -
PooledDataSource forcefully closed/removed all connections.
[DEBUG] 2014-02-27 16:36:05,270
org.apache.ibatis.datasource.pooled.PooledDataSource forceCloseAll -
PooledDataSource forcefully closed/removed all connections.


The AuthenticationFilter class is not that complicated

@WebFilter(/AuthenticationFilter)
public class AuthenticationFilter implements Filter {

private ServletContext context;
private static ListString ALLOWED_URLS;

public void init(FilterConfig fConfig) throws ServletException {
this.context = fConfig.getServletContext();

// put the allowed JSP urls here:
ALLOWED_URLS = new ArrayListString();
ALLOWED_URLS.add(fConfig.getServletContext().getContextPath() +
/login.jsp);
ALLOWED_URLS.add(fConfig.getServletContext().getContextPath() +
/loginFail.jsp);
ALLOWED_URLS.add(fConfig.getServletContext().getContextPath() +
/LoginServlet);
}

public void doFilter(ServletRequest request, ServletResponse response,
FilterChain chain) throws IOException,
ServletException {

Logger log = Logger.getLogger(AuthenticationFilter.class);
HttpServletRequest req = (HttpServletRequest) request;
HttpServletResponse res = (HttpServletResponse) response;

String uri = req.getRequestURI();
log.info(Requested Resource:: + uri + - allowed: +
ALLOWED_URLS.contains(uri));
LdapAuthenticator authenticator = new
LdapAuthenticator(req.getSession());
if (ALLOWED_URLS.contains(uri) || authenticator.isLogged()) {
// pass the request along the filter chain
chain.doFilter(request, response);
} else {
log.info(Unauthorized access request);
res.sendRedirect(this.context.getContextPath() + /login.jsp);
}
}

public void destroy() {
// close any resources here
}

}



2014-02-27 16:14 GMT+01:00 Mark Thomas ma...@apache.org:

 On 27/02/2014 15:01, Lorenzo Fini wrote:
  Hi Mark,
 
  if I am just doing request.getSession() on the request that I receive,
 how
  can it be an application error?

 That would depend on where the object named request was obtained from.

  I do no store any request or session..

 In which case, I refer you to the answer I provided earlier:

  This is either an application bug or a bug in
  com.abovo.gc.plata.filter.AuthenticationFilter that is retaining and
  using a reference to a request object from a previous request rather
  than using the request object for the current request.

 The application code was not the only possible source of the bug.

 Strictly, since you failed to provide the full stack trace, there is a
 third option that some as yet undisclosed component is retaining the
 reference to the request object.

 Mark

 -
 To unsubscribe, e-mail: 

Re: Error using same server.xml from a RedHat box on a Windows 2008 R2 box

2014-02-27 Thread Mike Johnson
Thank you all for your very thorough responses. I have learned a ton from 2
emails.

I appreciate your time in responding to educate me.

Mike.


On Thu, Feb 27, 2014 at 10:09 AM, Mark Thomas ma...@apache.org wrote:

 On 27/02/2014 14:40, Mike Johnson wrote:
  Here's the issue that I'm looking for insight on(I did a workaround that
  seems to work fine, just doesn't make sense why it works differently on
 OS
  if Tomcat is portable across OS).

 If you use different configurations - on the same OS or across different
 OSes - you will get different behaviour. If you want the same behaviour,
 start by using the same configuration.

  Tomcat 7.0.47

 Not related to this question but you need to upgrade.

  Using SSL on a connector, defining the connector like so...
 
  Connector port=443
 maxThreads=150 minSpareThreads=25 maxSpareThreads=75
 enableLookups=false disableUploadTimeout=true
 acceptCount=101 debug=0 scheme=https secure=true
 SSLEnabled=true keyAlias=MyAlias
 keystoreFile=relative path to file cert file.pfx
 keystoreType=pkcs12
 keystorePass=mypassword
 clientAuth=false sslProtocol=TLS
   /
 
  Seems as though on Linux, works like a charm...
 
  When I recreate this install on a Windows 2008 R2 box, I get an error
 
  SEVERE: Failed to initialize end point associated with ProtocolHandler
 [...]
  java.lang.Exception: Connector attribute SSLCertificateFile must be
 defined
  when using SSL with APR

 If you had used protocol=org.apache.coyote.http11.Http11Protocol then
 you'd see the same (working) behaviour on Linux and Windows.

 If you had used protocol=org.apache.coyote.http11.Http11AprProtocol
 then you'd see the same (broken) behaviour on Linux and Windows.

  I have to take out the following line from the server.xml
  Listener className=org.apache.catalina.core.AprLifecycleListener
  SSLEngine=on /

 This disables the APR/native library.

  Now, from what I'm reading(far from an expert here) it looks like APR is
  OpenSSL and if you comment this out, it defaults to JSSE's SSL stuff.

 Not quite. Disabling that listener disables APR support. In turn, that
 removes the possibility of auto switching as described under the
 protocol attribute in
 http://tomcat.apache.org/tomcat-8.0-doc/config/http.html#Common_Attributes
 
  When I google further, it seems that people are having this issue and
 they
  think it's related to how the .pfx file is being read in, text vs binary.

 Then those people would be wrong.

  Anyway, I've contacted a few colleagues that do the same thing as me at
  other organizations, and they have been able to reproduce this problem.
 
  It just doesn't seem right that I can't do the same thing on a Windows
 box.

 You didn't do the same thing, hence you got a different result.

  Anyone have any thoughts?

 On Linux you didn't installed the APR/native library so you will be
 using the HTTP BIO connector which uses JSSE style configuration for SSL
 which is how you configured the HTTPS connector so it works.

 On Windows you did install the APR/native library so you will be using
 the HTTP APR connector which uses OpenSSL style configuration for SSL
 which is not how you configured the HTTPS connector so it fails.

 Mark

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




-- 
Mike Johnson
Datatel Programmer/Analyst
Northern Ontario School of Medicine
955 Oliver Road
Thunder Bay, ON   P7B 5E1
Phone: (807) 766-7331
Email: mike.john...@nosm.ca


Re: Filter behaviour ( settinf Content-Length header )

2014-02-27 Thread Konstantin Kolinko
2014-02-27 18:31 GMT+04:00 Jose María Zaragoza demablo...@gmail.com:

 And what do you recommend to me for forcing to return  a Content-Type ?
 Some weird clients require it

 If I cannot do it with a Filter , where can I do it ?


You can do it in a Filter.

As I said,
1. The header must be set before writing anything to the output
stream. That is per HTTP/1.1 protocol.
2. The header must have correct value.

How to implement that is up to you (do not expect me to teach you java
programming, but maybe others here will do).

If you do not know the length before response is generated, a solution
can be to buffer the response before writing it out.

Buffering can be done by writing an adapter around servlet response
that replaces default output stream with a buffered one. The adapter
can be implemented by extending
javax.servlet.http.HttpServletResponseWrapper class.  Some caching
frameworks have filters that perform such buffering and caching.

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



Re: can i have programatically access to the ServerContainer (websocket) in tomcat 7?

2014-02-27 Thread Johan Compagner
thx,

On 27 February 2014 15:25, Mark Thomas ma...@apache.org wrote:


 You haven't started the Context so the attributes won't have been
 populated.

 Try adding a ContextListener to the context and use that to set up the
 endpoints using the programmatic API.

 Mark



I have it working for WebSocket endpoints yes. Those can be added at
anytime it seems on the fly

Problem is that i want to do the same for servlets and filters (then onces
that are annotated).. But the context is already initialized
so even call ServletContext.addFilter(Filter.class)
directly after Catalina.load(); (but before start()) will already result in:

SEVERE: A child container failed during start
java.util.concurrent.ExecutionException: java.lang.IllegalStateException:
Filters can not be added to context /beans as the context has been
initialised
 at java.util.concurrent.FutureTask.report(Unknown Source)


or is it possible to do something directly on the StandardContext ?

johan





-- 
Johan Compagner
Servoy


Re: can i have programatically access to the ServerContainer (websocket) in tomcat 7?

2014-02-27 Thread Mark Thomas
On 27/02/2014 17:12, Johan Compagner wrote:
 thx,
 
 On 27 February 2014 15:25, Mark Thomas ma...@apache.org wrote:
 

 You haven't started the Context so the attributes won't have been
 populated.

 Try adding a ContextListener to the context and use that to set up the
 endpoints using the programmatic API.

 Mark
 
 
 I have it working for WebSocket endpoints yes. Those can be added at
 anytime it seems on the fly
 
 Problem is that i want to do the same for servlets and filters (then onces
 that are annotated).. But the context is already initialized
 so even call ServletContext.addFilter(Filter.class)
 directly after Catalina.load(); (but before start()) will already result in:
 
 SEVERE: A child container failed during start
 java.util.concurrent.ExecutionException: java.lang.IllegalStateException:
 Filters can not be added to context /beans as the context has been
 initialised
  at java.util.concurrent.FutureTask.report(Unknown Source)
 
 
 or is it possible to do something directly on the StandardContext ?

You can do it directly (look at the unit tests for lots of examples). Or
you can do it via a ServletContextListener.

Mark



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



Re: Filter behaviour ( settinf Content-Length header )

2014-02-27 Thread Jose María Zaragoza
2014-02-27 17:24 GMT+01:00 Konstantin Kolinko knst.koli...@gmail.com:
 2014-02-27 18:31 GMT+04:00 Jose María Zaragoza demablo...@gmail.com:

 And what do you recommend to me for forcing to return  a Content-Type ?
 Some weird clients require it

 If I cannot do it with a Filter , where can I do it ?


 You can do it in a Filter.

 As I said,
 1. The header must be set before writing anything to the output
 stream. That is per HTTP/1.1 protocol.
 2. The header must have correct value.

 How to implement that is up to you (do not expect me to teach you java
 programming, but maybe others here will do).

 If you do not know the length before response is generated, a solution
 can be to buffer the response before writing it out.

 Buffering can be done by writing an adapter around servlet response
 that replaces default output stream with a buffered one. The adapter
 can be implemented by extending
 javax.servlet.http.HttpServletResponseWrapper class.  Some caching
 frameworks have filters that perform such buffering and caching.


Thanks.
Finally, I did it with a servlet and it works

I tried with a Filter and a HttpServletResponseWrapper. Long time
before asking here.
And I wrapped the response output stream into a FilterOutputStream ,
so I could count every byte written
I got the right content length . All OK and I was happy.
But , when I tried set the header with
wrapper.setHeader(Content-Length, count ) , and as you told me
before, the response headers had already been flushed ( i checked
isCommited() )
I could modify output stream data but I couldn't modify response
headers. I don't understand but it is

Regards

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



Re: Filter behaviour ( settinf Content-Length header )

2014-02-27 Thread Christopher Schultz
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA256

Jose,

On 2/27/14, 1:29 PM, Jose María Zaragoza wrote:
 2014-02-27 17:24 GMT+01:00 Konstantin Kolinko
 knst.koli...@gmail.com:
 2014-02-27 18:31 GMT+04:00 Jose María Zaragoza
 demablo...@gmail.com:
 
 And what do you recommend to me for forcing to return  a
 Content-Type ? Some weird clients require it
 
 If I cannot do it with a Filter , where can I do it ?
 
 
 You can do it in a Filter.
 
 As I said, 1. The header must be set before writing anything to
 the output stream. That is per HTTP/1.1 protocol. 2. The header
 must have correct value.
 
 How to implement that is up to you (do not expect me to teach you
 java programming, but maybe others here will do).
 
 If you do not know the length before response is generated, a
 solution can be to buffer the response before writing it out.
 
 Buffering can be done by writing an adapter around servlet
 response that replaces default output stream with a buffered one.
 The adapter can be implemented by extending 
 javax.servlet.http.HttpServletResponseWrapper class.  Some
 caching frameworks have filters that perform such buffering and
 caching.
 
 
 Thanks. Finally, I did it with a servlet and it works
 
 I tried with a Filter and a HttpServletResponseWrapper. Long time 
 before asking here. And I wrapped the response output stream into a
 FilterOutputStream , so I could count every byte written I got the
 right content length . All OK and I was happy. But , when I tried
 set the header with wrapper.setHeader(Content-Length, count ) ,
 and as you told me before, the response headers had already been
 flushed ( i checked isCommited() ) I could modify output stream
 data but I couldn't modify response headers. I don't understand but
 it is

Don't forget that you actually need to buffer the data. You can't just
wrap the container's OutputStream (or Writer) in a FilterOutputStream
- -- the bytes will flow through your stream (writer) back to the client
while you are counting them.

If you aren't using a big byte array (or something similar), then you
aren't buffering.

- -chris
-BEGIN PGP SIGNATURE-
Version: GnuPG v1
Comment: GPGTools - http://gpgtools.org
Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/

iQIcBAEBCAAGBQJTD56OAAoJEBzwKT+lPKRYQ2EP/2FySYxzV177T3YB6Mf+7+ss
a9DGruZmfJ8EsD21qOO+qjnNOs7pc6sBHGjpCFRDzVut7hhAUzNJVXsVr/bUKzVg
fzrwFCEb+EDmE2fNdVjpDeP16HPOqzfBGwgSltNpYg40q0XXXwDdnZA8xDwUHwib
Iqdz7CJnZj6+5jiSMKOwFunEbC4d3U706/8AbgpUfScNQF9K+sNjwQfgEPQWtudb
IMF2n48Fm4MTfid+UQgQI5XGM9xFhLf+owPYTWyb+bO13ooLyCL8YFMBAKTSumfm
9HSojPOGz7cNOtUZjwIdCNtrcog6sZFoiAJ27Kxgs5qNPH8wMYkkrXMN28sI44A+
MG+8EICHcjRqP+e4Vb8wgb5jJwwK7Sqt5/DqFtNn/xv1m8ISCIe0pl9rgqYAfd5d
QtoNDhjW/V9aG+uhaYCHxEwSrVgscnuun04T49NK/Z4QsswerHmsDHSs79JXr8YW
iRjRj3GWpet5NTZ/k6WvO/5aw24uuk9OD+GMWpFAk3zmYOIh0CVE1WeVbHUXjUyo
mFZm4wxU3ccmQk2vqCoXqX5RVuaApMmc2M1wl+A5jzAqxwPWyBkPrQNg/k0SZ0/2
MSYG+qftA8sqF1v1Ydpb4U+hfNUXCKeatQY38rn43wXmEVkw/UOPtJQ8f3fAUFuL
7OHvXmOo/R3gE9cndILK
=pOC4
-END PGP SIGNATURE-

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



Re: Filter behaviour ( settinf Content-Length header )

2014-02-27 Thread Christopher Schultz
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA256

Jose,

On 2/27/14, 3:22 PM, Christopher Schultz wrote:
 Jose,
 
 On 2/27/14, 1:29 PM, Jose María Zaragoza wrote:
 2014-02-27 17:24 GMT+01:00 Konstantin Kolinko 
 knst.koli...@gmail.com:
 2014-02-27 18:31 GMT+04:00 Jose María Zaragoza 
 demablo...@gmail.com:
 
 And what do you recommend to me for forcing to return  a 
 Content-Type ? Some weird clients require it
 
 If I cannot do it with a Filter , where can I do it ?
 
 
 You can do it in a Filter.
 
 As I said, 1. The header must be set before writing anything
 to the output stream. That is per HTTP/1.1 protocol. 2. The
 header must have correct value.
 
 How to implement that is up to you (do not expect me to teach
 you java programming, but maybe others here will do).
 
 If you do not know the length before response is generated, a 
 solution can be to buffer the response before writing it out.
 
 Buffering can be done by writing an adapter around servlet 
 response that replaces default output stream with a buffered
 one. The adapter can be implemented by extending 
 javax.servlet.http.HttpServletResponseWrapper class.  Some 
 caching frameworks have filters that perform such buffering
 and caching.
 
 
 Thanks. Finally, I did it with a servlet and it works
 
 I tried with a Filter and a HttpServletResponseWrapper. Long time
  before asking here. And I wrapped the response output stream
 into a FilterOutputStream , so I could count every byte written I
 got the right content length . All OK and I was happy. But , when
 I tried set the header with wrapper.setHeader(Content-Length,
 count ) , and as you told me before, the response headers had
 already been flushed ( i checked isCommited() ) I could modify
 output stream data but I couldn't modify response headers. I
 don't understand but it is
 
 Don't forget that you actually need to buffer the data. You can't
 just wrap the container's OutputStream (or Writer) in a
 FilterOutputStream -- the bytes will flow through your stream
 (writer) back to the client while you are counting them.
 
 If you aren't using a big byte array (or something similar), then
 you aren't buffering.

You may be interested in this thread from 2009:
http://markmail.org/thread/fumpfuspt7a3nesz

- -chris
-BEGIN PGP SIGNATURE-
Version: GnuPG v1
Comment: GPGTools - http://gpgtools.org
Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/

iQIcBAEBCAAGBQJTD58JAAoJEBzwKT+lPKRYFeEP/RYqIt/69O/nBEI807rWvVKC
OGF2Cc41TwGpI2FG8H5BEvFUQNYBm3+Jjh7keN1kOdfvmKsGGpATFcVg3qnaDr22
qdT//2cUfARaCG3YrEyV02YTGH5aFuVPY9bM5qG4we2KSYwxeUlB150jWu/wRPLt
8VZnJmAuxUWkNqX0HnzT6P8k53npQhK7kT8Dj+pbHIfKfnJeU98BCUsDvbRHPCgJ
WRlDsEqzfOmSLM8pWKXv2NTu+cNcCf9mfEuNMyFFb35ySNnbq0Mo9ndCIRIUTKQL
jRhzLuKrpWDY+XnTADvT+IBkw6rSg9GWfchdfGi5m/RtNVpz09YdpFp4KcIPUdrb
okf4hPyCbdPGm1Rm0YDTiwxjZOtNjClnIQ+WEWuOxR49C1BYhAIclYNzJ87sWnwk
iQRteRTU+fcMLMvG1azS53jiiQsmndFIzQFJ53szIDmU8F08oybJG14IQI7nJP1l
wmQCf4yTTDKJijw1lO9z79mpi7CRaZr6vgPWV7y9+d/H9KyRXutjSafABG+iUB7I
9vTF+85AI0FX1OV5CA6te7eBqNrvwrzSreCSyXLuEJvqprhXtb+3XQApj8N3ml90
g6h7GfRnP8xwuiIs2MmMowoZ3JdtK44IjRkI/gKNwNvXlmKCSAM8m6tF5g32Bkuf
geCSTdZxgOTq/2NpUFfA
=XcJc
-END PGP SIGNATURE-

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



Re: Error using same server.xml from a RedHat box on a Windows 2008 R2 box

2014-02-27 Thread Christopher Schultz
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA256

Daniel,

On 2/27/14, 9:58 AM, Daniel Mikusa wrote:
 By default Tomcat will look for the APR libraries and if it finds 
 them, it will use them.  In this case, it seems like it’s not
 finding them on your Linux environment and it is finding them on
 your Windows environment.

Tomcat ships with a binary tcnative for win32, but not for any other
OS, so that's probably why it works by default on Linux and not on
Windows.

- -chris
-BEGIN PGP SIGNATURE-
Version: GnuPG v1
Comment: GPGTools - http://gpgtools.org
Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/

iQIcBAEBCAAGBQJTD5+ZAAoJEBzwKT+lPKRYruQQAJCrKQlhFUnvwQPH7zy7xzIq
9hSVIo1ylm06pZHDL61LnTbHCTX7JBTbEI5t19ZsbyfK7VDKY+TulxEro+uzn6gu
yUOn1z1adeiw1rkYOLQxJ/r3NYWUfsmCZouwemnOIEVDWCR7zXlazf8AZm6XruBN
AYvTEcIlS0YeUFasFYr2A1Ii8uEBdlmxmLU47DJBiqKNg5wUzTztcMQlY6lbNG7I
A0rOWqrSBZ/GurAjR/71dLwwnEuXj9B88f0AWmkB4K/UH3DYEmu7TUK3EXU7CkyT
W7oG8x2ypW6+3pUhTazKug3YwjHfK5G0kT91i2dEkiXfBjsu+UEUX8zAxexOVJ1+
lkCxW3DZ6jxbNnvCC6bj3im5sM0wMrPSQ05L54nRRAOX194IQM/t2Vs0dhFPHFod
a01WmSFc2vggKfJj7eDTc9QQCRbYCqqJbA3/qX7f7ZW9thO3O2GMZRTlBgkekGjl
BxWH4iOWi779ut0MdDFbFiRvXit9fknk2W2Xnhu7nkmp5819GnVvWQeC7p0ysIV8
/+vv44NX0/JyskJM/mXL76vAhZ060TB7InnbqlfVifbuHkgW1UO0nVCllUk960M5
C+m6dxpRmao71gcsnqSbfKqz7Wook9yvpkITfgUDj4f/VkFa0PnjB8pjqwlOQBLw
RmdtIPUfGJdU9JgdIpyV
=2e0u
-END PGP SIGNATURE-

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



Re: java: src/network.c:441: Java_org_apache_tomcat_jni_Socket_send: Assertion failed

2014-02-27 Thread Dmitry Batiyevskiy
This didn't helped, java process died with same error in about 5 hours

Regards,

Dmitry Batiyevskiy

Ardas Group Inc.

www.ardas.dp.ua


2014-02-21 19:50 GMT+02:00 Dmitry Batiyevskiy 
dmitry.batiyevs...@ardas.dp.ua:

 Ok thanks I will try setting org.apache.catalina.connector.RECYCLE_FACADES
 to true


 Regards,

 Dmitry Batiyevskiy

 Ardas Group Inc.

 www.ardas.dp.ua




Re: NullPointerException is thrown when executing org.apache.coyote.http11.InternalNioOutputBuffer.writeToSocket

2014-02-27 Thread Christopher Schultz
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA256

Eric,

On 2/26/14, 3:39 AM, HU E wrote:
 Chris, Mark, thanks for your suggestion. After setting the system 
 property org.apache.catalina.connector.RECYCLE_FACADES to true,
 this issue disappeared.

That suggests that your application is making a mistake somewhere. You
might want to fix that, as recycling facades gives you a bit of a
performance drop.

- -chris
-BEGIN PGP SIGNATURE-
Version: GnuPG v1
Comment: GPGTools - http://gpgtools.org
Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/

iQIcBAEBCAAGBQJTD6NvAAoJEBzwKT+lPKRYeJAP+wRF5tzw6A6LaT0aqxS5zzdm
IsMdyKhT+IiqJNtUDuTZ4EkXiL6iP21pexigiPmPj4RBsetvzqKZBBv9ZYdpjuQE
7Ei8K1UmBndbFEbCiAYyb8UizArplxy0Dysmn6JjsG1wCqfhXGArLBVOJbe2YRWt
d39arANbV6Y14U5PCKo3zH3oN36FFSH0lbgA6CAqPkPyD843K2xSiIRGjPmySnXY
R8OkowijIr5tbKDJfe+vl6it04XA2m0pO0iVVNNIMHZkU3/zmptNIgw1n2cVT18/
kRMONFPyakZFzIXPbG32vBZWTjiHSzUpRbUBc+0NGUER5dYlkzF57UtmKk4inG7Y
wYEXVH8Wd+pdWD/NCIm9+9WM47U+fkVKOtOzAW3dn4psZ6GbrzNQ2X2oAKZakgH5
RRvPg804cgE3xEy8HsIqOO1Zx9xPzmf11LG6T33Xz9OZ7xp9ToQuJKVsYKzReMd4
I0c5nmcLnxn1K7v95YlkafOOuIopW3lnoHEbwK8LW9tAQ38ylNIp+GDErjLQbKin
alV7EAOJ4ZAZjqPizFWUJDEh3TJmOul8C9DH033K+32aZdWoOY5R+nL4+1rGelOw
YpVDrgaedikvG8f2awgkovBjZ/HmmFVBxVB63Vp/IdCWEJOEIkz02ZqWSYMvllN3
qPy/JXQPsgMwnwXWx00n
=4bJx
-END PGP SIGNATURE-

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



Re: java: src/network.c:441: Java_org_apache_tomcat_jni_Socket_send: Assertion failed

2014-02-27 Thread Christopher Schultz
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA256

Dmitry,

On 2/27/14, 3:27 PM, Dmitry Batiyevskiy wrote:
 This didn't helped, java process died with same error in about 5 
 hours

Okay. The assert() call will in fact kill the process -- I had to check.
It seems that for the time being, your only resource would be to switch
to one of the pure-Java connectors until you are able to track-down the
problem.

We haven't been hearing a lot about this problem, so it looks like for
now it's likely to be a problem with your application or environment.

- -chris
-BEGIN PGP SIGNATURE-
Version: GnuPG v1
Comment: GPGTools - http://gpgtools.org
Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/

iQIcBAEBCAAGBQJTD60NAAoJEBzwKT+lPKRY8YEQAIFCUrgNaLwRgA1ktIyOwid/
bU/9CD93obj/vgsQbUkoDB4wneepGW5AFWVR0kk5tVWynjjg8JZNbiKtYoHX5FrJ
Ig4hzzlUaETL/KNczeMwprmhARZSdMEl+QXXi9Evau/K7ngCUZUXGV8nTrCTGxtz
XEmXp/UnSkRDKuD72TkYMFWNQhiZZjLBeqcba6B0SY80F0jj04r5yNW7dLDmNphx
LUC+U6WtPyoo3IMj7V5KRTPcDTmjDsGIjp//lCf7kDZ9GyQTHasV85GBzxmuwvvj
TeuD17cjOsOacEw4baxqI/ah1IboWkVHhdwEn/7Af6iUS+AI2J5lQmMej/DoZiJy
y805A+xDTOap29vhZTx9d+PlTQnp0KCnHKfN8sRHBtQGdImarr8bQ9E5KI1GEiaP
ezYRiM0Z0sA+sCq7dUMvFEjXXsNcoP1kInq3HjqRdaJd2LE6peRYDzJhPgXB3U22
NZSF6i4Ab8mSuueTQvX7UOhZG8s4chMdfcmw/W9e8lMG43MKkiuELHENzLarQwKe
6hOk6eUthYw1p1zSO53UxwgGAzC7yLAPQ/tvDZN1dbewUcOWNjQ9GzIDZ2WMTZRg
TsGFz3CjmSo59q9VegmIA4DHMRXz0Zxrxzt2YjQEwXSYMoVAm8vcM3AssuorhAWi
HCcozZP3IkQHc7eBZ2lW
=xTw7
-END PGP SIGNATURE-

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



Tomcat 7.0.52 issue on our Sun Sparc with SunOS 5.10

2014-02-27 Thread Jay
Hello,

We newly installed Solaris 10 with all default settings on our Sun Sparc
machine (sun4u sparc SUNW,UltraAX-i2 64-bit sparcv9 kernel modules).
The OS Version: SunOS hostname 5.10 Generic_147147-26 sun4u sparc
SUNW,UltraAX-i2.

We downloaded and installed JDK packages as follows:
jdk-7u51-solaris-sparc.z
jdk-7u51-solaris-sparcv9.z

The Java in the environment:
java version 1.7.0_51
Java(TM) SE Runtime Environment (build 1.7.0_51-b13)
Java HotSpot(TM) Client VM (build 24.51-b03, mixed mode, sharing)

We downloaded the  apache-tomcat-7.0.52.tar.gz and just unpacked it in
/export/home/tester.
Then we started the Tomcat server just using ./startup.sh without change of
any default settings.
The Tomcat is started ok listening at 8080 and we can see the Tomcat main
page on Web Browser at the port 8080. 
But there is SEVERE error in the logs as follows:
  org.apache.catalina.core.StandardContext listenerStart
  SEVERE: Error configuring application listener of class
websocket.drawboard.DrawboardContextListener

Is anyone aware about this issue? is it a configuration issue or environment
issue? 
Will this issue affect the basic Tomcat functions?
Can you please provide any clues or check points?

Thanks,
Jay 

PS. Here are the outputs from the logs:
#
# cat catalina.out
Feb 27, 2014 4:23:18 PM org.apache.catalina.core.AprLifecycleListener init
INFO: The APR based Apache Tomcat Native library which allows optimal
performance in production environments was not found on the
java.library.path: /usr/jdk/packages/lib/sparc:/lib:/usr/lib
Feb 27, 2014 4:23:21 PM org.apache.coyote.AbstractProtocol init
INFO: Initializing ProtocolHandler [http-bio-8080]
Feb 27, 2014 4:23:22 PM org.apache.coyote.AbstractProtocol init
INFO: Initializing ProtocolHandler [ajp-bio-8009]
Feb 27, 2014 4:23:22 PM org.apache.catalina.startup.Catalina load
INFO: Initialization processed in 6354 ms
Feb 27, 2014 4:23:22 PM org.apache.catalina.core.StandardService
startInternal
INFO: Starting service Catalina
Feb 27, 2014 4:23:22 PM org.apache.catalina.core.StandardEngine
startInternal
INFO: Starting Servlet Engine: Apache Tomcat/7.0.52
Feb 27, 2014 4:23:22 PM org.apache.catalina.startup.HostConfig
deployDirectory
INFO: Deploying web application directory
/export/home/tester/apache-tomcat-7.0.52/webapps/manager
Feb 27, 2014 4:23:26 PM org.apache.catalina.startup.HostConfig
deployDirectory
INFO: Deploying web application directory
/export/home/tester/apache-tomcat-7.0.52/webapps/docs
Feb 27, 2014 4:23:27 PM org.apache.catalina.startup.HostConfig
deployDirectory
INFO: Deploying web application directory
/export/home/tester/apache-tomcat-7.0.52/webapps/examples
Feb 27, 2014 4:23:31 PM org.apache.catalina.core.StandardContext
startInternal
SEVERE: Error listenerStart
Feb 27, 2014 4:23:31 PM org.apache.catalina.core.StandardContext
startInternal
SEVERE: Context [/examples] startup failed due to previous errors
Feb 27, 2014 4:23:31 PM org.apache.catalina.startup.HostConfig
deployDirectory
INFO: Deploying web application directory
/export/home/tester/apache-tomcat-7.0.52/webapps/ROOT
Feb 27, 2014 4:23:32 PM org.apache.catalina.startup.HostConfig
deployDirectory
INFO: Deploying web application directory
/export/home/tester/apache-tomcat-7.0.52/webapps/host-manager
Feb 27, 2014 4:23:32 PM org.apache.coyote.AbstractProtocol start
INFO: Starting ProtocolHandler [http-bio-8080]
Feb 27, 2014 4:23:32 PM org.apache.coyote.AbstractProtocol start
INFO: Starting ProtocolHandler [ajp-bio-8009]
Feb 27, 2014 4:23:32 PM org.apache.catalina.startup.Catalina start
INFO: Server startup in 10763 ms
#
# cat localhost.2014-02-27.log
Feb 27, 2014 4:23:31 PM org.apache.catalina.core.StandardContext
listenerStart
SEVERE: Error configuring application listener of class
websocket.drawboard.DrawboardContextListener
java.lang.ClassNotFoundException:
websocket.drawboard.DrawboardContextListener
at
org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.jav
a:1718)
at
org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.jav
a:1569)
at
org.apache.catalina.core.DefaultInstanceManager.loadClass(DefaultInstanceMan
ager.java:529)
at
org.apache.catalina.core.DefaultInstanceManager.loadClassMaybePrivileged(Def
aultInstanceManager.java:511)
at
org.apache.catalina.core.DefaultInstanceManager.newInstance(DefaultInstanceM
anager.java:139)
at
org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:
4888)
at
org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:
5467)
at
org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
at
org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:9
01)
at
org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:877)
at

Re: Tomcat 7.0.52 issue on our Sun Sparc with SunOS 5.10

2014-02-27 Thread Konstantin Kolinko
2014-02-28 1:56 GMT+04:00 Jay mx...@live.com:
 Hello,

 We newly installed Solaris 10 with all default settings on our Sun Sparc
 machine (sun4u sparc SUNW,UltraAX-i2 64-bit sparcv9 kernel modules).
 The OS Version: SunOS hostname 5.10 Generic_147147-26 sun4u sparc
 SUNW,UltraAX-i2.

 We downloaded and installed JDK packages as follows:
 jdk-7u51-solaris-sparc.z
 jdk-7u51-solaris-sparcv9.z

 The Java in the environment:
 java version 1.7.0_51
 Java(TM) SE Runtime Environment (build 1.7.0_51-b13)
 Java HotSpot(TM) Client VM (build 24.51-b03, mixed mode, sharing)

 We downloaded the  apache-tomcat-7.0.52.tar.gz and just unpacked it in
 /export/home/tester.
 Then we started the Tomcat server just using ./startup.sh without change of
 any default settings.
 The Tomcat is started ok listening at 8080 and we can see the Tomcat main
 page on Web Browser at the port 8080.
 But there is SEVERE error in the logs as follows:
   org.apache.catalina.core.StandardContext listenerStart
   SEVERE: Error configuring application listener of class
 websocket.drawboard.DrawboardContextListener

 Is anyone aware about this issue? is it a configuration issue or environment
 issue?
 Will this issue affect the basic Tomcat functions?
 Can you please provide any clues or check points?

 Thanks,
 Jay

 PS. Here are the outputs from the logs:
()
 INFO: Deploying web application directory
 /export/home/tester/apache-tomcat-7.0.52/webapps/examples
(...)
 java.lang.ClassNotFoundException:
 websocket.drawboard.DrawboardContextListener


Does the following class file exist in your installation?
/export/home/tester/apache-tomcat-7.0.52/webapps/examples/WEB-INF/classes/websocket/drawboard/DrawboardContextListener.class

I have checked, that it is present in apache-tomcat-7.0.52.tar.gz, but
may be you had trouble unpacking it.  The *.tar.gz file requires GNU
Tar (as mentioned in README file on the download page), because of
some long file names.

You can download apache-tomcat-7.0.52.zip instead.

Best regards,
Konstantin Kolinko

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



Re: tomcat 6 refuses mod_jk connections after server runs for a couple of days

2014-02-27 Thread Konstantin Kolinko
2014-02-28 2:06 GMT+04:00 Isaac Gonzalez igonza...@autoreturn.com:
 Hi Christopher(and Konstantin), attached is a couple of thread dumps of when 
 we experienced the issue again today. I also noticed we get this message 
 right before the problem occurs:
 Feb 27, 2014 12:47:15 PM 
 org.apache.tomcat.util.threads.ThreadPool$ControlRunnable run
 SEVERE: Caught exception (java.lang.OutOfMemoryError: unable to create new 
 native thread) executing 
 org.apache.jk.common.ChannelSocket$SocketAcceptor@177ddea, terminating thread

That explains why a connection cannot be accepted.

I wonder are you hitting an ulimit limit,
or there is just not enough free memory to allocate stack area for a
new thread (which size is set by -Xss option to java executable).

Your thread dumps contain 149 threads each.

Best regards,
Konstantin Kolinko

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



RE: tomcat 6 refuses mod_jk connections after server runs for a couple of days

2014-02-27 Thread Isaac Gonzalez

-Original Message-
From: Konstantin Kolinko [mailto:knst.koli...@gmail.com] 
Sent: Thursday, February 27, 2014 2:40 PM
To: Tomcat Users List
Subject: Re: tomcat 6 refuses mod_jk connections after server runs for a couple 
of days

2014-02-28 2:06 GMT+04:00 Isaac Gonzalez igonza...@autoreturn.com:
 Hi Christopher(and Konstantin), attached is a couple of thread dumps of when 
 we experienced the issue again today. I also noticed we get this message 
 right before the problem occurs:
 Feb 27, 2014 12:47:15 PM 
 org.apache.tomcat.util.threads.ThreadPool$ControlRunnable run
 SEVERE: Caught exception (java.lang.OutOfMemoryError: unable to create 
 new native thread) executing 
 org.apache.jk.common.ChannelSocket$SocketAcceptor@177ddea, terminating 
 thread

That explains why a connection cannot be accepted.

I wonder are you hitting an ulimit limit, or there is just not enough free 
memory to allocate stack area for a new thread (which size is set by -Xss 
option to java executable).

I thought of the ulimit settings and increased it to the upward limit 
allowed at the end of last weekend:
[root@server ~]# su tomcat
[tomcat@server root]$ ulimit -a
core file size  (blocks, -c) 0
data seg size   (kbytes, -d) unlimited
scheduling priority (-e) 0
file size   (blocks, -f) unlimited
pending signals (-i) 62835
max locked memory   (kbytes, -l) 64
max memory size (kbytes, -m) unlimited
open files  (-n) 65535
pipe size(512 bytes, -p) 8
POSIX message queues (bytes, -q) 819200
real-time priority  (-r) 0
stack size  (kbytes, -s) 10240
cpu time   (seconds, -t) unlimited
max user processes  (-u) 1024
virtual memory  (kbytes, -v) unlimited
file locks  (-x) unlimited

Here is my options I am passing to Java in my init 
script(I'm not using the -Xss option)
-Dbuild.compiler.emacs=true -XX:MaxPermSize=256M -Xmx2048m 
-Duser.timezone=America/Los_Angeles -Dcom.sun.management.jmxremote 
-Dcom.sun.management.jmxremote.port=8089 
-Dcom.sun.management.jmxremote.ssl=false 
-Dcom.sun.management.jmxremote.authenticate=false -Xdebug 
-Xrunjdwp:transport=dt_socket,address=8003,server=y,suspend=n

Your thread dumps contain 149 threads each.

So I am not maxing out threads...seems like each tomcat node is running out of 
memory at the same time

Best regards,
Konstantin Kolinko

-
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