-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

To whom it may concern,

On 5/26/2009 10:22 PM, trojansnake12 wrote:
> I am about at my wits' end here with Tomcat on Debian.

With one exception, I think all your problems are self-inflicted. Let's
see...

> I have an app called
> Project.java

...which isn't in a package, violating the servlet specification. Put
Project.java into a package (use "package foo.bar;" in your code) and
into a subdirectory of WEB-INF/classes (like /foo/bar).

> and all it should do is grab a file from the file system, and
> output that on the browser window.

Note that you are doing WAY more work than necessary.

> On my windows box, this works perfectly.

Okay, what is different about your configuration?

> I'm using jdk6 on the windows box, and gcj4.3 on the debian box.

I suspect you mean that you are using Sun's JDK on your Windows box?
GCJ, for whatever reason, is next to worthless for use with web
applications. I really don't understand it, since that project has been
around for a long time and even comes preinstalled on many GNU/Linux
distros.

Switch to a Sun JVM on your Debian install (which it looks like you've
already done) and I suspect you'll get better results.

> My other
> apps work fine, none of them working with ImageIO.  I will post the code for
> the servlet below here.

Maybe ImageIO is the problem? This is where Debian can actually fight
you: if you don't have the native library required for ImageIO
installed, your stuff won't work.

> The BOLDED line below is the one that, if uncommented, totally breaks my
> server.

This list doesn't allow HTML posts, so we're only seeing the text
version. I suspect the line you meant was:

>  ImageIO.write(bufi,"bmp",response.getOutputStream());

> Like, if I travel to the URL, I get a server connection error, and
> my entire Tomcat server shuts down.

Wow, really? Your JVM crashes? That sounds like a serious bug in GCJ
which you should report.

> Why the hell is this happening?

Did you get a stack trace in catalina.out when your server died? How
about any logging of any kind?

>                       File myGifFile = new 
> File("../webapps/geosim/WEB-INF/images/test.jpg");
>                       if(!myGifFile.exists())
>                               return;

Note that it's not polite to return /nothing/. 200 OK is the default
response type, but obviously in your case the situation is /not/ OK.
Consider responding with a 404 or even a 500.

>                       BufferedImage bufi = ImageIO.read(myGifFile);
>                       response.setContentType("image/bmp"); 
>                       ImageIO.write(bufi,"bmp",response.getOutputStream());

Ugh. Transcoding? Why not just convert the GIF -> BMP once and serve the
copy?

It seems you have everything working, now, after a JVM upgrade and a
Tomcat upgrade (to a "real" Tomcat). If you're motivated, please contact
the Debian folks and tell them that their stuff wasn't working.
Honestly, we'd like to stop telling Tomcat users to discard the
package-managed versions of Tomcat, but when they continue to fail we
have no choice. If you can help the Debian folks fix their packages,
then we will have fewer chances to complain about their packages :)

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

iEYEARECAAYFAkoe618ACgkQ9CaO5/Lv0PDJdgCfbSuxkJI42eGQH7aXMsttskgT
c2AAoIa7hjdeITYToKQEh/N6d8WUhRxL
=4W5P
-----END PGP SIGNATURE-----

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org

Reply via email to