Re: genStrAsCharArray not available in JspC and performance increase?

2005-05-29 Thread Remy Maucherat
On 5/29/05, Kevin Burton [EMAIL PROTECTED] wrote:
 So on:
 
 http://jakarta.apache.org/tomcat/tomcat-5.5-doc/jasper-howto.html#Production%20Configuration
 
 It recommends to use genStrAsCharArray when in production.
 
 This can be set in web.xml but not when using JspC from the command line.
 
 trimSpaces is there... but not genStrAsCharArray.
 
 Its in the source but it just doesn't have a command line option.
 
 1... does it make sense for me to just recompile my 5.5.4 production
 server with this enabled?  Whats the performance gain?
 
 2.  Can we make this an option in JspC moving forward?  I don't see why
 it can't be a command line switch.
 
 I verified that this is still the case in 5.5.9 btw.

The command line version of jspc has been kind of deprecated for a
while now; we recommend using Ant.

Otherwise, adding code to set the flag is relatively simple.

-- 
x
Rémy Maucherat
Developer  Consultant
JBoss Group (Europe) SàRL
x

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



How can I catch the ip-address chenged event?

2005-05-29 Thread maojm
Hi,

I create a thread using an init servlet, which is loaded on
start-up. This thread listens on port 3030 and does well.
But  after changing ip-address,this thread seems dead and no responses
to any incoming connections.
   How can i catch the ip-address chenged event so that i can
re-initialize the thread?

Thanks in advance

maojm

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



Redirect by configuration

2005-05-29 Thread Amihai Fuks
Hi,

Is there a standard way in Tomcat 5.5 (standalone) to configure a
context redirection? Meaning, I had a URL 
http://my-host:my-port/my-OLD-context/my-servlet and it changed
to 
http://my-host:my-port/my-NEW-context/my-servlet. Now, I do not
want an HTTP standard redirection, I only want the Tomcat (standalone)
to be able redirect by configuration! (Writing a Servlet that redirects
from /my-OLD-servlet is not what I need I want to delete the
/my-OLD-context directory.)

Regards, 

Amihai

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



can tomcat 5.5.9 inc compatibility pack but over jdk1.5 cause a jvm crash?

2005-05-29 Thread Guy Katz
hello;
i have a tomcat 5.5.9 over jdk 1.5 on freeBSD running a web application.
i got the crash below.
note that i noticed that my 5.5.9 was started with the compatibility package 
inside (i forgot to remove it).
but my question is:
can such a jvm crash be caused by this?

thanks in advance.

crash stack trace:
#
# An unexpected error has been detected by HotSpot Virtual Machine:
#
#  SIGBUS (0xa) at pc=0x28261710, pid=85917, tid=0x82ec800
#
# Java VM: Java HotSpot(TM) Client VM (1.5.0-p1-root_08_apr_2005_11_21 mixed 
mode)
# Problematic frame:
# V  [libjvm.so+0x138710]
#
# An error report file with more information is saved as hs_err_pid85917.log
#
# If you would like to submit a bug report, please write
# a letter to [EMAIL PROTECTED] mailing list
#


Guy Katz
Allot Communications
[EMAIL PROTECTED]
tel: +972 9 7619288
fax: +972 9 7443626



Putting together the context.xml for access to a common service (like mail)

2005-05-29 Thread Richard Toren

Hello,
  I wanted to set up Tomcat (5.02) to send mail.  I see that the 
mailsend.jsp and the MailSendServlet no longer work because the JNDI 
variable is needs to be created differently (not from the main 
server.xml, it seems).  The question is logically mail services could be 
global so how do you define it globally and then access it per war 
file?   If you need to create a separate context.xml then where are 
there full examples of one;   much more than 
Context../Context  ;-) 



I'm sure it is not meant to be hard, but I haven't grasped it yet.

Thanks,

Richard Toren

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



tomcat-user@jakarta.apache.org

2005-05-29 Thread 1funny
Please do not reply.  This is an automated message.

Use this link if you need to unsubscribe to our newsletter:
http://www.mybro.com/newsletters/index.php?f=unsubnl=2

If you need to contact us, please use this form:
http://www.1funny.com/contactus.shtml

Regards,

1Funny.com Webmaster
http://www.1funny.com



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



tomcat-user@jakarta.apache.org

2005-05-29 Thread 1funny
Please do not reply.  This is an automated message.

Use this link if you need to unsubscribe to our newsletter:
http://www.mybro.com/newsletters/index.php?f=unsubnl=2

If you need to contact us, please use this form:
http://www.1funny.com/contactus.shtml

Regards,

1Funny.com Webmaster
http://www.1funny.com



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



tomcat-user@jakarta.apache.org

2005-05-29 Thread 1funny
Please do not reply.  This is an automated message.

Use this link if you need to unsubscribe to our newsletter:
http://www.mybro.com/newsletters/index.php?f=unsubnl=2

If you need to contact us, please use this form:
http://www.1funny.com/contactus.shtml

Regards,

1Funny.com Webmaster
http://www.1funny.com



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



Tomcat optimization... saving internal strings with character encoding at compile time.

2005-05-29 Thread Kevin Burton


Another area that I'm noticing that Tomcat is spending a LOT of time in 
is with character encoding.  Its not a ton of time but its really 
showing up as one of the top 20 areas of our webapp.


Internally its either storing text as a java.lang.String or with 
genStrAsCharArray ... a char array


Most people are probably using a fixed character encoding.  For example 
we use UTF8.  I doubt they're changing charset on the fly.


Its a waste of CPU to continually encode these strings.  This isn't just 
theoretical as I'm seeing our webapp do this internally via JProfiler.


Why not have strings fixed to a character coding at runtime?  While this 
would yield inflexibility it would increase performance.


This could be a new feature called genStrAsEncodedByteArray... which 
would just store the string as a byte[] and output it directly.


The only thing that would need to be encoded in this setup would be 
dynamic strings from EL.


It would also save more memory for English text since strings no longer 
are stored in 32bit but just UTF8 encoded 8 bit values.


It would slow down compile time though because Jasper would now need to 
call toByteArray() on all your strings.


Thoughts?

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: Tomcat optimization... saving internal strings with character encoding at compile time.

2005-05-29 Thread Remy Maucherat
On 5/29/05, Kevin Burton [EMAIL PROTECTED] wrote:
 
 Another area that I'm noticing that Tomcat is spending a LOT of time in
 is with character encoding.  Its not a ton of time but its really
 showing up as one of the top 20 areas of our webapp.
 
 Internally its either storing text as a java.lang.String or with
 genStrAsCharArray ... a char array
 
 Most people are probably using a fixed character encoding.  For example
 we use UTF8.  I doubt they're changing charset on the fly.
 
 Its a waste of CPU to continually encode these strings.  This isn't just
 theoretical as I'm seeing our webapp do this internally via JProfiler.
 
 Why not have strings fixed to a character coding at runtime?  While this
 would yield inflexibility it would increase performance.
 
 This could be a new feature called genStrAsEncodedByteArray... which
 would just store the string as a byte[] and output it directly.
 
 The only thing that would need to be encoded in this setup would be
 dynamic strings from EL.
 
 It would also save more memory for English text since strings no longer
 are stored in 32bit but just UTF8 encoded 8 bit values.
 
 It would slow down compile time though because Jasper would now need to
 call toByteArray() on all your strings.
 
 Thoughts?

This is obvious.

This is not an implementable optimization idea, as you cannot use both
a writer and an out stream in a servlet. If this was doable, then
obviously constant strings would be cached as byte arrays.

-- 
x
Rémy Maucherat
Developer  Consultant
JBoss Group (Europe) SàRL
x

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



Embedded Tomcat JNDI/JDBC Configuration Questions

2005-05-29 Thread Joe Reger, Jr.
Hi!
 
I've successfully created a project that embeds Tomcat. Excellent!  I can
see the sample page and the manager app, reporting Tomcat 5.5.9.  Now I'm
working on deploying a .war file programatically:   
 
public void registerWAR(String contextPath, String absolutePath) throws
Exception {
Context context = this.embedded.createContext(contextPath,
absolutePath);
context.setReloadable(false);
this.host.addChild(context);
}
 
I pass in the path  and the location of the .war file.  When I run the
application the .war file is found and exploded to the /ROOT directory
properly.   Inside of the .war file is a context.xml file.  The jdbc/db
resource is defined in context.xml, inside of the .war file with the
following:
 
Resource name=jdbc/db auth=Container type=javax.sql.DataSource/
  ResourceParams name=jdbc/db
parameter
  namefactory/name
  valueorg.apache.commons.dbcp.BasicDataSourceFactory/value
/parameter
parameter
  namemaxActive/name
  value100/value
/parameter
parameter
  namemaxIdle/name
  value30/value
/parameter
parameter
  namemaxWait/name
  value1/value
/parameter
parameter
 nameusername/name
 valuefoo/value
/parameter
parameter
 namepassword/name
 valuebar/value
/parameter
parameter
   namedriverClassName/name
   valuecom.mysql.jdbc.Driver/value
/parameter
parameter
  nameurl/name
 
valuejdbc:mysql://localhost:3306/reger?autoReconnect=true/value
/parameter
  /ResourceParams
 
When I make a call to my application the code inside the .war file attempts
to connect to the database like this:
 
private static final String jndiPrePend = java:comp/env/;
private static final String jndiDB = jdbc/db;
public static Connection getConnection(){
Connection conn=null;
try{
  Context ctx = new InitialContext();
  if(ctx != null){
DataSource ds = (DataSource)ctx.lookup(jndiPrePend + jndiDB);
if(ds != null){
conn = ds.getConnection();
return conn;
}
  }
} catch (Exception e){
e.printStackTrace();
   util.errorsave(e);
}
return null;
  }
 
But I get the following error in the console window, repeatedly, each time
my app tries to connect to the db:
 
javax.naming.NamingException: Cannot create resource instance
 at
org.apache.naming.factory.ResourceFactory.getObjectInstance(ResourceFactory.
java:132)
 at javax.naming.spi.NamingManager.getObjectInstance(NamingManager.java:304)
 at org.apache.naming.NamingContext.lookup(NamingContext.java:792)
 at org.apache.naming.NamingContext.lookup(NamingContext.java:139)
 at org.apache.naming.NamingContext.lookup(NamingContext.java:780)
 at org.apache.naming.NamingContext.lookup(NamingContext.java:139)
 at org.apache.naming.NamingContext.lookup(NamingContext.java:780)
 at org.apache.naming.NamingContext.lookup(NamingContext.java:139)
 at org.apache.naming.NamingContext.lookup(NamingContext.java:780)
 at org.apache.naming.NamingContext.lookup(NamingContext.java:152)
 at org.apache.naming.SelectorContext.lookup(SelectorContext.java:136)
 at javax.naming.InitialContext.lookup(InitialContext.java:351)
 at reger.db.RunSQL(db.java:64)
 at reger.db.RunSQL(db.java:124)
 at reger.scheduler.MasterThread.setupThread(MasterThread.java:377)
 at reger.scheduler.MasterThread.run(MasterThread.java:48)
 
It looks like the jndi/jdbc resource isn't configured correctly and/or isn't
available to the code from the .war file running inside of the embedded
tomcat.
 
Questions:
1) Is my jndiPrePend variable correct?  It works for a standard deployment
on a non-embedded tomcat.
2) Is there anything special I need to do to get a jndi/jdbc resource
configured under the embedded tomcat?
3) Does the error message I'm seeing point to anything that I need to
change?
 
Thanks,
 
Joe


looking for insight on invoking Thread.sleep() from a tomcat servlet

2005-05-29 Thread Clark O'Brien
Can someone provide insight on the adverse affects of
invoking sleep() from a servlet. I understand that the
J2EE explicitly forbids invoking sleep from within a
servlet and it is not hard to figure out this could
cause problems given that a single tomcat thread may 
service multiple requests. But I still see
applications that break this rule so I would like to
hear ideas on this.
 Clark 



__ 
Do you Yahoo!? 
Yahoo! Small Business - Try our new Resources site
http://smallbusiness.yahoo.com/resources/

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



Re: [OT]: Adding content/JSPs on the fly: file.separtor

2005-05-29 Thread Tim Diggins

Hi -

I think it would be better to use java.io.File.separator (which will be 
identical to file.separator, but is clearer and compile-time checked for 
typos (as opposed to the string file.separator )).



Tim

egan0019 wrote:

When building file path strings, should one always use the
System.getProperty(file.separator) return value?  Is this to
differentiate between Windows(\) and unix/linux/solaris(/ separators? 
I haven't seen that property before.


And, are there any other things I should know about to make my file system
accessing code portable?

Yes, I am new to java.



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



Context setup for a webapp

2005-05-29 Thread john_wjf935 . fletcher
According to the Tomcat 5.5 Docs (
http://jakarta.apache.org/tomcat/tomcat-5.5-doc/config/context.html):


You may define as many Context elements as you wish. Each such Context 
MUST have a unique context path, which is defined by the path attribute. 
In addition, you MUST define a Context with a context path equal to a 
zero-length string. This Context becomes the default web application for 
this virtual host, and is used to process all requests that do not match 
any other Context's context path.

The value of the path field must not be set except when statically 
defining a Context in server.xml 
In addition to nesting Context elements inside a Host element, you can 
also store them:
- in the individual $CATALINA_HOME/conf/context.xml file: the Context 
element information will be loaded by all webapps
- in the individual 
$CATALINA_HOME/conf/[enginename]/[hostname]/context.xml.default file: the 
Context element information will be loaded by all webapps of that host
- in individual files (with a .xml extension) in the 
$CATALINA_HOME/conf/[enginename]/[hostname]/ directory
- if the previous file was not found for this application, in individual 
file at /META-INF/context.xml inside the application files

Finally, note that if you are defining contexts explicitly, you should 
probably turn off automatic application deployment. Otherwise, your 
context will be deployed twice each, and that may cause problems for your 
app. 
---

Now, I want to define a context with docbase of /decweb, which will be 
the default web application (in particular, respond to all requests to the 
root of the webserver).  So I put in my server.xml Context 
docBase=/decweb path= /.  I also set autodeploy=false in my host 
element.  However for some reason I have to restart my server twice after 
deployment for the webapp to work and I don't know why.

When I deploy and then start my server and then go to the root of the 
webserver in my browser, I get a directory listing (decweb, decweb.war). 
Even if I click on /decweb, the application malfunctions (can't explain in 
more detail, but some servlets/scripts don't run). Then I restart the 
webserver and it works.  Why?  Should I also have a context.xml in my 
webapps META-INF directory with Context docBase=/decweb / ?  I tried 
that and it didn't help.
Thanks,


Regards,
John Fletcher




This disclaimer certifies that this message has been scanned by Centrelink's 
Anti-virus system.  If this e-mail is found to have a virus attached by any 
other Anti-virus system, this does not mean that Centrelink are responsible in 
any way.

**
IMPORTANT:  This e-mail is intended for the use of the addressee and may 
contain information that is confidential, commercially valuable or subject to 
legal or parliamentary privilege.  If you are not the intended recipient you 
are notified that any review, re-transmission, disclosure, use or dissemination 
of this communication is strictly prohibited by several Commonwealth Acts of 
Parliament.  If you have received this communication in error please notify the 
sender immediately and delete all copies of this transmission together with any 
attachments.
**



Automatic Response

2005-05-29 Thread
Dear Eachnet member,

We’re sorry. We are not able to process your recent reply to our email. We are 
the processor for the email surveys for Eachnet and are not directly linked to 
the Eachnet customer service center.

Please respond through the survey link imbedded in the original email you 
received from us.

Thank you and we apologize for the inconvenience.

Eachnet Survey Partner

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

Re: looking for insight on invoking Thread.sleep() from a tomcat servlet

2005-05-29 Thread Kevin Burton

Clark O'Brien wrote:


Can someone provide insight on the adverse affects of
invoking sleep() from a servlet. I understand that the
J2EE explicitly forbids invoking sleep from within a
servlet and it is not hard to figure out this could
cause problems given that a single tomcat thread may 
service multiple requests. But I still see

applications that break this rule so I would like to
hear ideas on this.
 

I haven't noticed any problem here.  Our in house JDBC conn  pool used 
thread.sleep as well as a lot of other code.


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: JRE vs. JDK for Tomcat

2005-05-29 Thread George Sexton
If you aren't using JSP, you can change the startup batch file to skip the
test for the full JDK.

George Sexton
MH Software, Inc.
http://www.mhsoftware.com/
Voice: 303 438 9585
  

 -Original Message-
 From: Iannis Hanen [mailto:[EMAIL PROTECTED] 
 Sent: Wednesday, May 18, 2005 7:59 PM
 To: tomcat-user@jakarta.apache.org
 Cc: [EMAIL PROTECTED]
 Subject: JRE vs. JDK for Tomcat
 
 Hi,
 
  
 
 It seems that tomcat requires a JDK (and not only a JRE) to be present
 on the physical machine in order to run properly. I am a bit surprised
 that a JDK is also required. Is there a way to run Tomcat on top of a
 JRE only? How do I setup this?
 
  
 
 Thanks,
 
 Iannis
 
 


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



Maxime Buisson is out of the office.

2005-05-29 Thread maxime . buisson
I will be out of the office starting  16/05/2005 and will not return until
31/05/2005.

I will be out of the office from monday 16th of May until Monday 30th of
May included. My emails will not be forwarded.
For any urgent matters, contact Isabelle Picot:
[EMAIL PROTECTED]
With best regards,


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