Re: How to change a running Tomcat with root user to other user.

2005-04-17 Thread Anoop kumar V
I strongly suggest that you look through the man pages of setuid.

Then u need to make adequate changes with setuid in your startup.sh
file which will help u start the process as a normal user even though
root has started the process during boot.

HTH
-Anoop


On 4/15/05, Lorenzo Jiménez [EMAIL PROTECTED] wrote:
 Hi,
 
 Today we saw that our Tomcat 5.0.28 had been installed and it is running with 
 the root user.
 
 Because is a security hazard,
 
 how can I change it to other less dangerous user?, and
 what privileges needs to have in order to work?
 
 Our system is a RedHat 9.0, 2.4.21-20.ELsmp
 
 Thanks,
 Regards,
 
 Lorenzo
 
 -
 
 Si usted no es el destinatario indicado en este mensaje o responsable como 
 persona
 de la entrega del mensaje, no debe copiar o reenviar este mensaje, por favor 
 notifique
 al correo [EMAIL PROTECTED] Para más referencia sobre términos importantes
 relacionados a este correo visite 
 http://www.nacion.com/disclaimer/index_es2.htm
 
 If you are not the addressee indicated in this message (or responsible for 
 delivery of the
 message to such person), you may not copy or send this message to anyone, 
 please notify
 to [EMAIL PROTECTED] Click here for important additional terms relating to 
 this e-mail.
 http://www.nacion.com/disclaimer/index_en2.htm
 
 -
 
 -
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 
 


-- 
Thanks and best regards,
Anoop

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



jsvc.exec error: syscall failed in set_caps

2005-04-17 Thread Georges Roux
Hi,
I can't start tomcat 5.5.9 as a daemon on linux on port 8080 (default 
configuration)
nothing is running on this port
and have only thi error in logs/catalina.err

jsvc.exec error: syscall failed in set_caps
jsvc.exec error: Service exit with a return value of 4
Georges
-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


JMX on Tomcat 5.5.9, JDK1.4 broken even with compatibility package?

2005-04-17 Thread Paul ANDERSON
In the change log for TC5.5.9, there is a claim that MX4J 3.0.1 has been
integrated instead of 2. The JAR in bin from the compatibility package
for JDK1.4 matches MX4J 3.0.1. But if I put the other 3.0.1 JARs in
common/lib and configure Coyote to use jk2.properties with
mx.enabled=true, using JDK1.4.2_07 on RHEL3, the connector tries to load
an MX4J version 2 jrmp adaptor class.

 

SEVERE: MX4j RMI adapter not loaded: java.lang.ClassNotFoundException:
mx4j.adaptor.rmi.jrmp.JRMPAdaptor

 

Is it because there is a new configuration style when using 3.0.1 to
allow JSR160 RMI/http remoting with JDK1.4?

Or is it expected that MX4J version 2 will still be used in the case of
JDK1.4? (Seems not, because of the compatibility package)

Or have I done something wrong?

 

Thanks for any help everyone,

 

Paul



Re: jsvc.exec error: syscall failed in set_caps

2005-04-17 Thread Wolfgang Hackl
Georges Roux wrote:
I can't start tomcat 5.5.9 as a daemon on linux on port 8080 (default 
configuration)
nothing is running on this port
and have only thi error in logs/catalina.err

jsvc.exec error: syscall failed in set_caps
jsvc.exec error: Service exit with a return value of 4
Try modprobe capability. I think there is also a bug filed concerning 
this problem.

Kind regards,
Wolfgang
-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


Re: How to change a running Tomcat with root user to other user.

2005-04-17 Thread QM
On Fri, Apr 15, 2005 at 08:37:14AM -0600, Lorenzo Jim?nez wrote:
: Today we saw that our Tomcat 5.0.28 had been installed and it is running with
: the root user.
: how can I change it to other less dangerous user?, and
: what privileges needs to have in order to work?

You've already gotten some wise advice from other posters, so I'll just
add this:

if Tomcat doesn't need to bind to a privileged port (below 1024) then
you don't have to use jsvc or netfilter.  You can write an init script
that does one of the following:

1/ su - {user} -c {path to tomcat's startup.sh}
2/ use erni instead of su
3/ use sudo instead of su

In all three cases, the init script (running as root) will change to the
Tomcat user before starting Tomcat.


btw, if Tomcat's been running as root all this time, you'll have to do
some fine-tuning with the permissions to get it to work.  You *could*
just recursively chown the Tomcat dir to the nonroot user; but as long
as you're interested in security, you could determine which files need
to be writable and only chown those.  (Hint: logs, work dir, and maybe
the webapps dir depending on how strict is your deployment process.)

Write back if you want more info.  I've done this before, I just don't
have any examples right in front of me.

-QM

-- 

software   -- http://www.brandxdev.net/
tech news  -- http://www.RoarNetworX.com/
code scan  -- http://www.JxRef.org/

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: jsvc.exec error: syscall failed in set_caps

2005-04-17 Thread QM
On Sun, Apr 17, 2005 at 10:33:56AM +0200, Georges Roux wrote:
: I can't start tomcat 5.5.9 as a daemon on linux on port 8080 (default 
: configuration)
: nothing is running on this port
: and have only thi error in logs/catalina.err
: 
: jsvc.exec error: syscall failed in set_caps
: jsvc.exec error: Service exit with a return value of 4


Do you call jsvc as root?

A long time ago, there was a bug that would cause jsvc to fail unless
called as root.  IIRC set_caps() is the function that calls
setuid()/setgid().  Those calls require root privs, so they would fail;
and in turn, the whole program bailed out.

(The other option would have been for jsvc to see whether the requested
and calling user were the same.)

-QM

-- 

software   -- http://www.brandxdev.net/
tech news  -- http://www.RoarNetworX.com/
code scan  -- http://www.JxRef.org/

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: ssl-forwarding filter not working in IE 6

2005-04-17 Thread sudip shrestha
Actually, I fixed the code by adding encodeRedirectURL method. 
Strange thing is Firefox does not seem to care about proper url
encoding, where as IE does.

On 4/15/05, Sng Wee Jim [EMAIL PROTECTED] wrote:
 
 Try setting the following 2 response header
 
response.setHeader(Pragma, public);
response.setHeader(Cache-Control, max-age=0);
 
 - Jim
 
 -Original Message-
 From: sudip shrestha [mailto:[EMAIL PROTECTED]
 Sent: Friday, April 15, 2005 9:54 PM
 To: Struts Users Mailing List; Tomcat Users List
 Subject: ssl-forwarding filter not working in IE 6
 
 Hi : I have following code for automatic ssl-forwarding filter:
 
 public void doFilter(ServletRequest servletrequest, ServletResponse
 servletresponse, FilterChain filterchain)
throws IOException, ServletException
{
String s = servletrequest.getScheme();
if( !s.equalsIgnoreCase(http) )
{
//System.out.println( Normal filter Operation );
filterchain.doFilter(servletrequest, servletresponse);
}
else
{
HttpServletResponse response =
 (HttpServletResponse)servletresponse;
HttpServletRequest request =
 (HttpServletRequest)servletrequest;
 
//System.out.println( currPort: +request.getServerPort()
 );
String url = https://; + request.getServerName();
//System.out.println( currUrl: +url );
url = url + : + PORT;
//System.out.println( currUrl: +url );
url = url + request.getRequestURI();
//System.out.println( currUrl: +url );
String queryStr = request.getQueryString();
if( queryStr!=null )
url = url + ? + queryStr;
//System.out.println( currUrl: +url );
response.sendRedirect(url);
return;
}
}
 
 This works perfectly in Firefox.  However, IE just sits there till it
 throws me a page cannot be displayed.  If I directly type secure
 url, e.g., https://domain.com/siteAdd, it works in IE as well, but IE
 just cannot seem to forward it to the secure url from the plain url.
 Any suggestions?
 
 
 The information in this email is confidential and is intended solely
 for the addressee(s).
 Access to this email by anyone else is unauthorized. If you are not
 an intended recipient, please notify the sender of this email
 immediately. You should not copy, use or disseminate the
 information contained in the email.
 Any views expressed in this message are those of the individual
 sender, except where the sender specifically states them to be
 the views of Capco.
 
 http://www.capco.com/
 
 
 
 -
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: jsvc.exec error: syscall failed in set_caps

2005-04-17 Thread Georges Roux
QM a écrit :
Do you call jsvc as root?
A long time ago, there was a bug that would cause jsvc to fail unless
called as root.  IIRC set_caps() is the function that calls
setuid()/setgid().  Those calls require root privs, so they would fail;
and in turn, the whole program bailed out.
(The other option would have been for jsvc to see whether the requested
and calling user were the same.)
-QM
 

Yes as root and jsvc crash
Georges
-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


Re: jsvc.exec error: syscall failed in set_caps

2005-04-17 Thread Georges Roux
And the problem was...
first I try to start tomcat with
-user www-data
-Djava.io.tmpdir=/tmp
and after as root with only
-Djava.io.tmpdir=/tmp
the problem was the write permissions on the sessions files in /tmp
Georges
-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


Symlinked subdirectories of webapps

2005-04-17 Thread Nick Johnson
Hello,

(with respect to tomcat 5.0.28)

I have a bunch of JSP files which work hapily when located in a
subdirectory of webapps/ROOT.  However, whenever I want to move that
directory, and then leave a symlink to that directory in webapps/ROOT,
it all falls apart.

I searched around, and the closest think I can find is the
allowLinking=true flag.  but, I cannot figure out where to put
this...

Any help would be greatly appreciated,
Nick Johnson

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: jsvc.exec error: syscall failed in set_caps

2005-04-17 Thread QM

On Sun, Apr 17, 2005 at 07:34:49PM +0200, Georges Roux wrote:
: and after as root with only
: -Djava.io.tmpdir=/tmp
: the problem was the write permissions on the sessions files in /tmp


Thanks much for sharing your solution with the group -- this will help
people when they search the archives.

-QM


-- 

software   -- http://www.brandxdev.net/
tech news  -- http://www.RoarNetworX.com/
code scan  -- http://www.JxRef.org/

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Symlinked subdirectories of webapps

2005-04-17 Thread QM
On Sun, Apr 17, 2005 at 02:30:16PM -0400, Nick Johnson wrote:
: (with respect to tomcat 5.0.28)
: I have a bunch of JSP files which work hapily when located in a
: subdirectory of webapps/ROOT.  However, whenever I want to move that
: directory, and then leave a symlink to that directory in webapps/ROOT,
: it all falls apart.

As in, a symlink inside the webapp?  I wouldn't rely on this... it's not
supported by the spec (likely because it's not cross-platform), and
allowLinking is just a Tomcat convenience feature.  



: I searched around, and the closest think I can find is the
: allowLinking=true flag.  but, I cannot figure out where to put
: this...

It's an attr, I think for Context/.  Scan the online docs for
allowLinking and it should turn up.

-QM

-- 

software   -- http://www.brandxdev.net/
tech news  -- http://www.RoarNetworX.com/
code scan  -- http://www.JxRef.org/

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Reflection for custom taglibs killing performance...

2005-04-17 Thread Kevin Burton
I've been spending this week running a profiler across our webapp and 
Tomcat.

We've had a few bottlenecks in our code that have since been removed but 
the remaining big bottleneck is Tomcat.  The JSP engine is creating 
compiled code that is heavily relying on reflection.  Reflection 
shouldn't hit the page too much but we have tight loops over say 400 
items or so and each uses 10-20 taglibs.  This is resulting in about 
800ms of page load time.!!!

After rewriting the taglibs to use jspf includes the page load drops 10x 
to about 80ms.  The bottleneck is gone and the pages essentially snap on 
the screen. Very fast!   :) 

Our app still has 2200 ms that can be shaved off if I could just get rid 
of reflection within taglibs.

The problem is that I'd like to continue to use taglibs and I'd like to 
to avoid rewriting our code.

Is there ANY way to get Tomcat to not use reflection in this situation.
I'm running Tomcat 5.5.4 if it helps.
Thanks.
--
Use Rojo (RSS/Atom aggregator)! - visit http://rojo.com. 
See irc.freenode.net #rojo if you want to chat.

Rojo is Hiring! - http://www.rojonetworks.com/JobsAtRojo.html
  Kevin A. Burton, Location - San Francisco, CA
 AIM/YIM - sfburtonator,  Web - http://peerfear.org/
GPG fingerprint: 5FB2 F3E2 760E 70A8 6174 D393 E84D 8D04 99F1 4412 

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


Re: can´t Configurate Database Connection Pool (DBCP) with Tomcat 5.0.28

2005-04-17 Thread Sevillano sevi llano
Hi Caroline
it works perfectly now!!
thanks very much for your help
I love you!!
:-)
From: Caroline Jen [EMAIL PROTECTED]
Reply-To: Tomcat Users List tomcat-user@jakarta.apache.org
To: Tomcat Users List tomcat-user@jakarta.apache.org
Subject: Re: can´t Configurate Database Connection Pool (DBCP) with Tomcat 
5.0.28
Date: Fri, 15 Apr 2005 07:47:11 -0700 (PDT)

Hi Sevillano,
   I inserted the configuration after the last Realm
/ tag and before the Host ... tage (see below)
in the $TOMCAT/config/server.xml file.  This is my
configuration (sorry, I should have shown it in my
previous posting).  Let us see if it works:
  !--
  Realm
className=org.apache.catalina.realm.JDBCRealm
debug=99
 driverName=sun.jdbc.odbc.JdbcOdbcDriver
  connectionURL=jdbc:odbc:CATALINA
  userTable=users
userNameCol=user_name userCredCol=user_pass
  userRoleTable=user_roles
roleNameCol=role_name /
  --
  !-- Define the default virtual host
   Note: XML Schema validation will not work
with Xerces 2.2.
   --
!-- The DefaultContext segment and its elements below
are added by Caroline Jen --
DefaultContext
   Resource name=jdbc/OracleDB auth=Container
 type=javax.sql.DataSource/
   ResourceParams name=jdbc/OracleDB
  parameter
 namefactory/name
valueorg.apache.commons.dbcp.BasicDataSourceFactory/value
  /parameter
  parameter
 namemaxWait/name
 value-1/value
  /parameter
  parameter
 namemaxActive/name
 value20/value
  /parameter
  parameter
 namepassword/name
 valuejavadude/value
  /parameter
  parameter
 nameurl/name
valuejdbc:oracle:thin:@bigbird:1522:dcapes/value
  /parameter
  parameter
 namedriverClassName/name
valueoracle.jdbc.driver.OracleDriver/value
  /parameter
  parameter
 namemaxIdle/name
 value10/value
  /parameter
  parameter
 nameusername/name
 valuejavauser/value
  /parameter
  parameter
 nameremoveAbandoned/name
 valuetrue/value
  /parameter
  parameter
 nameremoveAbandonedTimeout/name
 value60/value
  /parameter
  parameter
 namelogAbandoned/name
 valuetrue/value
  /parameter
/ResourceParams
/DefaultContext
!-- The DefaultContext segment and its elements above
are added by Caroline Jen --
  Host name=localhost debug=0
appBase=webapps
   unpackWARs=true autoDeploy=true
   xmlValidation=false
xmlNamespaceAware=false
!-- The line below is added by Caroline Jen
--
DefaultContext reloadable=true/
!-- Defines a cluster for this node,
 By defining this element, means that
every manager will be changed.
 So when running a cluster
-Caroline
--- Sevillano sevi llano [EMAIL PROTECTED]
wrote:
 but...

 where do I add the Context exactly?

 this is my server.xml, If I add context, tomcat
 doesn´t start


 thanks

 Server port=8005 shutdown=SHUTDOWN
   GlobalNamingResources
 !-- Used by Manager webapp --
 Resource name=UserDatabase auth=Container

 type=org.apache.catalina.UserDatabase
   description=User database that can be updated
 and saved
 /Resource
 ResourceParams name=UserDatabase
   parameter
 namefactory/name


valueorg.apache.catalina.users.MemoryUserDatabaseFactory/value
   /parameter
   parameter
 namepathname/name
 valueconf/tomcat-users.xml/value
   /parameter
 /ResourceParams
   /GlobalNamingResources

   Service name=Catalina
 Connector port=8080 /

 !-- This is here for compatibility only, not
 required --
 Connector port=8009 protocol=AJP/1.3 /

 Engine name=Catalina defaultHost=localhost
   Logger
 className=org.apache.catalina.logger.FileLogger /

   Realm

className=org.apache.catalina.realm.UserDatabaseRealm
  resourceName=UserDatabase /
   Host name=localhost appBase=webapps/
 /Engine
   /Service
 /Server




 From: Parsons Technical Services
 [EMAIL PROTECTED]
 Reply-To: Tomcat Users List
 tomcat-user@jakarta.apache.org
 To: Tomcat Users List
 tomcat-user@jakarta.apache.org
 Subject: Re: can´t Configurate Database Connection
 Pool (DBCP) with Tomcat
 5.0.28
 Date: Fri, 15 Apr 2005 07:56:36 -0400
 
 Do you have your resource link in the context
 element? And if you don't
 have a context for the app you need to create one.
 
 Doug
 
 
 - Original Message - From: Sevillano sevi
 llano
 [EMAIL PROTECTED]
 To: tomcat-user@jakarta.apache.org
 Sent: Friday, April 15, 2005 5:34 AM
 Subject: can´t Configurate Database Connection Pool
 (DBCP) with Tomcat
 5.0.28
 
 
 Hi, I´m a newbie trying to configurate DBCP with
 Tomcat 5.0.28
 
 I´m following this documentation:

http://jakarta.apache.org/tomcat/tomcat-5.0-doc/jndi-datasource-examples-howto.html
 
 ...Add this in between the /Context tag of the
 examples context and the
 

Re: jsvc.exec error: syscall failed in set_caps

2005-04-17 Thread Georges Roux

Thanks much for sharing your solution with the group -- this will help
people when they search the archives.
-QM
 

Well hm, bad news, the probleme is already here and I don't have the 
solution.

Sorry
Georges
-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


Handling requests for .asp files

2005-04-17 Thread Martin Lidgard
Hi.
 
I am trying to get Tomcat to respond to requests for files with an .asp
extension in order to let Turbine handle the request and redirect to the
appropriate Velocity page. The reason for this seemingly strange need is
that I want to handle external references (on other web sites) to my site
from when the site was on an ASP-based server.
 
The problem is that Tomcat does not seem to respond at all to requests for
urls with .asp as an extension.  The extensions .as and .aspp work
fine. Could there be some filter that tells Tomcat to not process the
request or tries to forward the request somewhere? I can't find anything
asp in conf/server.xml, conf/web.xml, or my WEB-INF/web.xml and none of
the log files even register the http-request, which makes me think that the
problem lies in my servlet container configuration rather than the servlet.
 
Googling for tomcat handling asp requests doesn't seem to generate the
desired set of answers, so any pointers would be greatly appreciated.
 
I'm using Tomcat 4.1 on Linux.
 
Thanks for your attention.

Martin



-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Reflection for custom taglibs killing performance...

2005-04-17 Thread QM
On Sun, Apr 17, 2005 at 03:44:59PM -0700, Kevin Burton wrote:
: We've had a few bottlenecks in our code that have since been removed but 
: the remaining big bottleneck is Tomcat.  The JSP engine is creating 
: compiled code that is heavily relying on reflection.
: [snip]
: 
: Is there ANY way to get Tomcat to not use reflection in this situation.

How could a tag work without reflection?
For example, if you use any of the expression-language features, how is
Tomcat supposed to react to, say,

${request.somvar.something}

without dynamic invocation?

While I doubt you could make Tomcat not use reflection (without
completely hacking the source) perhaps you could share more details of
what you're doing... that may give the rest of us insight to help you
trim the bottlenecks more.  i.e. you mention lots of looping and
tag nesting; is there any way to change how that's done?

-QM


-- 

software   -- http://www.brandxdev.net/
tech news  -- http://www.RoarNetworX.com/
code scan  -- http://www.JxRef.org/

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Handling requests for .asp files

2005-04-17 Thread QM
On Mon, Apr 18, 2005 at 03:03:45AM +0200, Martin Lidgard wrote:
: I am trying to get Tomcat to respond to requests for files with an .asp
: extension in order to let Turbine handle the request and redirect to the
: appropriate Velocity page.
: [snip]  
: The problem is that Tomcat does not seem to respond at all to requests for
: urls with .asp as an extension.  The extensions .as and .aspp work
: fine.

How are you mapping the .as and .aspp extensions?  Through a servlet
mapping in yoru webapp's web.xml?

You could also check the global web.xml. That one defines the mapping
for .jsp files; maybe someone at your site put in a mapping for .asp as
well...?

Another thought -- do you access Tomcat directly, or do you go through
Apache as an intermediary?


-QM

-- 

software   -- http://www.brandxdev.net/
tech news  -- http://www.RoarNetworX.com/
code scan  -- http://www.JxRef.org/

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: jsvc.exec error: syscall failed in set_caps

2005-04-17 Thread Bill Barker

Georges Roux [EMAIL PROTECTED] wrote in message 
news:[EMAIL PROTECTED]

Thanks much for sharing your solution with the group -- this will help
people when they search the archives.

-QM

 Well hm, bad news, the probleme is already here and I don't have the 
 solution.


Yeah, well, check out 
http://issues.apache.org/bugzilla/show_bug.cgi?id=33154.

 Sorry

 Georges 




-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Reflection for custom taglibs killing performance...

2005-04-17 Thread Kevin Burton
QM wrote:
On Sun, Apr 17, 2005 at 03:44:59PM -0700, Kevin Burton wrote:
: We've had a few bottlenecks in our code that have since been removed but 
: the remaining big bottleneck is Tomcat.  The JSP engine is creating 
: compiled code that is heavily relying on reflection.
: [snip]
: 
: Is there ANY way to get Tomcat to not use reflection in this situation.

How could a tag work without reflection?
For example, if you use any of the expression-language features, how is
Tomcat supposed to react to, say,
${request.somvar.something}
without dynamic invocation?
 

I'm not sure about this mechanism but if you take a function like:
c:set var=test value=${foo:bar()} /
and rewrite it to use
c:set var=test
   foo:bar/
/c:set
Then it won't use reflection.
This is why c:set and c:choose and so forth work so well.
There isn't a perf penalty here.
So this means I'll have to rewrite all my function calls to elements 
that are in tight loops.

There's also no reason that it MUST use reflection. I mean its a CODE 
generator so all you have to do is generate code that doesn't use 
reflection and calls the methods directly.

There.s about a .5ms overhead for reflected functions and if you have 
1000 on a page (EASY!) then it will be DOG slow.

While I doubt you could make Tomcat not use reflection (without
completely hacking the source) perhaps you could share more details of
what you're doing... that may give the rest of us insight to help you
trim the bottlenecks more.  i.e. you mention lots of looping and
tag nesting; is there any way to change how that's done?
 

Well I think I'm going to have to review all forms of code that cause 
this and rewrite them.

The BIGGEST problem as I currently see it is with .tag files.  These use 
reflection but I can't figure out a way to rewrite them.

I think if i were to do this it would yield DRAMATIC performance 
improvements.

The REAL issue is that enabling developers to shoot themselves in the 
foot like this is really irresponsible and probably needs to be removed 
or a HUGE warning be placed before examples.

Kevin
--
Use Rojo (RSS/Atom aggregator)! - visit http://rojo.com. 
See irc.freenode.net #rojo if you want to chat.

Rojo is Hiring! - http://www.rojonetworks.com/JobsAtRojo.html
  Kevin A. Burton, Location - San Francisco, CA
 AIM/YIM - sfburtonator,  Web - http://peerfear.org/
GPG fingerprint: 5FB2 F3E2 760E 70A8 6174 D393 E84D 8D04 99F1 4412 

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


Re: Reflection for custom taglibs killing performance...

2005-04-17 Thread Dakota Jack
1000 on a page?  Really?  That seems very odd to me given my
experience.  What would a page like that look like?  Do you have
examples?



On 4/17/05, Kevin Burton [EMAIL PROTECTED] wrote:
 QM wrote:
 
 On Sun, Apr 17, 2005 at 03:44:59PM -0700, Kevin Burton wrote:
 : We've had a few bottlenecks in our code that have since been removed but
 : the remaining big bottleneck is Tomcat.  The JSP engine is creating
 : compiled code that is heavily relying on reflection.
 : [snip]
 :
 : Is there ANY way to get Tomcat to not use reflection in this situation.
 
 How could a tag work without reflection?
 For example, if you use any of the expression-language features, how is
 Tomcat supposed to react to, say,
 
${request.somvar.something}
 
 without dynamic invocation?
 
 
 
 I'm not sure about this mechanism but if you take a function like:
 
 c:set var=test value=${foo:bar()} /
 
 and rewrite it to use
 
 c:set var=test
 foo:bar/
 /c:set
 
 Then it won't use reflection.
 
 This is why c:set and c:choose and so forth work so well.
 
 There isn't a perf penalty here.
 
 So this means I'll have to rewrite all my function calls to elements
 that are in tight loops.
 
 There's also no reason that it MUST use reflection. I mean its a CODE
 generator so all you have to do is generate code that doesn't use
 reflection and calls the methods directly.
 
 There.s about a .5ms overhead for reflected functions and if you have
 1000 on a page (EASY!) then it will be DOG slow.
 
 While I doubt you could make Tomcat not use reflection (without
 completely hacking the source) perhaps you could share more details of
 what you're doing... that may give the rest of us insight to help you
 trim the bottlenecks more.  i.e. you mention lots of looping and
 tag nesting; is there any way to change how that's done?
 
 
 
 Well I think I'm going to have to review all forms of code that cause
 this and rewrite them.
 
 The BIGGEST problem as I currently see it is with .tag files.  These use
 reflection but I can't figure out a way to rewrite them.
 
 I think if i were to do this it would yield DRAMATIC performance
 improvements.
 
 The REAL issue is that enabling developers to shoot themselves in the
 foot like this is really irresponsible and probably needs to be removed
 or a HUGE warning be placed before examples.
 
 Kevin
 
 --
 
 Use Rojo (RSS/Atom aggregator)! - visit http://rojo.com.
 See irc.freenode.net #rojo if you want to chat.
 
 Rojo is Hiring! - http://www.rojonetworks.com/JobsAtRojo.html
 
Kevin A. Burton, Location - San Francisco, CA
   AIM/YIM - sfburtonator,  Web - http://peerfear.org/
 GPG fingerprint: 5FB2 F3E2 760E 70A8 6174 D393 E84D 8D04 99F1 4412
 
 -
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 
 


-- 
You can lead a horse to water but you cannot make it float on its back.
~Dakota Jack~

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Reflection for custom taglibs killing performance...

2005-04-17 Thread Kevin Burton
Dakota Jack wrote:
1000 on a page?  Really?  That seems very odd to me given my
experience.  What would a page like that look like?  Do you have
examples?
 

So psuedo code...
- get a list of objects from your DB..  Say 500
- for each object
  tag A
  tag B
  tag C
  fn:length
And  so forth... Thats 2000 reflection calls and about 500ms.  REALLY 
slow.  Horribly slow in fact :-/

Kevin
--
Use Rojo (RSS/Atom aggregator)! - visit http://rojo.com. 
See irc.freenode.net #rojo if you want to chat.

Rojo is Hiring! - http://www.rojonetworks.com/JobsAtRojo.html
  Kevin A. Burton, Location - San Francisco, CA
 AIM/YIM - sfburtonator,  Web - http://peerfear.org/
GPG fingerprint: 5FB2 F3E2 760E 70A8 6174 D393 E84D 8D04 99F1 4412 

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]