file vs servlet through a filter

2008-11-04 Thread Tom Eugelink
I have created a XSL-FO filter, it reacts on a parameter and then pulls 
the contents of the response through Apache's FOP. Simple exercise and 
it almost works.


In order to capture the response output I have created a 
BufferedHttpResponseWrapper and BufferedServletOutputStream similar to 
the O'Reilly example 
(http://www.unix.com.ua/orelly/xml/jxslt/ch08_04.htm). The filter reacts 
to any url and the behavior is determined by a parameter being present 
or not.


   
   XsltfoFilter
   nl.knowledgeplaza.filters.XsltfoFilter
   
   
   XsltfoFilter
   /*
   


Now, if the filter captures the result of a servlet, then it works 
perfectly:


public class XslfoTestServlet extends HttpServlet
{
   public void doGet(final HttpServletRequest request, final 
HttpServletResponse response) throws IOException, ServletException

   {
   PrintWriter lWriter = response.getWriter();
   lWriter.append("\n");
   lWriter.append("xmlns:fo=\"http://www.w3.org/1999/XSL/Format\";>\n");

   lWriter.append("  \n");
   lWriter.append("master-name=\"A4-portrait\"\n");
   lWriter.append("  page-height=\"29.7cm\" 
page-width=\"21.0cm\" margin=\"2cm\">\n");

   lWriter.append("  \n");
   lWriter.append("\n");
   lWriter.append("  \n");
   lWriter.append("  master-reference=\"A4-portrait\">\n");

   lWriter.append("\n");
   lWriter.append("  \n");
   lWriter.append("Hello world!\n");
   lWriter.append("  \n");
   lWriter.append("\n");
   lWriter.append("  \n");
   lWriter.append("\n");
   IOUtil.close(lWriter);
   }
}

The filter's log says:

>> XSLFO
>> Content: 514 bytes

The content denotes the captured number of bytes by the 
BufferedServletOutputStream. I get a nice PDF and all is well...

But if I use exactly the same XSL-FO source in a file I get this:

>> XSLFO
>> Content: 0 bytes
[Fatal Error] :-1:-1: Premature end of file.
[http-8080-1] |/CheyenneServlet, 
session=F7CCB78F6878465CC3BE3DBBC7F874DF| 2008-11-04 10:14:12,125 ERROR 
nl.knowledgeplaza.filters.XsltfoFilter.doFilter(XsltfoFilter.java:137) - 
=== 2008-11-04 10:14:12


javax.xml.transform.TransformerException: org.xml.sax.SAXParseException: 
Premature end of file.
   at 
org.apache.xalan.transformer.TransformerIdentityImpl.transform(TransformerIdentityImpl.java:501)
   at 
nl.knowledgeplaza.filters.XsltfoFilter.doFilter(XsltfoFilter.java:132)
   at 
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
   at 
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
   at 
org.tbee.servlets.util.ConfigurationPropertiesFilter.doFilter(ConfigurationPropertiesFilter.java:194)
   at 
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
   at 
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
   at 
org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
   at 
org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175)
   at 
org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128)
   at 
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
   at 
org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
   at 
org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:263)
   at 
org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844)
   at 
org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:584)
   at 
org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)

   at java.lang.Thread.run(Unknown Source)
Caused by: org.xml.sax.SAXParseException: Premature end of file.
   at org.apache.xerces.parsers.AbstractSAXParser.parse(Unknown Source)
   at 
org.apache.xalan.transformer.TransformerIdentityImpl.transform(TransformerIdentityImpl.java:484)

   ... 16 more

I can however access the file directly (the filter will not try to 
capture the output when the parameter is not present) and the content is 
returned correctly.


It seems that when accessing the file, there are no calls made to the 
"public void write(int data)" in the BufferedServletOutputStream. I 
added some debugging there and the method simply is not called. I tried 
flushing the original response, closing its stream, but to no avail.


Increasing the file size suddenly does make it write to the outputstream:

>> XSLFO
>> Content: 1766 bytes

But then there is an error in stating the generate PDF is corrupt. It 
seems this has something to do with buffers... From servlet works 
perfectly, from a file does not.


Any suggestions?


-
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional c

RE: Custom Error Messages (5xx and 4xx)

2008-11-04 Thread Kirchhoff, Florian
Rob,

First you need to gather the information about the exception, then send
it to who needs to know. You might want to be proactive and send it to
the support team regardless of what the users want...

One thing to lookout for is that depending on where you exception is
thrown the implicit "exception" variable may not be the one you're
looking for and you have to "unwind" the calling stack to find the root
cause. That's what Tomcat's default error page does. I found it
instructive to study the source of the ErrorReportValve in subversion:


Look into the "report" method to see how to use "exception.getCause()"
to get to the root cause.

I hope you find this useful.

Florian


> -Original Message-
> From: Serge Fonville [mailto:[EMAIL PROTECTED]
> Sent: Monday, November 03, 2008 4:44 PM
> To: Tomcat Users List
> Subject: Re: Custom Error Messages (5xx and 4xx)
> 
> Hi,
> 
> Look at
> http://java.sun.com/developer/EJTechTips/2003/tt0114.html,
> especially the text
> The string isErrorPage="true" causes the Web container to
> define a new
> implicit variable, "exception", that the JSP page can use
> in scriptlets or
> in custom tags. For example, the error page for the current
> example uses the
> "exception" object to report the name of the class that
> caused the
> exception:
> Basically when at the top of the jsp you specify
> isErrorPage=true, you have
> a variable exception that contains the thrown exception
> 
> Hope this helps
> 
> Regards,
> 
> Serge Fonville
> On Mon, Nov 3, 2008 at 10:31 PM, Rob Mercer
> <[EMAIL PROTECTED]>wrote:
> 
> > Hey all,
> >
> >I'm trying to setup custom error messages
> in Tomcat
> > 6.0.14. I've got the following entry in web.xml:
> >
> >
> >
> > 
> >
> >  
> >
> >404
> >
> >/error_pages/404.jsf
> >
> >  
> >
> >
> >
> >  
> >
> >500
> >
> >/error_pages/500.jsf
> >
> >  
> >
> > 
> >
> >
> >
> > And I've got a much less scary set of pages setup but I
> was wondering if
> > there was a way to get the stack trace and error message
> information to
> > shoot to the support team if the user clicked an "email
> the support team
> > about this error message."  Any ideas on how I'd go about
> that?
> >
> >
> >
> > Additionally, is there a way to setup a 5xx page? Just a
> page that
> > handled all 500 pages? Like a web.xml shorthand?
> >
> >
> >
> >
> >
> > Thanks ahead of time!
> >
> >
> >
> > Rob M
> >
> >


This communication is the property of Qwest and may contain confidential or
privileged information. Unauthorized use of this communication is strictly 
prohibited and may be unlawful.  If you have received this communication 
in error, please immediately notify the sender by reply e-mail and destroy 
all copies of the communication and any attachments.

-
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Using X509 proxy certificate for single sign on using APR (grid security)

2008-11-04 Thread Thilina Gunarathne
Hi,
I'm trying to support mutually authenticated SSL connection to tomcat using
pem encoded x509 certificates. I use APR as mentioned in
http://tomcat.apache.org/tomcat-5.5-doc/apr.html.  I have the mutual
authentication working well for normal certificates. We use our own CA's.
Our tomcat setup is going to be used in conjunction with grid..

The problem came in when I tried using a proxy certificate[1] generated by
MyProxy[4]  for the client side. The tomcat server contains the certificate
of the CA, but does not contain the certificate of the user who
issued/signed the proxy certificate. Hence the proxy certificate file also
contains the public key of the user as mentioned in here [2] .  The overall
format of the certificate has the following structure [3].

   PEM-encoded proxy certificate
   PEM-encoded private key
   PEM-encoded public certificate of the user (delegator) to help create
the certificate chain in the server side.

My question is whether APR+mod_ssl supports the above scenario of using a
public key contained in the client proxy file as an intermediary certificate
when building the trust path to the CA. If so please provide me some
pointers to follow.

Also I'm curious to know whether there are any users who supported MyProxy
generated proxy certificates  without using Globus security packages.

thanks,
Thilina

1. http://www.ietf.org/rfc/rfc3820.txt
2.
http://gdp.globus.org/gt4-tutorial/multiplehtml/ch10s05.html#fig_sec_gsi_proxyvalidation
3. http://dev.globus.org/wiki/Security/ProxyFileFormat
4. http://grid.ncsa.uiuc.edu/myproxy/
-- 
Thilina Gunarathne  - http://thilinag.blogspot.com



-- 
Thilina Gunarathne  - http://thilinag.blogspot.com


[Fwd: [Urgent] Please help promote ApacheCon video streaming!]

2008-11-04 Thread jean-frederic clere
 --- Begin Message ---
Hi,

please help promote the ApacheCon live video streaming by forwarding
the email below to your PMC user and dev mailing lists, ASAP!

Thank you
Lars Eilebrecht

-

Subject: ApacheCon live video streaming available; keynotes and Apache 101 are 
free


Can't make ApacheCon this week in New Orleans?  You can still watch all 
the keynotes, Apache 101 sessions, and system administration track in 
live video streams:

   http://streaming.linux-magazin.de/en/program_apacheconus08.htm?ann

Keynotes and the Apache 101 lunchtime sessions are free; the full 
sysadmin track, including httpd performance, security, and server stack 
administration talks are available for a fee.

Keynotes include:
- David Recordon, Six Apart  (Wednesday 09:30)
   "Learning from Apache to create Open Specifications"

- Shahani Markus Weerawarana, Ph.D.  (Thursday 11:30)
   "Standing on the Shoulders of Giants"

- Sam Ramji, Microsoft  (Friday 11:30)
   "struct.new("future", :open, :microsoft)"


   Reminder: New Orleans is CST or UTC/GMT -6 hours.


Advance notice: ApacheCon EU 2009 returns to Amsterdam, 23-27 March.  We 
had a great response to our CFP and look forward to announcing the 
schedule in the next month.

---

-- 
Lars Eilebrecht  -  V.P., Conference Planning
[EMAIL PROTECTED]  -  http://www.us.apachecon.com




--- End Message ---
-
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

HTTPS after JDK upgrade in Firefox 3 stopped working

2008-11-04 Thread Jozef Hovan
Hi all,

we are running web application on tomcat 5.5.x which is using HTTPS and
after upgrade of software (Windows Server, JDK, Tomcat, SSL certificate) we
are getting security error message in Firefox 3 when we are accessing web
application.

Message is:
=
Secure Connection Failed

An error occurred during a connection to x.

Peer's certificate has an invalid signature.

(Error code: sec_error_bad_signature)
=

In IE and Opera our application works fine. First I thought that our SSL
certificate is bad, but after using old certficate problem remained. After
lot of testing and trying I can say, that problem occured after upgrade JDK
from 5.0 to 6.0. I was not able to find resolution anywhere on internet.
Could anyone help me, which direction to go to fix it? Running tomcat in JDK
5.0 doesn't causes problem after upgrade.

Environment: I upgraded Windows 2000 -> Windows Server 2003, JDK 5u14 -> JDK
6u10, Tomcat 5.5.25->5.5.27. When I run Tomcat in JDK 5u16, it runs fine. I
am using SSL certificate signed by self-signed CA and CA certificate is
correctly installed in IE, FF and Opera.

Thank you,

Jozef


Ant deploy/undeploy task failure

2008-11-04 Thread brent80301a

Hello All,

I am developing a Java 1.6 application using Tomcat 6.0.18 in embedded mode. 
I am attempting to use the tomcat manager application and associated Ant
tasks to perform operations on the running tomcat instance.  Tasks such as
list, serverinfo, sessions, and jmxproxy tasks work fine, however the deploy
and undeploy tasks fail with the following exception (see below).  I
actually get the same exception when trying to use the manager web interface
which leads me to believe that it is a systemic configuration issue
somewhere.  Any suggestions on what I might be missing or where I should
look?  Unfortunately, Googling doesn't yield much.  I realize that I can
always switch to an SCP Ant task for remote deployment if necessary, but I
also want to ensure that my configuration is correct.

Regards,
Brent


Ant reports the following:

[deploy] FAIL - Encountered exception
javax.management.InstanceNotFoundException:
Catalina:type=Deployer,host=localhost


Tomcat reports the following:

[INFO] [2008-05-04 10:05:09]
[org.apache.catalina.core.ContainerBase.[Catalina].[localhost].[/manager]] -
Manager: init: Associated with Deployer
'Catalina:type=Deployer,host=localhost'
[INFO] [2008-05-04 10:05:09]
[org.apache.catalina.core.ContainerBase.[Catalina].[localhost].[/manager]] -
Manager: deploy: Deploying web application at '/services'
[INFO] [2008-05-04 10:05:09]
[org.apache.catalina.core.ContainerBase.[Catalina].[localhost].[/manager]] -
Manager: Uploading WAR file to
/Users/brent/Projects/ZZZ/trunk/Manager/tomcat/webapps/services.war
[ERROR] [2008-05-04 10:05:14]
[org.apache.catalina.core.ContainerBase.[Catalina].[localhost].[/manager]] -
Manager: managerServlet.check[/services]
javax.management.InstanceNotFoundException:
Catalina:type=Deployer,host=localhost
at
com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.getMBean(DefaultMBeanServerInterceptor.java:1094)
at
com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.invoke(DefaultMBeanServerInterceptor.java:833)
at 
com.sun.jmx.mbeanserver.JmxMBeanServer.invoke(JmxMBeanServer.java:761)
at
org.apache.catalina.manager.ManagerServlet.isServiced(ManagerServlet.java:1482)
at
org.apache.catalina.manager.ManagerServlet.deploy(ManagerServlet.java:631)
at
org.apache.catalina.manager.ManagerServlet.doPut(ManagerServlet.java:432)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:640)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
at
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at
org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
at
org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
at
org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:525)
at
org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128)
at
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
at
org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
at
org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:568)
at
org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:286)
at
org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:845)
at
org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:583)
at 
org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)
at java.lang.Thread.run(Thread.java:637)
-- 
View this message in context: 
http://www.nabble.com/Ant-deploy-undeploy-task-failure-tp20327057p20327057.html
Sent from the Tomcat - User mailing list archive at Nabble.com.


-
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: read context.xml Resource attributes

2008-11-04 Thread Harry Levinson
Found a solution that uses the Connection object:

String dataSource = "jdbc/whatever";
DatabaseMetaData dbMetaData;
Connection conn = connections.get(dataSource);

dbMetaData = conn.getMetaData();
String url = dbMetaData.getURL();

Thanks for your help Juha.


Does the Server element have a listen address?

2008-11-04 Thread Fu-Tung Cheng
Hi,

I have two ip addresses and I would like the server element with the shutdown 
port to listen on only one.  Is that possible or will it just listen on all?

I did look at the docs:

http://tomcat.apache.org/tomcat-6.0-doc/config/server.html

but they don't mention a way to do that.

Thank you,

Fu-Tung


  


-
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: [JMX] org.apache.catalina.session.StandardManager not serializable

2008-11-04 Thread Emmanuel Soden
Hi,

Using Tomcat 5.5.27 with JDK 1.5.0_11, I'm trying to retrieve the attribute
"manager" from the MBean
"Catalina:J2EEApplication=none,J2EEServer=none,j2eeType=WebModule,name=//localhost/".
But I'm getting thre following error.

Exception in thread "main" java.rmi.UnmarshalException: error unmarshalling
return; nested exception is:
java.io.WriteAbortedException: writing aborted;
java.io.NotSerializableException:
org.apache.catalina.session.StandardManager
at sun.rmi.server.UnicastRef.invoke(UnicastRef.java:157)
at com.sun.jmx.remote.internal.PRef.invoke(Unknown Source)
at javax.management.remote.rmi.RMIConnectionImpl_Stub.getAttribute(Unknown
Source)
at
javax.management.remote.rmi.RMIConnector$RemoteMBeanServerConnection.getAttribute(RMIConnector.java:857)
at test.jmx.JmxTest.main(JmxTest.java:37)
Caused by: java.io.WriteAbortedException: writing aborted;
java.io.NotSerializableException:
org.apache.catalina.session.StandardManager
at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1309)
at java.io.ObjectInputStream.readObject(ObjectInputStream.java:348)
at sun.rmi.server.UnicastRef.unmarshalValue(UnicastRef.java:290)
at sun.rmi.server.UnicastRef.invoke(UnicastRef.java:139)
... 4 more
Caused by: java.io.NotSerializableException:
org.apache.catalina.session.StandardManager
at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1081)
at java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:302)
at sun.rmi.server.UnicastRef.marshalValue(UnicastRef.java:258)
at sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:304)
at sun.rmi.transport.Transport$1.run(Transport.java:153)
at java.security.AccessController.doPrivileged(Native Method)
at sun.rmi.transport.Transport.serviceCall(Transport.java: 149)
at sun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.java:466)
at
sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport.java:707)
at java.lang.Thread.run(Thread.java:595)
I attach to this mail a sample that able to reproduce this. In fact I would
like to know how to retrieve this Class, I hope that this class implement
Serializable otherwise I don't know why StandardManager is exposed as Jmx
Attribute.

Additionnaly, when I try to retrieve an attribute like "managedResource"
from the MBean "Catalina:host=localhost,type=Host". I got the following
execption
Exception in thread "main" java.rmi.UnmarshalException: error unmarshalling
return; nested exception is:
 java.io.WriteAbortedException: writing aborted;
java.io.NotSerializableException: org.apache.catalina.util.LifecycleSupport
 at sun.rmi.server.UnicastRef.invoke(UnicastRef.java:157)
 at com.sun.jmx.remote.internal.PRef.invoke(Unknown Source)
 at javax.management.remote.rmi.RMIConnectionImpl_Stub.getAttribute(Unknown
Source)
 at
javax.management.remote.rmi.RMIConnector$RemoteMBeanServerConnection.getAttribute(RMIConnector.java:857)
 at test.jmx.JmxTest.main(JmxTest.java:36)

see attached file for complete stacktrace.

Regards,

Emmanuel
/**
 * 
 */
package test.jmx;

import java.util.Hashtable;

import javax.management.MBeanServerConnection;
import javax.management.ObjectName;
import javax.management.remote.JMXConnector;
import javax.management.remote.JMXConnectorFactory;
import javax.management.remote.JMXServiceURL;

import org.apache.catalina.Manager;

/**
 * @author xbi0bnv
 * 
 */
public class JmxTest {

/**
 * @param args
 */
public static void main(String[] args) throws Exception {
JMXServiceURL serviceURL = new 
JMXServiceURL("service:jmx:rmi:///jndi/rmi://localhost:21205/jmxrmi");

Hashtable h = new Hashtable();
h.put(JMXConnector.CREDENTIALS, new String[] { "controlRole", "tomcat" 
});

JMXConnector connector = JMXConnectorFactory.connect(serviceURL, h);

MBeanServerConnection connection = connector.getMBeanServerConnection();

ObjectName oName = new 
ObjectName("Catalina:J2EEApplication=none,J2EEServer=none,j2eeType=WebModule,name=//localhost/");
Manager manager = (Manager) connection.getAttribute(oName, "manager");
System.out.println(manager.getInfo());

}

}
Exception in thread "main" java.rmi.UnmarshalException: error unmarshalling 
return; nested exception is: 
java.io.WriteAbortedException: writing aborted; 
java.io.NotSerializableException: org.apache.catalina.util.LifecycleSupport
at sun.rmi.server.UnicastRef.invoke(UnicastRef.java:157)
at com.sun.jmx.remote.internal.PRef.invoke(Unknown Source)
at 
javax.management.remote.rmi.RMIConnectionImpl_Stub.getAttribute(Unknown Source)
at 
javax.management.remote.rmi.RMIConnector$RemoteMBeanServerConnection.getAttribute(RMIConnector.java:857)
at test.jmx.JmxTest.main(JmxTest.java:36)
Caused by: java.io.WriteAbortedException: writing aborted; 
java.io.NotSerializableException: org.apache.catalina.util.LifecycleSupport
at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1309)

Threads and blocked count value

2008-11-04 Thread Stefano Nichele

 Hi All,
I'm running tomcat 6.0.13 + jdk 1.5 in my production system and I'm a 
bit wondering about the number of times the "Reference Handler" thread 
has been blocked in just 3 days: 9500835 (checked using jmx)


For the other http threads (the ones that start with "http-port-") as 
average I have 24377 as blocked count.


What do you think about these numbers ?

Cheers and thanks in advance.
ste

-
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



RE: Does the Server element have a listen address?

2008-11-04 Thread Caldarale, Charles R
> From: Fu-Tung Cheng [mailto:[EMAIL PROTECTED]
> Subject: Does the Server element have a listen address?
>
> I have two ip addresses and I would like the server element
> with the shutdown port to listen on only one.

The shutdown listener uses only 127.0.0.1, nothing else, which is why the doc 
says:

"This connection must be initiated from the same server computer that is 
running this instance of Tomcat."

 - Chuck


THIS COMMUNICATION MAY CONTAIN CONFIDENTIAL AND/OR OTHERWISE PROPRIETARY 
MATERIAL and is thus for use only by the intended recipient. If you received 
this in error, please contact the sender and delete the e-mail and its 
attachments from all computers.

-
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



RE: Threads and blocked count value

2008-11-04 Thread Caldarale, Charles R
> From: Stefano Nichele [mailto:[EMAIL PROTECTED]
> Subject: Threads and blocked count value
>
> I'm running tomcat 6.0.13 + jdk 1.5 in my production system and I'm a
> bit wondering about the number of times the "Reference Handler" thread
> has been blocked in just 3 days: 9500835 (checked using jmx)

The Reference Handler thread is internal to the JVM; it doesn't belong to 
Tomcat.  It's responsibility is to take care of objects that garbage collection 
has found to be unreachable other than via some form of Reference object (e.g., 
SoftReference, WeakReference).  Completely ignorable.

> What do you think about these numbers ?

Pretty much meaningless when taken out of context like this.

 - Chuck


THIS COMMUNICATION MAY CONTAIN CONFIDENTIAL AND/OR OTHERWISE PROPRIETARY 
MATERIAL and is thus for use only by the intended recipient. If you received 
this in error, please contact the sender and delete the e-mail and its 
attachments from all computers.

-
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



RE: Custom Error Messages (5xx and 4xx)

2008-11-04 Thread Rob Mercer
First off, thank you for your responses, I've worked on this a little
more and am still have problems getting the error message pages to even
appear when the server side error is generated. Below is my web.xml




javax.faces.DEFAULT_SUFFIX
.xhtml



facelets.VIEW_MAPPINGS
*.xhtml





404
/error_pages/404.xhtml
 
   

500
/error_pages/500.xhtml


Please let me know if I missed anything relevant.

Currently when an error (500) is generated all I get is a blank white
screen :(. I can go directly to the error pages both logged into the
system and not and I get the nice little "Something has gone wrong .."
custom error page that I've setup for this test...

Any ideas?

-Rob

-Original Message-
From: Kirchhoff, Florian [mailto:[EMAIL PROTECTED] 
Sent: Tuesday, November 04, 2008 10:20 AM
To: Tomcat Users List
Subject: RE: Custom Error Messages (5xx and 4xx)

Rob,

First you need to gather the information about the exception, then send
it to who needs to know. You might want to be proactive and send it to
the support team regardless of what the users want...

One thing to lookout for is that depending on where you exception is
thrown the implicit "exception" variable may not be the one you're
looking for and you have to "unwind" the calling stack to find the root
cause. That's what Tomcat's default error page does. I found it
instructive to study the source of the ErrorReportValve in subversion:


Look into the "report" method to see how to use "exception.getCause()"
to get to the root cause.

I hope you find this useful.

Florian


> -Original Message-
> From: Serge Fonville [mailto:[EMAIL PROTECTED]
> Sent: Monday, November 03, 2008 4:44 PM
> To: Tomcat Users List
> Subject: Re: Custom Error Messages (5xx and 4xx)
> 
> Hi,
> 
> Look at
> http://java.sun.com/developer/EJTechTips/2003/tt0114.html,
> especially the text
> The string isErrorPage="true" causes the Web container to
> define a new
> implicit variable, "exception", that the JSP page can use
> in scriptlets or
> in custom tags. For example, the error page for the current
> example uses the
> "exception" object to report the name of the class that
> caused the
> exception:
> Basically when at the top of the jsp you specify
> isErrorPage=true, you have
> a variable exception that contains the thrown exception
> 
> Hope this helps
> 
> Regards,
> 
> Serge Fonville
> On Mon, Nov 3, 2008 at 10:31 PM, Rob Mercer
> <[EMAIL PROTECTED]>wrote:
> 
> > Hey all,
> >
> >I'm trying to setup custom error messages
> in Tomcat
> > 6.0.14. I've got the following entry in web.xml:
> >
> >
> >
> > 
> >
> >  
> >
> >404
> >
> >/error_pages/404.jsf
> >
> >  
> >
> >
> >
> >  
> >
> >500
> >
> >/error_pages/500.jsf
> >
> >  
> >
> > 
> >
> >
> >
> > And I've got a much less scary set of pages setup but I
> was wondering if
> > there was a way to get the stack trace and error message
> information to
> > shoot to the support team if the user clicked an "email
> the support team
> > about this error message."  Any ideas on how I'd go about
> that?
> >
> >
> >
> > Additionally, is there a way to setup a 5xx page? Just a
> page that
> > handled all 500 pages? Like a web.xml shorthand?
> >
> >
> >
> >
> >
> > Thanks ahead of time!
> >
> >
> >
> > Rob M
> >
> >


This communication is the property of Qwest and may contain confidential
or
privileged information. Unauthorized use of this communication is
strictly 
prohibited and may be unlawful.  If you have received this communication

in error, please immediately notify the sender by reply e-mail and
destroy 
all copies of the communication and any attachments.

-
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


-
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



RE: Custom Error Messages (5xx and 4xx)

2008-11-04 Thread Rob Mercer
Correction, the 404 error pages now seem to work, but the 500 error page
is not being produced on an error

-Rob

-Original Message-
From: Rob Mercer [mailto:[EMAIL PROTECTED] 
Sent: Tuesday, November 04, 2008 2:09 PM
To: Tomcat Users List
Subject: RE: Custom Error Messages (5xx and 4xx)

First off, thank you for your responses, I've worked on this a little
more and am still have problems getting the error message pages to even
appear when the server side error is generated. Below is my web.xml




javax.faces.DEFAULT_SUFFIX
.xhtml



facelets.VIEW_MAPPINGS
*.xhtml





404
/error_pages/404.xhtml
 
   

500
/error_pages/500.xhtml


Please let me know if I missed anything relevant.

Currently when an error (500) is generated all I get is a blank white
screen :(. I can go directly to the error pages both logged into the
system and not and I get the nice little "Something has gone wrong .."
custom error page that I've setup for this test...

Any ideas?

-Rob

-Original Message-
From: Kirchhoff, Florian [mailto:[EMAIL PROTECTED] 
Sent: Tuesday, November 04, 2008 10:20 AM
To: Tomcat Users List
Subject: RE: Custom Error Messages (5xx and 4xx)

Rob,

First you need to gather the information about the exception, then send
it to who needs to know. You might want to be proactive and send it to
the support team regardless of what the users want...

One thing to lookout for is that depending on where you exception is
thrown the implicit "exception" variable may not be the one you're
looking for and you have to "unwind" the calling stack to find the root
cause. That's what Tomcat's default error page does. I found it
instructive to study the source of the ErrorReportValve in subversion:


Look into the "report" method to see how to use "exception.getCause()"
to get to the root cause.

I hope you find this useful.

Florian


> -Original Message-
> From: Serge Fonville [mailto:[EMAIL PROTECTED]
> Sent: Monday, November 03, 2008 4:44 PM
> To: Tomcat Users List
> Subject: Re: Custom Error Messages (5xx and 4xx)
> 
> Hi,
> 
> Look at
> http://java.sun.com/developer/EJTechTips/2003/tt0114.html,
> especially the text
> The string isErrorPage="true" causes the Web container to
> define a new
> implicit variable, "exception", that the JSP page can use
> in scriptlets or
> in custom tags. For example, the error page for the current
> example uses the
> "exception" object to report the name of the class that
> caused the
> exception:
> Basically when at the top of the jsp you specify
> isErrorPage=true, you have
> a variable exception that contains the thrown exception
> 
> Hope this helps
> 
> Regards,
> 
> Serge Fonville
> On Mon, Nov 3, 2008 at 10:31 PM, Rob Mercer
> <[EMAIL PROTECTED]>wrote:
> 
> > Hey all,
> >
> >I'm trying to setup custom error messages
> in Tomcat
> > 6.0.14. I've got the following entry in web.xml:
> >
> >
> >
> > 
> >
> >  
> >
> >404
> >
> >/error_pages/404.jsf
> >
> >  
> >
> >
> >
> >  
> >
> >500
> >
> >/error_pages/500.jsf
> >
> >  
> >
> > 
> >
> >
> >
> > And I've got a much less scary set of pages setup but I
> was wondering if
> > there was a way to get the stack trace and error message
> information to
> > shoot to the support team if the user clicked an "email
> the support team
> > about this error message."  Any ideas on how I'd go about
> that?
> >
> >
> >
> > Additionally, is there a way to setup a 5xx page? Just a
> page that
> > handled all 500 pages? Like a web.xml shorthand?
> >
> >
> >
> >
> >
> > Thanks ahead of time!
> >
> >
> >
> > Rob M
> >
> >


This communication is the property of Qwest and may contain confidential
or
privileged information. Unauthorized use of this communication is
strictly 
prohibited and may be unlawful.  If you have received this communication

in error, please immediately notify the sender by reply e-mail and
destroy 
all copies of the communication and any attachments.

-
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


-
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


-
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: file vs servlet through a filter

2008-11-04 Thread Tom Eugelink

Right. Sorry. Tomcat 6.0.14, Java 1.6.0_03, WindowsXP SP3.

It gets even better: if the servlet copies the file's contents to its 
response, both have 1766 bytes returned. One gives an invalid PDF, the 
other not.


   IOUtil.copy(new FileReader(new File("C:\\...\\test.xslfo.xml")), 
response.getWriter());



-
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



RE: HTTPS after JDK upgrade in Firefox 3 stopped working

2008-11-04 Thread Caldarale, Charles R
> From: Jozef Hovan [mailto:[EMAIL PROTECTED]
> Subject: HTTPS after JDK upgrade in Firefox 3 stopped working
>
> Environment: I upgraded Windows 2000 -> Windows Server 2003,
> JDK 5u14 -> JDK 6u10, Tomcat 5.5.25->5.5.27.

Just for grins, can you replace the JDK 6u10 with 6u7 and try it again?  Lots 
of things changed in 6u10...

 - Chuck


THIS COMMUNICATION MAY CONTAIN CONFIDENTIAL AND/OR OTHERWISE PROPRIETARY 
MATERIAL and is thus for use only by the intended recipient. If you received 
this in error, please contact the sender and delete the e-mail and its 
attachments from all computers.

-
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



RE: [JMX] org.apache.catalina.session.StandardManager not serializable

2008-11-04 Thread Caldarale, Charles R
> From: Emmanuel Soden [mailto:[EMAIL PROTECTED]
> Subject: Re: [JMX] org.apache.catalina.session.StandardManager not 
> serializable
>
> Using Tomcat 5.5.27 with JDK 1.5.0_11, I'm trying to retrieve
> the attribute "manager" from the MBean
> "Catalina:J2EEApplication=none,J2EEServer=none,
> j2eeType=WebModule,name=//localhost/".

I don't think there's any requirement for any app to guarantee that attributes 
are serializable, and I suspect trying to make StandardManager so would create 
a host of issues inside Tomcat.

Perhaps you should try retrieving the attributes you're interested in from this 
JMX location instead:
  "Catalina:type=Manager,path=/,host=localhost"
Its attributes are all retrievable, at least according to JConsole.

> when I try to retrieve an attribute like "managedResource"
> from the MBean "Catalina:host=localhost,type=Host"

>From a brief perusal of the 6.0 code (sorry, not the level you're using), 
>there appears to be extremely limited use of the "managedResource" attribute, 
>despite its presence in most of the MBeans.  Looks like in the vast majority 
>of cases, the attribute is never set.

 - Chuck


THIS COMMUNICATION MAY CONTAIN CONFIDENTIAL AND/OR OTHERWISE PROPRIETARY 
MATERIAL and is thus for use only by the intended recipient. If you received 
this in error, please contact the sender and delete the e-mail and its 
attachments from all computers.

-
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: configure the Heap Size

2008-11-04 Thread Christopher Schultz
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

Frank,

Frank Uccello wrote:
> Is it possible to set the Heap size in the server.xml file

No.

> and if so what the syntax

You need to set a JVM startup parameter. This parameter is
JVM-dependent, but most JVMs use parameters of the form:

- -Xmsinitial heap size
- -Xmxmax heap size

Note that  can be something like "512m" to specify that you'd like
516 megabytes of heap space.

If you run Tomcat from the command-line, you can set the JAVA_OPTS
environment variable in order to set the JVM parameters before running
catalina.bat/catalina.sh. If you use a Microsoft Windows service, you'll
need to use the service editor to set the parameters. This page might
help if you are running on Microsoft Windows:
http://tomcat.apache.org/tomcat-5.5-doc/windows-service-howto.html

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

iEYEARECAAYFAkkQr0UACgkQ9CaO5/Lv0PB+hQCgstd4cD6V6vj//5aRY9aazP2O
W4IAoKxdZWkFivy3MYCu20nrYvubCK25
=KlBj
-END PGP SIGNATURE-

-
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: [JMX] org.apache.catalina.session.StandardManager not serializable

2008-11-04 Thread Jess Holle

Caldarale, Charles R wrote:

From: Emmanuel Soden [mailto:[EMAIL PROTECTED]
Subject: Re: [JMX] org.apache.catalina.session.StandardManager not serializable

Using Tomcat 5.5.27 with JDK 1.5.0_11, I'm trying to retrieve
the attribute "manager" from the MBean
"Catalina:J2EEApplication=none,J2EEServer=none,
j2eeType=WebModule,name=//localhost/".


I don't think there's any requirement for any app to guarantee that attributes 
are serializable, and I suspect trying to make StandardManager so would create 
a host of issues inside Tomcat.

Perhaps you should try retrieving the attributes you're interested in from this 
JMX location instead:
  "Catalina:type=Manager,path=/,host=localhost"
Its attributes are all retrievable, at least according to JConsole

when I try to retrieve an attribute like "managedResource"
from the MBean "Catalina:host=localhost,type=Host"



>From a brief perusal of the 6.0 code (sorry, not the level you're using), there appears 
to be extremely limited use of the "managedResource" attribute, despite its 
presence in most of the MBeans.  Looks like in the vast majority of cases, the attribute is 
never set.
  
More generally I have had cases where I've had an attribute exposed via 
JMX for /in-process /usage that then blows chunks with out-of-process 
usage.  This should be avoided, but where it cannot be it should be 
documented as "the way things are" and possibly addressed by 
replaceObject().  [In my recent case I used replaceObject() to replace 
my non-serializable data with an approximation thereof whose toString() 
would show something somewhat meaningful in a remote JMX console.]


--
Jess Holle



Re: TOMCAT 6 and FOP

2008-11-04 Thread Christopher Schultz
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

David,

David Venus wrote:
>  28: Transformer transformer = factory.newTransformer(new StreamSource(new  
>  java.io.StringReader(request.getParameter("template";  


>  java.lang.NullPointerException 
>  java.io.StringReader.(StringReader.java:33)
>  org.apache.jsp.apex_005ffop_jsp._jspService(apex_005ffop_jsp.java:92)  

Looks like request.getParameter("template") is returning null. Your JSP
should sanity-check (and taint-check!) all data supplied by the user
before use.

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

iEYEARECAAYFAkkQsK8ACgkQ9CaO5/Lv0PCaXgCeJI2tW0Ryo6BJaSgvNNtyRXf6
P4YAnA31MuUSTNYZZS1Lud0RxUsNOQm2
=9Fld
-END PGP SIGNATURE-

-
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: @PersistenceUnit injection not working

2008-11-04 Thread Youssef Mohammed
This has nothing to do with tomcat, you will need to figure out how to
configure Persistence Manager in your web application.


Regards, Youssef


On Tue, Nov 4, 2008 at 10:27 PM, Pablo Caballero
<[EMAIL PROTECTED]>wrote:

> Hi everyone.
>
> I have an @PersistenceUnit(unitName="blah") injection but the value of the
> related variable in the method where I'm using it is null.
>
> Using Persistence.createEntityManagerFactory("blah") instead of injection
> in the method's body works fine!
>
> I'm using Tomcat 6.0.16. The server log not show any abnormal (I see it
> from Netbeans that is my IDE)
>
> Can you explain me if this behaviour is normal or if it's an error (in some
> place)?
>
> I'm a newbie in Java (and related technologies)
>
> I apologize for my bad english.
>
> Thank you very much
>
> Regards
>
>
>
>
>


@PersistenceUnit injection not working

2008-11-04 Thread Pablo Caballero
Hi everyone.

I have an @PersistenceUnit(unitName="blah") injection but the value of the 
related variable in the method where I'm using it is null.

Using Persistence.createEntityManagerFactory("blah") instead of injection in 
the method's body works fine!

I'm using Tomcat 6.0.16. The server log not show any abnormal (I see it from 
Netbeans that is my IDE)

Can you explain me if this behaviour is normal or if it's an error (in some 
place)?

I'm a newbie in Java (and related technologies)

I apologize for my bad english.

Thank you very much

Regards




  

Re: Thread Dumps/ Emailing Results...

2008-11-04 Thread Christopher Schultz
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

Chuek,

Caldarale, Charles R wrote:
>> From: keeplearning [mailto:[EMAIL PROTECTED]
>> Subject: Thread Dumps/ Emailing Results...
>>
>> So, do i need to supply process id with this command. Like:
>> kill -3 .
> 
> That's one way to do it.  My preference is to use the jstack tool from the 
> JDK, assuming you're running a 1.5 or 1.6 Sun JVM.

I have written a script to check for OOMs by checking catalina.out for
"OutOfMemoryError". When such an error is detected, I run the following
commands (apologies for the line wrapping):

APP_PID=[fill this in with a way to get your app's pid]
  # Make sure the pid looks like a pid
  if [ "${APP_PID}" != `expr match "${APP_PID}" '\([0-9]\+\)'` ] ; then
echo "Could not determine the correct pid for ${APP_NAME}" >> ${OUTPUT}
  else
# Make sure that this pid belongs to the proper process
ps -e x | grep "^[ \t]*${APP_PID}.*${PROCESS_STRING}" > /dev/null

if [ "$?" == "0" ] ; then
  # This is the correct pid

  if [ -x ${JSTACK} ] ; then
 # jstack is available on the system: this is way easier

 echo '=== THREAD DUMP =' >> ${OUTPUT}
 ${JSTACK} ${APP_PID} >> "${OUTPUT}" 2>&1
  else
 # Generate a thread dump on the java process
 kill -QUIT ${APP_PID}

 # Now, go find that thread dump in the log file
 echo '=== THREAD DUMP =' >> ${OUTPUT}
 dump_start_line=`grep -n '^Full thread' ${LOGFILE} | tail -n 1
| sed -e
 's/\([0-9]\+\):.*/\1/'`
 tail -n +${dump_start_line} ${LOGFILE} >> ${OUTPUT}
  fi

  # What the heck, let's get a heap dump, too.
  echo ' HEAP SUMMARY ===' >> ${OUTPUT}
  ${JMAP} -heap ${APP_PID} >> ${OUTPUT} 2>&1

  echo ' OBJECT HISTOGRAM ===' >> ${OUTPUT}
  ${JMAP} -histo ${APP_PID} >> ${OUTPUT} 2>&1
else
  echo 'Could not determine the correct pid for ${APP_NAME}' >>
${OUTPUT}
fi
  fi

  mail -s "Found OOME in ${APP_NAME}!" ${ADMIN_EMAIL} < ${OUTPUT}



If jstack isn't available, we use a hack to generate a thread dump and
extract it from catalina.out.

> You still need the process id, and the JDK includes the jps tool
> which is easier than wading through the output of ps.  The JDK tools
> also work on Windows, whereas kill doesn't normally exist there.

Yes, this is a UNIX-specific script, unless you want to run it on Cygwin
(untested, by the way). But, if you're running on Windows, you don't
really care about uptime, anyway, do you? ;)

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

iEUEARECAAYFAkkQwkMACgkQ9CaO5/Lv0PB2vgCYvDQJNbkkVEFcpL/QnEegGg6x
iQCgmpuTbVPR6THyGbXE0U8GTLEK/No=
=Kg1V
-END PGP SIGNATURE-

-
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Thread Dumps/ Emailing Results...

2008-11-04 Thread Christopher Schultz
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

Chuck,

Caldarale, Charles R wrote:
>> From: keeplearning [mailto:[EMAIL PROTECTED]
>> Subject: RE: Thread Dumps/ Emailing Results...
>>
>> 1) I tried using following to mail the file as attachment (we
>> are also using MS Outlook):
>>
>> mail -s "Subject:test" [EMAIL PROTECTED] < test.log
> 
> That's using a Linux mailer, not Outlook; can't help you there.  From
> Outlook, I just insert the file from the Linux box directly over an
> SMB connection.

If you want to actually attach a file to a message, regular
sendmail-style "mail" won't cut it: you have to use mutt:

mutt -s "${EMAIL_SUBJECT}" -a "${REPORT_FILE}" ${EMAIL_RECIPIENTS}

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

iEYEARECAAYFAkkQwswACgkQ9CaO5/Lv0PDqDQCfXDaRATaf1WJOjvIMLkIY63P3
HDMAoK146Q3QWW+vcqn/hY8q1sGA333h
=hgqH
-END PGP SIGNATURE-

-
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: All threads (200) are currently busy

2008-11-04 Thread Christopher Schultz
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

AD,

>> On Fri, Oct 31, 2008 at 9:43 PM, Litton, Tom - CEPM
>> <[EMAIL PROTECTED]>wrote:
>> 
>>> If you do a kill -3 on the process it will dump the stack trace to the
>>> standard output stream.

AD wrote:
> will it provide more info than what is in the kill -QUIT from above ?

FYI "kill -3" == "kill -QUIT". UNIX signal 3 /is/ QUIT.

- -chris

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

iEYEARECAAYFAkkQxr8ACgkQ9CaO5/Lv0PAF/ACdHkxwf/zQkDFgD0KTKnII3j4m
ZBYAoIpqPJsYBx2iurWwz5rL+QklpCek
=koF9
-END PGP SIGNATURE-

-
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Convenient web application configuration.

2008-11-04 Thread Christopher Schultz
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

Jason,

Jason Cipriani wrote:
> I'm developing with Eclipse but could configure custom build steps
> with ant. This solution would remove most of the inconvenience, but I
> would still have to make 4 separate WARs available for distribution.
> Not *too* big of a deal but I'd rather just distribute a single
> archive.

If you need a different web.xml file for each machine, they you will, by
definition, require a different WAR for each machine. There's really
nothing you can do about that.

Another option would be to configure your application using something
other than web.xml but then you've just moved the problem to another
file.

We use a file in the user's home directory (called .ant.properties) that
includes machine-specific environmental information. To deploy, we grab
the source from CVS and run "ant install" which does everything,
including merging the machine-specific configuration into the WAR and
deploying it. We have a small number of production machines, so this
isn't a big deal for us. If we had a large number, we'd just further
script the process by allowing the WAR creation to be parameterized by,
say, command-line switches (which they really are, since you can define
any ant property right on the command-line).

Hope that helps,
- -chris

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

iEYEARECAAYFAkkQyYEACgkQ9CaO5/Lv0PBzXQCdH4lqz0vHbGOChbEJIihowz50
2lsAoK6obiLTx09nSb7+8taZxxITlpjM
=GAv3
-END PGP SIGNATURE-

-
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



RE: Thread Dumps/ Emailing Results...

2008-11-04 Thread Caldarale, Charles R
> From: Christopher Schultz [mailto:[EMAIL PROTECTED]
> Subject: Re: Thread Dumps/ Emailing Results...
>
> I have written a script to check for OOMs by checking catalina.out
> for "OutOfMemoryError". When such an error is detected, I run the
> following commands (apologies for the line wrapping):

An easier way to get the heap dump on a modern HotSpot JVM is to add the 
command-line option:
  -XX:+HeapDumpOnOutOfMemoryError

Also, in JDK 6 and above, there's another intriguing option:
  -XX:OnOutOfMemoryError=""

The above will run an external command to do whatever you deem appropriate, 
such us running the thread dump script you provided.

 - Chuck


THIS COMMUNICATION MAY CONTAIN CONFIDENTIAL AND/OR OTHERWISE PROPRIETARY 
MATERIAL and is thus for use only by the intended recipient. If you received 
this in error, please contact the sender and delete the e-mail and its 
attachments from all computers.

-
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Howto ip-protect a specific url in webapp?

2008-11-04 Thread Christopher Schultz
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

Chuck,

Caldarale, Charles R wrote:
>> From: [EMAIL PROTECTED]
>> [mailto:[EMAIL PROTECTED]
>> Subject: Howto ip-protect a specific url in webapp?
>>
>> I can restrict the whole /foo by using valve in
>> "/etc/tomcat5/Catalina/localhost/foo.xml" but howto protect
>> only /foo/admin?
> 
> Either put the check in the servlet that handles /foo/admin, or write your 
> own valve that extends the existing RemoteAddrValve.

You could also use a filter. URLrewrite will do this for you if you
don't feel like writing one yourself (http://tuckey.org/urlrewrite/).

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

iEYEARECAAYFAkkQycsACgkQ9CaO5/Lv0PDUBgCcCRMOvtPpdTVO7L+3LglnlnDc
rRkAmwWcPLj0QTV7w9I2JekTXPoQWQYa
=DPbQ
-END PGP SIGNATURE-

-
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Fw: Problem with form processing using doGet

2008-11-04 Thread Christopher Schultz
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

Remigiusz,

Remigiusz Andrzejak wrote:
> What is strange is that Tomcat doesn't give me exception: resource not found.

Could you provide a stack trace for that error?

> Instead nor doGet, nor doPost seem to be called for those servlets.
> 
> What might be the source of the problem is the way servlets are invoked.
> 
> Here is an example of what I have in HTML page to get a picture served by my 
> servlet:
> 
>  height="16" border="0" alt="Wybierz datę">

You might want to check to see that the context name is the same between
machines. You are going to want to change all your links to point to
something like this:



This allows you to relocate your webapp without having to change your
URLs all the time.

While you're at it, you should add a call to request.encodeURL() in
there so that non-cookie-using clients will work, too. ;)

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

iEYEARECAAYFAkkQyvkACgkQ9CaO5/Lv0PCb+ACfTxbBihOrkzdQIj+NJ4ePmYhq
08EAn0omOotVRK30C1VeNEIzwx+dUHKE
=s5VX
-END PGP SIGNATURE-

-
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: An issue concerning authentication in Tomcat hosted web application

2008-11-04 Thread Christopher Schultz
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

Chuck,

Caldarale, Charles R wrote:
>> From: Nar Karapetyan [mailto:[EMAIL PROTECTED] Subject: An
>> issue concerning authentication in Tomcat hosted web application
>> 
>> This snippet says that any url ending with ".action" or ".jsp"
>> should be authenticated first, and works OK.
>> 
>> However, I need to exclude some specific urls which end with 
>> ".action". (e.g. RSS feed urls that contain the string "rss").
> 
> There's no provision for using regular expressions in section 12 of
> the Servlet Spec.  I think you can add another 
> listing the specific RSS URLs you want to allow, but do not include a
> nested  element.  This should allow unauthenticated
> access, if I'm interpreting the spec (and Tomcat's implementation
> thereof) properly.
> 
> You might want to take a look at SecurityFilter, which is more
> flexible than strict declarative security: 
> http://securityfilter.sourceforge.net/

SecurityFilter's handling of URL mappings is spec-compliant. We haven't
added any bells or whistles in here. It's mostly things like drive-by
logins and such.

Your interpretation of the spec matches ours: if you create a
 that matches "*.action" and another one that
matches "/full/path/to/my/special.action", then the latter will match
/first/ because it is a "longer" match. Order in the web.xml file is
irrelevant. Basically, the more-specific mapping always wins, which is
typically exactly what you want.

For more information, the OP should read chapter 11 ("Mapping Requests
to Servlets") in the servlet spec. It clearly defines how URLs should be
mapped to servlets (and the security constraints follow the identical
URL mapping rules).

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

iEYEARECAAYFAkkQzEYACgkQ9CaO5/Lv0PCV+gCeIHNZjI2eeiAjMSMeC46l7OGO
l80An2y6D9ZiSG9Tgj+KWGyfmyAVfupb
=6NUf
-END PGP SIGNATURE-

-
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Thread Dumps/ Emailing Results...

2008-11-04 Thread Christopher Schultz
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

Chuck,

Caldarale, Charles R wrote:
>> From: Christopher Schultz [mailto:[EMAIL PROTECTED]
>> Subject: Re: Thread Dumps/ Emailing Results...
>>
>> I have written a script to check for OOMs by checking catalina.out
>> for "OutOfMemoryError". When such an error is detected, I run the
>> following commands (apologies for the line wrapping):
> 
> An easier way to get the heap dump on a modern HotSpot JVM is to add the 
> command-line option:
>   -XX:+HeapDumpOnOutOfMemoryError

I noticed that, but we only run our OOM-check every 5 minutes, and we
want to avoid getting too much extra stuff in our email notifications.
If the thread dump happened a few minutes before, then we might not get
an up-to-date thread dump. One could argue that the exact timing of the
thread dump is not particularly relevant; merely having one /is/ useful.
Dumping threads at the time of the OOME would probably be better.

> Also, in JDK 6 and above, there's another intriguing option:
>   -XX:OnOutOfMemoryError=""

That's pretty cool. For the time being, we're on JRE 1.5, so that's not
an option. I'll look into it as we look forward to upgrading.

> The above will run an external command to do whatever you deem
> appropriate, such us running the thread dump script you provided.

It would be great if that command could be parameterized and, say, take
something like the thread dump on standard input. If you know anyone at
Sun, feel free to give them that idea ;)

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

iEYEARECAAYFAkkQzUcACgkQ9CaO5/Lv0PADZACgqgA/aL47vYm50iF2g50VhQy4
40oAnRCS2tcjNiecOPsJEdlU/jgRlDlD
=75eD
-END PGP SIGNATURE-

-
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: refresh bad db connection on tomcat - urgent help

2008-11-04 Thread Flavio Reis

Hi Srinivas,

Have you already solved this problem?
I have the same, an i can`t get the solution.

Regards.


Christopher Schultz-2 wrote:
> 
> -BEGIN PGP SIGNED MESSAGE-
> Hash: SHA1
> 
> Srinivas,
> 
> Srinivas Jonnalagadda wrote:
>> what is the syntaxt to refresh bad db connection on tomcat -
>> context.xml? We are using tomcata 5.5.9 connecting to oracle 10. The
>> issue is that our jvm crashed because in the connection pool we had
>> bad db connection and it the connections were out of limit. we could
>> not detect and it happened in our prod environment. if there is any
>> command for that it would be great help.
> 
> Just to be clear: you ran out of database connections, or your database
> connections went stale and you just need to replace one connection at a
> time?
> 
> If you are getting stale connections, you just need to set a "validation
> query" in your connection configuration. In your application's
> META-INF/context.xml, you should have a  element which defines
> your data source (this may also be in Tomcat's server.xml if you have a
> global data source). Just add
> 
> validationQuery="SELECT 1 FROM DUAL"
> 
> to detect stale connections. The query itself is irrelevant, except that
> it needs to return successfully and you want something that's not going
> to put a load on the server. Some drivers/servers support a 'ping' query
> that is super lightweight (for instance, recent versions of MySQL's
> Connector/J allows a query starting with '/* ping */' to be used as a
> lightweight communications check).
> 
> If you are leaking connections from your pool, you should review your
> application for proper try/finally processing of JDBC connections.
> Tomcat's connection pool (which is really commons-dbcpo in disguise) can
> help you find places where connection are being leaked using a few other
> attributes:
> 
> logAbandoned="true"
> removeAbandoned="true"
> removeAbandonedTimeout="30"
> 
> These settings tell the connection pool that it should keep track of
> where connections are borrowed from the connection pool. If the
> connection hasn't been returned to the pool within
> "removeAbandonedTimeout" seconds, then the connection will be purged
> from the pool, and a stack trace showing the code that borrowed the
> connection will be dumped into your log.
> 
> See http://commons.apache.org/dbcp/configuration.html for more
> information.
> 
> Hope that helps,
> - -chris
> 
> -BEGIN PGP SIGNATURE-
> Version: GnuPG v1.4.9 (MingW32)
> Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org
> 
> iEYEARECAAYFAkjvcOEACgkQ9CaO5/Lv0PDVWACfTxkUIKm/M6mcGVnFQ9yQjsKe
> RfYAnjnaW8aSH4ZGOJqrg4GAXshyasyk
> =FsRS
> -END PGP SIGNATURE-
> 
> -
> To start a new topic, e-mail: users@tomcat.apache.org
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 
> 
> 

-- 
View this message in context: 
http://www.nabble.com/refresh-bad-db-connection-on-tomcat---urgent-help-tp19919463p20332763.html
Sent from the Tomcat - User mailing list archive at Nabble.com.


-
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



JspC processFile java.lang.NullPointerException

2008-11-04 Thread Josh Joy
Am receiving the following when trying to precompile my jsp. Server starts
up and pages run fine without precompiling.

Using apache-tomcat-6.0.18





















   [jasper] Nov 4, 2008 8:46:43 PM org.apache.jasper.JspC processFile
   [jasper] SEVERE: ERROR-the file '/WEB-INF/views/upload/page.jsp'
generated the following general exception:
   [jasper] java.lang.NullPointerException
   [jasper] at sun.misc.URLClassPath$3.run(URLClassPath.java:323)
   [jasper] at java.security.AccessController.doPrivileged(Native
Method)
   [jasper] at sun.misc.URLClassPath.getLoader(URLClassPath.java:320)
   [jasper] at sun.misc.URLClassPath.getLoader(URLClassPath.java:297)
   [jasper] at sun.misc.URLClassPath.getResource(URLClassPath.java:167)
   [jasper] at java.net.URLClassLoader$1.run(URLClassLoader.java:192)
   [jasper] at java.security.AccessController.doPrivileged(Native
Method)
   [jasper] at
java.net.URLClassLoader.findClass(URLClassLoader.java:188)
   [jasper] at
org.apache.jasper.servlet.JasperLoader.loadClass(JasperLoader.java:134)
   [jasper] at
org.apache.jasper.servlet.JasperLoader.loadClass(JasperLoader.java:66)
   [jasper] at
org.apache.jasper.JspCompilationContext.load(JspCompilationContext.java:618)
   [jasper] at
org.apache.jasper.servlet.JspServletWrapper.loadTagFile(JspServletWrapper.java:224)
   [jasper] at
org.apache.jasper.compiler.TagFileProcessor.loadTagFile(TagFileProcessor.java:576)
   [jasper] at
org.apache.jasper.compiler.TagFileProcessor.access$000(TagFileProcessor.java:50)
   [jasper] at
org.apache.jasper.compiler.TagFileProcessor$TagFileLoaderVisitor.visit(TagFileProcessor.java:636)
   [jasper] at
org.apache.jasper.compiler.Node$CustomTag.accept(Node.java:1512)
   [jasper] at
org.apache.jasper.compiler.Node$Nodes.visit(Node.java:2343)
   [jasper] at
org.apache.jasper.compiler.Node$Visitor.visitBody(Node.java:2393)
   [jasper] at
org.apache.jasper.compiler.Node$Visitor.visit(Node.java:2399)
   [jasper] at
org.apache.jasper.compiler.Node$Root.accept(Node.java:489)
   [jasper] at
org.apache.jasper.compiler.Node$Nodes.visit(Node.java:2343)
   [jasper] at
org.apache.jasper.compiler.TagFileProcessor.loadTagFiles(TagFileProcessor.java:654)
   [jasper] at
org.apache.jasper.compiler.Compiler.generateJava(Compiler.java:178)
   [jasper] at
org.apache.jasper.compiler.Compiler.compile(Compiler.java:315)
   [jasper] at org.apache.jasper.JspC.processFile(JspC.java:1010)
   [jasper] at org.apache.jasper.JspC.execute(JspC.java:1159)
   [jasper] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native
Method)
   [jasper] at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
   [jasper] at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
   [jasper] at java.lang.reflect.Method.invoke(Method.java:597)
   [jasper] at
org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:105)
   [jasper] at
org.apache.tools.ant.TaskAdapter.execute(TaskAdapter.java:134)
   [jasper] at
org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:288)
   [jasper] at sun.reflect.GeneratedMethodAccessor3.invoke(Unknown
Source)
   [jasper] at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
   [jasper] at java.lang.reflect.Method.invoke(Method.java:597)
   [jasper] at
org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:105)
   [jasper] at org.apache.tools.ant.Task.perform(Task.java:348)
   [jasper] at org.apache.tools.ant.Target.execute(Target.java:357)
   [jasper] at org.apache.tools.ant.Target.performTasks(Target.java:385)
   [jasper] at
org.apache.tools.ant.Project.executeSortedTargets(Project.java:1329)
   [jasper] at
org.apache.tools.ant.Project.executeTarget(Project.java:1298)
   [jasper] at
org.apache.tools.ant.helper.DefaultExecutor.executeTargets(DefaultExecutor.java:41)
   [jasper] at
org.eclipse.ant.internal.ui.antsupport.EclipseDefaultExecutor.executeTargets(EclipseDefaultExecutor.java:32)
   [jasper] at
org.apache.tools.ant.Project.executeTargets(Project.java:1181)
   [jasper] at
org.eclipse.ant.internal.ui.antsupport.InternalAntRunner.run(InternalAntRunner.java:423)
   [jasper] at
org.eclipse.ant.internal.ui.antsupport.InternalAntRunner.main(InternalAntRunner.java:137)
   [jasper] java.lang.NullPointerException
   [jasper] at sun.misc.URLClassPath$3.run(URLClassPath.java:323)
   [jasper] at java.security.AccessController.doPrivileged(Native
Method)
   [jasper] at sun.misc.URLClassPath.getLoader(URLClassPath.java:320)
   [jasper] at sun.misc.URLClassPath.getLoader(URLClassPath.java:297)
   [jasper] at sun.misc.URLClassPath.getResource(URLClassPath.java:167)
   [jasper] at java.net.URLClassLoader$1.run(URLClassLoader.java

Re: Thread Dumps/ Emailing Results...

2008-11-04 Thread Rainer Jung


Christopher Schultz schrieb:
>> Also, in JDK 6 and above, there's another intriguing option:
>>   -XX:OnOutOfMemoryError=""
> 
> That's pretty cool. For the time being, we're on JRE 1.5, so that's not
> an option. I'll look into it as we look forward to upgrading.
> 
>> The above will run an external command to do whatever you deem
>> appropriate, such us running the thread dump script you provided.
> 
> It would be great if that command could be parameterized and, say, take
> something like the thread dump on standard input. If you know anyone at
> Sun, feel free to give them that idea ;)

You can add white space separated arguments inside the flag value behind
the command name. It looks like oyu could also list several semicolon
separated commands. Any '%p' in the value will be automatically resolved
with the pid (which is part of the default heap file dump name). What
you can't get though, is the full heap dump file name:

http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6457610

Although usually you should be able to figure out, how to calculate it
based on the pid.

Regards,

Rainer

-
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: [JMX] org.apache.catalina.session.StandardManager not serializable

2008-11-04 Thread Emmanuel Soden
Thank you Chuck,
 What I understand know is that, you can only retrieve primitive values.
In the same way, I was trying to retrieve a "org.apache.catalina.Context"
from the MBean
"Catalina:J2EEApplication=none,J2EEServer=none,j2eeType=WebModule,name=//localhost/"
using the JMX operation operation "findMappingObject" and I get the
following error

Caused by: java.rmi.UnmarshalException: error unmarshalling return; nested
exception is:
java.io.WriteAbortedException: writing aborted;
java.io.NotSerializableException: org.apache.catalina.util.LifecycleSupport
at sun.rmi.server.UnicastRef.invoke(Unknown Source)
at com.sun.jmx.remote.internal.PRef.invoke(Unknown Source)
at javax.management.remote.rmi.RMIConnectionImpl_Stub.invoke(Unknown Source)
at
javax.management.remote.rmi.RMIConnector$RemoteMBeanServerConnection.invoke(Unknown
Source)

My suggestion:
 - If you want to expose a JMX object all of their attributes or operations
have to be serializable.
 - Provide a different set of interface for Remote JMX connection and local
JMX connection.
 - Add to the documentation a list of objects that can be retrieved

Regards,
Emmanuel


On 11/4/08, Caldarale, Charles R <[EMAIL PROTECTED]> wrote:
>
> > From: Emmanuel Soden [mailto:[EMAIL PROTECTED]
> > Subject: Re: [JMX] org.apache.catalina.session.StandardManager not
> serializable
> >
> > Using Tomcat 5.5.27 with JDK 1.5.0_11, I'm trying to retrieve
> > the attribute "manager" from the MBean
> > "Catalina:J2EEApplication=none,J2EEServer=none,
> > j2eeType=WebModule,name=//localhost/".
>
> I don't think there's any requirement for any app to guarantee that
> attributes are serializable, and I suspect trying to make StandardManager so
> would create a host of issues inside Tomcat.
>
> Perhaps you should try retrieving the attributes you're interested in from
> this JMX location instead:
> "Catalina:type=Manager,path=/,host=localhost"
> Its attributes are all retrievable, at least according to JConsole.
>
> > when I try to retrieve an attribute like "managedResource"
> > from the MBean "Catalina:host=localhost,type=Host"
>
> From a brief perusal of the 6.0 code (sorry, not the level you're using),
> there appears to be extremely limited use of the "managedResource"
> attribute, despite its presence in most of the MBeans.  Looks like in the
> vast majority of cases, the attribute is never set.
>
> - Chuck
>
>
> THIS COMMUNICATION MAY CONTAIN CONFIDENTIAL AND/OR OTHERWISE PROPRIETARY
> MATERIAL and is thus for use only by the intended recipient. If you received
> this in error, please contact the sender and delete the e-mail and its
> attachments from all computers.
>
> -
> To start a new topic, e-mail: users@tomcat.apache.org
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>