Launching servlet in browser - error "The requested resource is not available"
CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 9 of 9

Thread: Launching servlet in browser - error "The requested resource is not available"

  1. #1
    Join Date
    Sep 2017
    Posts
    9

    Launching servlet in browser - error "The requested resource is not available"

    Hey, everyone! I truly hope you can help.

    I am well aware there have been many, many related questions asked already about this, as well as even more answers. Unfortunately, having tried all this advice I still cannot resolve this problem.

    I am trying to launch a simple Java servlet in the browser, following instructions from the textbook:

    Java Programming: Comprehensive Concepts and Techniques, Shelly Cashman Series, ISBN: 9781418859855.

    I am aware of the advice given here to other people with this/similar problems, that servlets should preferably be written under a package, and not packageless, but I am following the textbook's guidance with this, and of course being a textbook, its method must work. I seek help with doing it in THIS method.

    I have a Java servlet, called HTMLBank.java which I successfully compiled with no compilation errors. Now, according to the textbook:

    1) Place the .class file into C:\Program Files\Apache Software Foundation\Tomcat 5.5\webapps\ROOT\WEB-INF\classes folder. Yes, the textbook uses the default package for this and the ROOT directory of Tomcat.

    2) Run the Tomcat service - it is running (shown as a green "play" arrow in right-bottom of the screen).

    3) In the browser, type URL: http://localhost:8080/servlet/HTMLBank and enter it. After doing this, the following error results:

    HTTP Status 404 - /servlet/HTMLBank
    type Status report
    message /servlet/HTMLBank
    description The requested resource (/servlet/HTMLBank) is not available.


    Now, I might mention that I did succeed in launching a servlet once before, but that was only if I used a package, say com.example and mapped it in the web.xml file, but as stated before, this deviates from the textbook and I need to get it to work using the default package and ROOT directory.

    Here is the code of the HTMLBank.java servlet file:

    Code:
    import javax.servlet.*;
    import javax.servlet.http.*;
    
    import java.io.; import java.util.;
    
    public class HTMLBank extends HttpServlet { public void init() throws ServletException {
    
    }
    
    public void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException
    {
        response.setContentType("text/html");
        PrintWriter out = response.getWriter();
    
        response.setHeader("Expires", "Tues, 01 Jan 1980 00:00:00 GMT");
    
        out.println("<html>");
            out.println("<title>Online Bank ATM Simulator</title>");
            out.println("<h1>Tester Text.</h1>");
            out.println("<body>This serves to test functioning of the servlet in browser.</body>");
        out.println("</html>");
    }
    
    public void destroy()
    {
    
    }
    }
    Here is the code of the web.xml file:

    Code:
    <?xml version="1.0" encoding="ISO-8859-1"?>
      http://www.apache.org/licenses/LICENSE-2.0
    Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. -->
    http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd" version="2.4">
    
    Welcome to Tomcat Welcome to Tomcat
    
    <servlet>
        <servlet-name>org.apache.jsp.index_jsp</servlet-name>
        <servlet-class>org.apache.jsp.index_jsp</servlet-class>
    </servlet>
    
    <servlet-mapping>
        <servlet-name>org.apache.jsp.index_jsp</servlet-name>
        <url-pattern>/index.jsp</url-pattern>
    </servlet-mapping>
    <-- added the following for invoker servlet --> invoker org.apache.catalina.servlets.InvokerServlet
    
    <servlet-mapping>
        <servlet-name>invoker</servlet-name>
        <url-pattern>/servlet/*</url-pattern>
    </servlet-mapping>
    The web.xml file was modified per book guide to allow locating anonymous servlets in the default directory.

    Here is the context.xml file:

    Code:
    <!-- The contents of this file will be loaded for each web application -->
    <!-- Default set of monitored resources -->
    <WatchedResource>WEB-INF/web.xml</WatchedResource>
    <WatchedResource>META-INF/context.xml</WatchedResource>
    
    <!-- Uncomment this to disable session persistence across Tomcat restarts -->
    <!--
    <Manager pathname="" />
    -->
    This file was edited to enable servlet reloading, also as per book guide.

    The following are paths to all the files/folders involved in this discussion:

    C:\Program Files\Apache Software Foundation\Tomcat 5.5\webapps\ROOT\WEB-INF\classes --> I created the "classes" folder, per book guide.

    C:\Program Files\Apache Software Foundation\Tomcat 5.5\webapps\ROOT\WEB-INF\classes\HTMLBank.class --> I placed the .class file into here.

    C:\Program Files\Apache Software Foundation\Tomcat 5.5\webapps\ROOT\WEB-INF\web.xml --> This is the location of web.xml file which was edited.

    C:\Program Files\Apache Software Foundation\Tomcat 5.5\conf\context.xml is the location of the context.xml file which was edited.

    So, as I said, I NEED to work the servlet without a package and from ROOT.

    Please can somebody help? I greatly appreciate it!

  2. #2
    Join Date
    Jun 1999
    Location
    Eastern Florida
    Posts
    3,756

    Re: Launching servlet in browser - error "The requested resource is not available"

    I am trying to launch a simple Java servlet in the browser
    I'm not sure what you mean. A browser reads and displays a page written in HTML and javascript.
    A Java servlet requires a server to execute.
    Norm

  3. #3
    Join Date
    Sep 2017
    Posts
    9

    Re: Launching servlet in browser - error "The requested resource is not available"

    Hey, Norm.

    I meant I wrote and compiled the said servlet, as per explanation in the post, and am trying to access it using URL in my browser. Would you have any suggestions as to the my said problem?

  4. #4
    Join Date
    Sep 2017
    Posts
    9

    Re: Launching servlet in browser - error "The requested resource is not available"

    Guys, I insert below the content of an error file generated by Tomcat. I am a novice at Java, so to me it doesn't explain much. Please see if it helps to find the issue. Thanks!

    08 Sep 2017 10:47:53 AM org.apache.coyote.http11.Http11Protocol init
    INFO: Initializing Coyote HTTP/1.1 on http-8080
    08 Sep 2017 10:47:53 AM org.apache.catalina.startup.Catalina load
    INFO: Initialization processed in 3887 ms
    08 Sep 2017 10:47:54 AM org.apache.catalina.core.StandardService start
    INFO: Starting service Catalina
    08 Sep 2017 10:47:54 AM org.apache.catalina.core.StandardEngine start
    INFO: Starting Servlet Engine: Apache Tomcat/5.5.7
    08 Sep 2017 10:47:54 AM org.apache.catalina.core.StandardHost start
    INFO: XML validation disabled
    08 Sep 2017 10:47:56 AM org.apache.catalina.core.ApplicationContext log
    INFO: org.apache.webapp.balancer.BalancerFilter: init(): ruleChain: [org.apache.webapp.balancer.RuleChain: [org.apache.webapp.balancer.rules.URLStringMatchRule: Target string: News / Redirect URL: http://www.cnn.com], [org.apache.webapp.balancer.rules.RequestParameterRule: Target param name: paramName / Target param value: paramValue / Redirect URL: http://www.yahoo.com], [org.apache.webapp.balancer.rules.AcceptEverythingRule: Redirect URL: http://jakarta.apache.org]]
    08 Sep 2017 10:47:56 AM org.apache.catalina.core.ApplicationContext log
    INFO: ContextListener: contextInitialized()
    08 Sep 2017 10:47:56 AM org.apache.catalina.core.ApplicationContext log
    INFO: SessionListener: contextInitialized()
    08 Sep 2017 10:47:57 AM org.apache.tomcat.util.digester.Digester fatalError
    SEVERE: Parse Fatal Error at line 42 column 2: The content of elements must consist of well-formed character data or markup.
    org.xml.sax.SAXParseException: The content of elements must consist of well-formed character data or markup.
    at com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.createSAXParseException(Unknown Source)
    at com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.fatalError(Unknown Source)
    at com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(Unknown Source)
    at com.sun.org.apache.xerces.internal.impl.XMLScanner.reportFatalError(Unknown Source)
    at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl$FragmentContentDriver.startOfMarkup(Unknown Source)
    at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl$FragmentContentDriver.next(Unknown Source)
    at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl.next(Unknown Source)
    at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanDocument(Unknown Source)
    at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(Unknown Source)
    at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(Unknown Source)
    at com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(Unknown Source)
    at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.parse(Unknown Source)
    at com.sun.org.apache.xerces.internal.jaxp.SAXParserImpl$JAXPSAXParser.parse(Unknown Source)
    at org.apache.tomcat.util.digester.Digester.parse(Digester.java:1561)
    at org.apache.catalina.startup.ContextConfig.applicationWebConfig(ContextConfig.java:302)
    at org.apache.catalina.startup.ContextConfig.start(ContextConfig.java:959)
    at org.apache.catalina.startup.ContextConfig.lifecycleEvent(ContextConfig.java:249)
    at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:119)
    at org.apache.catalina.core.StandardContext.start(StandardContext.java:4020)
    at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:759)
    at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:739)
    at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:524)
    at org.apache.catalina.startup.HostConfig.deployDirectory(HostConfig.java:909)
    at org.apache.catalina.startup.HostConfig.deployDirectories(HostConfig.java:872)
    at org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:474)
    at org.apache.catalina.startup.HostConfig.start(HostConfig.java:1106)
    at org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java:310)
    at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:119)
    at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1019)
    at org.apache.catalina.core.StandardHost.start(StandardHost.java:718)
    at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1011)
    at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:440)
    at org.apache.catalina.core.StandardService.start(StandardService.java:450)
    at org.apache.catalina.core.StandardServer.start(StandardServer.java:683)
    at org.apache.catalina.startup.Catalina.start(Catalina.java:537)
    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:271)
    at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:409)
    08 Sep 2017 10:47:57 AM org.apache.catalina.startup.ContextConfig applicationWebConfig
    SEVERE: Parse error in application web.xml
    org.xml.sax.SAXParseException: The content of elements must consist of well-formed character data or markup.
    at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.parse(Unknown Source)
    at com.sun.org.apache.xerces.internal.jaxp.SAXParserImpl$JAXPSAXParser.parse(Unknown Source)
    at org.apache.tomcat.util.digester.Digester.parse(Digester.java:1561)
    at org.apache.catalina.startup.ContextConfig.applicationWebConfig(ContextConfig.java:302)
    at org.apache.catalina.startup.ContextConfig.start(ContextConfig.java:959)
    at org.apache.catalina.startup.ContextConfig.lifecycleEvent(ContextConfig.java:249)
    at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:119)
    at org.apache.catalina.core.StandardContext.start(StandardContext.java:4020)
    at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:759)
    at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:739)
    at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:524)
    at org.apache.catalina.startup.HostConfig.deployDirectory(HostConfig.java:909)
    at org.apache.catalina.startup.HostConfig.deployDirectories(HostConfig.java:872)
    at org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:474)
    at org.apache.catalina.startup.HostConfig.start(HostConfig.java:1106)
    at org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java:310)
    at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:119)
    at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1019)
    at org.apache.catalina.core.StandardHost.start(StandardHost.java:718)
    at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1011)
    at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:440)
    at org.apache.catalina.core.StandardService.start(StandardService.java:450)
    at org.apache.catalina.core.StandardServer.start(StandardServer.java:683)
    at org.apache.catalina.startup.Catalina.start(Catalina.java:537)
    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:271)
    at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:409)
    08 Sep 2017 10:47:57 AM org.apache.catalina.startup.ContextConfig applicationWebConfig
    SEVERE: Occurred at line 42 column 2
    08 Sep 2017 10:47:57 AM org.apache.catalina.startup.ContextConfig start
    SEVERE: Marking this application unavailable due to previous error(s)
    08 Sep 2017 10:47:57 AM org.apache.catalina.core.StandardContext start
    SEVERE: Error getConfigured
    08 Sep 2017 10:47:57 AM org.apache.catalina.core.StandardContext start
    SEVERE: Context startup failed due to previous errors
    08 Sep 2017 10:47:57 AM org.apache.catalina.core.ApplicationContext log
    INFO: ContextListener: contextInitialized()
    08 Sep 2017 10:47:57 AM org.apache.catalina.core.ApplicationContext log
    INFO: SessionListener: contextInitialized()
    08 Sep 2017 10:47:58 AM org.apache.coyote.http11.Http11Protocol start
    INFO: Starting Coyote HTTP/1.1 on http-8080
    08 Sep 2017 10:47:58 AM org.apache.jk.common.ChannelSocket init
    INFO: JK2: ajp13 listening on /0.0.0.0:8009
    08 Sep 2017 10:47:58 AM org.apache.jk.server.JkMain start
    INFO: Jk running ID=0 time=0/152 config=null
    08 Sep 2017 10:47:58 AM org.apache.catalina.storeconfig.StoreLoader load
    INFO: Find registry server-registry.xml at classpath resource
    08 Sep 2017 10:47:58 AM org.apache.catalina.startup.Catalina start
    INFO: Server startup in 4765 ms
    09 Sep 2017 10:44:16 AM org.apache.coyote.http11.Http11Protocol pause
    INFO: Pausing Coyote HTTP/1.1 on http-8080
    09 Sep 2017 10:44:18 AM org.apache.catalina.core.StandardService stop
    INFO: Stopping service Catalina
    09 Sep 2017 10:44:18 AM org.apache.catalina.core.ApplicationContext log
    INFO: ContextListener: attributeRemoved('org.apache.catalina.jsp_classpath', '/C:/Program Files/Apache Software Foundation/Tomcat 5.5/webapps/servlets-examples/WEB-INF/classes/;/C:/Program Files/Apache Software Foundation/Tomcat 5.5/shared/classes/;/C:/Program Files/Apache Software Foundation/Tomcat 5.5/common/classes/;/C:/Program Files/Apache Software Foundation/Tomcat 5.5/common/i18n/tomcat-i18n-en.jar;/C:/Program Files/Apache Software Foundation/Tomcat 5.5/common/i18n/tomcat-i18n-es.jar;/C:/Program Files/Apache Software Foundation/Tomcat 5.5/common/i18n/tomcat-i18n-fr.jar;/C:/Program Files/Apache Software Foundation/Tomcat 5.5/common/i18n/tomcat-i18n-ja.jar;/C:/Program Files/Apache Software Foundation/Tomcat 5.5/common/lib/commons-el.jar;/C:/Program Files/Apache Software Foundation/Tomcat 5.5/common/lib/jasper-compiler-jdt.jar;/C:/Program Files/Apache Software Foundation/Tomcat 5.5/common/lib/jasper-compiler.jar;/C:/Program Files/Apache Software Foundation/Tomcat 5.5/common/lib/jasper-runtime.jar;/C:/Program Files/Apache Software Foundation/Tomcat 5.5/common/lib/jsp-api.jar;/C:/Program Files/Apache Software Foundation/Tomcat 5.5/common/lib/naming-factory-dbcp.jar;/C:/Program Files/Apache Software Foundation/Tomcat 5.5/common/lib/naming-factory.jar;/C:/Program Files/Apache Software Foundation/Tomcat 5.5/common/lib/naming-resources.jar;/C:/Program Files/Apache Software Foundation/Tomcat 5.5/common/lib/servlet-api.jar;/C:/Program%20Files/Apache%20Software%20Foundation/Tomcat%205.5/bin/bootstrap.jar;/C:/Program%20Files/Java/jre6/lib/ext/dnsns.jar;/C:/Program%20Files/Java/jre6/lib/ext/localedata.jar;/C:/Program%20Files/Java/jre6/lib/ext/servlet-api.jar;/C:/Program%20Files/Java/jre6/lib/ext/sunjce_provider.jar;/C:/Program%20Files/Java/jre6/lib/ext/sunmscapi.jar;/C:/Program%20Files/Java/jre6/lib/ext/sunpkcs11.jar')
    09 Sep 2017 10:44:18 AM org.apache.catalina.core.ApplicationContext log
    INFO: ContextListener: attributeRemoved('org.apache.catalina.WELCOME_FILES', '[Ljava.lang.String;@257f1b')
    09 Sep 2017 10:44:18 AM org.apache.catalina.core.ApplicationContext log
    INFO: ContextListener: attributeRemoved('javax.servlet.context.tempdir', 'C:\Program Files\Apache Software Foundation\Tomcat 5.5\work\Catalina\localhost\servlets-examples')
    09 Sep 2017 10:44:18 AM org.apache.catalina.core.ApplicationContext log
    INFO: ContextListener: attributeRemoved('org.apache.catalina.resources', 'org.apache.naming.resources.ProxyDirContext@1bbdd48')
    09 Sep 2017 10:44:18 AM org.apache.catalina.core.ApplicationContext log
    INFO: ContextListener: attributeAdded('org.apache.catalina.WELCOME_FILES', '[Ljava.lang.String;@1d6fbb3')
    09 Sep 2017 10:44:18 AM org.apache.catalina.core.ApplicationContext log
    INFO: ContextListener: attributeReplaced('org.apache.catalina.WELCOME_FILES', '[Ljava.lang.String;@1d6fbb3')
    09 Sep 2017 10:44:18 AM org.apache.catalina.core.ApplicationContext log
    INFO: ContextListener: attributeReplaced('org.apache.catalina.WELCOME_FILES', '[Ljava.lang.String;@126d3df')
    09 Sep 2017 10:44:18 AM org.apache.catalina.core.ApplicationContext log
    INFO: SessionListener: contextDestroyed()
    09 Sep 2017 10:44:18 AM org.apache.catalina.core.ApplicationContext log
    INFO: ContextListener: contextDestroyed()
    09 Sep 2017 10:44:18 AM org.apache.catalina.core.ApplicationContext log
    INFO: ContextListener: attributeRemoved('org.apache.catalina.jsp_classpath', '/C:/Program Files/Apache Software Foundation/Tomcat 5.5/webapps/jsp-examples/WEB-INF/classes/;/C:/Program Files/Apache Software Foundation/Tomcat 5.5/webapps/jsp-examples/WEB-INF/lib/jstl.jar;/C:/Program Files/Apache Software Foundation/Tomcat 5.5/webapps/jsp-examples/WEB-INF/lib/standard.jar;/C:/Program Files/Apache Software Foundation/Tomcat 5.5/shared/classes/;/C:/Program Files/Apache Software Foundation/Tomcat 5.5/common/classes/;/C:/Program Files/Apache Software Foundation/Tomcat 5.5/common/i18n/tomcat-i18n-en.jar;/C:/Program Files/Apache Software Foundation/Tomcat 5.5/common/i18n/tomcat-i18n-es.jar;/C:/Program Files/Apache Software Foundation/Tomcat 5.5/common/i18n/tomcat-i18n-fr.jar;/C:/Program Files/Apache Software Foundation/Tomcat 5.5/common/i18n/tomcat-i18n-ja.jar;/C:/Program Files/Apache Software Foundation/Tomcat 5.5/common/lib/commons-el.jar;/C:/Program Files/Apache Software Foundation/Tomcat 5.5/common/lib/jasper-compiler-jdt.jar;/C:/Program Files/Apache Software Foundation/Tomcat 5.5/common/lib/jasper-compiler.jar;/C:/Program Files/Apache Software Foundation/Tomcat 5.5/common/lib/jasper-runtime.jar;/C:/Program Files/Apache Software Foundation/Tomcat 5.5/common/lib/jsp-api.jar;/C:/Program Files/Apache Software Foundation/Tomcat 5.5/common/lib/naming-factory-dbcp.jar;/C:/Program Files/Apache Software Foundation/Tomcat 5.5/common/lib/naming-factory.jar;/C:/Program Files/Apache Software Foundation/Tomcat 5.5/common/lib/naming-resources.jar;/C:/Program Files/Apache Software Foundation/Tomcat 5.5/common/lib/servlet-api.jar;/C:/Program%20Files/Apache%20Software%20Foundation/Tomcat%205.5/bin/bootstrap.jar;/C:/Program%20Files/Java/jre6/lib/ext/dnsns.jar;/C:/Program%20Files/Java/jre6/lib/ext/localedata.jar;/C:/Program%20Files/Java/jre6/lib/ext/servlet-api.jar;/C:/Program%20Files/Java/jre6/lib/ext/sunjce_provider.jar;/C:/Program%20Files/Java/jre6/lib/ext/sunmscapi.jar;/C:/Program%20Files/Java/jre6/lib/ext/sunpkcs11.jar')
    09 Sep 2017 10:44:18 AM org.apache.catalina.core.ApplicationContext log
    INFO: ContextListener: attributeRemoved('org.apache.catalina.WELCOME_FILES', '[Ljava.lang.String;@c5aa00')
    09 Sep 2017 10:44:18 AM org.apache.catalina.core.ApplicationContext log
    INFO: ContextListener: attributeRemoved('javax.servlet.context.tempdir', 'C:\Program Files\Apache Software Foundation\Tomcat 5.5\work\Catalina\localhost\jsp-examples')
    09 Sep 2017 10:44:18 AM org.apache.catalina.core.ApplicationContext log
    INFO: ContextListener: attributeRemoved('org.apache.catalina.resources', 'org.apache.naming.resources.ProxyDirContext@11c0d60')
    09 Sep 2017 10:44:18 AM org.apache.catalina.core.ApplicationContext log
    INFO: ContextListener: attributeAdded('org.apache.catalina.WELCOME_FILES', '[Ljava.lang.String;@136d9d8')
    09 Sep 2017 10:44:18 AM org.apache.catalina.core.ApplicationContext log
    INFO: ContextListener: attributeReplaced('org.apache.catalina.WELCOME_FILES', '[Ljava.lang.String;@136d9d8')
    09 Sep 2017 10:44:18 AM org.apache.catalina.core.ApplicationContext log
    INFO: ContextListener: attributeReplaced('org.apache.catalina.WELCOME_FILES', '[Ljava.lang.String;@1827d1')
    09 Sep 2017 10:44:18 AM org.apache.catalina.core.ApplicationContext log
    INFO: SessionListener: contextDestroyed()
    09 Sep 2017 10:44:18 AM org.apache.catalina.core.ApplicationContext log
    INFO: ContextListener: contextDestroyed()
    09 Sep 2017 10:44:18 AM org.apache.coyote.http11.Http11Protocol destroy
    INFO: Stopping Coyote HTTP/1.1 on http-8080

  5. #5
    Join Date
    Jun 1999
    Location
    Eastern Florida
    Posts
    3,756

    Re: Launching servlet in browser - error "The requested resource is not available"

    Ok, I see that you are trying to write a servlet that will return an HTML page to your browser.
    I haven't worked with Tomcat in a while and will have to do some research about how to configure servlets.
    Norm

  6. #6
    Join Date
    Jun 1999
    Location
    Eastern Florida
    Posts
    3,756

    Re: Launching servlet in browser - error "The requested resource is not available"

    Does the server work without your servlet? Does the first page have an Examples link?
    Can you execute any of the example servlets that are shown on this page: http://127.0.0.1:8080/examples/servlets/
    Norm

  7. #7
    Join Date
    Jun 1999
    Location
    Eastern Florida
    Posts
    3,756

    Re: Launching servlet in browser - error "The requested resource is not available"

    SEVERE: Parse Fatal Error at line 42 column 2: The content of elements must consist of well-formed character data or markup.
    What files did you change? Did you change anything around line 42? Say in a web.xml file?

    The web.xml file was modified
    Check that your changes are valid.
    Restore the original web.xml file and test the server. If it works, then there is probably a problem in your changes to it.
    Last edited by Norm; September 13th, 2017 at 11:32 AM.
    Norm

  8. #8
    Join Date
    Jun 1999
    Location
    Eastern Florida
    Posts
    3,756

    Re: Launching servlet in browser - error "The requested resource is not available"

    Norm

  9. #9
    Join Date
    Sep 2017
    Posts
    9

    Re: Launching servlet in browser - error "The requested resource is not available"

    Okay, I solved this problem:

    As stated by Norm - the error log actually shows that line 42 of the web.xml file has an error. I examined that line and found a very stupid typo right at the beginning - the comment beginning tag that was supposed to be typed as <!-- was mistakenly typed as <-- and obviously it couldn't recognize it. Almost 3 weeks of searching in wrong places because I never would have thought to check something like this.

    Thanks a lot for this, it was much appreciated!

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  


Windows Mobile Development Center


Click Here to Expand Forum to Full Width

This a Codeguru.com survey!


On-Demand Webinars (sponsored)