• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 196
  • Last Modified:

why doesTomcat not recognize the script? but only treat is as "text"?

dear experts,

we just move to Tomcat 5.0.27 which seems have different configuration. after I move all the codes which work fine on another server (Tomcat 4) to this server, the Tomcat does not recognize my codes, instead, it shows <%=request....%> which means all the codes in <%% > was not compileed, but only treated as "text", why? thanks.
0
dodowoman
Asked:
dodowoman
  • 5
  • 3
  • 3
  • +1
2 Solutions
 
Ryan ChongCommented:
Can you view the tomcat start page at:

http://localhost:8080

?

how's your codes look like?
0
 
TimYatesCommented:
yeah, I think you're going to have to post some example code...
0
 
KuldeepchaturvediCommented:
One difference that I can recall between tomcat 4 and tomcat 5 is that its config file is not server.xml anymore. It creates different files for each web app.. Have you checked that part?
0
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
TimYatesCommented:
THis sounds like a ropey install though...

As if the JSP compiler servlet isn't loading...
0
 
dodowomanAuthor Commented:
to ryancys,
this is not a local server, so I can't test that.

to Kuldeepchaturvedi,
based on the document I have seen, it is still server.xml for configuration. and each application has web.xml as before. but the parameters in server.xml don't look the same between different version.

to TimYates,
I think you are right that the JSP compiler servlet isn't loading. how do we check that, do you know? thanks.
0
 
TimYatesCommented:
Inside

    /tomcat/conf/web.xml

there should be a section for the JSP compiler servlet like this:

------------

  <!-- The JSP page compiler and execution servlet, which is the mechanism  -->
  <!-- used by Tomcat to support JSP pages.  Traditionally, this servlet    -->
  <!-- is mapped to URL pattern "*.jsp".  This servlet supports the         -->
  <!-- following initialization parameters (default values are in square    -->
  <!-- brackets):                                                           -->

... LOADS of comments snipped out ...

  <!-- If you wish to use Jikes to compile JSP pages:                       -->
  <!--   Set the init parameter "compiler" to "jikes".  Define              -->
  <!--   the property "-Dbuild.compiler.emacs=true" when starting Tomcat    -->
  <!--   by adding the above to your CATALINA_OPTS environment variable.    -->
  <!--   If you get an error reporting that jikes can't use UTF8 encoding,  -->
  <!--   try setting the init parameter "javaEncoding" to "ISO-8859-1".     -->

    <servlet>
        <servlet-name>jsp</servlet-name>
        <servlet-class>org.apache.jasper.servlet.JspServlet</servlet-class>
        <init-param>
            <param-name>fork</param-name>
            <param-value>false</param-value>
        </init-param>
        <init-param>
            <param-name>xpoweredBy</param-name>
            <param-value>false</param-value>
        </init-param>
        <load-on-startup>3</load-on-startup>
    </servlet>

 ... then on the last page of the file ...

    <!-- The mapping for the JSP servlet -->
    <servlet-mapping>
        <servlet-name>jsp</servlet-name>
        <url-pattern>*.jsp</url-pattern>
    </servlet-mapping>
0
 
TimYatesCommented:
I reckon either

a)  Someone's commented that bit out (or removed the file)

or

b)  Someone has stripped out the web.xml file thinking they were in WEB-INF inside a web application...
0
 
KuldeepchaturvediCommented:
if its loading the jsp as a text file, this means.. server is up and running and recieving the request.
but intercepter is not working... so I go with Tim on it.. somebody messed up the web.xml...
try copying one from an up & running tomcat and see if that works...
0
 
dodowomanAuthor Commented:
thanks.
but, I created a WEB-INF under my application directory and put web.xml in it. I thought Tomcat will find the application web.xml before it loads the tomcat/conf/web.xml for all the server. is that right?
0
 
TimYatesCommented:
No

tomcat web.xml first...

Try reinstalling Tomcat...  Or just get the conf/web.xml file out of a tomcat binary zip...
0
 
dodowomanAuthor Commented:
thanks to all. I finally get Tomcat to compile the codes. But, after I modified the /tomcat/conf/web.xml to add my servlet entry, and put this modified web.xml to myApplication/WEB-INF/ to be my application web.xml, I restart the server and got the following message:

Mar 25, 2005 2:58:47 PM org.apache.commons.digester.Digester endElement
SEVERE: End event threw exception
java.lang.reflect.InvocationTargetException
      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
      at java.lang.reflect.Method.invoke(Method.java:324)
      at org.apache.commons.beanutils.MethodUtils.invokeMethod(MethodUtils.java:252)
      at org.apache.commons.digester.CallMethodRule.end(CallMethodRule.java:505)
      at org.apache.commons.digester.Rule.end(Rule.java:276)
      at org.apache.commons.digester.Digester.endElement(Digester.java:1058)
      at org.apache.xerces.parsers.AbstractSAXParser.endElement(Unknown Source)
      at org.apache.xerces.impl.dtd.XMLDTDValidator.endNamespaceScope(Unknown Source)
      at org.apache.xerces.impl.dtd.XMLDTDValidator.handleEndElement(Unknown Source)
      at org.apache.xerces.impl.dtd.XMLDTDValidator.endElement(Unknown Source)
      at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanEndElement(Unknown Source)
      at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl$FragmentContentDispatcher.dispatch(Unknown Source)
      at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanDocument(Unknown Source)
      at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
      at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
      at org.apache.xerces.parsers.XMLParser.parse(Unknown Source)
      at org.apache.xerces.parsers.AbstractSAXParser.parse(Unknown Source)
      at org.apache.commons.digester.Digester.parse(Digester.java:1548)
      at org.apache.catalina.startup.ContextConfig.applicationConfig(ContextConfig.java:263)
      at org.apache.catalina.startup.ContextConfig.start(ContextConfig.java:624)
      at org.apache.catalina.startup.ContextConfig.lifecycleEvent(ContextConfig.java:216)
      at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:119)
      at org.apache.catalina.core.StandardContext.start(StandardContext.java:4290)
      at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:823)
      at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:807)
      at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:595)
      at org.apache.catalina.core.StandardHostDeployer.install(StandardHostDeployer.java:277)
      at org.apache.catalina.core.StandardHost.install(StandardHost.java:832)
      at org.apache.catalina.startup.HostConfig.deployDirectories(HostConfig.java:687)
      at org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:432)
      at org.apache.catalina.startup.HostConfig.start(HostConfig.java:968)
      at org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java:349)
      at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:119)
      at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1091)
      at org.apache.catalina.core.StandardHost.start(StandardHost.java:789)
      at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1083)
      at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:478)
      at org.apache.catalina.core.StandardService.start(StandardService.java:480)
      at org.apache.catalina.core.StandardServer.start(StandardServer.java:2313)
      at org.apache.catalina.startup.Catalina.start(Catalina.java:556)
      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
      at java.lang.reflect.Method.invoke(Method.java:324)
      at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:284)
      at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:422)
Caused by: java.lang.IllegalArgumentException: Servlet mapping specifies an unknown servlet name invoker
      at org.apache.catalina.core.StandardContext.addServletMapping(StandardContext.java:2234)
      at org.apache.catalina.core.StandardContext.addServletMapping(StandardContext.java:2214)
      ... 48 more
Mar 25, 2005 2:58:47 PM org.apache.catalina.startup.ContextConfig applicationConfig
SEVERE: Parse error in application web.xml
java.lang.IllegalArgumentException: Servlet mapping specifies an unknown servlet name invoker
      at org.apache.commons.digester.Digester.createSAXException(Digester.java:2540)
      at org.apache.commons.digester.Digester.createSAXException(Digester.java:2566)
      at org.apache.commons.digester.Digester.endElement(Digester.java:1061)
      at org.apache.xerces.parsers.AbstractSAXParser.endElement(Unknown Source)
      at org.apache.xerces.impl.dtd.XMLDTDValidator.endNamespaceScope(Unknown Source)
      at org.apache.xerces.impl.dtd.XMLDTDValidator.handleEndElement(Unknown Source)
      at org.apache.xerces.impl.dtd.XMLDTDValidator.endElement(Unknown Source)
      at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanEndElement(Unknown Source)
      at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl$FragmentContentDispatcher.dispatch(Unknown Source)
      at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanDocument(Unknown Source)
      at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
      at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
      at org.apache.xerces.parsers.XMLParser.parse(Unknown Source)
      at org.apache.xerces.parsers.AbstractSAXParser.parse(Unknown Source)
      at org.apache.commons.digester.Digester.parse(Digester.java:1548)
      at org.apache.catalina.startup.ContextConfig.applicationConfig(ContextConfig.java:263)
      at org.apache.catalina.startup.ContextConfig.start(ContextConfig.java:624)
      at org.apache.catalina.startup.ContextConfig.lifecycleEvent(ContextConfig.java:216)
      at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:119)
      at org.apache.catalina.core.StandardContext.start(StandardContext.java:4290)
      at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:823)
      at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:807)
      at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:595)
      at org.apache.catalina.core.StandardHostDeployer.install(StandardHostDeployer.java:277)
      at org.apache.catalina.core.StandardHost.install(StandardHost.java:832)
      at org.apache.catalina.startup.HostConfig.deployDirectories(HostConfig.java:687)
      at org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:432)
      at org.apache.catalina.startup.HostConfig.start(HostConfig.java:968)
      at org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java:349)
      at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:119)
      at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1091)
      at org.apache.catalina.core.StandardHost.start(StandardHost.java:789)
      at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1083)
      at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:478)
      at org.apache.catalina.core.StandardService.start(StandardService.java:480)
      at org.apache.catalina.core.StandardServer.start(StandardServer.java:2313)
      at org.apache.catalina.startup.Catalina.start(Catalina.java:556)
      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
      at java.lang.reflect.Method.invoke(Method.java:324)
      at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:284)
      at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:422)
Mar 25, 2005 2:58:47 PM org.apache.catalina.startup.ContextConfig applicationConfig
SEVERE: Occurred at line 158 column 23
Mar 25, 2005 2:58:47 PM org.apache.catalina.startup.ContextConfig start
SEVERE: Marking this application unavailable due to previous error(s)
Mar 25, 2005 2:58:47 PM org.apache.catalina.core.StandardContext start
SEVERE: Error getConfigured
Mar 25, 2005 2:58:47 PM org.apache.catalina.core.StandardContext start
SEVERE: Context startup failed due to previous errors
Mar 25, 2005 2:58:47 PM org.apache.jk.common.ChannelSocket init
INFO: JK2: ajp13 listening on /127.0.0.1:8054
Mar 25, 2005 2:58:47 PM org.apache.jk.server.JkMain start
INFO: Jk running ID=0 time=3/99  config=/www/test.screendb.med.harvard.edu/tomcat/conf/jk2.properties
Mar 25, 2005 2:58:47 PM org.apache.coyote.tomcat5.MapperListener registerEngine
WARNING: Unknown default host: localhost
Mar 25, 2005 2:58:47 PM org.apache.catalina.startup.Catalina start
INFO: Server startup in 1984 ms
0
 
KuldeepchaturvediCommented:
above message means that the the entry you made in web.xml is not a correct one. System is not finding the servlet that you are asking him to find.. please check if the package name and servlet names are spelled correctly in your web.xml and web.xml is well formed
0

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

  • 5
  • 3
  • 3
  • +1
Tackle projects and never again get stuck behind a technical roadblock.
Join Now