Re: Optimizing Tomcat with Http11NioProtocol?

2008-12-29 Thread nodje

thanks again Brian.

one last question about monitoring, have you bean able to use Hyperic HQ on
your production environment without significant performance reduction?

We have identified Glassbox and LambdaProbe as potentially good tools but
never dared to put them on the production server.

-nodje


Brian Clark-10 wrote:
> 
> Glad to be of help.
> 
> First, I don't think that APR has anything to do with thread management. I
> think the two things it does really well is to serve up static content and
> provide native SSL processing. Tomcat 6 and/or Java 6 may help with though
> (I would assume so, but I don't know for sure).
> 
> Second, Tomcat 6 and Java 6 will provide performance
> enhancements--particularly from the newer hotspot compiler in Java 6. If
> using on 32-bit Windows, be sure to select the "server" version of the
> JVM, and not the "client" JVM. By default, Tomcat will select the client
> version on 32-bit Windows. On 64-bit Windows, there is only one version
> available, the server version. 
> 
> Also, as your original question started off with asking about the NIO
> protocol, according to the benchmarking done by the authors of the
> O'Reilly Tomcat book, the JIO connector is sometimes faster than the
> NIO connector. I recommend getting this book and reviewing the sections
> on performance tuning.
> 
> Finally, I suggest using a tool to monitor your JVM and applications over
> a period of time. We use the free Hyperic HQ monitoring tool. It uses JMX
> to remotely monitor Java 6/Tomcat 6, and I have found it to be very
> valuable. There is a free and a commercial version. WE use the free
> version and it works great. Check it out at http://www.hyperic.com  We use
> this tool to monitor heap usage and thread usage over time, so that we can
> tell if we are hitting our upper limits on either of these constraints. 
> 
> Brian
> 
> 
> 
> 
> 
> From: nodje 
> To: users@tomcat.apache.org
> Sent: Monday, December 29, 2008 9:10:05 PM
> Subject: Re: Optimizing Tomcat with Http11NioProtocol?
> 
> 
> Hi, thanks all for your answers.
> 
> I have jconsole in place. I can monitor Tomcat and general JVM
> information. 
> The think is it's not easy to understand statistics.
> 
> - How much I am using of Xmx is definitely something I want to know
> - how many thread are used in peak times is also something I need to know:
> if it reaches 150, the max, how much further can I push it? Would
> Http11NioProtocol help for this matter?
> - How can I detect if it's the application that takes time to process
> request or Tomcat that is at its max capacity? Number of threads and Heap
> memory usages are probably two good indicators right?
> 
> More generally avout Http11NioProtocol, can it be less efficient than the
> std connector? Or is it suppose to be the next generation good-for-all
> connector?
> 
> We are going to update to Tomcat 6 +APR anyways. Is the APR good only for
> static content? I thought it would help the thread management anyways.
> 
> Thanks Brian for confirming memory usage! That's very good to know it's
> possible to use that much memory!
> 
> cheers
> 
> 
> Brian Clark-10 wrote:
>> 
>> Try using jconsole.exe (it is part of the Sun JDK) to review memory and
>> thread usage of your JVM. That should help you narrow down where the
>> issue
>> is. One key thing to look at with Jconsole is the heap memory used
>> figure.
>> You are setting your -Xmx, but how much of it are you actually using?
>> Heap
>> memory used will tell you if you have a memory constraint or not. Also
>> look at how often you have garbage collections. You'll have more of them
>> if you have a memory constraint. One more thing, be sure your min and max
>> memory configurations are the same. It's more efficient that way. 
>> 
>> On 32-bit Windows, you should be able to use 1536MB as your -Xmx size.
>> That is what we are able to use, at least using JDK 1.6.x. Upgrading to
>> 64-bit Windows and a 64-bit JVM (and 64-bit Tomcat) will allow you to use
>> as much RAM as you have available. We have a 64-bit Windows system with
>> 18
>> GB of RAM allocated to Tomcat/Java.
>> 
>> 
>> Good luck,
>> Brian
>> 
>> 
>> 
>> 
>> 
>> From: nodje 
>> To: users@tomcat.apache.org
>> Sent: Monday, December 29, 2008 2:57:14 AM
>> Subject: Optimizing Tomcat with Http11NioProtocol?
>> 
>> 
>> Hi,
>> 
>> we are still using 5.5.12 in production and our users are facing
>> increasing
>> delays with their requests (like way too long by now already).
>> While we are not entirely sure about what's causing this (database vs
>> Java
>> application), we suppose it comes from the Java application (the database
>> server never seems to be under stress).
>> The CPU of the Tomcat machine doesn't seem too busy either.
>> 
>> Providing it comes from the Java application side (by the way, any tips
>> on
>> how to precisely identify that is more than welcome), and providing that
>> the
>> problems come f

Re: Cannot create PoolableConnectionFactory (Unexpected exception encountered during query.)

2008-12-29 Thread David Smith
Thanks ... the config in your context.xml and web.xml look normal
enough.  I would recommend you change your JDK from OpenJDK to Sun's JDK
though.

Also was this installed from a Ubuntu's package or installed from a
tomcat.apache.org download?  If installed from Ubuntu, do a search of
Ubuntu's docs on tomcat for how to configure database pooling.   Each
packager does little things different from the main tomcat distribution
that may affect how you need to configure things.  One last possibility,
repackaged versions have a tendency to split things out into a gazillion
different little pieces and you may be missing a package containing the
tomcat dbcp jar.  If that's the case, the logs should have something to
the effect of "ClassNotFound" when you start the service.

--David


Stefan Riegel wrote:
> Here it comes:
>
> ---
> context.xml in META-INF
> ---
>
>  crossContext="true">
>
>  prefix="localhost_DBTest_log." suffix=".log" timestamp="true" />
>
> 
> WEB-INF/web.xml
>
>  type="javax.sql.DataSource"
> maxActive="100" maxIdle="30" maxWait="1" username="correct"
> password="also-correct"
> driverClassName="com.mysql.jdbc.Driver"
> url="jdbc:mysql://localhost:3306/swex-products" />
> 
>
> --
> web.xml in WEB-INF
> --
>
> 
>  xmlns="http://java.sun.com/xml/ns/j2ee";
> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
> xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee
> http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd";>
> 
> swex-v2009.01
> 
> index.html
> index.htm
> index.jsp
> default.html
> default.htm
> default.jsp
> 
> 
>  
>   DB Connection
>   jdbc/TestDB
>   javax.sql.DataSource
>   Container
>   
> 
> 
>
> -
> index.jsp
> -
>
> 
>  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd";>
> <%@ page language="java" contentType="text/html; charset=UTF-8"
> pageEncoding="UTF-8"%>
> <%@ taglib uri="http://java.sun.com/jsp/jstl/sql"; prefix="sql" %>
> <%@ taglib uri="http://java.sun.com/jsp/jstl/core"; prefix="c" %>
> http://www.w3.org/1999/xhtml";>
> 
> 
> Insert title here
> 
> 
> ${7+7}ÄÖ
>
> 
> select * from base LIMIT 30
> 
>
> 
>   
> DB Test
>   
>   
>
>   Results
>
> 
> Name ${row.name}
> 
>
>   
> 
>
> 
> 
>
> ---
> JDK
> ---
>
> OpenJDK  Runtime Environment (build 1.6.0_0-b11)
> OpenJDK 64-Bit Server VM (build 1.6.0_0-b11, mixed mode)
>
> Do You need any more information?
>
> I have no problems connecting to mysql (same database, same user, same
> passwd, same port) on localhost with other clients. I use the latest,
> fresh, stable mysql Connector/J.
>
>
> David Smith schrieb:
>> Can you post relevant parts of your config?  Replace the username,
>> password and hostnames with fakes, but otherwise post exactly what you
>> have in your specific environment.
>>
>> --David
>>
>> Stefan Riegel wrote:
>>> Hi all,
>>>
>>> I'm trying to connect to a MySQL database based on the Tomcat Docs
>>> example. See the error message below.
>>>
>>> Similar to the Problem from Krapacs Ambrose, I'm using a standard
>>> configured Ubuntu 8.04 Server with Tomcat 5.5. I did follow all hints
>>> in the whole thread and reproduced exactly the example from the Tomcat
>>> Docs.
>>>
>>> http://marc.info/?l=tomcat-user&m=122701096423437&w=2
>>>
>>> http://tomcat.apache.org/tomcat-5.5-doc/jndi-datasource-examples-howto.html
>>>
>>>
>>>
>>> but did not succeed. My security manager is disabled.
>>>
>>> Hopefully someone can help me. I have spend a complete day without any
>>> result. Very frustrating :-(
>>>
>>> ---
>>>  error messages shown up in the browser ---
>>> ---
>>>
>>> type Exception report
>>>
>>> message
>>>
>>> description The server encountered an internal error () that prevented
>>> it from fulfilling this request.
>>>
>>> exception
>>>
>>> org.apache.jasper.JasperException: Exception in JSP: /index.jsp:15
>>>
>>> 12: 
>>> 13: ${7+7}ÄÖ
>>> 14:
>>> 15: 
>>> 16: select * from base LIMIT 30;
>>> 17: 
>>> 18:
>>>
>>>
>>> Stacktrace:
>>>
>>> org.apache.jasper.servlet.JspServletWrapper.handleJspException(JspServletWrapper.java:451)
>>>
>>>
>>>
>>> org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:355)
>>>
>>>
>>>
>>> org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:329)
>>>
>>>
>>> org.apache.jasper.servlet.JspServlet.service(JspServlet.java:265)
>>> javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
>>>
>>> root cause
>>>
>>> javax.servlet.ServletException: Unable to get connection, DataSource
>>> invalid: "org.apache.commons.dbcp.SQLNestedException: Cannot create
>>> PoolableConnectionFactory (Unexpected exception encountered during
>>> query.)"
>>>
>>> org.apache.jasper.runtime.PageContextImpl.doH

Re: Optimizing Tomcat with Http11NioProtocol?

2008-12-29 Thread Brian Clark
Glad to be of help.

First, I don't think that APR has anything to do with thread management. I 
think the two things it does really well is to serve up static content and 
provide native SSL processing. Tomcat 6 and/or Java 6 may help with though (I 
would assume so, but I don't know for sure).

Second, Tomcat 6 and Java 6 will provide performance enhancements--particularly 
from the newer hotspot compiler in Java 6. If using on 32-bit Windows, be sure 
to select the "server" version of the JVM, and not the "client" JVM. By 
default, Tomcat will select the client version on 32-bit Windows. On 64-bit 
Windows, there is only one version available, the server version. 

Also, as your original question started off with asking about the NIO
protocol, according to the benchmarking done by the authors of the
O'Reilly Tomcat book, the JIO connector is sometimes faster than the
NIO connector. I recommend getting this book and reviewing the sections
on performance tuning.

Finally, I suggest using a tool to monitor your JVM and applications over a 
period of time. We use the free Hyperic HQ monitoring tool. It uses JMX to 
remotely monitor Java 6/Tomcat 6, and I have found it to be very valuable. 
There is a free and a commercial version. WE use the free version and it works 
great. Check it out at http://www.hyperic.com  We use this tool to monitor heap 
usage and thread usage over time, so that we can tell if we are hitting our 
upper limits on either of these constraints. 

Brian





From: nodje 
To: users@tomcat.apache.org
Sent: Monday, December 29, 2008 9:10:05 PM
Subject: Re: Optimizing Tomcat with Http11NioProtocol?


Hi, thanks all for your answers.

I have jconsole in place. I can monitor Tomcat and general JVM information. 
The think is it's not easy to understand statistics.

- How much I am using of Xmx is definitely something I want to know
- how many thread are used in peak times is also something I need to know:
if it reaches 150, the max, how much further can I push it? Would
Http11NioProtocol help for this matter?
- How can I detect if it's the application that takes time to process
request or Tomcat that is at its max capacity? Number of threads and Heap
memory usages are probably two good indicators right?

More generally avout Http11NioProtocol, can it be less efficient than the
std connector? Or is it suppose to be the next generation good-for-all
connector?

We are going to update to Tomcat 6 +APR anyways. Is the APR good only for
static content? I thought it would help the thread management anyways.

Thanks Brian for confirming memory usage! That's very good to know it's
possible to use that much memory!

cheers


Brian Clark-10 wrote:
> 
> Try using jconsole.exe (it is part of the Sun JDK) to review memory and
> thread usage of your JVM. That should help you narrow down where the issue
> is. One key thing to look at with Jconsole is the heap memory used figure.
> You are setting your -Xmx, but how much of it are you actually using? Heap
> memory used will tell you if you have a memory constraint or not. Also
> look at how often you have garbage collections. You'll have more of them
> if you have a memory constraint. One more thing, be sure your min and max
> memory configurations are the same. It's more efficient that way. 
> 
> On 32-bit Windows, you should be able to use 1536MB as your -Xmx size.
> That is what we are able to use, at least using JDK 1.6.x. Upgrading to
> 64-bit Windows and a 64-bit JVM (and 64-bit Tomcat) will allow you to use
> as much RAM as you have available. We have a 64-bit Windows system with 18
> GB of RAM allocated to Tomcat/Java.
> 
> 
> Good luck,
> Brian
> 
> 
> 
> 
> 
> From: nodje 
> To: users@tomcat.apache.org
> Sent: Monday, December 29, 2008 2:57:14 AM
> Subject: Optimizing Tomcat with Http11NioProtocol?
> 
> 
> Hi,
> 
> we are still using 5.5.12 in production and our users are facing
> increasing
> delays with their requests (like way too long by now already).
> While we are not entirely sure about what's causing this (database vs Java
> application), we suppose it comes from the Java application (the database
> server never seems to be under stress).
> The CPU of the Tomcat machine doesn't seem too busy either.
> 
> Providing it comes from the Java application side (by the way, any tips on
> how to precisely identify that is more than welcome), and providing that
> the
> problems come from too many requests, would Http11NioProtocol help Tomcat
> speed up the execution? 
> It seems worth trying Http11NioProtocol before going for clustering+load
> balancing. Any advice on the matter?
> 
> Also we think that request that cannot b served in the reasonable time
> should be refused. Taking into account the described behaviour with the
> default maxThreads=150 and acceptCount =100 values, shouldn't we decrease
> the acceptCount?
> Moreover the CPU on the Tomcat machine doesn't seem too busy. Is it

How can the login page see parameters in the original request?

2008-12-29 Thread removeps-groups
How can the login page see parameters in the original request?

In my app, I make a request to https://localhost/mywebservice/action.do.
Because the user is not authenticated, Tomcat redirects them to the login page. 
 I want the login page to be able to see the parameters passed in the original 
request.  Only if certain secret fields and values are present, do I want to 
generate the login page.  Otherwise, I want to send the response code 404.

In FormAuthenticator.java, function saveRequest, they have

if ("POST".equalsIgnoreCase(request.getMethod())) {
ByteChunk body = new ByteChunk();
body.setLimit(request.getConnector().getMaxSavePostSize());

byte[] buffer = new byte[4096];
int bytesRead;
InputStream is = request.getInputStream();

while ( (bytesRead = is.read(buffer) ) >= 0) {
body.append(buffer, 0, bytesRead);
}
saved.setContentType(request.getContentType());
saved.setBody(body);
}

Maybe the act of reading the input stream through is.read uses it up, not sure.


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



Re: Optimizing Tomcat with Http11NioProtocol?

2008-12-29 Thread nodje

Hi, thanks all for your answers.

I have jconsole in place. I can monitor Tomcat and general JVM information. 
The think is it's not easy to understand statistics.

- How much I am using of Xmx is definitely something I want to know
- how many thread are used in peak times is also something I need to know:
if it reaches 150, the max, how much further can I push it? Would
Http11NioProtocol help for this matter?
- How can I detect if it's the application that takes time to process
request or Tomcat that is at its max capacity? Number of threads and Heap
memory usages are probably two good indicators right?

More generally avout Http11NioProtocol, can it be less efficient than the
std connector? Or is it suppose to be the next generation good-for-all
connector?

We are going to update to Tomcat 6 +APR anyways. Is the APR good only for
static content? I thought it would help the thread management anyways.

Thanks Brian for confirming memory usage! That's very good to know it's
possible to use that much memory!

cheers


Brian Clark-10 wrote:
> 
> Try using jconsole.exe (it is part of the Sun JDK) to review memory and
> thread usage of your JVM. That should help you narrow down where the issue
> is. One key thing to look at with Jconsole is the heap memory used figure.
> You are setting your -Xmx, but how much of it are you actually using? Heap
> memory used will tell you if you have a memory constraint or not. Also
> look at how often you have garbage collections. You'll have more of them
> if you have a memory constraint. One more thing, be sure your min and max
> memory configurations are the same. It's more efficient that way. 
> 
> On 32-bit Windows, you should be able to use 1536MB as your -Xmx size.
> That is what we are able to use, at least using JDK 1.6.x. Upgrading to
> 64-bit Windows and a 64-bit JVM (and 64-bit Tomcat) will allow you to use
> as much RAM as you have available. We have a 64-bit Windows system with 18
> GB of RAM allocated to Tomcat/Java.
> 
> 
> Good luck,
> Brian
> 
> 
> 
> 
> 
> From: nodje 
> To: users@tomcat.apache.org
> Sent: Monday, December 29, 2008 2:57:14 AM
> Subject: Optimizing Tomcat with Http11NioProtocol?
> 
> 
> Hi,
> 
> we are still using 5.5.12 in production and our users are facing
> increasing
> delays with their requests (like way too long by now already).
> While we are not entirely sure about what's causing this (database vs Java
> application), we suppose it comes from the Java application (the database
> server never seems to be under stress).
> The CPU of the Tomcat machine doesn't seem too busy either.
> 
> Providing it comes from the Java application side (by the way, any tips on
> how to precisely identify that is more than welcome), and providing that
> the
> problems come from too many requests, would Http11NioProtocol help Tomcat
> speed up the execution? 
> It seems worth trying Http11NioProtocol before going for clustering+load
> balancing. Any advice on the matter?
> 
> Also we think that request that cannot b served in the reasonable time
> should be refused. Taking into account the described behaviour with the
> default maxThreads=150 and acceptCount =100 values, shouldn't we decrease
> the acceptCount?
> Moreover the CPU on the Tomcat machine doesn't seem too busy. Is it a sign
> that we can increase maxThreads?
> 
> Tomcat is on a Windows 32bits machine, so even though the machine has 4Gb
> of
> RAM, the MAX -Xmx size  that we can be used seems to be around 1200Mb.
> Would
> a 64bits OS automatically allows for more memory usage?
> 
> A lot of questions I know, but facing big problems like we are now, we
> want
> to try anything possible to quickly relieve the pain from using the
> application!
> 
> thanks to anyone providing advice
> -nodje
> -- 
> View this message in context:
> http://www.nabble.com/Optimizing-Tomcat-with-Http11NioProtocol--tp21200419p21200419.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
> 
> 
>   
> 

-- 
View this message in context: 
http://www.nabble.com/Optimizing-Tomcat-with-Http11NioProtocol--tp21200419p21212597.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



Re: Cannot create PoolableConnectionFactory (Unexpected exception encountered during query.)

2008-12-29 Thread Stefan Riegel

Here it comes:

---
context.xml in META-INF
---






WEB-INF/web.xml

		password="also-correct" driverClassName="com.mysql.jdbc.Driver" 
url="jdbc:mysql://localhost:3306/swex-products" />



--
web.xml in WEB-INF
--


xmlns="http://java.sun.com/xml/ns/j2ee"; 
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"; 
xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee 
http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd";>


swex-v2009.01

index.html
index.htm
index.jsp
default.html
default.htm
default.jsp


 
  DB Connection
  jdbc/TestDB
  javax.sql.DataSource
  Container




-
index.jsp
-


"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd";>

<%@ page language="java" contentType="text/html; charset=UTF-8"
pageEncoding="UTF-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/sql"; prefix="sql" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core"; prefix="c" %>
http://www.w3.org/1999/xhtml";>


Insert title here


${7+7}ÄÖ


select * from base LIMIT 30



  
DB Test
  
  

  Results


Name ${row.name}


  





---
JDK
---

OpenJDK  Runtime Environment (build 1.6.0_0-b11)
OpenJDK 64-Bit Server VM (build 1.6.0_0-b11, mixed mode)

Do You need any more information?

I have no problems connecting to mysql (same database, same user, same 
passwd, same port) on localhost with other clients. I use the latest, 
fresh, stable mysql Connector/J.



David Smith schrieb:

Can you post relevant parts of your config?  Replace the username,
password and hostnames with fakes, but otherwise post exactly what you
have in your specific environment.

--David

Stefan Riegel wrote:

Hi all,

I'm trying to connect to a MySQL database based on the Tomcat Docs
example. See the error message below.

Similar to the Problem from Krapacs Ambrose, I'm using a standard
configured Ubuntu 8.04 Server with Tomcat 5.5. I did follow all hints
in the whole thread and reproduced exactly the example from the Tomcat
Docs.

http://marc.info/?l=tomcat-user&m=122701096423437&w=2

http://tomcat.apache.org/tomcat-5.5-doc/jndi-datasource-examples-howto.html


but did not succeed. My security manager is disabled.

Hopefully someone can help me. I have spend a complete day without any
result. Very frustrating :-(

---
 error messages shown up in the browser ---
---

type Exception report

message

description The server encountered an internal error () that prevented
it from fulfilling this request.

exception

org.apache.jasper.JasperException: Exception in JSP: /index.jsp:15

12: 
13: ${7+7}ÄÖ
14:
15: 
16: select * from base LIMIT 30;
17: 
18:


Stacktrace:

org.apache.jasper.servlet.JspServletWrapper.handleJspException(JspServletWrapper.java:451)


org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:355)

org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:329)

org.apache.jasper.servlet.JspServlet.service(JspServlet.java:265)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)

root cause

javax.servlet.ServletException: Unable to get connection, DataSource
invalid: "org.apache.commons.dbcp.SQLNestedException: Cannot create
PoolableConnectionFactory (Unexpected exception encountered during
query.)"

org.apache.jasper.runtime.PageContextImpl.doHandlePageException(PageContextImpl.java:841)


org.apache.jasper.runtime.PageContextImpl.handlePageException(PageContextImpl.java:774)

org.apache.jsp.index_jsp._jspService(index_jsp.java:96)
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:98)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)

org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:331)

org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:329)

org.apache.jasper.servlet.JspServlet.service(JspServlet.java:265)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)

root cause

javax.servlet.jsp.JspException: Unable to get connection, DataSource
invalid: "org.apache.commons.dbcp.SQLNestedException: Cannot create
PoolableConnectionFactory (Unexpected exception encountered during
query.)"

org.apache.taglibs.standard.tag.common.sql.QueryTagSupport.getConnection(QueryTagSupport.java:276)


org.apache.taglibs.standard.tag.common.sql.QueryTagSupport.doStartTag(QueryTagSupport.java:159)

org.apache.jsp.index_jsp._jspx_meth_sql_005fquery_005f0(index_jsp.java:115)

org.apache.jsp.index_jsp._jspService(index_jsp.java:70)
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:98)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)

org.apache.jaspe

Re: [OT] How to compile a servlet for Tomcat 5 on IBM JVM, or, "Dr. Warnier: How I learned to stop worrying and love VMWare"

2008-12-29 Thread Michael Ludwig
Christopher Schultz schrieb am 29.12.2008 um 15:54:41 (-0500):
> André Warnier wrote:
> > It's a whole process to connect to that server, and when I am
> > connected I lose my other connections (email e.g.).
> 
> Aah, you use a VPN that fubar's your other connections? That's too
> bad.

Maybe you just haven't told your Windows OS to *not* use your VPN
connection as the default gateway for non-local connections?

Open the VPN connection properties. Dort auf "Netzwerk >
Internetprotokoll > Eigenschaften > Erweitert". Das Häkchen bei
"Standardgateway für das Remotenetzwerk verwenden" entfernen. Or
the equivalent steps in English.

But maybe your case is a different one.

Michael Ludwig

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



Re: Cannot create PoolableConnectionFactory (Unexpected exception encountered during query.)

2008-12-29 Thread David Smith
Can you post relevant parts of your config?  Replace the username,
password and hostnames with fakes, but otherwise post exactly what you
have in your specific environment.

--David

Stefan Riegel wrote:
> Hi all,
>
> I'm trying to connect to a MySQL database based on the Tomcat Docs
> example. See the error message below.
>
> Similar to the Problem from Krapacs Ambrose, I'm using a standard
> configured Ubuntu 8.04 Server with Tomcat 5.5. I did follow all hints
> in the whole thread and reproduced exactly the example from the Tomcat
> Docs.
>
> http://marc.info/?l=tomcat-user&m=122701096423437&w=2
>
> http://tomcat.apache.org/tomcat-5.5-doc/jndi-datasource-examples-howto.html
>
>
> but did not succeed. My security manager is disabled.
>
> Hopefully someone can help me. I have spend a complete day without any
> result. Very frustrating :-(
>
> ---
>  error messages shown up in the browser ---
> ---
>
> type Exception report
>
> message
>
> description The server encountered an internal error () that prevented
> it from fulfilling this request.
>
> exception
>
> org.apache.jasper.JasperException: Exception in JSP: /index.jsp:15
>
> 12: 
> 13: ${7+7}ÄÖ
> 14:
> 15: 
> 16: select * from base LIMIT 30;
> 17: 
> 18:
>
>
> Stacktrace:
> 
> org.apache.jasper.servlet.JspServletWrapper.handleJspException(JspServletWrapper.java:451)
>
> 
> org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:355)
>
> org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:329)
>
> org.apache.jasper.servlet.JspServlet.service(JspServlet.java:265)
> javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
>
> root cause
>
> javax.servlet.ServletException: Unable to get connection, DataSource
> invalid: "org.apache.commons.dbcp.SQLNestedException: Cannot create
> PoolableConnectionFactory (Unexpected exception encountered during
> query.)"
> 
> org.apache.jasper.runtime.PageContextImpl.doHandlePageException(PageContextImpl.java:841)
>
> 
> org.apache.jasper.runtime.PageContextImpl.handlePageException(PageContextImpl.java:774)
>
> org.apache.jsp.index_jsp._jspService(index_jsp.java:96)
> org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:98)
> javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
> 
> org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:331)
>
> org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:329)
>
> org.apache.jasper.servlet.JspServlet.service(JspServlet.java:265)
> javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
>
> root cause
>
> javax.servlet.jsp.JspException: Unable to get connection, DataSource
> invalid: "org.apache.commons.dbcp.SQLNestedException: Cannot create
> PoolableConnectionFactory (Unexpected exception encountered during
> query.)"
> 
> org.apache.taglibs.standard.tag.common.sql.QueryTagSupport.getConnection(QueryTagSupport.java:276)
>
> 
> org.apache.taglibs.standard.tag.common.sql.QueryTagSupport.doStartTag(QueryTagSupport.java:159)
>
> 
> org.apache.jsp.index_jsp._jspx_meth_sql_005fquery_005f0(index_jsp.java:115)
>
> org.apache.jsp.index_jsp._jspService(index_jsp.java:70)
> org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:98)
> javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
> 
> org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:331)
>
> org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:329)
>
> org.apache.jasper.servlet.JspServlet.service(JspServlet.java:265)
> javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
>
> note The full stack trace of the root cause is available in the Apache
> Tomcat/5.5 logs.
>
>
>


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



Re: Hints on upgrading from 6.0.14 to 6.0.18 on production server

2008-12-29 Thread Brian Clark
The only thing we found when going from 6.0.16 to 6.0.18 was an issue with some 
of our JSP's. The fix is described by "jroller" here:
http://www.searchfull.net/1289260.html

Since I had a real hard time getting to this website, I'll copy and paste the 
article here


Tomcat 6.0.18 includes a fix for JSP specification compliance as described in 
Bug #45015. Unfortunately, that means a lot of your JSPs will fail with the 
following exception: 
org.apache.jasper.JasperException:
/WEB-INF/jsp/myPage.jsp(44,72) Attribute value  is quoted with " which must be escaped when used within
the value
While I haven't found a way to automatically fix them, you can at least find 
all of your JSPs ( *.jsp*) in need of an update with the following regular 
expression (take a deep breath): 

<\w+:[^>]+="[^<"]*<%=[^%]*"|<\w+:[^>]+='[^<']*<%=[^%]*'


Enjoy,
Brian





From: Alan Chaney 
To: Tomcat Users List 
Sent: Monday, December 29, 2008 11:54:56 AM
Subject: Hints on upgrading from 6.0.14 to 6.0.18 on production server

Hi

I have a 6.0.14 running with Apr 1.1.10 and I seem to be seeing instances of 
CVE-2007-6286: Tomcat duplicate request processing vulnerability

(64-Bit Server VM (build 1.6.0_03-b05, mixed mode)
(Centos 5.0 - Linux 2.6.18-8.el5  x86_64 )


The obvious thing to do is to upgrade from 6.0.14 to 6.0.18. Firstly, are there 
any changes in server.xml and web.xml in 6.0.18 that mean I can't just use the 
existing ones in the new installation.

My current installation has $TOMCAT_HOME pointing to /usr/local/tomcat

My intended upgrade sequence is:

1. opy down 6.0.18 and untar it int /usr/local/tomcat18 (after checking 
signatures)

2. copy over the jars that I have placed in the old $TOMCAT_HOME/lib (eg 
postgres jdbc jar) to /usr/local/tomcat18/lib

3. copy over my webapp wars from $TOMCAT_HOME/webapps to the new webapps folder.

4. as I am using jsvc to control tomcat, copy over the 'tomcat' file from the 
$TOMCAT_HOME ('tomcat' is actually a shell script which sets up
all the environment variables for jsvc.) jsvc is in /usr/lib/tcnative/jsvc so 
it should be unaffected by the move. However
I do need to copy over the $TOMCAT_HOME/bin/commons-daemon.jar.

5. stop the old server and rename its directory to /usr/local/tomcat.old

6. rename the directory of the new server to that of the current the new server.

7. restart the server.


Am I missing anything? What have I overlooked? I need this to go as smoothly as 
possible as there is quite a lot of traffic on this site.

Thanks in advance

Alan Chaney


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


  

Re: Optimizing Tomcat with Http11NioProtocol?

2008-12-29 Thread Brian Clark
Try using jconsole.exe (it is part of the Sun JDK) to review memory and thread 
usage of your JVM. That should help you narrow down where the issue is. One key 
thing to look at with Jconsole is the heap memory used figure. You are setting 
your -Xmx, but how much of it are you actually using? Heap memory used will 
tell you if you have a memory constraint or not. Also look at how often you 
have garbage collections. You'll have more of them if you have a memory 
constraint. One more thing, be sure your min and max memory configurations are 
the same. It's more efficient that way. 

On 32-bit Windows, you should be able to use 1536MB as your -Xmx size. That is 
what we are able to use, at least using JDK 1.6.x. Upgrading to 64-bit Windows 
and a 64-bit JVM (and 64-bit Tomcat) will allow you to use as much RAM as you 
have available. We have a 64-bit Windows system with 18 GB of RAM allocated to 
Tomcat/Java.


Good luck,
Brian





From: nodje 
To: users@tomcat.apache.org
Sent: Monday, December 29, 2008 2:57:14 AM
Subject: Optimizing Tomcat with Http11NioProtocol?


Hi,

we are still using 5.5.12 in production and our users are facing increasing
delays with their requests (like way too long by now already).
While we are not entirely sure about what's causing this (database vs Java
application), we suppose it comes from the Java application (the database
server never seems to be under stress).
The CPU of the Tomcat machine doesn't seem too busy either.

Providing it comes from the Java application side (by the way, any tips on
how to precisely identify that is more than welcome), and providing that the
problems come from too many requests, would Http11NioProtocol help Tomcat
speed up the execution? 
It seems worth trying Http11NioProtocol before going for clustering+load
balancing. Any advice on the matter?

Also we think that request that cannot b served in the reasonable time
should be refused. Taking into account the described behaviour with the
default maxThreads=150 and acceptCount =100 values, shouldn't we decrease
the acceptCount?
Moreover the CPU on the Tomcat machine doesn't seem too busy. Is it a sign
that we can increase maxThreads?

Tomcat is on a Windows 32bits machine, so even though the machine has 4Gb of
RAM, the MAX -Xmx size  that we can be used seems to be around 1200Mb. Would
a 64bits OS automatically allows for more memory usage?

A lot of questions I know, but facing big problems like we are now, we want
to try anything possible to quickly relieve the pain from using the
application!

thanks to anyone providing advice
-nodje
-- 
View this message in context: 
http://www.nabble.com/Optimizing-Tomcat-with-Http11NioProtocol--tp21200419p21200419.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


  

Cannot create PoolableConnectionFactory (Unexpected exception encountered during query.)

2008-12-29 Thread Stefan Riegel

Hi all,

I'm trying to connect to a MySQL database based on the Tomcat Docs 
example. See the error message below.


Similar to the Problem from Krapacs Ambrose, I'm using a standard 
configured Ubuntu 8.04 Server with Tomcat 5.5. I did follow all hints in 
the whole thread and reproduced exactly the example from the Tomcat Docs.


http://marc.info/?l=tomcat-user&m=122701096423437&w=2

http://tomcat.apache.org/tomcat-5.5-doc/jndi-datasource-examples-howto.html

but did not succeed. My security manager is disabled.

Hopefully someone can help me. I have spend a complete day without any 
result. Very frustrating :-(


---
 error messages shown up in the browser ---
---

type Exception report

message

description The server encountered an internal error () that prevented 
it from fulfilling this request.


exception

org.apache.jasper.JasperException: Exception in JSP: /index.jsp:15

12: 
13: ${7+7}ÄÖ
14:
15: 
16: select * from base LIMIT 30;
17: 
18:


Stacktrace:

org.apache.jasper.servlet.JspServletWrapper.handleJspException(JspServletWrapper.java:451)

org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:355)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:329)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:265)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)

root cause

javax.servlet.ServletException: Unable to get connection, DataSource 
invalid: "org.apache.commons.dbcp.SQLNestedException: Cannot create 
PoolableConnectionFactory (Unexpected exception encountered during query.)"


org.apache.jasper.runtime.PageContextImpl.doHandlePageException(PageContextImpl.java:841)

org.apache.jasper.runtime.PageContextImpl.handlePageException(PageContextImpl.java:774)
org.apache.jsp.index_jsp._jspService(index_jsp.java:96)
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:98)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)

org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:331)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:329)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:265)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)

root cause

javax.servlet.jsp.JspException: Unable to get connection, DataSource 
invalid: "org.apache.commons.dbcp.SQLNestedException: Cannot create 
PoolableConnectionFactory (Unexpected exception encountered during query.)"


org.apache.taglibs.standard.tag.common.sql.QueryTagSupport.getConnection(QueryTagSupport.java:276)

org.apache.taglibs.standard.tag.common.sql.QueryTagSupport.doStartTag(QueryTagSupport.java:159)

org.apache.jsp.index_jsp._jspx_meth_sql_005fquery_005f0(index_jsp.java:115)
org.apache.jsp.index_jsp._jspService(index_jsp.java:70)
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:98)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)

org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:331)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:329)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:265)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)

note The full stack trace of the root cause is available in the Apache 
Tomcat/5.5 logs.




--
Stefan

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



Re: [OT] How to compile a servlet for Tomcat 5 on IBM JVM, or, "Dr. Warnier: How I learned to stop worrying and love VMWare"

2008-12-29 Thread André Warnier

Christopher Schultz wrote:

-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

André,

André Warnier wrote:

It's a whole process to connect to that server, and when I am connected
I lose my other connections (email e.g.).


Aah, you use a VPN that fubar's your other connections? That's too bad.

Not me, them customers of ours.


If you often connect to this machine, you might want to consider running
a host-guest VM like VMWare Player. You can go to many sites that will
pre-package blank VMs for you (like "gimmie a 10GB MS Windows XP VM" and
it will give you a config file and a blank VM). Fire it up in VMWare
Player with your XP install CD in your drive and then install XP onto
the VM. Or, just download one of the very fine pre-packaged Linux VMs
right from VMWare's site.

Run your VPN from within the VM and your "real" machine's connections
should stay right as rain. It may be a bit of a production just to open
up an SSH connection, but at least you will be able to connect to your
production box AND do other work at the same time.

Just a thought.


That's more than a thought, it's plenty of thoughts.
Why didn't we think of that ourselves before ?
That stuff with different customers, each of them having different VPN 
setups often incompatible between them (in terms of clients on our 
workstations) has been bothering us for ages.
And as it happens, we are just in the process of setting up a VMWare 
server locally as a test machine. Me thinks we're gonna do something 
based on that above stuff.

Great idea ! Thanks.


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



Re: Tomcat - Binding to an IP address dynamically

2008-12-29 Thread Christopher Schultz
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

To whom it may concern,

ranjitm82 wrote:
> I have a requirement which says that Tomcat should bind to a particular IP
> when it is accessible.
> 
> The IP will not be available when Tomcat starts up but still configured in
> server.xml.

That's an odd requirement. Can you give us some background? We may be
able to suggest an alternative. What's wrong with just binding to *?

- -chris
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.9 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iEYEARECAAYFAklZOyIACgkQ9CaO5/Lv0PCDTgCcCqkoZSe0qqCBfnzKJCTP/XWz
Nv4An3hUd6JzIDiqZA6z7b6qUCrVrq7T
=DZZX
-END PGP SIGNATURE-

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



Re: java.sql.SQLException: Already closed..strange!

2008-12-29 Thread Christopher Schultz
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

Ken,

Ken Bowen wrote:
> validationQuery="select 1"

validationQuery="/* ping */ SELECT 1"

would be better. Newer versions of Connector/J will detect the "ping"
comment and use an even cheaper connection test than what is required to
execute this (rather simple) query.

- -chris
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.9 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iEYEARECAAYFAklZOl8ACgkQ9CaO5/Lv0PA/BgCgg6Ehq2Eg+vDTlE4r7ho4OJhW
1YMAoMITN7xXBOEy37W83zE47z4MsT4c
=fqvf
-END PGP SIGNATURE-

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



Re: [OT] How to compile a servlet for Tomcat 5 on IBM JVM, or, "Dr. Warnier: How I learned to stop worrying and love VMWare"

2008-12-29 Thread Christopher Schultz
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

André,

André Warnier wrote:
> It's a whole process to connect to that server, and when I am connected
> I lose my other connections (email e.g.).

Aah, you use a VPN that fubar's your other connections? That's too bad.
If you often connect to this machine, you might want to consider running
a host-guest VM like VMWare Player. You can go to many sites that will
pre-package blank VMs for you (like "gimmie a 10GB MS Windows XP VM" and
it will give you a config file and a blank VM). Fire it up in VMWare
Player with your XP install CD in your drive and then install XP onto
the VM. Or, just download one of the very fine pre-packaged Linux VMs
right from VMWare's site.

Run your VPN from within the VM and your "real" machine's connections
should stay right as rain. It may be a bit of a production just to open
up an SSH connection, but at least you will be able to connect to your
production box AND do other work at the same time.

Just a thought.

- -chris
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.9 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iEYEARECAAYFAklZOREACgkQ9CaO5/Lv0PAFrgCgsMYEJJbXGNodDCnO5KokB9VN
t+UAoINUYKFhoZ+Ymc+zcXXOCoCVymSu
=6Oyv
-END PGP SIGNATURE-

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



Re: how to invalidate old sessions when new user access appl on same machine

2008-12-29 Thread Christopher Schultz
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

Nicolas,

Nicolas Romantzoff wrote:
> Session is binded to a connection (browser session) basically, not a
> machine.
> If you open a second browser (or a second tab) you should get a different
> session-id.

That's debatable, and depends on application requirements.

> Don't use JSESSIONID in url parameters, but in session cookie (unless you
> need to cross protocols like http <-> https)

Actually, this is exactly backward: if you use JSESSIONID cookies, then
the browser will always have the same user "logged-in" no matter how
many windows you open. "Old" windows will suddenly inherit the
credentials of the "new" windows, etc.

If you want to have able to have multiple windows opened from the same
web browser on the same machine with different logins, you need to
DISABLE the use of cookies. This is possible by setting cookies="false"
in your  element for your webapp.

- -chris
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.9 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iEYEARECAAYFAklZN1MACgkQ9CaO5/Lv0PD6qwCgpj6xpGROai2yGYqomFtcvbZj
gEYAn024g6AaaBeaUnwBzgvo+wJRVhu7
=+Q2F
-END PGP SIGNATURE-

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



Re: Sessions not releasing for apache-tomcat 5.5.23

2008-12-29 Thread Christopher Schultz
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

Sudip,

sudip pattanayak wrote:
> We are using apache-tomcat for our Web Application. We do not allow
> to same users to log on from two instances of the application.
> So if the user is active from one session and then if he tries to log
> on from another session, we forcefully logoff the user from the
> previous session.
> 
> But recently there are couple of occasions where one or
> more users are failing to forcefully logoff the session.(thelogs shows
> clearly the pending sessions keeps on increasing and the value unbound
> is never called for the particular user failing to forcefully logoff.

Do you mean that your users /can/ login multiple times concurrently? Or,
do you mean that your sessions are never expiring / getting garbage
collected?

How are you enforcing your single-login requirement? How are you
checking the session counts?

- -chris
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.9 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iEYEARECAAYFAklZNhQACgkQ9CaO5/Lv0PDVhACfQFIWXe6KBfjvVaxFh0DyHqFe
xk0An2F7gu2PoGCk9PoE8MOBq7jPYytR
=S6lm
-END PGP SIGNATURE-

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



Re: HelloWorld servlet, or just about

2008-12-29 Thread Christopher Schultz
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

André,

André Warnier wrote:
> From a front-end Apache, I am issuing a request to Tomcat, with the only
> purpose of getting back a small string (a user-id).
> I would imagine that for Tomcat generating a whole response (headers +
> body) is heavier than generating just a set of headers.

A filter is not much lighter than a servlet, depending on what you have
it actually do: there's no performance gain from using a filter instead
of a servlet.

Tomcat's connectors are (almost) all HTTP connectors, so you're going to
get a set of headers and a (possibly empty) body anyway. I find that
it's more architecturally pretty to use filters for pre- and
post-processing or requests and servlets for "real" work. Note that the
Struts2 developers disagree ;)

> So can I, from the filter as before, generate a response consisting
> *only* of headers, among which one "propietary" one that would contain
> the string I want.
> 
> I would basically need only a response with
> 
> HTTP status line
> MyHeader: johnsmith
> 
> (and no body)

You can do this with a servlet, too. Just don't ever call
response.getWriter or response.getOutputStream.

> At the limit, it could even be just the status line, with my return
> string in the message part.

Yeah, but this might be a bit confusing as an HTTP response. I'd stick
with either a header (which makes it a bit easier to identify a null
string) or a single line of the response body.

If you don't need HTTP, why not use a separate protocol? Obviously, SOAP
is way heavier, but you could create something super simple. Then again,
integrating it with Tomcat's session management, etc. would be a giant
headache. On second thought, you should stuck to Tomcat's built-in HTTP
connectors.

- -chris

-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.9 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iEYEARECAAYFAklZNEkACgkQ9CaO5/Lv0PCnmQCfS1EEudjd9uqbuLdLAk9Eev13
JRsAn2ly4T4nf0VOdkmRj9kBn1ss8N7p
=E8HQ
-END PGP SIGNATURE-

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



Re: Tomcat and problems with languages

2008-12-29 Thread Christopher Schultz
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

Fairyaya,

fairyaya wrote:
> The same application on tomcat 5.5.15 on a linux workstation causes some
> problems: if we restart the server the application will respond with a mix
> of the browser language (italian) and the default (english) and the only way
> to make it go well again is to restart again the server.

So... restarting the server is both the cause and the solution to this
problem? Perhaps you could be a bit more precise: do you have to restart
the entire machine, or just Tomcat itself?

Is it possible that some of your text isn't run through the Struts i18n
mechanisms? Also, If you have ApplicationMessages.properties in some
default language (often English) and no strings defined for, say,
Italian, then you'll get English text instead of your user's preferred
language.

- -chris
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.9 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iEYEARECAAYFAklZMegACgkQ9CaO5/Lv0PCC0wCgwUgfGjJQmg/6kk4kSePgmCY2
92gAn0pj2K+lLTCupnVOVlUv8367nAVt
=liwU
-END PGP SIGNATURE-

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



Re: Hints on upgrading from 6.0.14 to 6.0.18 on production server

2008-12-29 Thread Alan Chaney

Or stop using APR...

but that in itself is quite a lot of work as I'll have to reconfigure my 
SSL.


Hmm...



Gregor Schneider wrote:

If I'm not mistaken, the APR has caused the bug, and 6.0.16 contains a
new version of the APR. Since this usually comes as a source, you'll
have to re-compile the APR.

Cheers

Gregor


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



Re: Hints on upgrading from 6.0.14 to 6.0.18 on production server

2008-12-29 Thread Gregor Schneider
If I'm not mistaken, the APR has caused the bug, and 6.0.16 contains a
new version of the APR. Since this usually comes as a source, you'll
have to re-compile the APR.

Cheers

Gregor
-- 
just because your paranoid, doesn't mean they're not after you...
gpgp-fp: 79A84FA526807026795E4209D3B3FE028B3170B2
gpgp-key available @ http://pgpkeys.pca.dfn.de:11371

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



Re: ssl

2008-12-29 Thread Michael Rooz
Hi Bill,
Well - first the reason we need to update the truststore often is because we
use self signed certificates and therefore each client certifcate needs to
be in there.

I've traced the code in the Http11Protocol class and noticed that I get get
the desired results by calling the detroy() and start() functions from the
nested Http11ConnectionHandler process() method.  This will cause the
JIOEndpoint  JSSESocketFactory to be reinitialized.

My only concern at this point is that this is not documented and I may get
undesired side effects.

Do you have any further insight into this matter?

thanks much!
Mike





On Thu, Dec 18, 2008 at 5:14 AM, Bill Barker  wrote:

>
> "Michael Rooz"  wrote in message
> news:3df1c6c00812170307m3252f89p8c58b8373142...@mail.gmail.com...
> > Hi,
> >
> > I've successfully configured Tomcat to use Client Authentication.
> > Evidently
> > for Tomcat to reflect updates made to the truststore, it needs to be
> > restarted.
> >
> > How can I get Tomcat to reload its truststore without performing a
> > restart?
> >
>
> Well, you can stop and start the Connector (e.g. via JMX).  But Tomcat will
> never re-load the truststore while the Connector is running on it's own.
>  Of
> course, if you are using a dynamic truststore (e.g. card-based), then this
> shouldn't be a problem.
>
> In general, it is very rarely that you need to update the truststore since
> it just contains the trusted CA certs.  Adding a user from a trusted CA
> doesn't require an update, since the user's cert will be accepted at the
> SSL
> layer.
> >
> >
> > If this requires writing a custom connector that would for example
> > reinitialize the SSLContext,  where can I find some documentation that
> can
> > be of some help/guidance?
> >
>
> Not sure if this can be done from the APR Connector, but for the Java
> Connectors you need to create your own SSLImplementation (from o.a.t.u.net
> )
> and configure it with
> sSSImplementation="com.myfirm.mypackage.MySSLImplementation" on the
>  element.  There is some information in the archives for
> this list, but otherwise the Tomcat JavaDocs and/or source code.
>
> >
> >
> > Thanks,
> >
> > -MIke
> >
>
>
>
>
> -
> To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
> For additional commands, e-mail: users-h...@tomcat.apache.org
>
>


Hints on upgrading from 6.0.14 to 6.0.18 on production server

2008-12-29 Thread Alan Chaney

Hi

I have a 6.0.14 running with Apr 1.1.10 and I seem to be seeing 
instances of CVE-2007-6286: Tomcat duplicate request processing 
vulnerability


(64-Bit Server VM (build 1.6.0_03-b05, mixed mode)
(Centos 5.0 - Linux 2.6.18-8.el5  x86_64 )


The obvious thing to do is to upgrade from 6.0.14 to 6.0.18. Firstly, 
are there any changes in server.xml and web.xml in 6.0.18 that mean I 
can't just use the existing ones in the new installation.


My current installation has $TOMCAT_HOME pointing to /usr/local/tomcat

My intended upgrade sequence is:

1. opy down 6.0.18 and untar it int /usr/local/tomcat18 (after checking 
signatures)


2. copy over the jars that I have placed in the old $TOMCAT_HOME/lib (eg 
postgres jdbc jar) to /usr/local/tomcat18/lib


3. copy over my webapp wars from $TOMCAT_HOME/webapps to the new webapps 
folder.


4. as I am using jsvc to control tomcat, copy over the 'tomcat' file 
from the $TOMCAT_HOME ('tomcat' is actually a shell script which sets up
all the environment variables for jsvc.) jsvc is in 
/usr/lib/tcnative/jsvc so it should be unaffected by the move. However

I do need to copy over the $TOMCAT_HOME/bin/commons-daemon.jar.

5. stop the old server and rename its directory to /usr/local/tomcat.old

6. rename the directory of the new server to that of the current the new 
server.


7. restart the server.


Am I missing anything? What have I overlooked? I need this to go as 
smoothly as possible as there is quite a lot of traffic on this site.


Thanks in advance

Alan Chaney


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



Re: JPA/Hibernate persistence and MySQL connection timeout

2008-12-29 Thread Kees de Kooter
Hi Ken,

Take a look at this page:
http://www.hibernate.org/hib_docs/entitymanager/reference/en/html/configuration.html
As you can see the datasource is obtained using JNDI:
java:/DefaultDS


Cheers,
Kees de Kooter
http://www.boplicity.net



On Mon, Dec 29, 2008 at 14:41, Ken Bowen  wrote:
> Kees,
>
> Can you point me to a discussion of how to do that?
>
> Thanks,
> Ken
>
> On Dec 29, 2008, at 3:42 AM, Kees de Kooter wrote:
>
>> Why don't u use the existing datasources for JPA (instead of setting
>> the hibernate.connection properties)?
>>
>> Kees
>>
>>
>> On Mon, Dec 29, 2008 at 00:50, Ken Bowen  wrote:
>>>
>>> Hi All,
>>>
>>> I'm using: Tomcat 6.0.18; Mysql 5.0.51a; Java 1.5; Hibernate 3.2;  (no
>>> spring)
>>>
>>> MyApp utilizes five (5) distinct mysql catalogs (databases).
>>> Originally all 5 were accessed using JDBC/JNDI with Resources that all
>>> look
>>> like this
>>> (in webapps/MyApp/META-INF):
>>>
>>> >> type="javax.sql.DataSource"
>>>  maxActive="100" maxIdle="30" maxWait="1"
>>>  username="X" password="X"
>>>  driverClassName="com.mysql.jdbc.Driver"
>>>  url="jdbc:mysql://localhost:3306/CATALOGNAME"
>>>  validationQuery="select 1"
>>> />
>>>
>>> Everything worked fine, including the validationQuery to deal with MySQL
>>> closing connections overnight.
>>>
>>> Recently I replaced the JDBC access for 3 of the catalogs by use of
>>> JPA/Hibernate persistence,
>>> while leaving the other two catalogs as originally implemented (they
>>> consist
>>> of large tables
>>> containing daily price information; hence not very object-oriented.) The
>>> persistence.xml looks
>>> like this:
>>>
>>> 
>>>  org.hibernate.ejb.HibernatePersistence
>>>
>>>  . lots of class entries like:
>>>  com.connectedtrading.database.users.AbstractLineitem
>>>  com.connectedtrading.database.users.Lineitem
>>>
>>>  
>>>>> value="com.mysql.jdbc.Driver" />
>>>>> value="jdbc:mysql://localhost:3306/CATALOGNAME" />
>>>
>>>
>>>  
>>> 
>>>
>>> [Interestingly enough, only one of the 3 CATALOGNAMEs appears.]
>>> Note that I left all 5 of the Resource elements in place in context.xml.
>>>
>>> Once again, everything works well, EXCEPT that now when I leave the
>>> system
>>> running overnight and
>>> no accesses occur (it's only in dev mode), in the morning I now get the
>>> exception shown at the
>>> end of this email.  It certainly looks like the "mysql" disconnect
>>> behavior.
>>> As with the JDBC case, repeating the access causes everything to start
>>> working correctly.
>>> The query being submitted is
>>>
>>>  org.hibernate.ejb.QueryImpl.getResultList(QueryImpl.java:75)
>>>
>>>
>>> com.connectedtrading.database.users.UserDAO.findByProperty(UserDAO.java:180)
>>>
>>> com.connectedtrading.database.users.UserDAO.findByLogin(UserDAO.java:203)
>>>
>>> which is a hibernate query supporting user login.
>>>
>>> If anyone on the list has had experience with this issue under
>>> JPA/Hibernate
>>> persistence,
>>> I hope you can give me some pointers to dealing with it.
>>>
>>> Thanks much in advance,
>>> Ken Bowen
>>>
>>> - The Exception-
>>>
>>> HTTP Status 500 -
>>>
>>> type Exception report
>>>
>>> message
>>>
>>> description The server encountered an internal error () that prevented it
>>> from fulfilling this request.
>>>
>>> exception
>>>
>>> javax.servlet.ServletException: javax.persistence.PersistenceException:
>>> org.hibernate.exception.JDBCConnectionException: could not execute query
>>>
>>>
>>> org.apache.struts.action.RequestProcessor.processException(RequestProcessor.java:523)
>>>
>>>
>>> org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java:421)
>>>
>>>
>>> org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:224)
>>>
>>> org.apache.struts.action.ActionServlet.process(ActionServlet.java:1194)
>>>
>>>  org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:432)
>>>  javax.servlet.http.HttpServlet.service(HttpServlet.java:637)
>>>  javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
>>> root cause
>>>
>>> javax.persistence.PersistenceException:
>>> org.hibernate.exception.JDBCConnectionException: could not execute query
>>>
>>>
>>> org.hibernate.ejb.AbstractEntityManagerImpl.throwPersistenceException(AbstractEntityManagerImpl.java:630)
>>>  org.hibernate.ejb.QueryImpl.getResultList(QueryImpl.java:75)
>>>
>>>
>>> com.connectedtrading.database.users.UserDAO.findByProperty(UserDAO.java:180)
>>>
>>> com.connectedtrading.database.users.UserDAO.findByLogin(UserDAO.java:203)
>>>
>>>
>>> com.connectedtrading.user_manage.LoginProcessor.locateUser(LoginProcessor.java:54)
>>>
>>>
>>> com.connectedtrading.user_manage.LoginProcessor.checkLogin(LoginProcessor.java:35)
>>>
>>>
>>> com.connectedtrading.actions.ProcessLoginAction.execute(ProcessLoginAction.java:33)
>>>
>>>
>>> org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java:419)
>>>
>>>
>>> org.a

Re: Optimizing Tomcat with Http11NioProtocol?

2008-12-29 Thread Gregor Schneider
Hi Nodje,

first, the post from Yassine contains some very valuable information.

To me, it looks as if you're fishing in blur waters, since you've got
no idea what might be the bottleneck.

Maybe some additional hints:

- If you're serving quite some of statical content, the Apache
Portable Runtime (APR) might be a good choice:
http://tomcat.apache.org/tomcat-5.5-doc/apr.html

- you might nwat to consider upgrading Tomcat and Java to the latest
version: Java6 had some performance-optimizations, same - if I'm not
mistaken - goes for Tomcat

On Mon, Dec 29, 2008 at 9:57 AM, nodje  wrote:
>
>
> Providing it comes from the Java application side (by the way, any tips on
> how to precisely identify that is more than welcome), and providing that the
> problems come from too many requests, would Http11NioProtocol help Tomcat
> speed up the execution?

If it really comes from your application, you better check the code of
your application first trying to optimize it. Only when you're sure
that your code is clean, proceed to tune Tomcat

> It seems worth trying Http11NioProtocol before going for clustering+load
> balancing. Any advice on the matter?
>

Should be an option, however, bear in mind that you'll have to move to
Tomcat 6 since HttpNio is not available with older versions

> Also we think that request that cannot b served in the reasonable time
> should be refused. Taking into account the described behaviour with the
> default maxThreads=150 and acceptCount =100 values, shouldn't we decrease
> the acceptCount?

Since the default HttpConnector is blocking and your cpu is idleing
and your memory-usage low, I guess you rather should increase the
maxThreads and acceptCount

I suggest you play around with those parameters using JMeter as your
testing-tool. You'll find out pretty fast how those parameters affect
the overall performance

> Tomcat is on a Windows 32bits machine, so even though the machine has 4Gb of
> RAM, the MAX -Xmx size  that we can be used seems to be around 1200Mb. Would
> a 64bits OS automatically allows for more memory usage?

yes

Cheers

Gregor
-- 
just because your paranoid, doesn't mean they're not after you...
gpgp-fp: 79A84FA526807026795E4209D3B3FE028B3170B2
gpgp-key available @ http://pgpkeys.pca.dfn.de:11371

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



Re: Tomcat 6, log4j and security manager

2008-12-29 Thread Kees de Kooter
In WEB-INF/classes of your application.




On Mon, Dec 29, 2008 at 12:37, Korobitsyn Roman  wrote:
> Hello Kees,
>
> And where should I put log4j.properties in that case?
>
> Roman
>
> KdK> It usually means that the log4j properties file cannot be found on the
> KdK> classpath.
>
> KdK> Kees
>
>
> KdK> On Mon, Dec 29, 2008 at 11:44, Korobitsyn Roman  wrote:
>>> Hello!
>>>
>>> I use
>>>  Win XP
>>>  JDK 1.5.0_13
>>>  Tomcat 6.0.16
>>>  Log4J 1.2.14
>>>
>>> I set up logging as described on
>>> http://tomcat.apache.org/tomcat-6.0-doc/logging.html
>>> And it's all right? everything is workng fine.
>>>
>>> But when I start tomcat with security manager, I've got only:
>>>
>>> log4j:WARN No appenders could be found for logger
>>> (org.apache.catalina.startup.Embedded).
>>> log4j:WARN Please initialize the log4j system properly.
>>>
>>> in stdout. All logs in ${catalina.home}/logs are empty.
>>>
>>> What is problem?
>>>
>>> Thank in advance, Roman
>
>
>
>
> -
> 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: Sudden and unexpected exception at Tomcat startup

2008-12-29 Thread Gregor Schneider
Hi André,

good to hear that you got the issue solved.

On Mon, Dec 29, 2008 at 10:55 AM, André Warnier  wrote:
>
> If anything, I feel that the log message is not very clear :
>
> 2008-12-28 13:21:58,548 [main] WARN  org.apache.naming.NamingContext -
> Unexpected exception resolving reference
> java.io.IOException: IOException writing to
> /srv/www/tomcat5/base/conf/tomcat-users.xml.new

well, what do you expect Tomcat (or Java) to do here?
The Java-Runtime throws an exception that writing is not possible and
delegates the exception to Tomcat.
What should Tomcat do without the appropriate information?
The only solution would be to enhance the Java Runtime to give a more
talkative Exception, however, that's a Java - not a Tomcat-issue.

Cheers

Gregor
-- 
just because your paranoid, doesn't mean they're not after you...
gpgp-fp: 79A84FA526807026795E4209D3B3FE028B3170B2
gpgp-key available @ http://pgpkeys.pca.dfn.de:11371

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



Re: JPA/Hibernate persistence and MySQL connection timeout

2008-12-29 Thread Ken Bowen

Kees,

Can you point me to a discussion of how to do that?

Thanks,
Ken

On Dec 29, 2008, at 3:42 AM, Kees de Kooter wrote:


Why don't u use the existing datasources for JPA (instead of setting
the hibernate.connection properties)?

Kees


On Mon, Dec 29, 2008 at 00:50, Ken Bowen  wrote:

Hi All,

I'm using: Tomcat 6.0.18; Mysql 5.0.51a; Java 1.5; Hibernate 3.2;   
(no

spring)

MyApp utilizes five (5) distinct mysql catalogs (databases).
Originally all 5 were accessed using JDBC/JNDI with Resources that  
all look

like this
(in webapps/MyApp/META-INF):



Everything worked fine, including the validationQuery to deal with  
MySQL

closing connections overnight.

Recently I replaced the JDBC access for 3 of the catalogs by use of
JPA/Hibernate persistence,
while leaving the other two catalogs as originally implemented  
(they consist

of large tables
containing daily price information; hence not very object- 
oriented.) The

persistence.xml looks
like this:


  org.hibernate.ejb.HibernatePersistence

  . lots of class entries like:
  com.connectedtrading.database.users.AbstractLineitem
  com.connectedtrading.database.users.Lineitem

  




  


[Interestingly enough, only one of the 3 CATALOGNAMEs appears.]
Note that I left all 5 of the Resource elements in place in  
context.xml.


Once again, everything works well, EXCEPT that now when I leave the  
system

running overnight and
no accesses occur (it's only in dev mode), in the morning I now get  
the

exception shown at the
end of this email.  It certainly looks like the "mysql" disconnect  
behavior.
As with the JDBC case, repeating the access causes everything to  
start

working correctly.
The query being submitted is

  org.hibernate.ejb.QueryImpl.getResultList(QueryImpl.java:75)

com 
.connectedtrading 
.database.users.UserDAO.findByProperty(UserDAO.java:180)


com 
.connectedtrading.database.users.UserDAO.findByLogin(UserDAO.java: 
203)


which is a hibernate query supporting user login.

If anyone on the list has had experience with this issue under JPA/ 
Hibernate

persistence,
I hope you can give me some pointers to dealing with it.

Thanks much in advance,
Ken Bowen

- The Exception-

HTTP Status 500 -

type Exception report

message

description The server encountered an internal error () that  
prevented it

from fulfilling this request.

exception

javax.servlet.ServletException:  
javax.persistence.PersistenceException:
org.hibernate.exception.JDBCConnectionException: could not execute  
query


org 
.apache 
.struts 
.action.RequestProcessor.processException(RequestProcessor.java:523)


org 
.apache 
.struts 
.action.RequestProcessor.processActionPerform(RequestProcessor.java: 
421)


org 
.apache 
.struts.action.RequestProcessor.process(RequestProcessor.java:224)


org.apache.struts.action.ActionServlet.process(ActionServlet.java: 
1194)
   
org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:432)

  javax.servlet.http.HttpServlet.service(HttpServlet.java:637)
  javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
root cause

javax.persistence.PersistenceException:
org.hibernate.exception.JDBCConnectionException: could not execute  
query


org 
.hibernate 
.ejb 
.AbstractEntityManagerImpl 
.throwPersistenceException(AbstractEntityManagerImpl.java:630)

  org.hibernate.ejb.QueryImpl.getResultList(QueryImpl.java:75)

com 
.connectedtrading 
.database.users.UserDAO.findByProperty(UserDAO.java:180)


com 
.connectedtrading.database.users.UserDAO.findByLogin(UserDAO.java: 
203)


com 
.connectedtrading 
.user_manage.LoginProcessor.locateUser(LoginProcessor.java:54)


com 
.connectedtrading 
.user_manage.LoginProcessor.checkLogin(LoginProcessor.java:35)


com 
.connectedtrading 
.actions.ProcessLoginAction.execute(ProcessLoginAction.java:33)


org 
.apache 
.struts 
.action.RequestProcessor.processActionPerform(RequestProcessor.java: 
419)


org 
.apache 
.struts.action.RequestProcessor.process(RequestProcessor.java:224)


org.apache.struts.action.ActionServlet.process(ActionServlet.java: 
1194)
   
org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:432)

  javax.servlet.http.HttpServlet.service(HttpServlet.java:637)
  javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
root cause

org.hibernate.exception.JDBCConnectionException: could not execute  
query


org 
.hibernate 
.exception.SQLStateConverter.convert(SQLStateConverter.java:74)


org 
.hibernate 
.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:43)

  org.hibernate.loader.Loader.doList(Loader.java:2216)
  org.hibernate.loader.Loader.listIgnoreQueryCache(Loader.java: 
2104)

  org.hibernate.loader.Loader.list(Loader.java:2099)
  org.hibernate.loader.hql.QueryLoader.list(QueryLoader.java:378)

org 
.hibernate 
.hql.ast.QueryTranslatorImpl.list(QueryTranslatorImpl.java:338)


org 
.hibernate.engine.query.HQLQueryPlan.performList(HQLQueryPlan.java: 
172

Re: Tomcat 6, log4j and security manager

2008-12-29 Thread Korobitsyn Roman
Hello Kees,

And where should I put log4j.properties in that case?

Roman

KdK> It usually means that the log4j properties file cannot be found on the
KdK> classpath.

KdK> Kees


KdK> On Mon, Dec 29, 2008 at 11:44, Korobitsyn Roman  wrote:
>> Hello!
>>
>> I use
>>  Win XP
>>  JDK 1.5.0_13
>>  Tomcat 6.0.16
>>  Log4J 1.2.14
>>
>> I set up logging as described on
>> http://tomcat.apache.org/tomcat-6.0-doc/logging.html
>> And it's all right? everything is workng fine.
>>
>> But when I start tomcat with security manager, I've got only:
>>
>> log4j:WARN No appenders could be found for logger
>> (org.apache.catalina.startup.Embedded).
>> log4j:WARN Please initialize the log4j system properly.
>>
>> in stdout. All logs in ${catalina.home}/logs are empty.
>>
>> What is problem?
>>
>> Thank in advance, Roman




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



Re: Tomcat 6, log4j and security manager

2008-12-29 Thread Kees de Kooter
It usually means that the log4j properties file cannot be found on the
classpath.

Kees


On Mon, Dec 29, 2008 at 11:44, Korobitsyn Roman  wrote:
> Hello!
>
> I use
>  Win XP
>  JDK 1.5.0_13
>  Tomcat 6.0.16
>  Log4J 1.2.14
>
> I set up logging as described on 
> http://tomcat.apache.org/tomcat-6.0-doc/logging.html
> And it's all right? everything is workng fine.
>
> But when I start tomcat with security manager, I've got only:
>
> log4j:WARN No appenders could be found for logger 
> (org.apache.catalina.startup.Embedded).
> log4j:WARN Please initialize the log4j system properly.
>
> in stdout. All logs in ${catalina.home}/logs are empty.
>
> What is problem?
>
> Thank in advance, Roman
>
>
>
>
> -
> 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



Tomcat 6, log4j and security manager

2008-12-29 Thread Korobitsyn Roman
Hello!

I use
  Win XP
  JDK 1.5.0_13
  Tomcat 6.0.16
  Log4J 1.2.14

I set up logging as described on 
http://tomcat.apache.org/tomcat-6.0-doc/logging.html
And it's all right? everything is workng fine.

But when I start tomcat with security manager, I've got only:

log4j:WARN No appenders could be found for logger 
(org.apache.catalina.startup.Embedded).
log4j:WARN Please initialize the log4j system properly.

in stdout. All logs in ${catalina.home}/logs are empty.

What is problem?

Thank in advance, Roman




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



Re: Optimizing Tomcat with Http11NioProtocol?

2008-12-29 Thread Yassine
my suggestion would be to make sure if the delay is coming from the connector or
somewhere else, you could use some monitoring tools jmeter
[http://jakarta.apache.org/jmeter/],
 moskito [http://moskito.anotheria.net/] or just write your own filter
which logs the number of active session,
the average time of request handling,.. once you have this data the
focus will get smaller and then you can
concentrate on identifying the source of the problem either its the
connector or your application's code

hope this helps
Yassine


On Mon, Dec 29, 2008 at 9:57 AM, nodje  wrote:
>
> Hi,
>
> we are still using 5.5.12 in production and our users are facing increasing
> delays with their requests (like way too long by now already).
> While we are not entirely sure about what's causing this (database vs Java
> application), we suppose it comes from the Java application (the database
> server never seems to be under stress).
> The CPU of the Tomcat machine doesn't seem too busy either.
>
> Providing it comes from the Java application side (by the way, any tips on
> how to precisely identify that is more than welcome), and providing that the
> problems come from too many requests, would Http11NioProtocol help Tomcat
> speed up the execution?
> It seems worth trying Http11NioProtocol before going for clustering+load
> balancing. Any advice on the matter?
>
> Also we think that request that cannot b served in the reasonable time
> should be refused. Taking into account the described behaviour with the
> default maxThreads=150 and acceptCount =100 values, shouldn't we decrease
> the acceptCount?
> Moreover the CPU on the Tomcat machine doesn't seem too busy. Is it a sign
> that we can increase maxThreads?
>
> Tomcat is on a Windows 32bits machine, so even though the machine has 4Gb of
> RAM, the MAX -Xmx size  that we can be used seems to be around 1200Mb. Would
> a 64bits OS automatically allows for more memory usage?
>
> A lot of questions I know, but facing big problems like we are now, we want
> to try anything possible to quickly relieve the pain from using the
> application!
>
> thanks to anyone providing advice
> -nodje
> --
> View this message in context: 
> http://www.nabble.com/Optimizing-Tomcat-with-Http11NioProtocol--tp21200419p21200419.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
>
>



-- 
--
Yassine Elassad
Bonn, Germany.
Fon : +49 228 97629355
Mobile : +49 157 74519666

PEACE :
( P ) Positive ( E ) Energy ( A ) Always ( C ) Correct ( E ) Errors.

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



Re: Sudden and unexpected exception at Tomcat startup

2008-12-29 Thread André Warnier

Alan Chaney wrote:
[...]

Hi.
I found the reason, and apologise for waisting everyone's time.
Thanks for the tips anyway, they helped.

It was a simple diskspace issue.
Unknown to me, someone created a huge backup file in the directory /mnt, 
part of the "/" filesystem, and filled up this filesystem.
On the other hand, as mentioned in my posts, the "conf" directory of 
Tomcat (where tomcat-users.xml lives) is in reality linked to 
/etc/tomcat5, also under "/".
Thus when Tomcat during startup tried to rewrite tomcat-users.xml 
(apparently first as tomcat-users.xml.new, which was also something I 
did not know), it encountered a full disk and got the IO Exception.


If anything, I feel that the log message is not very clear :

2008-12-28 13:21:58,548 [main] WARN  org.apache.naming.NamingContext - 
Unexpected exception resolving reference
java.io.IOException: IOException writing to 
/srv/www/tomcat5/base/conf/tomcat-users.xml.new
at 
org.apache.catalina.users.MemoryUserDatabase.save(MemoryUserDatabase.java:495)

at
...

a simple mention of "no space left on device" or something would have 
saved a lot of looking at permissions, config changes, etc..







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



Optimizing Tomcat with Http11NioProtocol?

2008-12-29 Thread nodje

Hi,

we are still using 5.5.12 in production and our users are facing increasing
delays with their requests (like way too long by now already).
While we are not entirely sure about what's causing this (database vs Java
application), we suppose it comes from the Java application (the database
server never seems to be under stress).
The CPU of the Tomcat machine doesn't seem too busy either.

Providing it comes from the Java application side (by the way, any tips on
how to precisely identify that is more than welcome), and providing that the
problems come from too many requests, would Http11NioProtocol help Tomcat
speed up the execution? 
It seems worth trying Http11NioProtocol before going for clustering+load
balancing. Any advice on the matter?

Also we think that request that cannot b served in the reasonable time
should be refused. Taking into account the described behaviour with the
default maxThreads=150 and acceptCount =100 values, shouldn't we decrease
the acceptCount?
Moreover the CPU on the Tomcat machine doesn't seem too busy. Is it a sign
that we can increase maxThreads?

Tomcat is on a Windows 32bits machine, so even though the machine has 4Gb of
RAM, the MAX -Xmx size  that we can be used seems to be around 1200Mb. Would
a 64bits OS automatically allows for more memory usage?

A lot of questions I know, but facing big problems like we are now, we want
to try anything possible to quickly relieve the pain from using the
application!

thanks to anyone providing advice
-nodje
-- 
View this message in context: 
http://www.nabble.com/Optimizing-Tomcat-with-Http11NioProtocol--tp21200419p21200419.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



Re: JPA/Hibernate persistence and MySQL connection timeout

2008-12-29 Thread Kees de Kooter
Why don't u use the existing datasources for JPA (instead of setting
the hibernate.connection properties)?

Kees


On Mon, Dec 29, 2008 at 00:50, Ken Bowen  wrote:
> Hi All,
>
> I'm using: Tomcat 6.0.18; Mysql 5.0.51a; Java 1.5; Hibernate 3.2;  (no
> spring)
>
> MyApp utilizes five (5) distinct mysql catalogs (databases).
> Originally all 5 were accessed using JDBC/JNDI with Resources that all look
> like this
> (in webapps/MyApp/META-INF):
>
>  type="javax.sql.DataSource"
>maxActive="100" maxIdle="30" maxWait="1"
>username="X" password="X"
>driverClassName="com.mysql.jdbc.Driver"
>url="jdbc:mysql://localhost:3306/CATALOGNAME"
>validationQuery="select 1"
>  />
>
> Everything worked fine, including the validationQuery to deal with MySQL
> closing connections overnight.
>
> Recently I replaced the JDBC access for 3 of the catalogs by use of
> JPA/Hibernate persistence,
> while leaving the other two catalogs as originally implemented (they consist
> of large tables
> containing daily price information; hence not very object-oriented.) The
> persistence.xml looks
> like this:
>
> 
>org.hibernate.ejb.HibernatePersistence
>
>. lots of class entries like:
>com.connectedtrading.database.users.AbstractLineitem
>com.connectedtrading.database.users.Lineitem
>
>
>   value="com.mysql.jdbc.Driver" />
>   value="jdbc:mysql://localhost:3306/CATALOGNAME" />
>  
>  
>
> 
>
> [Interestingly enough, only one of the 3 CATALOGNAMEs appears.]
> Note that I left all 5 of the Resource elements in place in context.xml.
>
> Once again, everything works well, EXCEPT that now when I leave the system
> running overnight and
> no accesses occur (it's only in dev mode), in the morning I now get the
> exception shown at the
> end of this email.  It certainly looks like the "mysql" disconnect behavior.
> As with the JDBC case, repeating the access causes everything to start
> working correctly.
> The query being submitted is
>
>org.hibernate.ejb.QueryImpl.getResultList(QueryImpl.java:75)
>
>  com.connectedtrading.database.users.UserDAO.findByProperty(UserDAO.java:180)
>
>  com.connectedtrading.database.users.UserDAO.findByLogin(UserDAO.java:203)
>
> which is a hibernate query supporting user login.
>
> If anyone on the list has had experience with this issue under JPA/Hibernate
> persistence,
> I hope you can give me some pointers to dealing with it.
>
> Thanks much in advance,
> Ken Bowen
>
> - The Exception-
>
> HTTP Status 500 -
>
> type Exception report
>
> message
>
> description The server encountered an internal error () that prevented it
> from fulfilling this request.
>
> exception
>
> javax.servlet.ServletException: javax.persistence.PersistenceException:
> org.hibernate.exception.JDBCConnectionException: could not execute query
>
>  
> org.apache.struts.action.RequestProcessor.processException(RequestProcessor.java:523)
>
>  
> org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java:421)
>
>  org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:224)
>
>  org.apache.struts.action.ActionServlet.process(ActionServlet.java:1194)
>org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:432)
>javax.servlet.http.HttpServlet.service(HttpServlet.java:637)
>javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
> root cause
>
> javax.persistence.PersistenceException:
> org.hibernate.exception.JDBCConnectionException: could not execute query
>
>  
> org.hibernate.ejb.AbstractEntityManagerImpl.throwPersistenceException(AbstractEntityManagerImpl.java:630)
>org.hibernate.ejb.QueryImpl.getResultList(QueryImpl.java:75)
>
>  com.connectedtrading.database.users.UserDAO.findByProperty(UserDAO.java:180)
>
>  com.connectedtrading.database.users.UserDAO.findByLogin(UserDAO.java:203)
>
>  
> com.connectedtrading.user_manage.LoginProcessor.locateUser(LoginProcessor.java:54)
>
>  
> com.connectedtrading.user_manage.LoginProcessor.checkLogin(LoginProcessor.java:35)
>
>  
> com.connectedtrading.actions.ProcessLoginAction.execute(ProcessLoginAction.java:33)
>
>  
> org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java:419)
>
>  org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:224)
>
>  org.apache.struts.action.ActionServlet.process(ActionServlet.java:1194)
>org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:432)
>javax.servlet.http.HttpServlet.service(HttpServlet.java:637)
>javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
> root cause
>
> org.hibernate.exception.JDBCConnectionException: could not execute query
>
>  org.hibernate.exception.SQLStateConverter.convert(SQLStateConverter.java:74)
>
>  
> org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:43)
>org.hibernate.loader.Loader.doList(Loader.jav