You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Wileynet <wi...@wileynet.com> on 2003/03/09 21:26:37 UTC

Beginner Servlet Question

I've been racking my brain for days trying to figure out WHY I cannot
get this servlet to work. Hopefully someone has an idea. Im running
tomcat 4.1 on IIS . From what I've been reading and the directions I'm
following from a WROX book is that you don’t need the web.xml file if
your inside webapps for the browser to see it.

Directory ch03 is inside the webapps dir. Underneath ch03 I have
classes/com/wrox/jsp/ch03/myapp/MyServlet

Wrox tells me to type this into the browser.
http://localhost:8080/ch03/servlet/com.wrox.jsp.ch03.myapp.MyServlet

I didn’t use the (servlet) because I don’t have  a directory servlet and
Im having a hard time figuring out why that needs to be there. 

I also try it with the (servlet) and nothing. 

I put an index page in the ch03 directory and It pulls that up fine. It
just will not find this servlet??? The class path is set , everything
works except for this.

This is the code for the servlet. Am I just set up wrong, Ive been
everywere I RTFM and Im stumped. It SHOULD WORK !!!!!???? but it does
not.



package com.wrox.jsp.ch03.myapp;

import java.io.IOException;
import java.io.PrintWriter;

import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import javax.servlet.ServletException;

public class MyFirstServlet extends HttpServlet {

  public void doGet(HttpServletRequest request, 
                    HttpServletResponse response) throws
ServletException, 
                    IOException {
    response.setContentType("text/plain");
log("doGet was just called");
    PrintWriter out = response.getWriter();
    out.println("This is my first Servlet");

  } 
}


---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org


Re: debugging tomcat/jvm crash

Posted by Cameron Hart <ca...@paradise.net.nz>.
I ran Tomcat from the console, when the JVM crashed I got the following message:

****************
Another exception has been detected while we were handling last error.
Dumping information about last error:
ERROR REPORT FILE = (N/A)
PC                = 0x2BE5C46D
SIGNAL            = -1073741819
FUNCTION NAME     = (N/A)
OFFSET            = 0xFFFFFFFF
LIBRARY NAME      = (N/A)
Please check ERROR REPORT FILE for further information, if there is any.
Good bye.


Anyone know why this might occur or how to get the JVM to write to the error
report file?

Thanks.


Quoting cam.hart@paradise.net.nz:

> i have been experiencing a serious crash running my webapp on
> tomcat4.1.18 +
> j2sdk1.4.1_02 + win2k. the tomcat/java process completely disappears
> without a
> trace. nothing is left in any of the logs suggesting what caused the
> crash and
> we are unable to reproduce it in our testing environment.
> 
> can anybody give me some advice on how i can get more information on
> what is
> causing the crash. on a un*x os i would expect a core file to be left
> behind
> after a crash. does anyone know how it is possible to get that kind of
> crash
> data out of java on win2k?
> 
> thanks,
> 
> 
> ------------------------------------------------- --------------------
> To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tomcat-user-help@jakarta.apache.org
> 
>  

---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org


debugging tomcat/jvm crash

Posted by ca...@paradise.net.nz.
i have been experiencing a serious crash running my webapp on tomcat4.1.18 +
j2sdk1.4.1_02 + win2k. the tomcat/java process completely disappears without a
trace. nothing is left in any of the logs suggesting what caused the crash and
we are unable to reproduce it in our testing environment.

can anybody give me some advice on how i can get more information on what is
causing the crash. on a un*x os i would expect a core file to be left behind
after a crash. does anyone know how it is possible to get that kind of crash
data out of java on win2k?

thanks,


---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org


RE: Beginner Servlet Question

Posted by jsp <js...@wileynet.com>.
That solved the problem. More reading about the change that was made in
version 4.1.12 and about the servlet invoker did the trick.
Thanks again.



-----Original Message-----
From: jsp [mailto:jsp@wileynet.com] 
Sent: Sunday, March 09, 2003 2:00 PM
To: 'Tomcat Users List'; 'Jens Skripczynski'
Subject: RE: Beginner Servlet Question

This is what I have in my conf/web.xml regarding what you said.
<servlet>
  <servlet-name>invoker</servlet-name> 
 
<servlet-class>org.apache.catalina.servlets.InvokerServlet</servlet-clas
s> 
- <init-param>
  <param-name>debug</param-name> 
  <param-value>0</param-value> 
  </init-param>
  <load-on-startup>2</load-on-startup> 
  </servlet>

And this is what I see in the web.xml of the webapps/examples/web-inf
...
<!-- Define filter mappings for the defined filters -->
    <filter-mapping>
        <filter-name>Servlet Mapped Filter</filter-name>
	<servlet-name>invoker</servlet-name>
    </filter-mapping>
    <filter-mapping>
        <filter-name>Path Mapped Filter</filter-name>
	<url-pattern>/servlet/*</url-pattern>
    </filter-mapping>

Even if I cant figure out this concept and make it work with the
"Servlet"  mapping. It should still work if I use

http://localhost:8080/ch03/com.wrox.jsp.myapp.MyServlet with the file
structure of..

webapps/ch03/WEB-INF/classes/com/wrox/jsp/myapp/MyServlet.class

The servlets in the examples dir work great except my app that I'm
trying to create????

Thanks for your help.


You have to make sure, that the invoker servlet is mapped to /server
like
-------------
    <servlet-mapping>
        <servlet-name>invoker</servlet-name>
        <url-pattern>/servlet/*</url-pattern>
    </servlet-mapping>
-------------
This section is commented out in the conf/web.xml.

So you either need to add this line to your server web.xml or your
application.


Wouldn't it be a good idea to activate this mapping by default
in further tomcat distributions ?



Ciao

Jens Skripczynski
-- 
E-Mail: skripi(at)myrealbox(dot)com

Technology is a constand battle between manufacturers producing bigger
and
more idiot-proof systems and nature producing bigger and better idiots.
                                -- Slashdot signature


---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org


RE: Beginner Servlet Question

Posted by jsp <js...@wileynet.com>.
This is what I have in my conf/web.xml regarding what you said.
<servlet>
  <servlet-name>invoker</servlet-name> 
 
<servlet-class>org.apache.catalina.servlets.InvokerServlet</servlet-clas
s> 
- <init-param>
  <param-name>debug</param-name> 
  <param-value>0</param-value> 
  </init-param>
  <load-on-startup>2</load-on-startup> 
  </servlet>

And this is what I see in the web.xml of the webapps/examples/web-inf
...
<!-- Define filter mappings for the defined filters -->
    <filter-mapping>
        <filter-name>Servlet Mapped Filter</filter-name>
	<servlet-name>invoker</servlet-name>
    </filter-mapping>
    <filter-mapping>
        <filter-name>Path Mapped Filter</filter-name>
	<url-pattern>/servlet/*</url-pattern>
    </filter-mapping>

Even if I cant figure out this concept and make it work with the
"Servlet"  mapping. It should still work if I use

http://localhost:8080/ch03/com.wrox.jsp.myapp.MyServlet with the file
structure of..

webapps/ch03/WEB-INF/classes/com/wrox/jsp/myapp/MyServlet.class

The servlets in the examples dir work great except my app that I'm
trying to create????

Thanks for your help.


You have to make sure, that the invoker servlet is mapped to /server
like
-------------
    <servlet-mapping>
        <servlet-name>invoker</servlet-name>
        <url-pattern>/servlet/*</url-pattern>
    </servlet-mapping>
-------------
This section is commented out in the conf/web.xml.

So you either need to add this line to your server web.xml or your
application.


Wouldn't it be a good idea to activate this mapping by default
in further tomcat distributions ?



Ciao

Jens Skripczynski
-- 
E-Mail: skripi(at)myrealbox(dot)com

Technology is a constand battle between manufacturers producing bigger
and
more idiot-proof systems and nature producing bigger and better idiots.
                                -- Slashdot signature


---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org


Re: Beginner Servlet Question

Posted by Jens Skripczynski <sk...@mail2003.skripczynski.de>.
Wileynet:
> I've been racking my brain for days trying to figure out WHY I cannot
> get this servlet to work. Hopefully someone has an idea. Im running
> tomcat 4.1 on IIS . From what I've been reading and the directions I'm
> following from a WROX book is that you don’t need the web.xml file if
> your inside webapps for the browser to see it.

> Directory ch03 is inside the webapps dir. Underneath ch03 I have
> classes/com/wrox/jsp/ch03/myapp/MyServlet
> 
> Wrox tells me to type this into the browser.
> http://localhost:8080/ch03/servlet/com.wrox.jsp.ch03.myapp.MyServlet
You have to make sure, that the invoker servlet is mapped to /server like
-------------
    <servlet-mapping>
        <servlet-name>invoker</servlet-name>
        <url-pattern>/servlet/*</url-pattern>
    </servlet-mapping>
-------------
This section is commented out in the conf/web.xml.

So you either need to add this line to your server web.xml or your
application.


Wouldn't it be a good idea to activate this mapping by default
in further tomcat distributions ?



Ciao

Jens Skripczynski
-- 
E-Mail: skripi(at)myrealbox(dot)com

Technology is a constand battle between manufacturers producing bigger and
more idiot-proof systems and nature producing bigger and better idiots.
                                -- Slashdot signature


---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org


RE: Tomcat 4 Clustering,

Posted by Filip Hanik <ma...@filip.net>.
seems to work fine with Tomcat 4.1.18 as well
Filip

~
Namaste - I bow to the divine in you
~
Filip Hanik
Software Architect
www.filip.net 

>-----Original Message-----
>From: Filip Hanik [mailto:mail@filip.net]
>Sent: Sunday, March 09, 2003 1:18 PM
>To: Tomcat Users List
>Subject: Tomcat 4 Clustering,
>
>
>okey dokey, a pre taste of what tomcat 5 is going to include,
>a fully working version of clustering for your Tomcat 4.1.x codebase.
>I wrote this against 4.1.12, but intend to test it with later versions as
>well. Let me know if you beat me to it.
>
>http://www.filip.net/tomcat-clustering.html
>
>Tomcat 5, will ship with clustering, or at least a module with 
>clustering :)
>
>Filip
>
>~
>Namaste - I bow to the divine in you
>~
>Filip Hanik
>Software Architect
>www.filip.net
>
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
>For additional commands, e-mail: tomcat-user-help@jakarta.apache.org
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org


Tomcat 4 Clustering,

Posted by Filip Hanik <ma...@filip.net>.
okey dokey, a pre taste of what tomcat 5 is going to include,
a fully working version of clustering for your Tomcat 4.1.x codebase.
I wrote this against 4.1.12, but intend to test it with later versions as
well. Let me know if you beat me to it.

http://www.filip.net/tomcat-clustering.html

Tomcat 5, will ship with clustering, or at least a module with clustering :)

Filip

~
Namaste - I bow to the divine in you
~
Filip Hanik
Software Architect
www.filip.net


---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org