I make an application on jsp. I want the page to load at a specific address - for this I do as advised in the Oracle documentation:

Registering a JSP as a Servlet

in web.xml created code

<servlet> <servlet-name>myFoo</servlet-name> <jsp-file>myJSPfile.jsp</jsp-file> </servlet> <servlet-mapping> <servlet-name>myFoo</servlet-name> <url-pattern>/main</url-pattern> </servlet-mapping> 

The myJSPfile.jsp file is in the webapp folder. When the server is deployed, I get the error:

 [2017-01-03 10:21:56,182] Artifact GuestApp:war exploded: Artifact is being deployed, please wait... 03-Jan-2017 22:21:56.464 SEVERE [RMI TCP Connection(3)-127.0.0.1] rg.apache.catalina.core.ContainerBase.addChildInternal ContainerBase.addChild: start: org.apache.catalina.LifecycleException: Failed to start component [StandardEngine[Catalina].StandardHost[localhost].StandardContext[]] at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:153) at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:725) at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:701) at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:717)... 03-Jan-2017 22:21:56.474 SEVERE [RMI TCP Connection(3)-127.0.0.1] org.apache.tomcat.util.modeler.BaseModelMBean.invoke Exception invoking method manageApp java.lang.IllegalStateException: ContainerBase.addChild: start: org.apache.catalina.LifecycleException: Failed to start component [StandardEngine[Catalina].StandardHost[localhost].StandardContext[]] at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:729)... 03-Jan-2017 22:21:56.474 SEVERE [RMI TCP Connection(3)-127.0.0.1] org.apache.tomcat.util.modeler.BaseModelMBean.invoke Exception invoking method createStandardContext javax.management.RuntimeOperationsException: Exception invoking method manageApp at ... 

Having read a forum, I understood that it can be from the fact that in mappinge at me the missing servlet is specified, but record according to documentation orakl. what to do?

  • What documentation do you do this for? - Mikhail Vaysman
  • @Mikhail Vaysman According to this: docs.oracle.com/cd/E11035_01/wls100/webapp/configurejsp.html - uncleSAM
  • one
    And you did not bother, what is it for WebLogic? - Mikhail Vaysman
  • @Mikhail Vaysman You are absolutely right! I'm even a little ashamed) - uncleSAM
  • @MikhailVaysman Do not put shadow on the fence. This is a completely standard mapping. It would be something specific to weblogic, it would be written in some weblogic-web.xml, and not in the standard web.xml, which is the same for everyone and should work the same for everyone. - Sergey

1 answer 1

For Tomcat, for mapping a JSP page requires the following entry:

 <servlet> <servlet-name>myFoo</servlet-name> <jsp-file>/myJSPfile.jsp</jsp-file> </servlet> <servlet-mapping> <servlet-name>myFoo</servlet-name> <url-pattern>/main</url-pattern> </servlet-mapping> 

Notice that the name of the JSP file is "/":

/ (!!!) myJSPfile.jsp

  • This is true not only for tomkat. Probably an error crept into the oracle documentation. - Sergey