RE: New bie problem about Tomcat

2002-02-23 Thread Brian Adams

the service in not supposed to be called at init load time.  notice the
request response parameters in it.  this is called by http get or post
don't know why it loads twice..
B

-Original Message-
From: Krishna Bhamidi [mailto:[EMAIL PROTECTED]]
Sent: Saturday, February 23, 2002 11:29 AM
To: [EMAIL PROTECTED]
Subject: New bie problem about Tomcat


Hi,

I have a problem about a servlet that I want to start on load of Tomcat. I
included into the web.xml for the application under the on-load.

The init method of the servlet is called two times, but not the service
method of the servlet. I am not sure why the init method should get called 2
times?

We are using Tomcat 4.0 on Apache. What do we do to execute a servlet on
web-server startup?

Krishna.



--
To unsubscribe:   
For additional commands: 
Troubles with the list: 




RE: Tomcat 4 and Apache

2002-02-23 Thread Brian Adams

Hi Kristian,
I think I see the problem.
you do NOT need the line:
AddModule mod_jk.c


I have seen this error before and I am no connection geek but I thought this
line was not needed for mod_jk and I cchecked with my config and myne does
not have it either.

Goodluck,
brian

-Original Message-
From: Kristian Duske [mailto:[EMAIL PROTECTED]]
Sent: Saturday, February 23, 2002 1:11 PM
To: [EMAIL PROTECTED]
Subject: Tomcat 4 and Apache


Hi everyone,

I'm sorry that I'm probably the 100th person to ask this, but I have
searched google groups and the archives of this mailing list, both of which
failed to help me setting up Tomcat 4.01 with Apache 1.3.23 on Windows.

I have tried to load both mod_jk.dll and mod_webapp.so in Apache. mod_jk
gives me the following error:
Syntax error on line 195 of c:/programme/wamp/apache/conf/httpd.conf:
Can't locate API module structure `mod_jk' in file
c:/programme/wamp/apache/modules/mod_jk.dll: (127) Die angegebene Prozedur
wurde nicht gefunden:

The last bit translates to "The specified procedure was not found". The
relevant lines in my httpd.conf are
LoadModule mod_jk modules/mod_jk.dll
AddModule mod_jk.c

I had more luck with mod_webapp, which loads properly using these lines:
LoadModule webapp_module modules/mod_webapp.so
AddModule mod_webapp.c
WebAppConnection conn  warp  localhost:8008

But when I add either (or both) of these lines
WebAppInfo /webapp-info
WebAppDeploy examples conn  /examples

apache -t gives me the following error:
C:\Programme\Wamp\Apache>apache -t
Syntax error on line 256 of c:/programme/wamp/apache/conf/httpd.conf:
Invalid virtual host name

where in line 256 is either one (or the first of)
WebAppInfo /webapp-info
WebAppDeploy examples conn  /examples

I have found out that other users had this problem when their ServerName
directive was commented out in their httpd.conf, and I have tried that
already, without luck.

Does anybody have an idea how to solve this problem?

Thank you very much
Kristian


--
To unsubscribe:   
For additional commands: 
Troubles with the list: 



--
To unsubscribe:   
For additional commands: 
Troubles with the list: 




mod_webapp on Linux - EAPI?

2002-02-23 Thread Kevin Williams

I downloaded the mod_webapp Linux binary for Tomcat 4.0.1 (I'm actually
running 4.0.2 though, if that matters) and installed it.  When Apache starts
up, I get the warning about needing to re-compile mod_webapp with -DEAPI...

Is there a mod_webapp binary available somewhere that has been compiled with
the EAPI option?  I've tried building it myself...  (./support/buildconf.sh
followed by ./configure) but when I run configure, I'm getting an error:
"cannot find or execute './configure' in 'webapp-module-1.0.1-tc401/apr'".
Aparently, my Debian unstable system doesn't quite have everything that's
needed for this build...

So, if I could just download a prebuilt binary from somewhere, it would just
be a lot easier. 

Thanks!
-Zak


--
To unsubscribe:   
For additional commands: 
Troubles with the list: 




Tomcat4.0.2 + JNDI jdbc + warp

2002-02-23 Thread Michael Donaghy

I've got a very simple servlet that gets a pooled JDBC connection to
MySQL that works just fine when I use :8080.  When using :80 with an
appache warp connection to tomcat, I can't get the connection.

I don't know much about JNDI, so that might be the source of my
problems.  Any and all help is greatly appreciated.

Michael



Relevant Code:

Context initCtx = new InitialContext();
Context envCtx = (Context) initCtx.lookup("java:comp/env");
Object ds = envCtx.lookup("jdbc/ResumeDB");
^^^
returns null on :80, but not :8080
WEB-INF/web.xml

  Resource reference for database
  jdbc/ResumeDB
  javax.sql.DataSource
  Container


conf/server.xml

  
  

  user
  
 

  password
  
 

  driverClassName
  org.gjt.mm.mysql.Driver
 

  driverName
  jdbc:mysql://localhost:3306/
 
  


--
To unsubscribe:   
For additional commands: 
Troubles with the list: 




RE: TC4 and cgi

2002-02-23 Thread Bill Boland

Jared,

Ironically, I also was trying to get the CGIServlet to work on Friday
with great difficulty. I believe I got it to work (although I am not a
Perl person). I am using tomcat on Windows 2000 and I just wanted to
invoke an test executable batch file (test.bat) just to see if I could
get the ting to work. I assume you can replace what I did with your perl
scripts and be on your way.

One flaw I noticed in the documentation for the CGIServlet is that the
example does not work in TC 4.0.2 unless you specify a cgiPathPrefix of
"WEB-INF/cgi". The default is actually a null value and so no path is
added to the base of the web application. For example, if the web
application is at path "/foo" and you do not specify a cgiPathPrefix,
then when you enter http://localhost/foo/cgi-bin/test.bat it looks at
the "/foo" directory. At least the source code and testing proved
otherwise. I hope some contributor will read this and verify and correct
this. I'm new to this list so I don't know the ropes too well.

I am using TC as a web server and have not attempted to integrate it
with Apache HTTP Server. Of course, the Apache Server can handle the CGI
requests for you too.

Anyway, here's some snippets from the web.xml file for a web application
in TC 4.0.2. My web application has a path of "/foo" for the web.xml
file is at "/foo/WEB-INF/web.xml" and I create the directory named "cgi"
in the "/foo/WEB-INF" directory. I renamed just the
servlets-cgi.renametojar since I only needed the CGI capability. Now I
just need to hook into the CGI I want to use (Crystal Reports CGI
interface).


  
cgi
 
org.apache.catalina.servlets.CGIServlet

  cgiPathPrefix
  WEB-INF/cgi


  debug
  99

  

  
cgi
/cgi-bin/*
  


Hope this helps,

bill


-Original Message-
From: Jared Nedzel [mailto:[EMAIL PROTECTED]] 
Sent: Friday, February 22, 2002 12:17 PM
To: Tomcat Users List
Subject: Re: TC4 and cgi

Paul:

That doesn't appear to me to be the case, given that TC 4
has a bunch of stuff in web.xml concerning CGIs.  For example
there are entries in web.xml like:


RE: Help Preventing VM & Tomcat Crash

2002-02-23 Thread Shawn Church

One more thing.  There is a fix in jdk1.4.0 which addresses this problem,
where the native code exception is handled correctly.  With this version,
the IOExceptions may be caught and treated as normal behavior.

Here's the fix:

http://developer.java.sun.com/developer/bugParade/bugs/4546112.html

Shawn


-Original Message-
From: Shawn Church [mailto:[EMAIL PROTECTED]]
Sent: Saturday, February 23, 2002 3:32 PM
To: Tomcat Users List
Subject: RE: Help Preventing VM & Tomcat Crash


So much for that theory.

However, your guess is pretty close.  I found something which you might find
interesting.  This is a known bug, which you can check out here:

http://developer.java.sun.com/developer/bugParade/bugs/4502892.html

The problem occurs when the socket is prematurely closed.  The workaround is
to buffer the output via ByteArrayOutputStream, isolating the native method
from stream disconnections.

The evaluation of the bug I will include here for convenience:

***
The JPEG library is not MT-safe.  In particular, there is a definition of
a global variable "struct error_mgr ek_err" which is used by all threads
for error handling -- including a setjmp buffer.  Consequently, when an
error does occur while more than one thread is executing in the native
library, it is common for that thread to longjmp to another thread's state.
It then uses the wrong JNIEnv pointer and trashes the VM.
x@x 2001-10-09

This bug has indeed been fixed in merlin-rc1, but its associated regression
test
(JPEGMultithread.java) is confusing and potentially misleading.  This is
addressed by another bug (4546112 - Reg-test JPEGMultithread.java Failing).
The regression test currently throws exceptions endlessly if bug 4502892 is
not
present, and hangs or crashes the VM if bug 4502892 is present.  This is bad
behavior for a regression test, so it will be updated in accordance with
4546112.
x@x 2001-12-19
***

Hope this helps more,
Shawn


-Original Message-
From: Kennedy Clark [mailto:[EMAIL PROTECTED]]
Sent: Saturday, February 23, 2002 2:32 PM
To: Tomcat Users List
Subject: RE: Help Preventing VM & Tomcat Crash


Hi Shawn,

Many thanks for the note & the suggestion!  I am using MySQL as my Db and
MM.MySQL is my driver (mm.mysql-2.0.11-bin.jar).  Given that this is a Type
4 driver, I don't think I should be getting a native code crash involving
database access, right?

I could be missing something, but it seems that the
sun.awt.image.codec.JPEGImageEncoderImpl.writeJPEGStream() method (which is
native code) is trying to write to my output stream and running into
trouble.  I assume this is because the user has clicked on an image serving
as a link to another web page and now Tomcat is off trying to handle the
new page.  My best guess is that in the process of doing so, the output
streams used by writeJPEGStream() are being torn down, but the native code
doesn't know this and it's causing the VM to puke.  Does anyone think my
logic makes sense?  Better yet, does anyone know a way to prevent it? :-)

Regards, Kennedy

At 09:02 AM 2/23/2002 -0600, Shawn Church wrote:
>Looks like you are using the JDBC-ODBC bridge (maybe to an MS Access or MS
>SQL Server database?), which is not thread-safe and is not intended for use
>in production environments.  My guess is that one thread (the current
thread
>servicing the Thumbnail servlet) has a db connection open, and the next
>request (the user clicking the thumbnail) opens another db connection.
This
>guess is based on these lines in your exception:
>
>An unexpected exception has been detected in native code outside the VM.
>Unexpected Signal : unknown exception code occurred at PC=0x77fb16cc
>Function name=RtlTraceDatabaseEnumerate
>Library=C:\WINNT\System32\ntdll.dll
>
>If this is the case, try finding a pure Java (type 4) JDBC driver for your
>database.
>
>Shawn
>
>
>-Original Message-
>From: Kennedy Clark [mailto:[EMAIL PROTECTED]]
>Sent: Saturday, February 23, 2002 5:36 AM
>To: [EMAIL PROTECTED]
>Subject: Help Preventing VM & Tomcat Crash
>
>
>I'm working on a servlet that shrinks JPEG photos on the fly to create
>thumbnails.  When the user selects the thumbnail page, a JSP generates HTML
>that results in many calls to the thumbnail servlet.  If the user is
>patient and waits for all of the thumbnails to load, everything works great
>-- they can click on a thumbnail to see the full-size version of that
>JPEG.  However, if the use clicks on a photo while they are still loading,
>I get the exception dump and crash shown at the bottom.  Any help greatly
>appreciated!  Regards, Kennedy
>
>Here is my thumbnail servlet:
>/*
>   * Note: JPEG manipulation code comes from Sun:
>   * http://developer.java.sun.com/developer/TechTips/1999/tt1021.html#tip1
>   */
>package gallery.servlet;
>
>import java.io.*;
>import java.text.*;
>import java.util.*;
>import javax.servlet.*;
>import javax.servlet.http.*;
>import java.awt.Image;
>import java.awt.Graphics2D;
>import java.awt.geom.

RE: Help Preventing VM & Tomcat Crash

2002-02-23 Thread Shawn Church

So much for that theory.

However, your guess is pretty close.  I found something which you might find
interesting.  This is a known bug, which you can check out here:

http://developer.java.sun.com/developer/bugParade/bugs/4502892.html

The problem occurs when the socket is prematurely closed.  The workaround is
to buffer the output via ByteArrayOutputStream, isolating the native method
from stream disconnections.

The evaluation of the bug I will include here for convenience:

***
The JPEG library is not MT-safe.  In particular, there is a definition of
a global variable "struct error_mgr ek_err" which is used by all threads
for error handling -- including a setjmp buffer.  Consequently, when an
error does occur while more than one thread is executing in the native
library, it is common for that thread to longjmp to another thread's state.
It then uses the wrong JNIEnv pointer and trashes the VM.
x@x 2001-10-09

This bug has indeed been fixed in merlin-rc1, but its associated regression
test
(JPEGMultithread.java) is confusing and potentially misleading.  This is
addressed by another bug (4546112 - Reg-test JPEGMultithread.java Failing).
The regression test currently throws exceptions endlessly if bug 4502892 is
not
present, and hangs or crashes the VM if bug 4502892 is present.  This is bad
behavior for a regression test, so it will be updated in accordance with
4546112.
x@x 2001-12-19
***

Hope this helps more,
Shawn


-Original Message-
From: Kennedy Clark [mailto:[EMAIL PROTECTED]]
Sent: Saturday, February 23, 2002 2:32 PM
To: Tomcat Users List
Subject: RE: Help Preventing VM & Tomcat Crash


Hi Shawn,

Many thanks for the note & the suggestion!  I am using MySQL as my Db and
MM.MySQL is my driver (mm.mysql-2.0.11-bin.jar).  Given that this is a Type
4 driver, I don't think I should be getting a native code crash involving
database access, right?

I could be missing something, but it seems that the
sun.awt.image.codec.JPEGImageEncoderImpl.writeJPEGStream() method (which is
native code) is trying to write to my output stream and running into
trouble.  I assume this is because the user has clicked on an image serving
as a link to another web page and now Tomcat is off trying to handle the
new page.  My best guess is that in the process of doing so, the output
streams used by writeJPEGStream() are being torn down, but the native code
doesn't know this and it's causing the VM to puke.  Does anyone think my
logic makes sense?  Better yet, does anyone know a way to prevent it? :-)

Regards, Kennedy

At 09:02 AM 2/23/2002 -0600, Shawn Church wrote:
>Looks like you are using the JDBC-ODBC bridge (maybe to an MS Access or MS
>SQL Server database?), which is not thread-safe and is not intended for use
>in production environments.  My guess is that one thread (the current
thread
>servicing the Thumbnail servlet) has a db connection open, and the next
>request (the user clicking the thumbnail) opens another db connection.
This
>guess is based on these lines in your exception:
>
>An unexpected exception has been detected in native code outside the VM.
>Unexpected Signal : unknown exception code occurred at PC=0x77fb16cc
>Function name=RtlTraceDatabaseEnumerate
>Library=C:\WINNT\System32\ntdll.dll
>
>If this is the case, try finding a pure Java (type 4) JDBC driver for your
>database.
>
>Shawn
>
>
>-Original Message-
>From: Kennedy Clark [mailto:[EMAIL PROTECTED]]
>Sent: Saturday, February 23, 2002 5:36 AM
>To: [EMAIL PROTECTED]
>Subject: Help Preventing VM & Tomcat Crash
>
>
>I'm working on a servlet that shrinks JPEG photos on the fly to create
>thumbnails.  When the user selects the thumbnail page, a JSP generates HTML
>that results in many calls to the thumbnail servlet.  If the user is
>patient and waits for all of the thumbnails to load, everything works great
>-- they can click on a thumbnail to see the full-size version of that
>JPEG.  However, if the use clicks on a photo while they are still loading,
>I get the exception dump and crash shown at the bottom.  Any help greatly
>appreciated!  Regards, Kennedy
>
>Here is my thumbnail servlet:
>/*
>   * Note: JPEG manipulation code comes from Sun:
>   * http://developer.java.sun.com/developer/TechTips/1999/tt1021.html#tip1
>   */
>package gallery.servlet;
>
>import java.io.*;
>import java.text.*;
>import java.util.*;
>import javax.servlet.*;
>import javax.servlet.http.*;
>import java.awt.Image;
>import java.awt.Graphics2D;
>import java.awt.geom.AffineTransform;
>import java.awt.image.BufferedImage;
>import javax.swing.ImageIcon;
>import com.sun.image.codec.jpeg.JPEGCodec;
>import com.sun.image.codec.jpeg.JPEGImageEncoder;
>
>
>/**
>   * Return a thumbnail of the image specified in the name parameter
>   */
>
>public class Thumbnail extends HttpServlet {
>
>
>  public void doGet(HttpServletRequest request,
>HttpServletResponse response)
>  throws IOException, ServletException
>  {
>   

RE: Help Preventing VM & Tomcat Crash

2002-02-23 Thread Kennedy Clark

Hi Shawn,

Many thanks for the note & the suggestion!  I am using MySQL as my Db and 
MM.MySQL is my driver (mm.mysql-2.0.11-bin.jar).  Given that this is a Type 
4 driver, I don't think I should be getting a native code crash involving 
database access, right?

I could be missing something, but it seems that the 
sun.awt.image.codec.JPEGImageEncoderImpl.writeJPEGStream() method (which is 
native code) is trying to write to my output stream and running into 
trouble.  I assume this is because the user has clicked on an image serving 
as a link to another web page and now Tomcat is off trying to handle the 
new page.  My best guess is that in the process of doing so, the output 
streams used by writeJPEGStream() are being torn down, but the native code 
doesn't know this and it's causing the VM to puke.  Does anyone think my 
logic makes sense?  Better yet, does anyone know a way to prevent it? :-)

Regards, Kennedy

At 09:02 AM 2/23/2002 -0600, Shawn Church wrote:
>Looks like you are using the JDBC-ODBC bridge (maybe to an MS Access or MS
>SQL Server database?), which is not thread-safe and is not intended for use
>in production environments.  My guess is that one thread (the current thread
>servicing the Thumbnail servlet) has a db connection open, and the next
>request (the user clicking the thumbnail) opens another db connection.  This
>guess is based on these lines in your exception:
>
>An unexpected exception has been detected in native code outside the VM.
>Unexpected Signal : unknown exception code occurred at PC=0x77fb16cc
>Function name=RtlTraceDatabaseEnumerate
>Library=C:\WINNT\System32\ntdll.dll
>
>If this is the case, try finding a pure Java (type 4) JDBC driver for your
>database.
>
>Shawn
>
>
>-Original Message-
>From: Kennedy Clark [mailto:[EMAIL PROTECTED]]
>Sent: Saturday, February 23, 2002 5:36 AM
>To: [EMAIL PROTECTED]
>Subject: Help Preventing VM & Tomcat Crash
>
>
>I'm working on a servlet that shrinks JPEG photos on the fly to create
>thumbnails.  When the user selects the thumbnail page, a JSP generates HTML
>that results in many calls to the thumbnail servlet.  If the user is
>patient and waits for all of the thumbnails to load, everything works great
>-- they can click on a thumbnail to see the full-size version of that
>JPEG.  However, if the use clicks on a photo while they are still loading,
>I get the exception dump and crash shown at the bottom.  Any help greatly
>appreciated!  Regards, Kennedy
>
>Here is my thumbnail servlet:
>/*
>   * Note: JPEG manipulation code comes from Sun:
>   * http://developer.java.sun.com/developer/TechTips/1999/tt1021.html#tip1
>   */
>package gallery.servlet;
>
>import java.io.*;
>import java.text.*;
>import java.util.*;
>import javax.servlet.*;
>import javax.servlet.http.*;
>import java.awt.Image;
>import java.awt.Graphics2D;
>import java.awt.geom.AffineTransform;
>import java.awt.image.BufferedImage;
>import javax.swing.ImageIcon;
>import com.sun.image.codec.jpeg.JPEGCodec;
>import com.sun.image.codec.jpeg.JPEGImageEncoder;
>
>
>/**
>   * Return a thumbnail of the image specified in the name parameter
>   */
>
>public class Thumbnail extends HttpServlet {
>
>
>  public void doGet(HttpServletRequest request,
>HttpServletResponse response)
>  throws IOException, ServletException
>  {
>  response.setContentType("image/jpeg");
>  File f = new File(request.getParameter("name"));
>  if (!f.exists())
>  return;
>  OutputStream os = response.getOutputStream();
>  createThumbnail(request.getParameter("name"), os, 150);
>  }
>
>  /**
>   * Reads an image in a file and creates a thumbnail to the output
>stream
>   *
>   * @param orig  The name of image file.
>   * @param thumb The name of thumbnail file.
>   * Will be created if necessary.
>   * @param maxDim The width and height of the thumbnail must
>   * be maxDim pixels or less.
>   */
>  public static void createThumbnail(String orig, OutputStream os, int
>maxDim) {
>  try {
>  // Get the image from a file.
>  Image inImage = new ImageIcon(orig).getImage();
>
>  // Determine the scale.
>  double scale = (double)maxDim/(double)inImage.getHeight(null);
>  if (inImage.getWidth(null) > inImage.getHeight(null)) {
>  scale = (double)maxDim/(double)inImage.getWidth(null);
>  }
>
>  // Determine size of new image.
>  // One of them should equal maxDim.
>  int scaledW = (int)(scale*inImage.getWidth(null));
>  int scaledH = (int)(scale*inImage.getHeight(null));
>
>  // Create an image buffer in which to paint on.
>  BufferedImage outImage =
>new BufferedImage(scaledW, scaledH,
>BufferedImage.TYPE_INT_RGB);
>
>  // Set the scale.
>  

Re: [Mac OS X] /examples not working

2002-02-23 Thread Ken Martin

On Saturday, February 23, 2002, at 10:31 AM, Ken Pelletier wrote:

> Did you make sure to use gnutar and not tar?

Ken, you're my hero! Works perfectly and installed instantly. A 
very happy weekend development!

Man, this is great... I've mucked around with this for quite a 
while over a number of weeks. Ugh!

You know, the Apple instructions use 'tar' and not 'gnutar'... 
boy the time adding three letters could have saved me!

Thanks again!

Ken Martin


--
To unsubscribe:   
For additional commands: 
Troubles with the list: 




Re: [Mac OS X] /examples not working

2002-02-23 Thread Terje Dahl

Excelent tip

StuffIt Deluxe was no good!

I now unpacked it with gnutar, an reinstalled it.
And it works!!

Thanks alot!
(Spent weeks trying to figure out the problem)

Terje


--
To unsubscribe:   
For additional commands: 
Troubles with the list: 




Tomcat 4 and Apache

2002-02-23 Thread Kristian Duske

Hi everyone,

I'm sorry that I'm probably the 100th person to ask this, but I have
searched google groups and the archives of this mailing list, both of which
failed to help me setting up Tomcat 4.01 with Apache 1.3.23 on Windows.

I have tried to load both mod_jk.dll and mod_webapp.so in Apache. mod_jk
gives me the following error:
Syntax error on line 195 of c:/programme/wamp/apache/conf/httpd.conf:
Can't locate API module structure `mod_jk' in file
c:/programme/wamp/apache/modules/mod_jk.dll: (127) Die angegebene Prozedur
wurde nicht gefunden:

The last bit translates to "The specified procedure was not found". The
relevant lines in my httpd.conf are
LoadModule mod_jk modules/mod_jk.dll
AddModule mod_jk.c

I had more luck with mod_webapp, which loads properly using these lines:
LoadModule webapp_module modules/mod_webapp.so
AddModule mod_webapp.c
WebAppConnection conn  warp  localhost:8008

But when I add either (or both) of these lines
WebAppInfo /webapp-info
WebAppDeploy examples conn  /examples

apache -t gives me the following error:
C:\Programme\Wamp\Apache>apache -t
Syntax error on line 256 of c:/programme/wamp/apache/conf/httpd.conf:
Invalid virtual host name

where in line 256 is either one (or the first of)
WebAppInfo /webapp-info
WebAppDeploy examples conn  /examples

I have found out that other users had this problem when their ServerName
directive was commented out in their httpd.conf, and I have tried that
already, without luck.

Does anybody have an idea how to solve this problem?

Thank you very much
Kristian


--
To unsubscribe:   
For additional commands: 
Troubles with the list: 




Re: [Mac OS X] /examples not working

2002-02-23 Thread Terje Dahl

I used StuffIt (Deluxe). Are you saying that should be OK, or not?

Terje


--
To unsubscribe:   
For additional commands: 
Troubles with the list: 




Apache Tomcat/4.0.2 - HTTP Status 404 - /examples/jsp/

2002-02-23 Thread Terje Dahl

Yes, I am a "newbie", but...

Installed Tomcat 4.0.2 (precompiled version) (on Mac OS X (That's 
unix) ) in a directory I called "Tomcat".

Tomcat starts just fine with this script:
#!/bin/sh
export CATALINA_HOME=/Tomcat/jakarta-tomcat-4.0.2
export JAVA_HOME=/System/Library/Frameworks/JavaVM.framework/Home
$CATALINA_HOME/bin/startup.sh

I get the default html-pages in "ROOT" no problem.
I can also run JSP-pages from "ROOT".
But nothing in "examples" works!
(I didn't change anything during installation, and there are lots of 
files and folder present in "examples"..)

Shouldn't I at least be able to expect at least the enclosed examples to 
run corectly "out of the box"?..

Terje


--
To unsubscribe:   
For additional commands: 
Troubles with the list: 




Re: Tomcat failure to start

2002-02-23 Thread Dieter Lunn

Can someone help please?

On February 22, 2002 03:10 pm, you wrote:
> Hi,
>
> Tomcat doesn't want to start on my RedHat 7.1 system.  I get this error in
> my log:
> usage: java org.apache.catalina.startup.Catalina [ -config {pathname} ] [
> -debug ] [ -nonaming ] { start | stop }
>
> and catalina.sh is loading
> org.apache.catalina.startup.Bootstrap
>
> Can someone help please?
>
> --
> To unsubscribe:   
> For additional commands: 
> Troubles with the list: 

--
To unsubscribe:   
For additional commands: 
Troubles with the list: 




New bie problem about Tomcat

2002-02-23 Thread Krishna Bhamidi

Hi,

I have a problem about a servlet that I want to start on load of Tomcat. I included 
into the web.xml for the application under the on-load.

The init method of the servlet is called two times, but not the service method of the 
servlet. I am not sure why the init method should get called 2 times?

We are using Tomcat 4.0 on Apache. What do we do to execute a servlet on web-server 
startup? 

Krishna. 




Re: [Mac OS X] /examples not working

2002-02-23 Thread Ken Pelletier

Ken,

Did you make sure to use gnutar and not tar?  I believe the Jakarta tar 
files use gnu extensions, and gnutar must be used.  At least that's what 
I read and it got me out of a jam with a mangled pathname within Tomcat 
when unpacked with tar - or StuffIt, for that matter.

- Ken

On Friday, February 22, 2002, at 05:12 PM, Ken Martin wrote:

> I have gone through the list archives and can't find a solution (though 
> this could certainly be my fault)...
>
> I have installed Tomcat 4.0.1 but I can't get the /examples to work. I 
> did try decompressing the .tar using Stuffit, tar in Terminal, and I 
> tried the .zip.
>
> I tried to follow the instructions at the Apple site (and I think I 
> succeeded in following the instructions), but no /examples. I also 
> tried to set it up for Apache and get the same error as I get at :8080.
>
> Thanks for any help/advice,
>
> Ken Martin
>
>
> --
> To unsubscribe:   
> For additional commands: 
> Troubles with the list: 
>
>


--
To unsubscribe:   
For additional commands: 
Troubles with the list: 




RE: Help Preventing VM & Tomcat Crash

2002-02-23 Thread Shawn Church

Looks like you are using the JDBC-ODBC bridge (maybe to an MS Access or MS
SQL Server database?), which is not thread-safe and is not intended for use
in production environments.  My guess is that one thread (the current thread
servicing the Thumbnail servlet) has a db connection open, and the next
request (the user clicking the thumbnail) opens another db connection.  This
guess is based on these lines in your exception:

An unexpected exception has been detected in native code outside the VM.
Unexpected Signal : unknown exception code occurred at PC=0x77fb16cc
Function name=RtlTraceDatabaseEnumerate
Library=C:\WINNT\System32\ntdll.dll

If this is the case, try finding a pure Java (type 4) JDBC driver for your
database.

Shawn


-Original Message-
From: Kennedy Clark [mailto:[EMAIL PROTECTED]]
Sent: Saturday, February 23, 2002 5:36 AM
To: [EMAIL PROTECTED]
Subject: Help Preventing VM & Tomcat Crash


I'm working on a servlet that shrinks JPEG photos on the fly to create
thumbnails.  When the user selects the thumbnail page, a JSP generates HTML
that results in many calls to the thumbnail servlet.  If the user is
patient and waits for all of the thumbnails to load, everything works great
-- they can click on a thumbnail to see the full-size version of that
JPEG.  However, if the use clicks on a photo while they are still loading,
I get the exception dump and crash shown at the bottom.  Any help greatly
appreciated!  Regards, Kennedy

Here is my thumbnail servlet:
/*
  * Note: JPEG manipulation code comes from Sun:
  * http://developer.java.sun.com/developer/TechTips/1999/tt1021.html#tip1
  */
package gallery.servlet;

import java.io.*;
import java.text.*;
import java.util.*;
import javax.servlet.*;
import javax.servlet.http.*;
import java.awt.Image;
import java.awt.Graphics2D;
import java.awt.geom.AffineTransform;
import java.awt.image.BufferedImage;
import javax.swing.ImageIcon;
import com.sun.image.codec.jpeg.JPEGCodec;
import com.sun.image.codec.jpeg.JPEGImageEncoder;


/**
  * Return a thumbnail of the image specified in the name parameter
  */

public class Thumbnail extends HttpServlet {


 public void doGet(HttpServletRequest request,
   HttpServletResponse response)
 throws IOException, ServletException
 {
 response.setContentType("image/jpeg");
 File f = new File(request.getParameter("name"));
 if (!f.exists())
 return;
 OutputStream os = response.getOutputStream();
 createThumbnail(request.getParameter("name"), os, 150);
 }

 /**
  * Reads an image in a file and creates a thumbnail to the output
stream
  *
  * @param orig  The name of image file.
  * @param thumb The name of thumbnail file.
  * Will be created if necessary.
  * @param maxDim The width and height of the thumbnail must
  * be maxDim pixels or less.
  */
 public static void createThumbnail(String orig, OutputStream os, int
maxDim) {
 try {
 // Get the image from a file.
 Image inImage = new ImageIcon(orig).getImage();

 // Determine the scale.
 double scale = (double)maxDim/(double)inImage.getHeight(null);
 if (inImage.getWidth(null) > inImage.getHeight(null)) {
 scale = (double)maxDim/(double)inImage.getWidth(null);
 }

 // Determine size of new image.
 // One of them should equal maxDim.
 int scaledW = (int)(scale*inImage.getWidth(null));
 int scaledH = (int)(scale*inImage.getHeight(null));

 // Create an image buffer in which to paint on.
 BufferedImage outImage =
   new BufferedImage(scaledW, scaledH,
BufferedImage.TYPE_INT_RGB);

 // Set the scale.
 AffineTransform tx = new AffineTransform();

 // If the image is smaller than
 //the desired image size,
 // don't bother scaling.
 if (scale < 1.0d) {
 tx.scale(scale, scale);
 }

 // Paint image.
 Graphics2D g2d = outImage.createGraphics();
 g2d.drawImage(inImage, tx, null);
 g2d.dispose();

 // JPEG-encode the image and write to file.
 //OutputStream os = new FileOutputStream(thumb);
 JPEGImageEncoder encoder = JPEGCodec.createJPEGEncoder(os);
 encoder.encode(outImage);
 //os.close();
 } catch (IOException e) {
 e.printStackTrace();
 }
 }
}



And here is the exception/crash:
java.io.IOException: reading encoded JPEG Stream
 at sun.awt.image.codec.JPEGImageEncoderImpl.writeJPEGStream(Native
Method)
 at
sun.awt.image.codec.JPEGImageEncoderImpl.encode(JPEGImageEncoderImpl.java:47
5)

 at
sun.awt.image.codec.JPEGImageEncoderImpl.encode(JPEGImageEncoderImpl.java:23
1)
 a

Re: Checking with DB

2002-02-23 Thread Anja Falkner

Hi,

I don't know if this is the cause of your problem, but you have to decode
the ' in your SQL-string.
Write \' instead of '

Anja


--
To unsubscribe:   
For additional commands: 
Troubles with the list: 




Help Preventing VM & Tomcat Crash

2002-02-23 Thread Kennedy Clark

I'm working on a servlet that shrinks JPEG photos on the fly to create 
thumbnails.  When the user selects the thumbnail page, a JSP generates HTML 
that results in many calls to the thumbnail servlet.  If the user is 
patient and waits for all of the thumbnails to load, everything works great 
-- they can click on a thumbnail to see the full-size version of that 
JPEG.  However, if the use clicks on a photo while they are still loading, 
I get the exception dump and crash shown at the bottom.  Any help greatly 
appreciated!  Regards, Kennedy

Here is my thumbnail servlet:
/*
  * Note: JPEG manipulation code comes from Sun:
  * http://developer.java.sun.com/developer/TechTips/1999/tt1021.html#tip1
  */
package gallery.servlet;

import java.io.*;
import java.text.*;
import java.util.*;
import javax.servlet.*;
import javax.servlet.http.*;
import java.awt.Image;
import java.awt.Graphics2D;
import java.awt.geom.AffineTransform;
import java.awt.image.BufferedImage;
import javax.swing.ImageIcon;
import com.sun.image.codec.jpeg.JPEGCodec;
import com.sun.image.codec.jpeg.JPEGImageEncoder;


/**
  * Return a thumbnail of the image specified in the name parameter
  */

public class Thumbnail extends HttpServlet {


 public void doGet(HttpServletRequest request,
   HttpServletResponse response)
 throws IOException, ServletException
 {
 response.setContentType("image/jpeg");
 File f = new File(request.getParameter("name"));
 if (!f.exists())
 return;
 OutputStream os = response.getOutputStream();
 createThumbnail(request.getParameter("name"), os, 150);
 }

 /**
  * Reads an image in a file and creates a thumbnail to the output stream
  *
  * @param orig  The name of image file.
  * @param thumb The name of thumbnail file.
  * Will be created if necessary.
  * @param maxDim The width and height of the thumbnail must
  * be maxDim pixels or less.
  */
 public static void createThumbnail(String orig, OutputStream os, int 
maxDim) {
 try {
 // Get the image from a file.
 Image inImage = new ImageIcon(orig).getImage();

 // Determine the scale.
 double scale = (double)maxDim/(double)inImage.getHeight(null);
 if (inImage.getWidth(null) > inImage.getHeight(null)) {
 scale = (double)maxDim/(double)inImage.getWidth(null);
 }

 // Determine size of new image.
 // One of them should equal maxDim.
 int scaledW = (int)(scale*inImage.getWidth(null));
 int scaledH = (int)(scale*inImage.getHeight(null));

 // Create an image buffer in which to paint on.
 BufferedImage outImage =
   new BufferedImage(scaledW, scaledH, BufferedImage.TYPE_INT_RGB);

 // Set the scale.
 AffineTransform tx = new AffineTransform();

 // If the image is smaller than
 //the desired image size,
 // don't bother scaling.
 if (scale < 1.0d) {
 tx.scale(scale, scale);
 }

 // Paint image.
 Graphics2D g2d = outImage.createGraphics();
 g2d.drawImage(inImage, tx, null);
 g2d.dispose();

 // JPEG-encode the image and write to file.
 //OutputStream os = new FileOutputStream(thumb);
 JPEGImageEncoder encoder = JPEGCodec.createJPEGEncoder(os);
 encoder.encode(outImage);
 //os.close();
 } catch (IOException e) {
 e.printStackTrace();
 }
 }
}



And here is the exception/crash:
java.io.IOException: reading encoded JPEG Stream
 at sun.awt.image.codec.JPEGImageEncoderImpl.writeJPEGStream(Native 
Method)
 at 
sun.awt.image.codec.JPEGImageEncoderImpl.encode(JPEGImageEncoderImpl.java:475)

 at 
sun.awt.image.codec.JPEGImageEncoderImpl.encode(JPEGImageEncoderImpl.java:231)
 at gallery.servlet.Thumbnail.createThumbnail(Thumbnail.java:85)
 at gallery.servlet.Thumbnail.doGet(Thumbnail.java:35)
 at javax.servlet.http.HttpServlet.service(HttpServlet.java:740)
 at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
 at 
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:247)
 at 
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:193)
 at 
org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:243)
 at 
org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:566)
 at 
org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)
 at 
org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
 at 
org.apache.catalina.core.StandardContextValve.invoke(