init parameter and web.xml cant get it to work?
I have Tomcat 4.0 running as a service on Windows 2000 platform. I am trying to get a servlet to work with init parameters. This is the code: package coreservlets; import java.io.*; import javax.servlet.*; import javax.servlet.http.*; /** *Example using servlet initialization. **/ public class ShowMessage extends HttpServlet { private String message; private String defaultMessage = No Message.; private int repeats = 1; public void init(ServletConfig config) throws ServletException { //Always call super.init super.init(config); message = config.getInitParameter(message); if (message == null) { message = defaultMessage; } try { String repeatString = config.getInitParameter(repeat); repeats = Integer.parseInt(repeatString); } catch(NumberFormatException nfe) { /**NumberFormatException handles case where repeatString is null *and* case where it is something in an illegal *format. Either way, do nothing in catch, as the previous value (1) for the repeats field will remain valid *because the Intiger.pareseInt throws the exception *before* the value gets assigned to repeats. **/ } } public void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { response.setContentType(text/html); PrintWriter out = response.getWriter(); String title = The ShowMessage Servlet; out.println(ServletUtilities.headWithTitle(title) + BODY BGCOLOR=\#FDF5E6\\n + H1 ALIGN=CENTER + title + /H1); for(int i=0; i=repeats; i++) { out.println(message + BR); } out.println(/BODY/HTML); } } ant this is the web.xml file: ?xml version=1.0 encoding=ISO-8859-1? !DOCTYPE web-app PUBLIC -//Sun Microsystems, Inc.//DTD Web Application 2.3//EN http://java.sun.com/dtd/web-app_2_3.dtd; web-app servlet servlet-name ShowMsg /servlet-name servlet-class coreservlets.ShowMessage /servlet-class init-param param-name message /param-name param-value HelloWorld /param-value /init-param init-param param-name repeats /param-name param-value 10 /param-value /init-param /servlet /web-app I am suppose to see Hello World repeated 10 times, but I don't so for some reason it is not retrieving the init paramets in the web.xml file? Please can anyone help me with this. Remember I am very new to this. If there is some other page you can re-direct me too I would appreciate it.
http://localhost:8080 on IE does not work, but does on Netscape?
I have Windows2000 platform. I have checked HOSTS file and it is in order. I have Tomcat running as a service. I at first had only tomcat Internet Explorer installed and tried testing it with http://localhost:8080 and it was not working so after a lot of head scratching I tried Netscape and it works. IE will only work when I enter IP address http://255.255.255.255:8080 ? please any help would be appreciated because I don't understand why this is happening?
Free KAWA?
Is there a programming enviornment similar to KAWA, but is free that is good to work with? That helps you adminsitrate your classpaths etc... Thanks -- To unsubscribe: mailto:[EMAIL PROTECTED] For additional commands: mailto:[EMAIL PROTECTED] Troubles with the list: mailto:[EMAIL PROTECTED]
Re: Running servlet from folder within WEB-INF?
Thank you very much! - Original Message - From: Chris Pheby [EMAIL PROTECTED] To: Tomcat Users List [EMAIL PROTECTED] Sent: Monday, March 11, 2002 9:43 AM Subject: RE: Running servlet from folder within WEB-INF? I recommend going to http://java.sun.com/docs/books/tutorial/servlets/index.html to read the servlets tutorial. Get the example they use - Bookstore.war and pay particular attention to the web.xml file which is simple and easy to understand. Download bookstore.war from ftp://ftp.javasoft.com/docs/tut-bookstore-tomcat.zip You can drop bookstore war in your webapps directory. Then restart Tomcat. Go to http://localhost:8080/bookstore/ to test it out. If you have a look in the webapps directory you will find that Tomcat has created the bookstore subdirectories. Experiment a little, this example made a lot of things clear for me. -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]] On Behalf Of [EMAIL PROTECTED] Sent: 11 March 2002 14:05 To: Tomcat Users List Subject: Re: Running servlet from folder within WEB-INF? Leon Vermaak [EMAIL PROTECTED] on 03/10/2002 07:30:00 PM Please respond to Tomcat Users List [EMAIL PROTECTED] To: Tomcat Users List [EMAIL PROTECTED] cc: Subject: Running servlet from folder within WEB-INF? Sorry but I don't know how best to fraze the question I have I will try to better explain myself. I am new to Tomcat I am on Windows 2000 Professional platform. I compiled the simplest of servlets! I created the following a folder %CATALINA_HOME%/webapps/project/WEB-INF/classes/SERVLET_NAME I started tomcat and called the servlet with http://ip:8080/project/servlet/SERVLET_NAME when I call the servlet, the word SERVLET does not form part of the path? how does this wrok? Is SERVLET_NAME a folder or is it a servlet class? If you have a servlet class called SERVLET_NAME then you have called it in the correct fashion. What do you mean when you say the word SERVLET does not form part of the path? It would be a good idea to check the documentation: http://localhost:8080/tomcat-docs/index.html If this list does not anwer these type of questions would anyone please be so kind as to tell me where I can find answer for beginners of any on-line documentation that explains things in a bit more detail than the Tomcat documentation, which is a bit vague. Thanks RS -- To unsubscribe: mailto:[EMAIL PROTECTED] For additional commands: mailto:[EMAIL PROTECTED] Troubles with the list: mailto:[EMAIL PROTECTED] -- To unsubscribe: mailto:[EMAIL PROTECTED] For additional commands: mailto:[EMAIL PROTECTED] Troubles with the list: mailto:[EMAIL PROTECTED] -- To unsubscribe: mailto:[EMAIL PROTECTED] For additional commands: mailto:[EMAIL PROTECTED] Troubles with the list: mailto:[EMAIL PROTECTED] -- To unsubscribe: mailto:[EMAIL PROTECTED] For additional commands: mailto:[EMAIL PROTECTED] Troubles with the list: mailto:[EMAIL PROTECTED]
localhost/ip? IE and Netscape
I know the answer to this question must be fairly simple, but I have no idea why this is happening? I am on windows 2000 pro platform, I have tomcat started. I have both IE 6.0.2 and Netscape 6.2.1. When I call servlets with my browser in Netscape I can call them by simply typing: http://localhost:8080/servlet/Servlet_Name, but, with IE I have to type my IP addresss it won't automatically resolve localhost to IP? can anyone please tell me why? thanks -- To unsubscribe: mailto:[EMAIL PROTECTED] For additional commands: mailto:[EMAIL PROTECTED] Troubles with the list: mailto:[EMAIL PROTECTED]
Running servlet from folder within WEB-INF?
Sorry but I don't know how best to fraze the question I have I will try to better explain myself. I am new to Tomcat I am on Windows 2000 Professional platform. I compiled the simplest of servlets! I created the following a folder %CATALINA_HOME%/webapps/project/WEB-INF/classes/SERVLET_NAME I started tomcat and called the servlet with http://ip:8080/project/servlet/SERVLET_NAME when I call the servlet, the word SERVLET does not form part of the path? how does this wrok? If this list does not anwer these type of questions would anyone please be so kind as to tell me where I can find answer for beginners of any on-line documentation that explains things in a bit more detail than the Tomcat documentation, which is a bit vague. Thanks -- To unsubscribe: mailto:[EMAIL PROTECTED] For additional commands: mailto:[EMAIL PROTECTED] Troubles with the list: mailto:[EMAIL PROTECTED]
Tomcat startup.bat does not work?
Hi, I am running Tomcat on Windows 2000 Professional. If anyone could please tell me why I am getting the following output = when I startup.bat Tomcat I would appreciate it: Catalina.start: LifecycleException: Error creating server socket = (java.net.Bind Exception): java.net.BindException: Address already in use: JVM_Bind LifecycleException: Error creating server socket = (java.net.BindException): jav a.net.BindException: Address already in use: JVM_Bind at = org.apache.catalina.connector.warp.WarpConnector.initialize(WarpConne ctor.java:491) at = org.apache.catalina.core.StandardService.initialize(StandardService.j ava:454) at = org.apache.catalina.core.StandardServer.initialize(StandardServer.jav a:553) at org.apache.catalina.startup.Catalina.start(Catalina.java:780) at = org.apache.catalina.startup.Catalina.execute(Catalina.java:681) at = org.apache.catalina.startup.Catalina.process(Catalina.java:179) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at = sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl. java:39) at = sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcces sorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:324) at = org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:243) - Root Cause - java.net.BindException: Address already in use: JVM_Bind at java.net.PlainSocketImpl.socketBind(Native Method) at java.net.PlainSocketImpl.bind(PlainSocketImpl.java:321) at java.net.ServerSocket.bind(ServerSocket.java:308) at java.net.ServerSocket.bind(ServerSocket.java:266) at java.net.ServerSocket.init(ServerSocket.java:182) at java.net.ServerSocket.init(ServerSocket.java:138) at = org.apache.catalina.net.DefaultServerSocketFactory.createSocket(Defau ltServerSocketFactory.java:118) at = org.apache.catalina.connector.warp.WarpConnector.initialize(WarpConne ctor.java:485) at = org.apache.catalina.core.StandardService.initialize(StandardService.j ava:454) at = org.apache.catalina.core.StandardServer.initialize(StandardServer.jav a:553) at org.apache.catalina.startup.Catalina.start(Catalina.java:780) at = org.apache.catalina.startup.Catalina.execute(Catalina.java:681) at = org.apache.catalina.startup.Catalina.process(Catalina.java:179) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at = sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl. java:39) at = sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcces sorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:324) at org.apache.catalina.startup.Bootstrap.main (Bootstrap.java:243) -- To unsubscribe: mailto:[EMAIL PROTECTED] For additional commands: mailto:[EMAIL PROTECTED] Troubles with the list: mailto:[EMAIL PROTECTED]
Re: Tomcat startup.bat does not work?
Yes! I understood the problem the first time I tried various ports above 1024, but the problem persists! - Original Message - From: Barney Hamish [EMAIL PROTECTED] To: 'Tomcat Users List' [EMAIL PROTECTED] Sent: Tuesday, March 05, 2002 6:29 AM Subject: RE: Tomcat startup.bat does not work? The Error message tells you what the proplem is: ... Error creating server socket = (java.net.Bind Exception): java.net.BindException: Address already in use:... Tomcat can't listen on the socket it wants to because some other application is already using that socket. Either find out which application is using that socket and stop it or change the port tomcat uses in the server.xml file. Hamish -Original Message- From: Leon Vermaak [mailto:[EMAIL PROTECTED]] Sent: Tuesday, March 05, 2002 6:24 PM To: Tomcat Users List Subject: Tomcat startup.bat does not work? Hi, I am running Tomcat on Windows 2000 Professional. If anyone could please tell me why I am getting the following output = when I startup.bat Tomcat I would appreciate it: Catalina.start: LifecycleException: Error creating server socket = (java.net.Bind Exception): java.net.BindException: Address already in use: JVM_Bind LifecycleException: Error creating server socket = (java.net.BindException): jav a.net.BindException: Address already in use: JVM_Bind at = org.apache.catalina.connector.warp.WarpConnector.initialize(WarpConne ctor.java:491) at = org.apache.catalina.core.StandardService.initialize(StandardService.j ava:454) at = org.apache.catalina.core.StandardServer.initialize(StandardServer.jav a:553) at org.apache.catalina.startup.Catalina.start(Catalina.java:780) at = org.apache.catalina.startup.Catalina.execute(Catalina.java:681) at = org.apache.catalina.startup.Catalina.process(Catalina.java:179) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at = sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl. java:39) at = sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcces sorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:324) at = org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:243) - Root Cause - java.net.BindException: Address already in use: JVM_Bind at java.net.PlainSocketImpl.socketBind(Native Method) at java.net.PlainSocketImpl.bind(PlainSocketImpl.java:321) at java.net.ServerSocket.bind(ServerSocket.java:308) at java.net.ServerSocket.bind(ServerSocket.java:266) at java.net.ServerSocket.init(ServerSocket.java:182) at java.net.ServerSocket.init(ServerSocket.java:138) at = org.apache.catalina.net.DefaultServerSocketFactory.createSocket(Defau ltServerSocketFactory.java:118) at = org.apache.catalina.connector.warp.WarpConnector.initialize(WarpConne ctor.java:485) at = org.apache.catalina.core.StandardService.initialize(StandardService.j ava:454) at = org.apache.catalina.core.StandardServer.initialize(StandardServer.jav a:553) at org.apache.catalina.startup.Catalina.start(Catalina.java:780) at = org.apache.catalina.startup.Catalina.execute(Catalina.java:681) at = org.apache.catalina.startup.Catalina.process(Catalina.java:179) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at = sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl. java:39) at = sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcces sorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:324) at org.apache.catalina.startup.Bootstrap.main (Bootstrap.java:243) -- To unsubscribe: mailto:[EMAIL PROTECTED] For additional commands: mailto:[EMAIL PROTECTED] Troubles with the list: mailto:[EMAIL PROTECTED] -- To unsubscribe: mailto:[EMAIL PROTECTED] For additional commands: mailto:[EMAIL PROTECTED] Troubles with the list: mailto:[EMAIL PROTECTED] -- To unsubscribe: mailto:[EMAIL PROTECTED] For additional commands: mailto:[EMAIL PROTECTED] Troubles with the list: mailto:[EMAIL PROTECTED]