Java Video Tutorial 42

Java ServletsIn this part of my Java Video Tutorial, I continue what I started in my Java Servlet Video Tutorial. If you haven’t seen it, you need to before you can try this code out.

I’ll show you how to pass form data to a Java Servlet using both the GET and POST method. I also cover the web.xml file and much more.

The code follows the video, to help you learn. Also vote on what my next tutorial should be on below.

If you like videos like this, tell Google .

Always feel free to share

Vote on my Next Tutorial

The Most Popular Requests

Always feel free to leave a request, but I’ve picked my next 3 tutorials based on your votes.

  • Design Patterns
  • Android App Development
  • More Java Tutorials

Code From the Video

package helloservlets;

import java.io.IOException;
import java.io.PrintWriter;
import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

/**
 * Servlet implementation class Lesson41
 */

@WebServlet("/Lesson41")
public class Lesson41 extends HttpServlet {
	private static final long serialVersionUID = 1L;

	/**
	 * @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response)
	 */ 

	protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		String usersName = request.getParameter("yourname");
		
		String theLang = request.getParameter("Language");
		
		int firstNum = Integer.parseInt(request.getParameter("firstnum"));
		int secondNum = Integer.parseInt(request.getParameter("secondnum"));
		int sumONum = firstNum + secondNum;
		
		response.setContentType("text/html");
		
		PrintWriter output = response.getWriter();
		
		output.println("<html><body><h3>Hello " + usersName);
		
		output.println("</h3><br />" + firstNum + " + " + secondNum);
		output.println(" = " + sumONum + "<br />Speaks " + theLang + "</body></html>");
	}

	/**
	 * @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse response)
	 */

	protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		doGet(request, response);
	}

}

21 Responses to “Java Video Tutorial 42”

  1. Punit says:

    hii nice video darek.
    have few questions:
    1.> instead of using web.xml can we use annotations, i think in servlet 3 we can, if yes than up to what level??

    2.> what things we can do with web.xml??
    i mean how can we provide security in web.xml and all??

    Thank you..

    • admin says:

      Yes you can eliminate the need for web.xml with the @WebServlet annotation. I may use that instead in a tutorial. I kind of like using web.xml though. It just seems neat and organized.

      You can define a ton of things in web.xml. Parameters, session time outs, admin info, error handling, who can access the servlets, etc. I’ll get more into this in my java tutorial

  2. USMAN says:

    Hello Derek thanks alot for you tutorial…. i have been following this from last few months…. i really like the way u teach stuff… but i have question…. i followed along this and previous tutorial… but when i run my html page it does not start the desired servlet… but this throw a the following error…

    HTTP Status 404 – /TestTomcat/TestTomcat

    ——————————————————————————–

    type Status report

    message /TestTomcat/TestTomcat

    description The requested resource is not available.

    ——————————————————————————–

    Apache Tomcat/7.0.37

    ================================================================
    TestTomcat java file code

    package helloServlets;

    import java.io.IOException;
    import java.io.PrintWriter;
    import javax.servlet.ServletException;
    import javax.servlet.annotation.WebServlet;
    import javax.servlet.http.HttpServlet;
    import javax.servlet.http.HttpServletRequest;
    import javax.servlet.http.HttpServletResponse;

    @WebServlet(“/TestTomcat”)
    public class TestTomcat extends HttpServlet {
    private static final long serialVersionUID = 1L;

    protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {

    String usersName = request.getParameter(“yourname”);

    String theLang = request.getParameter(“Language”);

    int firstNum = Integer.parseInt(request.getParameter(“firstnum”));
    int secondNum = Integer.parseInt(request.getParameter(“secondnum”));
    int sumONum = firstNum + secondNum;
    response.setContentType(“text/html”);

    PrintWriter output = response.getWriter();

    output.println(“Hello ” + usersName);

    output.println(“” + firstNum + ” + ” + secondNum);
    output.println(” = ” + sumONum + “Speaks ” + theLang + “”);
    }

    protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
    doGet(request, response);
    }

    }

    ====================================================================================
    sayhello.html file

    Insert title here

    What’s your name

    First number

    Second number

    ===========================================================================
    web.xml file

    CheckUser
    IMS.Servlets.CheckUser

    CheckUser
    /CheckUser

    thanks

    • Derek Banas says:

      It is saying that it can’t find /TestTomcat. There could be many reasons. Is it readable to everyone? Permissions can cause that. It is hard to figure out for me because I can’t see your directory structure

  3. Niraj says:

    The servlets named [Lesson41] and [helloservlet.Lesson41] are both mapped to the url-pattern [/Lesson41] which is not permitted

  4. Niraj says:

    I am getting this error
    I removed annotation line @Webservlet(“/Lesson41”)
    HTTP Status 404 – /Lesson42/

    type Status report

    message /Lesson42/

    description The requested resource is not available.

    • Derek Banas says:

      Did you figure out how to map to the directory by now. Sorry i couldn’t get to you quicker

      • Niraj says:

        I am using ubuntu 12.04,Eclipse Indigo and Tomcat 7.I removed all errors from the Tomcat log still I am not able to access the page.

        I dont know how do I map to a directory if I am not getting the required result.

  5. Niraj says:

    This is the console log of my eclipse

    3 Jul, 2013 4:11:22 PM org.apache.catalina.core.AprLifecycleListener init
    SEVERE: An incompatible version 1.1.22 of the APR based Apache Tomcat Native library is installed, while Tomcat requires version 1.1.24
    APR Statistical data ….
    Poll Statistics ………
    Polls created : 0
    Polls destroyed : 0
    Polls cleared : 0
    Network Statistics ……
    Sockets created : 0
    Sockets accepted : 0
    Sockets closed : 0
    Sockets cleared : 0
    Total send calls : 0
    Minimum send length : 10000000
    Maximum send length : 0
    Average send length : -nan
    Total recv calls : 0
    Minimum recv length : 10000000
    Maximum recv length : 0
    Average recv length : -nan
    Receive timeouts : 0
    Receive errors : 0
    Receive resets : 0
    Last receive error : 0
    Total sendfile calls : 0
    Minimum sendfile lenght : 10000000
    Maximum sendfile lenght : 0
    SSL Network Statistics ..
    Sockets created : 0
    Sockets accepted : 0
    Sockets closed : 0
    Sockets cleared : 0
    APR Terminated
    3 Jul, 2013 4:11:22 PM org.apache.catalina.core.AprLifecycleListener init
    SEVERE: An incompatible version 1.1.22 of the APR based Apache Tomcat Native library is installed, while Tomcat requires version 1.1.24
    APR Statistical data ….
    Poll Statistics ………
    Polls created : 0
    Polls destroyed : 0
    Polls cleared : 0
    Network Statistics ……
    Sockets created : 0
    Sockets accepted : 0
    Sockets closed : 0
    Sockets cleared : 0
    Total send calls : 0
    Minimum send length : 10000000
    Maximum send length : 0
    Average send length : -nan
    Total recv calls : 0
    Minimum recv length : 10000000
    Maximum recv length : 0
    Average recv length : -nan
    Receive timeouts : 0
    Receive errors : 0
    Receive resets : 0
    Last receive error : 0
    Total sendfile calls : 0
    Minimum sendfile lenght : 10000000
    Maximum sendfile lenght : 0
    SSL Network Statistics ..
    Sockets created : 0
    Sockets accepted : 0
    Sockets closed : 0
    Sockets cleared : 0
    APR Terminated
    3 Jul, 2013 4:11:22 PM org.apache.catalina.core.AprLifecycleListener init
    SEVERE: An incompatible version 1.1.22 of the APR based Apache Tomcat Native library is installed, while Tomcat requires version 1.1.24
    APR Statistical data ….
    Poll Statistics ………
    Polls created : 0
    Polls destroyed : 0
    Polls cleared : 0
    Network Statistics ……
    Sockets created : 0
    Sockets accepted : 0
    Sockets closed : 0
    Sockets cleared : 0
    Total send calls : 0
    Minimum send length : 10000000
    Maximum send length : 0
    Average send length : -nan
    Total recv calls : 0
    Minimum recv length : 10000000
    Maximum recv length : 0
    Average recv length : -nan
    Receive timeouts : 0
    Receive errors : 0
    Receive resets : 0
    Last receive error : 0
    Total sendfile calls : 0
    Minimum sendfile lenght : 10000000
    Maximum sendfile lenght : 0
    SSL Network Statistics ..
    Sockets created : 0
    Sockets accepted : 0
    Sockets closed : 0
    Sockets cleared : 0
    APR Terminated
    3 Jul, 2013 4:11:22 PM org.apache.catalina.core.AprLifecycleListener init
    SEVERE: An incompatible version 1.1.22 of the APR based Apache Tomcat Native library is installed, while Tomcat requires version 1.1.24
    APR Statistical data ….
    Poll Statistics ………
    Polls created : 0
    Polls destroyed : 0
    Polls cleared : 0
    Network Statistics ……
    Sockets created : 0
    Sockets accepted : 0
    Sockets closed : 0
    Sockets cleared : 0
    Total send calls : 0
    Minimum send length : 10000000
    Maximum send length : 0
    Average send length : -nan
    Total recv calls : 0
    Minimum recv length : 10000000
    Maximum recv length : 0
    Average recv length : -nan
    Receive timeouts : 0
    Receive errors : 0
    Receive resets : 0
    Last receive error : 0
    Total sendfile calls : 0
    Minimum sendfile lenght : 10000000
    Maximum sendfile lenght : 0
    SSL Network Statistics ..
    Sockets created : 0
    Sockets accepted : 0
    Sockets closed : 0
    Sockets cleared : 0
    APR Terminated
    3 Jul, 2013 4:11:23 PM org.apache.catalina.core.AprLifecycleListener init
    SEVERE: An incompatible version 1.1.22 of the APR based Apache Tomcat Native library is installed, while Tomcat requires version 1.1.24
    APR Statistical data ….
    Poll Statistics ………
    Polls created : 0
    Polls destroyed : 0
    Polls cleared : 0
    Network Statistics ……
    Sockets created : 0
    Sockets accepted : 0
    Sockets closed : 0
    Sockets cleared : 0
    Total send calls : 0
    Minimum send length : 10000000
    Maximum send length : 0
    Average send length : -nan
    Total recv calls : 0
    Minimum recv length : 10000000
    Maximum recv length : 0
    Average recv length : -nan
    Receive timeouts : 0
    Receive errors : 0
    Receive resets : 0
    Last receive error : 0
    Total sendfile calls : 0
    Minimum sendfile lenght : 10000000
    Maximum sendfile lenght : 0
    SSL Network Statistics ..
    Sockets created : 0
    Sockets accepted : 0
    Sockets closed : 0
    Sockets cleared : 0
    APR Terminated
    3 Jul, 2013 4:11:23 PM org.apache.coyote.AbstractProtocol init
    INFO: Initializing ProtocolHandler [“http-bio-8080”]
    3 Jul, 2013 4:11:23 PM org.apache.coyote.AbstractProtocol init
    INFO: Initializing ProtocolHandler [“ajp-bio-8009”]
    3 Jul, 2013 4:11:23 PM org.apache.catalina.startup.Catalina load
    INFO: Initialization processed in 1658 ms
    3 Jul, 2013 4:11:23 PM org.apache.catalina.core.StandardService startInternal
    INFO: Starting service Catalina
    3 Jul, 2013 4:11:23 PM org.apache.catalina.core.StandardEngine startInternal
    INFO: Starting Servlet Engine: Apache Tomcat/7.0.41
    3 Jul, 2013 4:11:23 PM org.apache.catalina.startup.HostConfig deployDescriptor
    INFO: Deploying configuration descriptor /home/niraj/apache-tomcat-7.0.41/conf/Catalina/localhost/Lesson42.xml
    3 Jul, 2013 4:11:23 PM org.apache.catalina.startup.HostConfig deployDescriptor
    WARNING: A docBase /home/niraj/apache-tomcat-7.0.41/webapps/Lesson42 inside the host appBase has been specified, and will be ignored
    3 Jul, 2013 4:11:23 PM org.apache.catalina.startup.SetContextPropertiesRule begin
    WARNING: [SetContextPropertiesRule]{Context} Setting property ‘source’ to ‘org.eclipse.jst.jee.server:Lesson42’ did not find a matching property.
    3 Jul, 2013 4:11:24 PM org.apache.catalina.startup.HostConfig deployDirectory
    INFO: Deploying web application directory /home/niraj/apache-tomcat-7.0.41/webapps/host-manager
    3 Jul, 2013 4:11:24 PM org.apache.catalina.startup.HostConfig deployDirectory
    INFO: Deploying web application directory /home/niraj/apache-tomcat-7.0.41/webapps/manager
    3 Jul, 2013 4:11:24 PM org.apache.catalina.startup.HostConfig deployDirectory
    INFO: Deploying web application directory /home/niraj/apache-tomcat-7.0.41/webapps/examples
    3 Jul, 2013 4:11:24 PM org.apache.catalina.core.ApplicationContext log
    INFO: ContextListener: contextInitialized()
    3 Jul, 2013 4:11:24 PM org.apache.catalina.core.ApplicationContext log
    INFO: SessionListener: contextInitialized()
    3 Jul, 2013 4:11:24 PM org.apache.catalina.core.ApplicationContext log
    INFO: ContextListener: attributeAdded(‘org.apache.jasper.compiler.TldLocationsCache’, ‘org.apache.jasper.compiler.TldLocationsCache@cd4544’)
    3 Jul, 2013 4:11:24 PM org.apache.catalina.startup.HostConfig deployDirectory
    INFO: Deploying web application directory /home/niraj/apache-tomcat-7.0.41/webapps/docs
    3 Jul, 2013 4:11:25 PM org.apache.catalina.startup.HostConfig deployDirectory
    INFO: Deploying web application directory /home/niraj/apache-tomcat-7.0.41/webapps/ROOT
    3 Jul, 2013 4:11:25 PM org.apache.coyote.AbstractProtocol start
    INFO: Starting ProtocolHandler [“http-bio-8080”]
    3 Jul, 2013 4:11:25 PM org.apache.coyote.AbstractProtocol start
    INFO: Starting ProtocolHandler [“ajp-bio-8009”]
    3 Jul, 2013 4:11:25 PM org.apache.catalina.startup.Catalina start
    INFO: Server startup in 1773 ms

      • Niraj says:

        Actually I did not get this error.But I went through the link and found that war file is needed.

        But what is a war file and how do I make one and put where?

        I found that war is a packaged web app. But I dont know where to put it.

        • Derek Banas says:

          I’m interested in where you read you need a war file? I’m sure you saw this, but I thought I’d post it either way http://en.wikipedia.org/wiki/WAR_file_format_(Sun)

          • Niraj says:

            you pointed me to a link where he was trying to deploy a war file and getting the error message that resource is not available.
            So I thought my war file is not existing and so I am getting the error.
            I also read that war file is auto-generated by using some ANT script.
            So it might be the case that you had it configured to run so I thought war file is needed.
            I went thru the link that you provided. I now has a pretty good view of war file.

            This does not solve my problem then what my problem might be.
            Why I am getting resource is not available.
            May be I am putting my class files into some wrong folder or my classpath is not set properly or eclipse is working crappy or the changes that I am making is not reflecting bcoz I am not restarting my system.
            I am not able to figure this out.
            Please help me out otherwise I am thinking of a creating a new project if I am messing things for this project.

            • Niraj says:

              I solved by issue today after toiling for 2 days and today 2 hours.

              The problem was
              I was getting the Lesson42 resource not available coz I was not putting my file name that should be searched in my tag.
              Due to which I was getting the required output when I typed:
              http://localhost:8080/Lesson42/Lesson42 into the browser address bar.

            • Derek Banas says:

              I saw that up above you were able to fix everything. I’m glad you got it. Sorry that I wasn’t able to answer quicker. I have been pretty overwhelmed with comments lately. I’ll always try to answer them. Sorry it took so long 🙁

  6. Niraj says:

    I solved my issue today after toiling for 2 days and today 2 hours.

    The problem was
    I was getting the Lesson42 resource not available coz I was not putting my file name that should be searched in my welcome-file-list tag.
    Due to which I was getting the required output when I typed:
    http://localhost:8080/Lesson42/Lesson42 into the browser address bar.

  7. morgan says:

    what can be the problem here please help me derek ?

    Eyl 02, 2013 4:12:37 AM org.apache.catalina.core.AprLifecycleListener init
    INFO: The APR based Apache Tomcat Native library which allows optimal performance in production environments was not found on the java.library.path: C:\Program Files\Java\jre7\bin;C:\Windows\Sun\Java\bin;C:\Windows\system32;C:\Windows;C:\Program Files (x86)\Intel\iCLS Client\;C:\Program Files\Intel\iCLS Client\;C:\Program Files (x86)\AMD APP\bin\x86_64;C:\Program Files (x86)\AMD APP\bin\x86;C:\Program Files\Common Files\Microsoft Shared\Windows Live;C:\Program Files (x86)\Common Files\Microsoft Shared\Windows Live;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Program Files (x86)\Intel\OpenCL SDK\2.0\bin\x86;C:\Program Files (x86)\Intel\OpenCL SDK\2.0\bin\x64;C:\Program Files (x86)\Windows Live\Shared;C:\Program Files\Intel\Intel(R) Management Engine Components\DAL;C:\Program Files\Intel\Intel(R) Management Engine Components\IPT;C:\Program Files (x86)\Intel\Intel(R) Management Engine Components\DAL;C:\Program Files (x86)\Intel\Intel(R) Management Engine Components\IPT;.
    Eyl 02, 2013 4:12:37 AM org.apache.tomcat.util.digester.SetPropertiesRule begin
    WARNING: [SetPropertiesRule]{Server/Service/Engine/Host/Context} Setting property ‘source’ to ‘org.eclipse.jst.jee.server:Javaders47’ did not find a matching property.
    Eyl 02, 2013 4:12:37 AM org.apache.coyote.AbstractProtocol init
    INFO: Initializing ProtocolHandler [“http-bio-8080”]
    Eyl 02, 2013 4:12:37 AM org.apache.coyote.AbstractProtocol init
    INFO: Initializing ProtocolHandler [“ajp-bio-8009”]
    Eyl 02, 2013 4:12:37 AM org.apache.catalina.startup.Catalina load
    INFO: Initialization processed in 420 ms
    Eyl 02, 2013 4:12:37 AM org.apache.catalina.core.StandardService startInternal
    INFO: Starting service Catalina
    Eyl 02, 2013 4:12:37 AM org.apache.catalina.core.StandardEngine startInternal
    INFO: Starting Servlet Engine: Apache Tomcat/7.0.42
    Eyl 02, 2013 4:12:37 AM org.apache.catalina.core.ContainerBase startInternal
    SEVERE: A child container failed during start
    java.util.concurrent.ExecutionException: org.apache.catalina.LifecycleException: Failed to start component [StandardEngine[Catalina].StandardHost[localhost].StandardContext[/Javaders47]]
    at java.util.concurrent.FutureTask$Sync.innerGet(Unknown Source)
    at java.util.concurrent.FutureTask.get(Unknown Source)
    at org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:1123)
    at org.apache.catalina.core.StandardHost.startInternal(StandardHost.java:800)
    at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
    at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1559)
    at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1549)
    at java.util.concurrent.FutureTask$Sync.innerRun(Unknown Source)
    at java.util.concurrent.FutureTask.run(Unknown Source)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
    at java.lang.Thread.run(Unknown Source)
    Caused by: org.apache.catalina.LifecycleException: Failed to start component [StandardEngine[Catalina].StandardHost[localhost].StandardContext[/Javaders47]]
    at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:154)
    … 7 more
    Caused by: java.lang.IllegalArgumentException: The servlets named [Javaders47] and [SelamunAleykum.Javaders47] are both mapped to the url-pattern [/Javaders47] which is not permitted
    at org.apache.catalina.deploy.WebXml.addServletMapping(WebXml.java:335)
    at org.apache.catalina.startup.ContextConfig.processAnnotationWebServlet(ContextConfig.java:2450)
    at org.apache.catalina.startup.ContextConfig.processAnnotationsStream(ContextConfig.java:2132)
    at org.apache.catalina.startup.ContextConfig.processAnnotationsFile(ContextConfig.java:2093)
    at org.apache.catalina.startup.ContextConfig.processAnnotationsFile(ContextConfig.java:2086)
    at org.apache.catalina.startup.ContextConfig.webConfig(ContextConfig.java:1293)
    at org.apache.catalina.startup.ContextConfig.configureStart(ContextConfig.java:878)
    at org.apache.catalina.startup.ContextConfig.lifecycleEvent(ContextConfig.java:376)
    at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:119)
    at org.apache.catalina.util.LifecycleBase.fireLifecycleEvent(LifecycleBase.java:90)
    at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5322)
    at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
    … 7 more

    Eyl 02, 2013 4:12:37 AM org.apache.catalina.core.ContainerBase startInternal
    SEVERE: A child container failed during start
    java.util.concurrent.ExecutionException: org.apache.catalina.LifecycleException: Failed to start component [StandardEngine[Catalina].StandardHost[localhost]]
    at java.util.concurrent.FutureTask$Sync.innerGet(Unknown Source)
    at java.util.concurrent.FutureTask.get(Unknown Source)
    at org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:1123)
    at org.apache.catalina.core.StandardEngine.startInternal(StandardEngine.java:302)
    at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
    at org.apache.catalina.core.StandardService.startInternal(StandardService.java:443)
    at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
    at org.apache.catalina.core.StandardServer.startInternal(StandardServer.java:732)
    at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
    at org.apache.catalina.startup.Catalina.start(Catalina.java:691)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
    at java.lang.reflect.Method.invoke(Unknown Source)
    at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:322)
    at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:456)
    Caused by: org.apache.catalina.LifecycleException: Failed to start component [StandardEngine[Catalina].StandardHost[localhost]]
    at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:154)
    at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1559)
    at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1549)
    at java.util.concurrent.FutureTask$Sync.innerRun(Unknown Source)
    at java.util.concurrent.FutureTask.run(Unknown Source)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
    at java.lang.Thread.run(Unknown Source)
    Caused by: org.apache.catalina.LifecycleException: A child container failed during start
    at org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:1131)
    at org.apache.catalina.core.StandardHost.startInternal(StandardHost.java:800)
    at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
    … 7 more

    Eyl 02, 2013 4:12:37 AM org.apache.catalina.startup.Catalina start
    SEVERE: The required Server component failed to start so Tomcat is unable to start.
    org.apache.catalina.LifecycleException: Failed to start component [StandardServer[8005]]
    at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:154)
    at org.apache.catalina.startup.Catalina.start(Catalina.java:691)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
    at java.lang.reflect.Method.invoke(Unknown Source)
    at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:322)
    at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:456)
    Caused by: org.apache.catalina.LifecycleException: Failed to start component [StandardService[Catalina]]
    at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:154)
    at org.apache.catalina.core.StandardServer.startInternal(StandardServer.java:732)
    at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
    … 7 more
    Caused by: org.apache.catalina.LifecycleException: Failed to start component [StandardEngine[Catalina]]
    at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:154)
    at org.apache.catalina.core.StandardService.startInternal(StandardService.java:443)
    at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
    … 9 more
    Caused by: org.apache.catalina.LifecycleException: A child container failed during start
    at org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:1131)
    at org.apache.catalina.core.StandardEngine.startInternal(StandardEngine.java:302)
    at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
    … 11 more

    Eyl 02, 2013 4:12:37 AM org.apache.coyote.AbstractProtocol pause
    INFO: Pausing ProtocolHandler [“http-bio-8080”]
    Eyl 02, 2013 4:12:37 AM org.apache.coyote.AbstractProtocol pause
    INFO: Pausing ProtocolHandler [“ajp-bio-8009”]
    Eyl 02, 2013 4:12:37 AM org.apache.catalina.core.StandardService stopInternal
    INFO: Stopping service Catalina
    Eyl 02, 2013 4:12:37 AM org.apache.coyote.AbstractProtocol destroy
    INFO: Destroying ProtocolHandler [“http-bio-8080”]
    Eyl 02, 2013 4:12:37 AM org.apache.coyote.AbstractProtocol destroy
    INFO: Destroying ProtocolHandler [“ajp-bio-8009”]

  8. Yuri says:

    Hi Derek! Great videos.
    Any chances that you cover asynchronous servlets and non-blocking IO from java.nio package?

Leave a Reply

Your email address will not be published.

Google+