Link to home
Start Free TrialLog in
Avatar of dodowoman
dodowoman

asked on

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.
Avatar of Ryan Chong
Ryan Chong
Flag of Singapore image

Can you view the tomcat start page at:

http://localhost:8080

?

how's your codes look like?
yeah, I think you're going to have to post some example code...
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?
THis sounds like a ropey install though...

As if the JSP compiler servlet isn't loading...
Avatar of dodowoman
dodowoman

ASKER

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.
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>
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...
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...
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?
ASKER CERTIFIED SOLUTION
Avatar of TimYates
TimYates
Flag of United Kingdom of Great Britain and Northern Ireland image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
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
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial