Re: Pass parameter to the JVM at startup

2005-05-07 Thread Michael Echerer

 Looking back I was starting Tomcat from inside Eclipse with the Sysdeo
 Tomcat Plugin which apparently doesn't use the tomcat startup scripts,
 i.e., it bypasses startup.sh so it never sees -server. When I started
 tomcat manually via the cli with startup.sh with the JAVA_OPTS in
 catalina.sh it did see the -server option and it does indeed show up
 on the cli too:
 
Nevertheless you can also configure the start options (e.g. to adjust
the memory usage) when using the Sysdeo plugin... There's a dialog for
this in Eclipse/Sysdeo as the startup scripts aren't used, as you mentioned.


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



Re: Tomcat 5 slow, it's in production, please help!

2005-05-07 Thread Oto Bossert
Yoo,

Yes switch to jk2 is faster!

set parameters in OPT_CATALINA with -server Xmx=? and Xms=?

Sorry values depend on your available memory on the server, parameters
could be different with your version, check or google for correct parameters,
should improve performance...

Another option could be your code, have a good look at it and try to optimize...

Greetings O.

On 5/6/05, Jeffrey [EMAIL PROTECTED] wrote:
 I use just mod_jk, not jk2 I believe. I do have
 connectionTimeout=2 set to AJP connector in
 server.xml
 
 Is there any performance issues with jk? Should I
 switch to jk2?
 
 Thanks.
 
 --- e [EMAIL PROTECTED] wrote:
  What JK version do you use?  To quote Mladen:
 
  You are probably using prefork mpm, so there is no
  way to
  control the number of connections to Tomcat in any
  way, trough
  mod_jk. You can limit it only by setting MaxClients
  in the httpd.conf
  to the maximum number desired.
  Because of pre-forking mechanism each child process
  will eventually
  establish a single connection to Tomcat, thus the
  number of connections
  will rise from StartServers to MaxClients.
 
  So there are two solutions for prefork.
  1. Make maxThreads==MaxClients
  2. Add connectionTimeout=2 to AJP connector.
 
  On 5/6/05, Jeffrey [EMAIL PROTECTED] wrote:
   I have a apache/tomcat environment that has some
   problems recently. The environment has the
  following:
   1.  Apache 1.3
   2.  Tomcat 5.0.28 (Max memory 384mb)
   3.  JDK 1.4.2_06
  
   My apache has MaxClient set to 256 (apache
  default).
   The maxThread for tomcat is 500. The site is a
   database driven site.
  
   It seems working fine when load is low. But when
  there
   are more than 150 threads (from the sever status
  view
   of the tomcat manager), it's response time is very
   slow (5 - 10 minutes). I have tested the database
   connections, they seem responding fairly well.
  
   Interesting thing is that most of time the slow
   response time only happens when a user login. Once
  the
   user login and get the main menu page, the user
  will
   get a good response time. Is it related to
  KeepAlive
   connections.
  
   Another strange thing is that many threads always
  show
   up in the server status view on the tomcat html
   manager page even though I am sure the request has
   gone (I tested this by making a request, then
  close
   the browser).
  
   My CPU usage is low when the slowdown is
  experienced
   (Using the top command on this solaris box which
  has
   old solaris operating system 2.6? with 1GB memory.
  
   I set the session timeout time to 5 minutes, but
  in
   the session view of tomcat manager, I see message
  30
   - 40 minutes:136 sessions. How a session that is
   more than 30 minutes is still there. Maybe I don't
   understand this message correctly.
  
   Please advice. This is a production machine. Helps
  are
   greatly appreciated.
  
   Thanks.
  
   Jeffrey.
  
   Discover Yahoo!
   Get on-the-go sports scores, stock quotes, news
  and more. Check it out!
   http://discover.yahoo.com/mobile.html
  
  
 
 -
   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]
 
 
 
 __
 Do You Yahoo!?
 Tired of spam?  Yahoo! Mail has the best spam protection around
 http://mail.yahoo.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: Tomcat 5 slow, it's in production, please help!

2005-05-07 Thread Michael Echerer
Oto Bossert wrote:
 Yoo,
 
 Yes switch to jk2 is faster!
But unsupported! Development of mod_jk1.x is going on, but not jk2. I
wouldn't advise anyone to select something uncontinued.
I set the session timeout time to 5 minutes, but

in

the session view of tomcat manager, I see message

30

- 40 minutes:136 sessions. How a session that is
more than 30 minutes is still there. Maybe I don't
understand this message correctly.
Check whether you session-timeout is really set correctly. You can set
the timeout in the default web.xml for all apps, but you could override
it in the webapps web.xml, too. Maybe there it's still set too high.


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



Simple JavaBeans applications not working (newbie question)

2005-05-07 Thread Michael Strorm
Hi,

First off, let me apologise for the level of detail in
this message; if possible, I'd have made it shorter.

Anyway, I'm trying to learn J2EE; Tomcat seemed like a
good choice to learn the underlying technology, rather
than a particular JSP/Servlet container's deployment
tool. I can get 'plain' JSP pages working fine.

Unfortunately, I'm having major problems developing my
own Javabeans applications for Tomcat; they all fail
as shown below. The demos that come with Tomcat work
fine (although I can't get the demo at
http://jakarta.apache.org/tomcat/tomcat-5.5-doc/appdev/sample
to work; However- that's another story)

I understand that I should simply be able to drop the
directory structure containing my program into
$CATALINA_HOME/webapps, restart Tomcat (I'm using
5.5.7) and have it work.
Its contents (root:root ownership, Tomcat running as
root) is:-
skeleton
skeleton/subapp
skeleton/subapp/skeleton.jsp
skeleton/WEB-INF
skeleton/WEB-INF/classes
skeleton/WEB-INF/lib
skeleton/WEB-INF/lib/subapp
skeleton/WEB-INF/lib/subapp/Beany.class
skeleton/WEB-INF/lib/subapp/Beany.java
skeleton/WEB-INF/lib/subapp.jar
skeleton/WEB-INF/web.xml
Contents of files listed at end of message.

Here's what happens when I try to run it:-
(1) When I try to access
   
http://localhost:8080/skeleton/subapp/skeleton.jsp
with the setup as above, I get
HTTP Status 404 - Servlet
org.apache.jsp.subapp.skeleton_jsp
is not available
message Servlet
org.apache.jsp.subapp.skeleton_jsp
is not available

(2) If I move skeleton/WEB-INF/lib/subapp to
skeleton/WEB-INF/classes/subapp,
I get
HTTP STATUS 500 - EXCEPTION REPORT
The server encountered an internal error ()
that prevented it from fulfilling this
request.
EXCEPTION
javax.servlet.ServletException: Wrapper
cannot find servlet class
org.apache.jsp.subapp.skeleton_jsp
or a class it depends on
   

org.apache.catalina.valves.ErrorReportValve.invoke
   
(ErrorReportValve.java:105)
[... SNIP ...]
java.lang.Thread.run(Thread.java:595)

ROOT CAUSE
java.lang.ClassNotFoundException:
org.apache.jsp.subapp.skeleton_jsp
   
org.apache.catalina.loader.WebappClassLoader.loadClass
   
(WebappClassLoader.java:1332)
[... SNIP ...]
java.lang.Thread.run(Thread.java:595)

(3) If I remove the deployment descriptor altogether,
I get:-
HTTP STATUS 500 - EXCEPTION REPORT
The server encountered an internal error ()
that prevented it from fulfilling this
request.
EXCEPTION
org.apache.jasper.JasperException:
/subapp/skeleton.jsp(2,0) The
value for the useBean class attribute
subclass.Beany is invalid.
   
org.apache.jasper.compiler.DefaultErrorHandler.jspError(DefaultErrorHandler.java:39)
[... SNIP
...]
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)

In short, it fails; in three noticeably different
ways, granted; but it still
fails. What on EARTH am I doing wrong or missing out?!
I'd really appreciate
some feedback on this. Thank you in advance.


Here are the files:-

** SKELETON.JSP:
html
jsp:useBean id=beanId class=subclass.Beany
scope=session /
headtitleFoo Bar/title/head
body
h1Foo Bar/h1
Duzzy wuzzy was a duck; ducky fuzzy duck a wuzz blah
blah some more yak.
/body
/html
---
** WEB.XML
?xml version=1.0 encoding=ISO-8859-1?
!-- Copyright 2004 The Apache [SNIP] --
web-app xmlns=http://java.sun.com/xml/ns/j2ee;
   
xmlns:xsi=http://www.w3.org/2001/XMLSchema-instance;
   
xsi:schemaLocation=http://java.sun.com/xml/ns/j2ee
http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd;
version=2.4

  display-nameDisplay Name/display-name
  description
 Display Description
  /description

!-- JSPC servlet mappings start --

servlet
   
servlet-nameorg.apache.jsp.subapp.skeleton_jsp/servlet-name
   
servlet-classorg.apache.jsp.subapp.skeleton_jsp/servlet-class
/servlet

servlet-mapping
   
servlet-nameorg.apache.jsp.subapp.skeleton_jsp/servlet-name
   
url-pattern/subapp/skeleton.jsp/url-pattern
/servlet-mapping

!-- JSPC servlet mappings end --

---
---
** BEANY.JAVA
package subapp;

public class Beany
{
   private int first;

   /** Public no-args constructor */
   public Beany()
   {
  first = 404;
   }

   public int getFirst()
   {
  return first;
   }
   public void setFirst(int first)
   {
  this.first = first;
   }

   public String stringy = Original Value;
   

JK Connector - Can't get it to work

2005-05-07 Thread Pep Blast

Hi everyone,

I have studied this problem for a week now, and I can't seem to figure it out.  
All I want to do is connect Tomcat 5.5.4 Server to Apache 2.0.52.  I've read 
the documents about the jk connector over and over, and tried doing the setup 
with many tiny variations, but whatever I do I always get either a 404 or a 
200.  If I hit tomcat directly through localhost:8080 I can run all my servlets 
and jsps, but not when I try and hit it through apache.  Here are the 
appropriate snips from all my files.  Can anyone offer advice - I'm guessing 
the problem is in my server.xml since everything else is either a log, an 
auto-generated, or a one liner in the httpd.conf.  Thanks in advance to anyone 
who can help.


 httpd.conf - I only have one Tomcat/Jk line in it right now - the include.

Include C:/Program Files/Apache Software Foundation/Tomcat 
5.5/conf/auto/mod_jk.conf



 mod_jk.conf (obviously this is 100% auto-generated)

## Auto generated on Thu May 05 21:33:00 CDT 2005##
IfModule !mod_jk.c
  LoadModule jk_module C:/Program Files/Apache Group/Apache2/modules/mod_jk.so
/IfModule

JkWorkersFile C:/Program Files/Apache Software Foundation/Tomcat 
5.5/conf/jk/workers.properties
JkLogFile C:/Program Files/Apache Software Foundation/Tomcat 
5.5/logs/mod_jk.log

JkLogLevel emerg

 

VirtualHost localhost
ServerName localhost

JkMount /roots ajp13
JkMount /roots/* ajp13

JkMount /wiki ajp13
JkMount /wiki/* ajp13

JkMount /tomcat-docs ajp13
JkMount /tomcat-docs/* ajp13

JkMount /manager ajp13
JkMount /manager/* ajp13
/VirtualHost


 server.xml

Server port=8005 shutdown=SHUTDOWN

Listener className=org.apache.jk.config.ApacheConfig 
 modJk=C:/Program Files/Apache Group/Apache2/modules/mod_jk.so /

  GlobalNamingResources
!-- Used by Manager webapp --
Resource name=UserDatabase auth=Container
  type=org.apache.catalina.UserDatabase
   description=User database that can be updated and saved
   factory=org.apache.catalina.users.MemoryUserDatabaseFactory
  pathname=conf/tomcat-users.xml /
  /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
  Realm className=org.apache.catalina.realm.UserDatabaseRealm
 resourceName=UserDatabase /
  Host name=localhost appBase=webapps
  
Listener className=org.apache.jk.config.ApacheConfig 
 modJk=C:/Program Files/Apache Group/Apache2/modules/mod_jk.so 
 append=true/
  
  /Host
/Engine

  /Service
/Server


 mod_jk.log
in the first line note that Apache seems to be asking jk about every request - 
that can't be right...
in the last line this is what I usually get when I try and hit a jsp - I get 
different errors if I try tweaking my httpd.conf

[Thu May 05 18:48:17 2005] [1924:2220] [debug] 
map_uri_to_worker::jk_uri_worker_map.c (455): Attempting to map URI 
'/index.php' from 1 maps
... snip
[Thu May 05 21:23:18 2005] [error] ajp_service::jk_ajp_common.c (1733): Error 
connecting to tomcat. Tomcat is probably not started or is listening on the 
wrong port. worker=ajp13 failed


 


-
Yahoo! Mail
 Stay connected, organized, and protected. Take the tour

RE: Tomcat 5 slow, it's in production, please help!

2005-05-07 Thread Jeffrey
I am sorry, the box runs a Solaris 5.6 instead of 2.6
as I said before. But still you are probably right, it
would be better to get a new OS installed.

I didn't use ndd commands to set the TCP parameters.
So even though we have the session timeout set to 5
minutes at the tomcat level, that parameter is not
honored by the operating system?


--- [EMAIL PROTECTED] wrote:
 I think some of the problem is at the OS level
 
 You can set a session time at the tomcat level, but
 the default solaris TCP timeouts are hours long.   I
 hope you used the ndd commands to set the TCP
 parameters for short web sessions.
 
 Also, Solaris 2.6 has a bad thread model and there
 are numerous patches required to run it with  any
 recent Java 2 distributions.   To use the 1.4.xxx
 JVM would require about a dozen patches.
 
 It would be way better to try to get Solaris 10
 installed on this box  -- It handles the ndd setting
 for you and is way faster on the same hardware. 
 [even solaris 8...]
 
 
  -- Original message
 --
 From: [EMAIL PROTECTED]
  What does netstat -nt show?
  You may have enough connections going that old
 ones 
  have to time out before you can establish a new
 one.
  
  -Original Message-
  From: Jeffrey [mailto:[EMAIL PROTECTED]
  Sent: Friday, May 06, 2005 2:16 PM
  To: tomcat-user@jakarta.apache.org
  Subject: Tomcat 5 slow, it's in production, please
 help!
  
  
  I have a apache/tomcat environment that has some
  problems recently. The environment has the
 following:
  1.  Apache 1.3
  2.  Tomcat 5.0.28 (Max memory 384mb)
  3.  JDK 1.4.2_06
  
  My apache has MaxClient set to 256 (apache
 default).
  The maxThread for tomcat is 500. The site is a
  database driven site. 
  
  It seems working fine when load is low. But when
 there
  are more than 150 threads (from the sever status
 view
  of the tomcat manager), it's response time is very
  slow (5 - 10 minutes). I have tested the database
  connections, they seem responding fairly well.
  
  Interesting thing is that most of time the slow
  response time only happens when a user login. Once
 the
  user login and get the main menu page, the user
 will
  get a good response time. Is it related to
 KeepAlive
  connections. 
  
  Another strange thing is that many threads always
 show
  up in the server status view on the tomcat html
  manager page even though I am sure the request has
  gone (I tested this by making a request, then
 close
  the browser).
  
  My CPU usage is low when the slowdown is
 experienced
  (Using the top command on this solaris box which
 has
  old solaris operating system 2.6? with 1GB memory.
  
  I set the session timeout time to 5 minutes, but
 in
  the session view of tomcat manager, I see message
 30
  - 40 minutes:136 sessions. How a session that is
  more than 30 minutes is still there. Maybe I don't
  understand this message correctly.
  
  Please advice. This is a production machine. Helps
 are
  greatly appreciated.
  
  Thanks.
  
  Jeffrey.
  
  
  
  Discover Yahoo! 
  Get on-the-go sports scores, stock quotes, news
 and more. Check it out! 
  http://discover.yahoo.com/mobile.html
  
 

-
  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]
  
 
 
 

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

__
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 

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



RE: Tomcat 5 slow, it's in production, please help!

2005-05-07 Thread Tony
As a wild guess
Browser drops the connection immediately without notice
After 5 minutes, tomcat decides to drop the connection
After 30 minutes or so, Solaris finally finishes dropping the connection.
Gives a strange meaning to Keep-Alive ;)

-Original Message-
From: Jeffrey [mailto:[EMAIL PROTECTED]
Sent: Saturday, May 07, 2005 9:21 AM
To: Tomcat Users List
Subject: RE: Tomcat 5 slow, it's in production, please help!


I am sorry, the box runs a Solaris 5.6 instead of 2.6
as I said before. But still you are probably right, it
would be better to get a new OS installed.

I didn't use ndd commands to set the TCP parameters.
So even though we have the session timeout set to 5
minutes at the tomcat level, that parameter is not
honored by the operating system?


--- [EMAIL PROTECTED] wrote:
 I think some of the problem is at the OS level
 
 You can set a session time at the tomcat level, but
 the default solaris TCP timeouts are hours long.   I
 hope you used the ndd commands to set the TCP
 parameters for short web sessions.
 
 Also, Solaris 2.6 has a bad thread model and there
 are numerous patches required to run it with  any
 recent Java 2 distributions.   To use the 1.4.xxx
 JVM would require about a dozen patches.
 
 It would be way better to try to get Solaris 10
 installed on this box  -- It handles the ndd setting
 for you and is way faster on the same hardware. 
 [even solaris 8...]
 
 
  -- Original message
 --
 From: [EMAIL PROTECTED]
  What does netstat -nt show?
  You may have enough connections going that old
 ones 
  have to time out before you can establish a new
 one.
  
  -Original Message-
  From: Jeffrey [mailto:[EMAIL PROTECTED]
  Sent: Friday, May 06, 2005 2:16 PM
  To: tomcat-user@jakarta.apache.org
  Subject: Tomcat 5 slow, it's in production, please
 help!
  
  
  I have a apache/tomcat environment that has some
  problems recently. The environment has the
 following:
  1.  Apache 1.3
  2.  Tomcat 5.0.28 (Max memory 384mb)
  3.  JDK 1.4.2_06
  
  My apache has MaxClient set to 256 (apache
 default).
  The maxThread for tomcat is 500. The site is a
  database driven site. 
  
  It seems working fine when load is low. But when
 there
  are more than 150 threads (from the sever status
 view
  of the tomcat manager), it's response time is very
  slow (5 - 10 minutes). I have tested the database
  connections, they seem responding fairly well.
  
  Interesting thing is that most of time the slow
  response time only happens when a user login. Once
 the
  user login and get the main menu page, the user
 will
  get a good response time. Is it related to
 KeepAlive
  connections. 
  
  Another strange thing is that many threads always
 show
  up in the server status view on the tomcat html
  manager page even though I am sure the request has
  gone (I tested this by making a request, then
 close
  the browser).
  
  My CPU usage is low when the slowdown is
 experienced
  (Using the top command on this solaris box which
 has
  old solaris operating system 2.6? with 1GB memory.
  
  I set the session timeout time to 5 minutes, but
 in
  the session view of tomcat manager, I see message
 30
  - 40 minutes:136 sessions. How a session that is
  more than 30 minutes is still there. Maybe I don't
  understand this message correctly.
  
  Please advice. This is a production machine. Helps
 are
  greatly appreciated.
  
  Thanks.
  
  Jeffrey.
  
  
  
  Discover Yahoo! 
  Get on-the-go sports scores, stock quotes, news
 and more. Check it out! 
  http://discover.yahoo.com/mobile.html
  
 

-
  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]
  
 
 
 

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

__
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.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: Tomcat 5 slow, it's in production, please help!

2005-05-07 Thread Jeffrey
This website has many JSP pages of which each has many
JSPF included. I wonder whether or not the system is
not be able to handle this kind of  setting. But
strange thing is that when we experienced the
slowness, I looked at the usage of CPU and find that
almost 90% of the CPU is idle.

Do anyone know what kind of load a tomcat can handle.
I am thinking that maybe a load balancer will help.
But I am still puzzled by the fact of low CPU usage at
the time of slowness.

From the server status view in tomcat manager, I can
see 's Request count: 127421'

--- Jeffrey [EMAIL PROTECTED] wrote:
 I have a apache/tomcat environment that has some
 problems recently. The environment has the
 following:
 1.  Apache 1.3
 2.  Tomcat 5.0.28 (Max memory 384mb)
 3.  JDK 1.4.2_06
 
 My apache has MaxClient set to 256 (apache default).
 The maxThread for tomcat is 500. The site is a
 database driven site. 
 
 It seems working fine when load is low. But when
 there
 are more than 150 threads (from the sever status
 view
 of the tomcat manager), it's response time is very
 slow (5 - 10 minutes). I have tested the database
 connections, they seem responding fairly well.
 
 Interesting thing is that most of time the slow
 response time only happens when a user login. Once
 the
 user login and get the main menu page, the user will
 get a good response time. Is it related to KeepAlive
 connections. 
 
 Another strange thing is that many threads always
 show
 up in the server status view on the tomcat html
 manager page even though I am sure the request has
 gone (I tested this by making a request, then close
 the browser).
 
 My CPU usage is low when the slowdown is experienced
 (Using the top command on this solaris box which has
 old solaris operating system 2.6? with 1GB memory.
 
 I set the session timeout time to 5 minutes, but in
 the session view of tomcat manager, I see message
 30
 - 40 minutes:136 sessions. How a session that is
 more than 30 minutes is still there. Maybe I don't
 understand this message correctly.
 
 Please advice. This is a production machine. Helps
 are
 greatly appreciated.
 
 Thanks.
 
 Jeffrey.
 
 
   
 Discover Yahoo! 
 Get on-the-go sports scores, stock quotes, news and
 more. Check it out! 
 http://discover.yahoo.com/mobile.html
 

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

__
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 

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



How do I handle International Characters

2005-05-07 Thread David Harland
I am using Tomcat 5.0 and I am trying to receive and
send  thai characters. Can someone please tell me the
simplest ways to do this.

Many thanks

Dave.

__
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 

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



Re: How do I handle International Characters

2005-05-07 Thread Mark Thomas
http://jakarta.apache.org/tomcat/faq/misc.html#tomcat5CharEncoding
Mark
David Harland wrote:
I am using Tomcat 5.0 and I am trying to receive and
send  thai characters. Can someone please tell me the
simplest ways to do this.
Many thanks
Dave.
__
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.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: How do I handle International Characters

2005-05-07 Thread David Harland
Hi Mark

If I have tried the following.

response.setContentType(text/html;
charset=utf-8);
PrintWriter out = response.getWriter();
request.setCharacterEncoding(UTF-8);
String test=request.getParameter(login);
out.println(Input string:+test);
out.println(URLEncoder.encode(test,UTF-8));
out.close();

What is output to the browser is Unicode instead of
the characters. If I look at the source of the
returned page. I see
#3615;#3627;#3585;#3615;#3627;#3585; instead of
characters like
#3585;#3619;#3640;#3591;#3648;#3607;#3614;#3631;.

Regards

David.

--- Mark Thomas [EMAIL PROTECTED] wrote:

http://jakarta.apache.org/tomcat/faq/misc.html#tomcat5CharEncoding
 
 Mark
 
 David Harland wrote:
  I am using Tomcat 5.0 and I am trying to receive
 and
  send  thai characters. Can someone please tell me
 the
  simplest ways to do this.
  
  Many thanks
  
  Dave.
  
  __
  Do You Yahoo!?
  Tired of spam?  Yahoo! Mail has the best spam
 protection around 
  http://mail.yahoo.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]
 
 



__ 
Yahoo! Mail Mobile 
Take Yahoo! Mail with you! Check email on your mobile phone. 
http://mobile.yahoo.com/learn/mail 

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



Re: JK Connector - Can't get it to work

2005-05-07 Thread Peter Rossbach
Hey,
Has your workers.properties a correct setup?
worker.list=ajp13
worker.ajp13.type=ajp13
worker.ajp13.port=8009
worker.ajp13.host=localhost
worker.ajp13.cachesize=150
worker.ajp13.cache_timeout=600
What mod_jk Version you use?
Better config at mod_jk =1.2.10
add this
worker.list=router,jkstatus
worker.router.type=lb
worker.router.balance_workers=ajp13
worker.jkstatus.type=status
and add JkMount /jkstatus jkstatus to your vhost at httpd.conf
then you can see the mod_jk status wiht http://localhost/jkstatus
Peter
Pep Blast schrieb:
Hi everyone,
I have studied this problem for a week now, and I can't seem to figure it out.  
All I want to do is connect Tomcat 5.5.4 Server to Apache 2.0.52.  I've read 
the documents about the jk connector over and over, and tried doing the setup 
with many tiny variations, but whatever I do I always get either a 404 or a 
200.  If I hit tomcat directly through localhost:8080 I can run all my servlets 
and jsps, but not when I try and hit it through apache.  Here are the 
appropriate snips from all my files.  Can anyone offer advice - I'm guessing 
the problem is in my server.xml since everything else is either a log, an 
auto-generated, or a one liner in the httpd.conf.  Thanks in advance to anyone 
who can help.

 httpd.conf - I only have one Tomcat/Jk line in it right now - the include.

Include C:/Program Files/Apache Software Foundation/Tomcat 
5.5/conf/auto/mod_jk.conf

 mod_jk.conf (obviously this is 100% auto-generated)

## Auto generated on Thu May 05 21:33:00 CDT 2005##
IfModule !mod_jk.c
 LoadModule jk_module C:/Program Files/Apache Group/Apache2/modules/mod_jk.so
/IfModule
JkWorkersFile C:/Program Files/Apache Software Foundation/Tomcat 
5.5/conf/jk/workers.properties
JkLogFile C:/Program Files/Apache Software Foundation/Tomcat 
5.5/logs/mod_jk.log
JkLogLevel emerg

VirtualHost localhost
   ServerName localhost
   JkMount /roots ajp13
   JkMount /roots/* ajp13
   JkMount /wiki ajp13
   JkMount /wiki/* ajp13
   JkMount /tomcat-docs ajp13
   JkMount /tomcat-docs/* ajp13
   JkMount /manager ajp13
   JkMount /manager/* ajp13
/VirtualHost

 server.xml

Server port=8005 shutdown=SHUTDOWN
Listener className=org.apache.jk.config.ApacheConfig 
modJk=C:/Program Files/Apache Group/Apache2/modules/mod_jk.so /

 GlobalNamingResources
   !-- Used by Manager webapp --
   Resource name=UserDatabase auth=Container
 type=org.apache.catalina.UserDatabase
  description=User database that can be updated and saved
  factory=org.apache.catalina.users.MemoryUserDatabaseFactory
 pathname=conf/tomcat-users.xml /
 /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
 Realm className=org.apache.catalina.realm.UserDatabaseRealm
resourceName=UserDatabase /
 Host name=localhost appBase=webapps
 
Listener className=org.apache.jk.config.ApacheConfig 
modJk=C:/Program Files/Apache Group/Apache2/modules/mod_jk.so 
append=true/
 
 /Host
   /Engine
   
 /Service
/Server


 mod_jk.log
in the first line note that Apache seems to be asking jk about every request - 
that can't be right...
in the last line this is what I usually get when I try and hit a jsp - I get 
different errors if I try tweaking my httpd.conf

[Thu May 05 18:48:17 2005] [1924:2220] [debug] 
map_uri_to_worker::jk_uri_worker_map.c (455): Attempting to map URI 
'/index.php' from 1 maps
... snip
[Thu May 05 21:23:18 2005] [error] ajp_service::jk_ajp_common.c (1733): Error 
connecting to tomcat. Tomcat is probably not started or is listening on the 
wrong port. worker=ajp13 failed

		
-
Yahoo! Mail
Stay connected, organized, and protected. Take the tour
 



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


Re: Tomcat 5 slow, it's in production, please help!

2005-05-07 Thread Parsons Technical Services
127421 over what period of time?
Without a profile it is impossible to say if Tomcat can handle the load. But 
if the memory consumption and the CPU usage is low (as noted) it is fairly 
safe to say that Tomcat itself is not the bottle neck.

Quick question, why are you using Apache?
Also what is the time out for the connection in Apache?
Do you get this slow reaction if you are hitting Tomcat directly?
I may be repeating something that was covered because I have not been 
reading this thread in detail. So sorry if already asked and answered.

Doug

- Original Message - 
From: Jeffrey [EMAIL PROTECTED]
To: Tomcat Users List tomcat-user@jakarta.apache.org
Sent: Saturday, May 07, 2005 10:44 AM
Subject: Re: Tomcat 5 slow, it's in production, please help!


This website has many JSP pages of which each has many
JSPF included. I wonder whether or not the system is
not be able to handle this kind of  setting. But
strange thing is that when we experienced the
slowness, I looked at the usage of CPU and find that
almost 90% of the CPU is idle.
Do anyone know what kind of load a tomcat can handle.
I am thinking that maybe a load balancer will help.
But I am still puzzled by the fact of low CPU usage at
the time of slowness.
From the server status view in tomcat manager, I can
see 's Request count: 127421'
--- Jeffrey [EMAIL PROTECTED] wrote:
I have a apache/tomcat environment that has some
problems recently. The environment has the
following:
1.  Apache 1.3
2.  Tomcat 5.0.28 (Max memory 384mb)
3.  JDK 1.4.2_06
My apache has MaxClient set to 256 (apache default).
The maxThread for tomcat is 500. The site is a
database driven site.
It seems working fine when load is low. But when
there
are more than 150 threads (from the sever status
view
of the tomcat manager), it's response time is very
slow (5 - 10 minutes). I have tested the database
connections, they seem responding fairly well.
Interesting thing is that most of time the slow
response time only happens when a user login. Once
the
user login and get the main menu page, the user will
get a good response time. Is it related to KeepAlive
connections.
Another strange thing is that many threads always
show
up in the server status view on the tomcat html
manager page even though I am sure the request has
gone (I tested this by making a request, then close
the browser).
My CPU usage is low when the slowdown is experienced
(Using the top command on this solaris box which has
old solaris operating system 2.6? with 1GB memory.
I set the session timeout time to 5 minutes, but in
the session view of tomcat manager, I see message
30
- 40 minutes:136 sessions. How a session that is
more than 30 minutes is still there. Maybe I don't
understand this message correctly.
Please advice. This is a production machine. Helps
are
greatly appreciated.
Thanks.
Jeffrey.

Discover Yahoo!
Get on-the-go sports scores, stock quotes, news and
more. Check it out!
http://discover.yahoo.com/mobile.html

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

__
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around
http://mail.yahoo.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: How do I handle International Characters

2005-05-07 Thread Mark Thomas
David,
You also need to look at how the parameters are set in the first place. 
Are you using GET or POST? If you are using GET have you set any of the 
character encoding settings on the connector?

The following index.jsp works for me:
%@ page contentType=text/html; charset=UTF-8 %
!DOCTYPE HTML PUBLIC -//W3C//DTD HTML 4.01 Transitional//EN
html
  head
titleCharacter encoding test page/title
  /head
  body
pData posted to this form was:
%
  request.setCharacterEncoding(UTF-8);
  out.print(request.getParameter(mydata));
%
/p
form method=post action=index.jsp
  input type=text name=mydata
  input type=submit value=Submit /
  input type=reset value=Reset /
/form
  /body
/html
David Harland wrote:
Hi Mark
If I have tried the following.
response.setContentType(text/html;
charset=utf-8);
PrintWriter out = response.getWriter();
request.setCharacterEncoding(UTF-8);
String test=request.getParameter(login);
out.println(Input string:+test);
out.println(URLEncoder.encode(test,UTF-8));
out.close();
What is output to the browser is Unicode instead of
the characters. If I look at the source of the
returned page. I see
#3615;#3627;#3585;#3615;#3627;#3585; instead of
characters like
#3585;#3619;#3640;#3591;#3648;#3607;#3614;#3631;.
Regards
David.
--- Mark Thomas [EMAIL PROTECTED] wrote:
http://jakarta.apache.org/tomcat/faq/misc.html#tomcat5CharEncoding
Mark
David Harland wrote:
I am using Tomcat 5.0 and I am trying to receive
and
send  thai characters. Can someone please tell me
the
simplest ways to do this.
Many thanks
Dave.
__
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam
protection around 

http://mail.yahoo.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]


		
__ 
Yahoo! Mail Mobile 
Take Yahoo! Mail with you! Check email on your mobile phone. 
http://mobile.yahoo.com/learn/mail 

-
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: Tomcat 5 slow, it's in production, please help!

2005-05-07 Thread Jeffrey
Please see the answer embedded below.

--- Parsons Technical Services
[EMAIL PROTECTED] wrote:

 127421 over what period of time?
It's about 6 hours. But most of them are at the first
hour or so.
 
 Without a profile it is impossible to say if Tomcat
 can handle the load. But 
 if the memory consumption and the CPU usage is low
 (as noted) it is fairly 
 safe to say that Tomcat itself is not the bottle
 neck.
 
 Quick question, why are you using Apache?

I am using Apache SSL for SSL connections. It is the
original setup by someone else.

 
 Also what is the time out for the connection in
 Apache?

Apache's Timeout value is 300. MaxKeepAliveRequests is
100 and KeepAliveTimeout is 15
 
 Do you get this slow reaction if you are hitting
 Tomcat directly?

I did get the slow reaction if I hit Tomcat directly
at port 8080 to the same webapp. But the tomcat
manager web pages seem show up fairly quick.

 
 I may be repeating something that was covered
 because I have not been 
 reading this thread in detail. So sorry if already
 asked and answered.
 
 
 Doug
 
 
 
 - Original Message - 
 From: Jeffrey [EMAIL PROTECTED]
 To: Tomcat Users List
 tomcat-user@jakarta.apache.org
 Sent: Saturday, May 07, 2005 10:44 AM
 Subject: Re: Tomcat 5 slow, it's in production,
 please help!
 
 
  This website has many JSP pages of which each has
 many
  JSPF included. I wonder whether or not the system
 is
  not be able to handle this kind of  setting. But
  strange thing is that when we experienced the
  slowness, I looked at the usage of CPU and find
 that
  almost 90% of the CPU is idle.
 
  Do anyone know what kind of load a tomcat can
 handle.
  I am thinking that maybe a load balancer will
 help.
  But I am still puzzled by the fact of low CPU
 usage at
  the time of slowness.
 
  From the server status view in tomcat manager, I
 can
  see 's Request count: 127421'
 
  --- Jeffrey [EMAIL PROTECTED] wrote:
  I have a apache/tomcat environment that has some
  problems recently. The environment has the
  following:
  1.  Apache 1.3
  2.  Tomcat 5.0.28 (Max memory 384mb)
  3.  JDK 1.4.2_06
 
  My apache has MaxClient set to 256 (apache
 default).
  The maxThread for tomcat is 500. The site is a
  database driven site.
 
  It seems working fine when load is low. But when
  there
  are more than 150 threads (from the sever status
  view
  of the tomcat manager), it's response time is
 very
  slow (5 - 10 minutes). I have tested the database
  connections, they seem responding fairly well.
 
  Interesting thing is that most of time the slow
  response time only happens when a user login.
 Once
  the
  user login and get the main menu page, the user
 will
  get a good response time. Is it related to
 KeepAlive
  connections.
 
  Another strange thing is that many threads always
  show
  up in the server status view on the tomcat html
  manager page even though I am sure the request
 has
  gone (I tested this by making a request, then
 close
  the browser).
 
  My CPU usage is low when the slowdown is
 experienced
  (Using the top command on this solaris box which
 has
  old solaris operating system 2.6? with 1GB
 memory.
 
  I set the session timeout time to 5 minutes, but
 in
  the session view of tomcat manager, I see message
  30
  - 40 minutes:136 sessions. How a session that
 is
  more than 30 minutes is still there. Maybe I
 don't
  understand this message correctly.
 
  Please advice. This is a production machine.
 Helps
  are
  greatly appreciated.
 
  Thanks.
 
  Jeffrey.
 
 
 
  Discover Yahoo!
  Get on-the-go sports scores, stock quotes, news
 and
  more. Check it out!
  http://discover.yahoo.com/mobile.html
 
 
 

-
  To unsubscribe, e-mail:
  [EMAIL PROTECTED]
  For additional commands, e-mail:
  [EMAIL PROTECTED]
 
 
 
  __
  Do You Yahoo!?
  Tired of spam?  Yahoo! Mail has the best spam
 protection around
  http://mail.yahoo.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]
 
 




Discover Yahoo! 
Stay in touch with email, IM, photo sharing and more. Check it out! 
http://discover.yahoo.com/stayintouch.html

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



Re: Tomcat 5 slow, it's in production, please help!

2005-05-07 Thread Jeffrey
It seems that, at least in most cases, the main menu
page after a login is loaded slow. After that other
pages are loaded pretty quick. Does that mean once a
connection is established, browser and server
communication is ok. If that is the case, maybe I
should look more at the connection timeout at the OS
level (solaris 5.6) since I see a lot of TIME_WAIT at
the machine using the 'netstat -n' command.


--- Jeffrey [EMAIL PROTECTED] wrote:

 Please see the answer embedded below.
 
 --- Parsons Technical Services
 [EMAIL PROTECTED] wrote:
 
  127421 over what period of time?
 It's about 6 hours. But most of them are at the
 first
 hour or so.
  
  Without a profile it is impossible to say if
 Tomcat
  can handle the load. But 
  if the memory consumption and the CPU usage is low
  (as noted) it is fairly 
  safe to say that Tomcat itself is not the bottle
  neck.
  
  Quick question, why are you using Apache?
 
 I am using Apache SSL for SSL connections. It is the
 original setup by someone else.
 
  
  Also what is the time out for the connection in
  Apache?
 
 Apache's Timeout value is 300. MaxKeepAliveRequests
 is
 100 and KeepAliveTimeout is 15
  
  Do you get this slow reaction if you are hitting
  Tomcat directly?
 
 I did get the slow reaction if I hit Tomcat directly
 at port 8080 to the same webapp. But the tomcat
 manager web pages seem show up fairly quick.
 
  
  I may be repeating something that was covered
  because I have not been 
  reading this thread in detail. So sorry if already
  asked and answered.
  
  
  Doug
  
  
  
  - Original Message - 
  From: Jeffrey [EMAIL PROTECTED]
  To: Tomcat Users List
  tomcat-user@jakarta.apache.org
  Sent: Saturday, May 07, 2005 10:44 AM
  Subject: Re: Tomcat 5 slow, it's in production,
  please help!
  
  
   This website has many JSP pages of which each
 has
  many
   JSPF included. I wonder whether or not the
 system
  is
   not be able to handle this kind of  setting. But
   strange thing is that when we experienced the
   slowness, I looked at the usage of CPU and find
  that
   almost 90% of the CPU is idle.
  
   Do anyone know what kind of load a tomcat can
  handle.
   I am thinking that maybe a load balancer will
  help.
   But I am still puzzled by the fact of low CPU
  usage at
   the time of slowness.
  
   From the server status view in tomcat manager, I
  can
   see 's Request count: 127421'
  
   --- Jeffrey [EMAIL PROTECTED] wrote:
   I have a apache/tomcat environment that has
 some
   problems recently. The environment has the
   following:
   1.  Apache 1.3
   2.  Tomcat 5.0.28 (Max memory 384mb)
   3.  JDK 1.4.2_06
  
   My apache has MaxClient set to 256 (apache
  default).
   The maxThread for tomcat is 500. The site is a
   database driven site.
  
   It seems working fine when load is low. But
 when
   there
   are more than 150 threads (from the sever
 status
   view
   of the tomcat manager), it's response time is
  very
   slow (5 - 10 minutes). I have tested the
 database
   connections, they seem responding fairly well.
  
   Interesting thing is that most of time the slow
   response time only happens when a user login.
  Once
   the
   user login and get the main menu page, the user
  will
   get a good response time. Is it related to
  KeepAlive
   connections.
  
   Another strange thing is that many threads
 always
   show
   up in the server status view on the tomcat html
   manager page even though I am sure the request
  has
   gone (I tested this by making a request, then
  close
   the browser).
  
   My CPU usage is low when the slowdown is
  experienced
   (Using the top command on this solaris box
 which
  has
   old solaris operating system 2.6? with 1GB
  memory.
  
   I set the session timeout time to 5 minutes,
 but
  in
   the session view of tomcat manager, I see
 message
   30
   - 40 minutes:136 sessions. How a session that
  is
   more than 30 minutes is still there. Maybe I
  don't
   understand this message correctly.
  
   Please advice. This is a production machine.
  Helps
   are
   greatly appreciated.
  
   Thanks.
  
   Jeffrey.
  
  
  
   Discover Yahoo!
   Get on-the-go sports scores, stock quotes, news
  and
   more. Check it out!
   http://discover.yahoo.com/mobile.html
  
  
  
 

-
   To unsubscribe, e-mail:
   [EMAIL PROTECTED]
   For additional commands, e-mail:
   [EMAIL PROTECTED]
  
  
  
  
 __
   Do You Yahoo!?
   Tired of spam?  Yahoo! Mail has the best spam
  protection around
   http://mail.yahoo.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:
 

Re: Simple JavaBeans applications not working (newbie question)

2005-05-07 Thread Anoop kumar V
Michael,

Everything works perfectly fine in your jsp and bean except that the package 
mentioned in your bean (Beany.java) file seems incorrect:
It is:

** BEANY.JAVA
package subapp;


It should be:

** BEANY.JAVA
package subclass;

Or else an alternative is to change the folder in which the bean is to 
subapp from subclass to match the package name...

Also you do not need to place a web.xml in the WEB-INF folder - I mean its 
optional since tomcat5.X (maybe earlier - someone please correct if I am 
wrong).. and if web.xml is not present the defauly web.xml settings will be 
applied.

Hope that helps,
Anoop

On 5/7/05, Michael Strorm [EMAIL PROTECTED] wrote:
 
 Hi,
 
 First off, let me apologise for the level of detail in
 this message; if possible, I'd have made it shorter.
 
 Anyway, I'm trying to learn J2EE; Tomcat seemed like a
 good choice to learn the underlying technology, rather
 than a particular JSP/Servlet container's deployment
 tool. I can get 'plain' JSP pages working fine.
 
 Unfortunately, I'm having major problems developing my
 own Javabeans applications for Tomcat; they all fail
 as shown below. The demos that come with Tomcat work
 fine (although I can't get the demo at
 http://jakarta.apache.org/tomcat/tomcat-5.5-doc/appdev/sample
 to work; However- that's another story)
 
 I understand that I should simply be able to drop the
 directory structure containing my program into
 $CATALINA_HOME/webapps, restart Tomcat (I'm using
 5.5.7) and have it work.
 Its contents (root:root ownership, Tomcat running as
 root) is:-
 skeleton
 skeleton/subapp
 skeleton/subapp/skeleton.jsp
 skeleton/WEB-INF
 skeleton/WEB-INF/classes
 skeleton/WEB-INF/lib
 skeleton/WEB-INF/lib/subapp
 skeleton/WEB-INF/lib/subapp/Beany.class
 skeleton/WEB-INF/lib/subapp/Beany.java
 skeleton/WEB-INF/lib/subapp.jar
 skeleton/WEB-INF/web.xml
 Contents of files listed at end of message.
 
 Here's what happens when I try to run it:-
 (1) When I try to access
 
 http://localhost:8080/skeleton/subapp/skeleton.jsp
 with the setup as above, I get
 HTTP Status 404 - Servlet
 org.apache.jsp.subapp.skeleton_jsp
 is not available
 message Servlet
 org.apache.jsp.subapp.skeleton_jsp
 is not available
 
 (2) If I move skeleton/WEB-INF/lib/subapp to
 skeleton/WEB-INF/classes/subapp,
 I get
 HTTP STATUS 500 - EXCEPTION REPORT
 The server encountered an internal error ()
 that prevented it from fulfilling this
 request.
 EXCEPTION
 javax.servlet.ServletException: Wrapper
 cannot find servlet class
 org.apache.jsp.subapp.skeleton_jsp
 or a class it depends on
 
 org.apache.catalina.valves.ErrorReportValve.invoke
 
 (ErrorReportValve.java:105)
 [... SNIP ...]
 java.lang.Thread.run(Thread.java:595)
 
 ROOT CAUSE
 java.lang.ClassNotFoundException:
 org.apache.jsp.subapp.skeleton_jsp
 
 org.apache.catalina.loader.WebappClassLoader.loadClass
 
 (WebappClassLoader.java:1332)
 [... SNIP ...]
 java.lang.Thread.run(Thread.java:595)
 
 (3) If I remove the deployment descriptor altogether,
 I get:-
 HTTP STATUS 500 - EXCEPTION REPORT
 The server encountered an internal error ()
 that prevented it from fulfilling this
 request.
 EXCEPTION
 org.apache.jasper.JasperException:
 /subapp/skeleton.jsp(2,0) The
 value for the useBean class attribute
 subclass.Beany is invalid.
 
 org.apache.jasper.compiler.DefaultErrorHandler.jspError(
 DefaultErrorHandler.java:39)
 [... SNIP
 ...]
 javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
 
 In short, it fails; in three noticeably different
 ways, granted; but it still
 fails. What on EARTH am I doing wrong or missing out?!
 I'd really appreciate
 some feedback on this. Thank you in advance.
 
 
 Here are the files:-
 
 ** SKELETON.JSP:
 html
 jsp:useBean id=beanId class=subclass.Beany
 scope=session /
 headtitleFoo Bar/title/head
 body
 h1Foo Bar/h1
 Duzzy wuzzy was a duck; ducky fuzzy duck a wuzz blah
 blah some more yak.
 /body
 /html
 ---
 ** WEB.XML
 ?xml version=1.0 encoding=ISO-8859-1?
 !-- Copyright 2004 The Apache [SNIP] --
 web-app xmlns=http://java.sun.com/xml/ns/j2ee;
 
 xmlns:xsi=http://www.w3.org/2001/XMLSchema-instance;
 
 xsi:schemaLocation=http://java.sun.com/xml/ns/j2ee
 http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd;
 version=2.4
 
 display-nameDisplay Name/display-name
 description
 Display Description
 /description
 
 !-- JSPC servlet mappings start --
 
 servlet
 
 servlet-nameorg.apache.jsp.subapp.skeleton_jsp/servlet-name
 
 servlet-classorg.apache.jsp.subapp.skeleton_jsp/servlet-class
 /servlet
 
 servlet-mapping
 
 servlet-nameorg.apache.jsp.subapp.skeleton_jsp/servlet-name
 
 url-pattern/subapp/skeleton.jsp/url-pattern
 /servlet-mapping
 
 !-- JSPC servlet mappings end --
 
 ---
 ---
 ** BEANY.JAVA
 package 

Re: Simple JavaBeans applications not working (newbie question)

2005-05-07 Thread Anoop kumar V
Another thing I noticed that you have placed your bean as a jar in the 
WEB-INF/lib directory - while this works perfectly the practice is to put 
custom class files in the WEB-INF/classes directory as just .class files 
under their respective folders (as per package declaration)..

IMO the lib folders should only contain jar files that represent generic 
functionality as opposed to customised project specific class files in the 
classes folder.

regards,
Anoop 

On 5/7/05, Anoop kumar V [EMAIL PROTECTED] wrote:
 
 Michael,
 
 Everything works perfectly fine in your jsp and bean except that the 
 package mentioned in your bean (Beany.java) file seems incorrect:
 It is:
 
 ** BEANY.JAVA
 package subapp;
 
 
 It should be:
 
 ** BEANY.JAVA
 package subclass;
 
 Or else an alternative is to change the folder in which the bean is to 
 subapp from subclass to match the package name...
 
 Also you do not need to place a web.xml in the WEB-INF folder - I mean its 
 optional since tomcat5.X (maybe earlier - someone please correct if I am 
 wrong).. and if web.xml is not present the defauly web.xml settings will 
 be applied.
 
 Hope that helps,
 Anoop
 
 On 5/7/05, Michael Strorm [EMAIL PROTECTED] wrote:
  
  Hi,
  
  First off, let me apologise for the level of detail in
  this message; if possible, I'd have made it shorter.
  
  Anyway, I'm trying to learn J2EE; Tomcat seemed like a
  good choice to learn the underlying technology, rather 
  than a particular JSP/Servlet container's deployment
  tool. I can get 'plain' JSP pages working fine.
  
  Unfortunately, I'm having major problems developing my
  own Javabeans applications for Tomcat; they all fail 
  as shown below. The demos that come with Tomcat work
  fine (although I can't get the demo at
  http://jakarta.apache.org/tomcat/tomcat-5.5-doc/appdev/sample 
  to work; However- that's another story)
  
  I understand that I should simply be able to drop the
  directory structure containing my program into
  $CATALINA_HOME/webapps, restart Tomcat (I'm using
  5.5.7) and have it work. 
  Its contents (root:root ownership, Tomcat running as
  root) is:-
  skeleton
  skeleton/subapp
  skeleton/subapp/skeleton.jsp
  skeleton/WEB-INF
  skeleton/WEB-INF/classes 
  skeleton/WEB-INF/lib
  skeleton/WEB-INF/lib/subapp
  skeleton/WEB-INF/lib/subapp/Beany.class
  skeleton/WEB-INF/lib/subapp/Beany.java
  skeleton/WEB-INF/lib/subapp.jar
  skeleton/WEB-INF/web.xml 
  Contents of files listed at end of message.
  
  Here's what happens when I try to run it:-
  (1) When I try to access
  
  http://localhost:8080/skeleton/subapp/skeleton.jsp 
  with the setup as above, I get
  HTTP Status 404 - Servlet
  org.apache.jsp.subapp.skeleton_jsp
  is not available
  message Servlet
  org.apache.jsp.subapp.skeleton_jsp 
  is not available
  
  (2) If I move skeleton/WEB-INF/lib/subapp to
  skeleton/WEB-INF/classes/subapp,
  I get
  HTTP STATUS 500 - EXCEPTION REPORT
  The server encountered an internal error () 
  that prevented it from fulfilling this
  request.
  EXCEPTION
  javax.servlet.ServletException: Wrapper
  cannot find servlet class
  org.apache.jsp.subapp.skeleton_jsp 
  or a class it depends on
  
  org.apache.catalina.valves.ErrorReportValve.invoke
  
  (ErrorReportValve.java:105)
  [... SNIP ...]
  java.lang.Thread.run(Thread.java:595)
  
  ROOT CAUSE 
  java.lang.ClassNotFoundException:
  org.apache.jsp.subapp.skeleton_jsp
  
  org.apache.catalina.loader.WebappClassLoader.loadClass
  
  (WebappClassLoader.java:1332)
  [... SNIP ...] 
  java.lang.Thread.run(Thread.java:595)
  
  (3) If I remove the deployment descriptor altogether,
  I get:-
  HTTP STATUS 500 - EXCEPTION REPORT
  The server encountered an internal error () 
  that prevented it from fulfilling this
  request.
  EXCEPTION
  org.apache.jasper.JasperException:
  /subapp/skeleton.jsp(2,0) The
  value for the useBean class attribute 
  subclass.Beany is invalid.
  
  org.apache.jasper.compiler.DefaultErrorHandler.jspError(
  DefaultErrorHandler.java:39)
  [... SNIP
  ...]
  javax.servlet.http.HttpServlet.service(HttpServlet.java:802) 
  
  In short, it fails; in three noticeably different
  ways, granted; but it still
  fails. What on EARTH am I doing wrong or missing out?!
  I'd really appreciate
  some feedback on this. Thank you in advance.
  
  
  Here are the files:-
  
  ** SKELETON.JSP:
  html
  jsp:useBean id=beanId class=subclass.Beany
  scope=session / 
  headtitleFoo Bar/title/head
  body
  h1Foo Bar/h1
  Duzzy wuzzy was a duck; ducky fuzzy duck a wuzz blah
  blah some more yak.
  /body
  /html 
  ---
  ** WEB.XML
  ?xml version=1.0 encoding=ISO-8859-1?
  !-- Copyright 2004 The Apache [SNIP] --
  web-app xmlns= http://java.sun.com/xml/ns/j2ee;
  
  xmlns:xsi=http://www.w3.org/2001/XMLSchema-instance;
  
  xsi:schemaLocation= 

Re: How do I handle International Characters

2005-05-07 Thread David Harland
#3655;Hi Mark,

Many thanks for your help.

Dave.

--- Mark Thomas [EMAIL PROTECTED] wrote:
 David,
 
 You also need to look at how the parameters are set
 in the first place. 
 Are you using GET or POST? If you are using GET have
 you set any of the 
 character encoding settings on the connector?
 
 The following index.jsp works for me:
 %@ page contentType=text/html; charset=UTF-8 %
 !DOCTYPE HTML PUBLIC -//W3C//DTD HTML 4.01
 Transitional//EN
 html
head
  titleCharacter encoding test page/title
/head
body
  pData posted to this form was:
  %
request.setCharacterEncoding(UTF-8);
out.print(request.getParameter(mydata));
  %
 
  /p
  form method=post action=index.jsp
input type=text name=mydata
input type=submit value=Submit /
input type=reset value=Reset /
  /form
/body
 /html
 
 
 David Harland wrote:
  Hi Mark
  
  If I have tried the following.
  
  response.setContentType(text/html;
  charset=utf-8);
  PrintWriter out = response.getWriter();
  request.setCharacterEncoding(UTF-8);
  String test=request.getParameter(login);
  out.println(Input string:+test);
 
 out.println(URLEncoder.encode(test,UTF-8));
  out.close();
  
  What is output to the browser is Unicode instead
 of
  the characters. If I look at the source of the
  returned page. I see
  #3615;#3627;#3585;#3615;#3627;#3585; instead
 of
  characters like
 

#3585;#3619;#3640;#3591;#3648;#3607;#3614;#3631;.
  
  Regards
  
  David.
  
  --- Mark Thomas [EMAIL PROTECTED] wrote:
  
 

http://jakarta.apache.org/tomcat/faq/misc.html#tomcat5CharEncoding
  
 Mark
 
 David Harland wrote:
 
 I am using Tomcat 5.0 and I am trying to receive
 
 and
 
 send  thai characters. Can someone please tell me
 
 the
 
 simplest ways to do this.
 
 Many thanks
 
 Dave.
 

__
 Do You Yahoo!?
 Tired of spam?  Yahoo! Mail has the best spam
 
 protection around 
 
 http://mail.yahoo.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]
 
 
  
  
  
  
  __ 
  Yahoo! Mail Mobile 
  Take Yahoo! Mail with you! Check email on your
 mobile phone. 
  http://mobile.yahoo.com/learn/mail 
  
 

-
  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]
 
 

__
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 

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



ClassNotFoundException - common/lib works, shared/lib gets exception

2005-05-07 Thread Rich Mayfield
 So that I avoid already loaded classloader problems with jar's that 
front native library calls via JNI, I am following the pattern of 
putting the jars into shared/lib.

However, I get a ClassNotFoundException.  If I put this into 
CATALINA_HOME/common/lib, everything works fine.  It's my impression, though, 
that one ought to put it into shared/lib.

I've tried both CATALINA_HOME/shared/lib and CATALINA_BASE/shared/lib.

This is on Tomcat 5.0.28.  I have not changed 
CATALINA_HOME/conf/catalina.properties, which would imply that 
CATALINA_BASE/shared/lib should 
work.

Any ideas what might be going awry?

Thanks for you help.
rich 


-
Do you Yahoo!?
 Yahoo! Mail - Helps protect you from nasty viruses.

ClassNotFoundException - common/lib works, shared/lib gets exception

2005-05-07 Thread Rich Mayfield
So that I avoid already loaded classloader problems with jar's that 
front native library calls via JNI, I am following the pattern of 
putting the jars into shared/lib.

However, I get a ClassNotFoundException.  If I put this into 
CATALINA_HOME/common/lib, everything works fine.  It's my impression, 
though, 
that one ought to put it into shared/lib.

I've tried both CATALINA_HOME/shared/lib and CATALINA_BASE/shared/lib.

This is on Tomcat 5.0.28.  I have not changed 
CATALINA_HOME/conf/catalina.properties, which would imply that 
CATALINA_BASE/shared/lib should 
work.

Any ideas what might be going awry?

Thanks for you help.
rich 
 


-
Do you Yahoo!?
 Yahoo! Mail - You care about security. So do we.

Re: Tomcat 5 slow, it's in production, please help!

2005-05-07 Thread Parsons Technical Services
I think that would be the direction I would take.
If you need more proof:
Sniff the connection to the server to confirm the lack of available 
connections. So far it is pointing in that direction.

Another test you might do is create a connection from a known IP, close the 
browser and monitor the connection status. If it is hanging open then start 
digging.

I think you may also be experiencing  an issue of clickatosis. It occurs 
when the client doesn't think the page is responding quick enough and since 
more is better after 10 or 20 clicks they decide to wait or give up. Mean 
while for each click they cause a request which can bog things down. 
Wrapping this with the held connections you can get a scenario as such:

Client hits site.
No or slow response.
Clicks again. Or several times.
Often closes browser and tries over.
This creates a new connection request.
Snowballs from there.
Think about this, do you really get over a 100k users in six hours? Or even 
100k page requests? That's a lot of traffic. If the client machines abandons 
the connection before the server, then establishes a new one, it compound 
the problem.

Find a way to have the OS let Apache handle the connection timeout and get 
it down to a reasonable time.

Since you are inheriting this, there may be a reason that the connection 
timeout is set so high. If the original creator of this wanted the user to 
be able to sit on a page for a long time without losing the session and 
connection thus causing the user to have to re-authenticate. But then there 
is a trade off. which you are experiencing right now.

Get the time down until the complaint about having to re-login get too high 
or until the connection speed delay is acceptable.

Just my $0.015
Doug
- Original Message - 
From: Jeffrey [EMAIL PROTECTED]
To: Tomcat Users List tomcat-user@jakarta.apache.org
Sent: Saturday, May 07, 2005 1:05 PM
Subject: Re: Tomcat 5 slow, it's in production, please help!


It seems that, at least in most cases, the main menu
page after a login is loaded slow. After that other
pages are loaded pretty quick. Does that mean once a
connection is established, browser and server
communication is ok. If that is the case, maybe I
should look more at the connection timeout at the OS
level (solaris 5.6) since I see a lot of TIME_WAIT at
the machine using the 'netstat -n' command.
--- Jeffrey [EMAIL PROTECTED] wrote:
Please see the answer embedded below.
--- Parsons Technical Services
[EMAIL PROTECTED] wrote:
 127421 over what period of time?
It's about 6 hours. But most of them are at the
first
hour or so.

 Without a profile it is impossible to say if
Tomcat
 can handle the load. But
 if the memory consumption and the CPU usage is low
 (as noted) it is fairly
 safe to say that Tomcat itself is not the bottle
 neck.

 Quick question, why are you using Apache?
I am using Apache SSL for SSL connections. It is the
original setup by someone else.

 Also what is the time out for the connection in
 Apache?
Apache's Timeout value is 300. MaxKeepAliveRequests
is
100 and KeepAliveTimeout is 15

 Do you get this slow reaction if you are hitting
 Tomcat directly?
I did get the slow reaction if I hit Tomcat directly
at port 8080 to the same webapp. But the tomcat
manager web pages seem show up fairly quick.

 I may be repeating something that was covered
 because I have not been
 reading this thread in detail. So sorry if already
 asked and answered.


 Doug



 - Original Message - 
 From: Jeffrey [EMAIL PROTECTED]
 To: Tomcat Users List
 tomcat-user@jakarta.apache.org
 Sent: Saturday, May 07, 2005 10:44 AM
 Subject: Re: Tomcat 5 slow, it's in production,
 please help!


  This website has many JSP pages of which each
has
 many
  JSPF included. I wonder whether or not the
system
 is
  not be able to handle this kind of  setting. But
  strange thing is that when we experienced the
  slowness, I looked at the usage of CPU and find
 that
  almost 90% of the CPU is idle.
 
  Do anyone know what kind of load a tomcat can
 handle.
  I am thinking that maybe a load balancer will
 help.
  But I am still puzzled by the fact of low CPU
 usage at
  the time of slowness.
 
  From the server status view in tomcat manager, I
 can
  see 's Request count: 127421'
 
  --- Jeffrey [EMAIL PROTECTED] wrote:
  I have a apache/tomcat environment that has
some
  problems recently. The environment has the
  following:
  1.  Apache 1.3
  2.  Tomcat 5.0.28 (Max memory 384mb)
  3.  JDK 1.4.2_06
 
  My apache has MaxClient set to 256 (apache
 default).
  The maxThread for tomcat is 500. The site is a
  database driven site.
 
  It seems working fine when load is low. But
when
  there
  are more than 150 threads (from the sever
status
  view
  of the tomcat manager), it's response time is
 very
  slow (5 - 10 minutes). I have tested the
database
  connections, they seem responding fairly well.
 
  Interesting thing is that most of time the slow
  response time only happens when a 

Re: context.xml created by Ant not discovered by Tomcat

2005-05-07 Thread Matt Galvin
 Here is context.xml...
 
 Context path=/xx docBase=xx crossContext=true
 
Resource name=jdbc/xxDb auth=Container 
 type=javax.sql.DataSource/
 
ResourceParams name=jdbc/xxDb
 
 parameternamefactory/namevalueorg.apache.commons.dbcp.BasicDataSourceFactory/value/parameter
 
  !-- Maximum number of dB connections in pool. Set to 0 for no limit.--
  !-- Maximum number of idle dB connections to retain in pool. Set to 0 
 for
 no limit.--
  !-- Maximum time to wait for a dB connection to become available in ms, 
 in
 this example 10 seconds. An Exception is thrown if this timeout is exceeded.
 Set to -1 to wait indefinitely. --
  parameternamemaxActive/namevalue100/value/parameter
  parameternamemaxIdle/namevalue30/value/parameter
  parameternamemaxWait/namevalue1/value/parameter
 
  !-- JDBC driver configuration  --
 
 parameternamedriverClassName/namevaluecom.mysql.jdbc.Driver/value/parameter
 
 parameternameurl/namevaluejdbc:mysql://localhost/xxDb/value/parameter
  parameternameusername/namevaluexx/value/parameter
  parameternamepassword/namevaluexx/value/parameter
 
/ResourceParams
 
  !-- Disables restart persistence of sessions --
  Manager pathname=/
 
 /Context

Well, the only thing I notice is that according to the tomcat 5.5.x docs at:

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

the dbcp resource take this for now:

--- snip ---
Resource name=jdbc/TestDB auth=Container type=javax.sql.DataSource
   maxActive=100 maxIdle=30 maxWait=1
   username=javauser password=javadude
driverClassName=com.mysql.jdbc.Driver
   url=jdbc:mysql://localhost:3306/javatest?autoReconnect=true/
--- snip ---

You may want to try it this way.

Matt

 --
 Lynn Hollerman.


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



confusion to DBCP

2005-05-07 Thread li yanjing
I'm using mysql + tomcat as server to run jsp pages.
and there are JavaBeans too.
I have read a lot on the web that using a connection pool is very good.
I just wondering why I should configure DBCP in tomcat?
i think if i write the database connection in jsp pages(not in beans)
I need configure DBCP in tomcat.
if in the page I just call some JavaBeans to connect to database, i
just need write a connection pool class in java.
is that true?
thanks

--

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



Re: trouble with Font objects in Tomcat

2005-05-07 Thread Daniel Watrous
Is there at least someone that could tell me where to find more
information about the option JAVA_OPTS=-Djava.awt.headless=true? 
What exactly is its purpose?  Thanks in advance.

Daniel

On 5/6/05, Daniel Watrous [EMAIL PROTECTED] wrote:
 Hello,
 
 I have a web application that uses java.awt.Font objects to render
 images.  The application will run in tomcat and that is where I have
 done development.  When I first tried to run the application on a
 Linux box with Tomcat 5.0.25 I got the following error:
 
 java.lang.NoClassDefFoundError
 at com.words2walls.customquote.CustomQuote.getQuoteFontName(Unknown 
 Source)
 at com.words2walls.webapp.filters.SessionQuoteFilter.doFilter(Unknown 
 Source)
 
 Here is the code call that throws the error:
 public String getQuoteFontName() {
 return QuoteFontType.getInstance(this.quoteFontCode).toString();
 }
 
 And the class that is being called:
 /*
   * QuoteFontType.java
  *
  * Created on April 15, 2005, 9:41 AM
  */
 
 package com.words2walls.customquote;
 
 import java.awt.Font;
 import java.awt.FontFormatException;
 import java.util.*;
 import java.io.*;
 
 import com.words2walls.customquote.exceptions.FontNotFoundException;
 
 /**
  * Type safe enumeration of available fonts
  *
   * @author Daniel Watrous
  */
 public class QuoteFontType {
 
 private static final String pathToWebapp = C:\\Program
 Files\\Apache Software Foundation\\Tomcat 5.0\\webapps\\words2walls;
 private static final String pathToPackage =
 \\WEB-INF\\classes\\com\\words2walls\\fonts\\;
 private String fontName;
 private int fontCode;
 private Font font;
 private static org.apache.log4j.Category cat =
 
 org.apache.log4j.Category.getInstance(QuoteFontType.class.getName());
 
 public static final QuoteFontType ADORABLE = new
 QuoteFontType(1,Adorable,adorable.ttf);
 private static final Map INSTANCES = new HashMap();
 
 static {
 cat.debug(Enter Static block to place fonts in INSTANCES Map);
 INSTANCES.put (ADORABLE.toInteger(), ADORABLE);
 cat.debug(Exit Static block with INSTANCES.size() =  +
 INSTANCES.size());
 }
 
 /** Creates a new instance of QuoteFontType */
 private QuoteFontType(int code, String fontName, String filename) {
 // create a font from the font file
 try {
 File fontFile = new File (pathToWebapp+pathToPackage+filename);
 FileInputStream fis = new FileInputStream(fontFile);
 font = Font.createFont(Font.TRUETYPE_FONT, fis);
 } catch (Exception e) {
 throw new FontNotFoundException(e);
 }
 // set member variables
 this.font = font;
 this.fontCode = code;
 this.fontName = fontName;
 }
 
 public String toString() {
 return fontName;
 }
 
 public Integer toInteger() {
 return new Integer(fontCode);
 }
 
 public static QuoteFontType getInstance(int code) {
 return (QuoteFontType) INSTANCES.get(new Integer(code));
 }
 
 public Font getFont() {
 return font;
 }
 
 }
 
 After some googling I found that if I set an environment variable
 JAVA_OPTS=-Djava.awt.headless=true that this error would go away.
 I'm not sure why this is the case, but it worked.
 
 I am now trying to test the application on a windows machine with
 Tomcat 5.0.30 and I get the same error.  I have set a Windows XP
 environment variable the same as mentioned above.  I have also added
 the option to the Java tab of the Tomcat monitor under Java Options:.
 
 What is the cause of this error?  Is there some way that I can make it
 work on both Windows and Linux?  Thanks in advance.
 
 Daniel


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



Re: trouble with Font objects in Tomcat

2005-05-07 Thread farhad
Look at this link:
http://java.sun.com/j2se/1.4.2/docs/guide/awt/AWTChanges.html#headless
This option is being used when you are operating on a machine without 
graphics support (usually in a server configuration).  You will use the 
option for example when you want to do some AWT/Swing operation on the 
server side (image manipulation).  You want to check and see if you have 
graphics support on your server (on unix/linux run something like xcalc 
on the server).
Based on your information, it is your class that has problem and has 
nothing to do with graphics.

Daniel Watrous wrote:
Is there at least someone that could tell me where to find more
information about the option JAVA_OPTS=-Djava.awt.headless=true? 
What exactly is its purpose?  Thanks in advance.

Daniel
On 5/6/05, Daniel Watrous [EMAIL PROTECTED] wrote:
 

Hello,
I have a web application that uses java.awt.Font objects to render
images.  The application will run in tomcat and that is where I have
done development.  When I first tried to run the application on a
Linux box with Tomcat 5.0.25 I got the following error:
java.lang.NoClassDefFoundError
   at com.words2walls.customquote.CustomQuote.getQuoteFontName(Unknown 
Source)
   at com.words2walls.webapp.filters.SessionQuoteFilter.doFilter(Unknown 
Source)
Here is the code call that throws the error:
   public String getQuoteFontName() {
   return QuoteFontType.getInstance(this.quoteFontCode).toString();
   }
And the class that is being called:
/*
 * QuoteFontType.java
*
* Created on April 15, 2005, 9:41 AM
*/
package com.words2walls.customquote;
import java.awt.Font;
import java.awt.FontFormatException;
import java.util.*;
import java.io.*;
import com.words2walls.customquote.exceptions.FontNotFoundException;
/**
* Type safe enumeration of available fonts
*
 * @author Daniel Watrous
*/
public class QuoteFontType {
   private static final String pathToWebapp = C:\\Program
Files\\Apache Software Foundation\\Tomcat 5.0\\webapps\\words2walls;
   private static final String pathToPackage =
\\WEB-INF\\classes\\com\\words2walls\\fonts\\;
   private String fontName;
   private int fontCode;
   private Font font;
   private static org.apache.log4j.Category cat =
   org.apache.log4j.Category.getInstance(QuoteFontType.class.getName());
   public static final QuoteFontType ADORABLE = new
QuoteFontType(1,Adorable,adorable.ttf);
   private static final Map INSTANCES = new HashMap();
   static {
   cat.debug(Enter Static block to place fonts in INSTANCES Map);
   INSTANCES.put (ADORABLE.toInteger(), ADORABLE);
   cat.debug(Exit Static block with INSTANCES.size() =  +
INSTANCES.size());
   }
   /** Creates a new instance of QuoteFontType */
   private QuoteFontType(int code, String fontName, String filename) {
   // create a font from the font file
   try {
   File fontFile = new File (pathToWebapp+pathToPackage+filename);
   FileInputStream fis = new FileInputStream(fontFile);
   font = Font.createFont(Font.TRUETYPE_FONT, fis);
   } catch (Exception e) {
   throw new FontNotFoundException(e);
   }
   // set member variables
   this.font = font;
   this.fontCode = code;
   this.fontName = fontName;
   }
   public String toString() {
   return fontName;
   }
   public Integer toInteger() {
   return new Integer(fontCode);
   }
   public static QuoteFontType getInstance(int code) {
   return (QuoteFontType) INSTANCES.get(new Integer(code));
   }
   public Font getFont() {
   return font;
   }
}
After some googling I found that if I set an environment variable
JAVA_OPTS=-Djava.awt.headless=true that this error would go away.
I'm not sure why this is the case, but it worked.
I am now trying to test the application on a windows machine with
Tomcat 5.0.30 and I get the same error.  I have set a Windows XP
environment variable the same as mentioned above.  I have also added
the option to the Java tab of the Tomcat monitor under Java Options:.
What is the cause of this error?  Is there some way that I can make it
work on both Windows and Linux?  Thanks in advance.
Daniel
   

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