Well, my interceptor class gets called and it looks to me like the 
Handler's initArgs get set with a 'classdebuginfo' entry.  That also 
seems to be the right parameter name in EmbededServletOptions which is 
what the SunJavaCompiler seems to be looking at.  Not sure how the 
Options gets it from the Handler.

However, it's still not working for me.

I'm going to try 3.3 and if that fails, I'll roll my own Tomcat and 
force the -g...

Thanks,
Chris

Larry Isaacs wrote:

>The "Removing duplicate" messages are normal and not an
>indication of an error.  Internally, the "JspServlet"
>and "*.jsp" mapping are added by default, which is why you
>don't have to have it in your web.xml.  Your web.xml update
>is causing those defaults to be replaced.
>
>I believe you could put the interceptor class under
>TOMCAT_HOME/classes and it will automatically be included
>on the classpath.  I forgot to mention that you will
>need to add this interceptor to your server.xml.  You
>can add:
>
>    <ContextInterceptor
>        className="your fully qualified classname" />
>
>after the one for WebXmlReader.
>
>Larry
>
>>-----Original Message-----
>>From: Chris Lamey [mailto:[EMAIL PROTECTED]]
>>Sent: Wednesday, September 19, 2001 3:25 PM
>>To: [EMAIL PROTECTED]
>>Subject: Re: JSP compiles with -g?
>>
>>
>>Thanks for the info, but I'm still having a problem getting 
>>it working.
>>
>>I'm using the example number guesser as a test for this.  
>>Here's what I did:
>>
>>- Add the following XML to webapps/examples/WEB-INF/web.xml
>>
>><servlet-name>jsp</servlet-name>
>><servlet-class>org.apache.jasper.servlet.JspServlet</servlet-class>
>><init-param>
>>    <param-name>classdebuginfo</param-name>
>>    <param-value>true</param-value>
>></init-param>
>><init-param>
>>    <param-name>keepgenerated</param-name>
>>    <param-value>true</param-value>
>></init-param>
>><init-param>
>>    <param-name>sendErrToClient</param-name>
>>    <param-value>true</param-value>
>></init-param>
>></servlet>
>><servlet-mapping>
>>    <servlet-name>jsp</servlet-name>
>>    <url-pattern>*.jsp</url-pattern>
>></servlet-mapping>
>>
>>- Start Tomcat in jdb.exe
>>- Here's the output from startup:
>>
>>VM Started: Starting tomcat. Check logs/tomcat.log for error messages
>>2001-09-19 13:09:02 - Ctx( /examples ): Set debug to 1
>>2001-09-19 13:09:02 - ContextManager: Adding context Ctx( /examples )
>>2001-09-19 13:09:02 - ContextManager: Adding context Ctx( /admin )
>>2001-09-19 13:09:02 - ContextManager: Adding context Ctx(  )
>>2001-09-19 13:09:02 - ContextManager: Adding context Ctx( /test )
>>2001-09-19 13:09:02 - Ctx( /examples ): XmlReader - init  /examples 
>>webapps/examples
>>2001-09-19 13:09:02 - Ctx( /examples ): Reading 
>>C:\tomcat\jakarta-tomcat-3.2.3\webapps\examples\WEB-INF\web.xml
>>2001-09-19 13:09:02 - Ctx( /examples ): Removing duplicate 
>>servlet jsp 
>>jsp(org.apache.jasper.servlet.JspServlet/null)
>>2001-09-19 13:09:02 - Ctx( /examples ): Removing duplicate *.jsp -> 
>>jsp(org.apache.jasper.servlet.JspServlet/null)
>>2001-09-19 13:09:03 - Ctx( /examples ): Add user tomcat tomcat tomcat
>>2001-09-19 13:09:03 - Ctx( /examples ): Add user role1 tomcat role1
>>2001-09-19 13:09:03 - Ctx( /examples ): Add user both tomcat 
>>tomcat,role1
>>2001-09-19 13:09:04 - PoolTcpConnector: Starting 
>>HttpConnectionHandler 
>>on 8080
>>2001-09-19 13:09:04 - PoolTcpConnector: Starting 
>>Ajp12ConnectionHandler 
>>on 8007
>>
>>Which says that it's removing a duplicate jsp entry.  But there isn't 
>>one in that web.xml...must be a default?
>>
>>As for you second suggestion, I created a class the extends 
>>BaseInterceptor and included that method.  But it didn't do 
>>the trick. 
>> Where should that class go?  I just have it in my $CLASSPATH
>>
>>It looks to me like the 'jsp' servlet doesn't recognize that 
>>init param. 
>> Or I'm just not doing something correct...
>>
>>Thanks for the help,
>>Chris
>>
>>Larry Isaacs wrote:
>>
>>>Hi Chris,
>>>
>>>There is support for this in Tomcat 3.2.3 (as well as 3.3),
>>>but it isn't widely known.  For 3.2.3, the following
>>>methods should work.
>>>
>>>Method 1.  Update the web.xml to explicitly configure
>>>Jasper's JspServlet.  This is documented in the last
>>>question in the "faq" document found in TOMCAT_HOME/doc.
>>>You will want to set the "classdebuginfo" init parameter
>>>true.
>>>
>>>Method 2.  To enable "-g" for all contexts without modifying
>>>web.xml's, implement a custom interceptor that sets JspServlet's
>>>"classdebuginfo" init parameter true. Write a class that
>>>imports "org.apache.tomcat.core.*", extends BaseInterceptor,
>>>and includes the following method:
>>>
>>>   public void contextInit(Context ctx) throws TomcatException {
>>>       ServletWrapper jasper=ctx.getServletByName( "jsp" );
>>>       jasper.addInitParam("classdebuginfo", "true" );
>>>   }
>>>
>>>You may enhance this by adding code to make it configurable.
>>>Hope this helps.
>>>
>>>Larry
>>>
>>>P.S. For Tomcat 3.3 users, add:
>>>
>>>   classDebugInfo="true"
>>>
>>>to the JspInterceptor in server.xml.
>>>
>>>
>>>>-----Original Message-----
>>>>From: Chris Lamey [mailto:[EMAIL PROTECTED]]
>>>>Sent: Wednesday, September 19, 2001 1:45 PM
>>>>To: [EMAIL PROTECTED]
>>>>Subject: JSP compiles with -g?
>>>>
>>>>
>>>>Hi all, I'm trying to debug some JSPs, and I'd like to be 
>>>>able to browse
>>>>the local variables on the stack.  However, jdb complains 
>>>>
>>that the JSP
>>
>>>>generated class file wasn't compiled with the -g option.
>>>>
>>>>Is there a way to pass that flag to the JSP compiler?
>>>>
>>>>Windows 2k/Tomcat 3.2.3/JDK 1.3.1_01
>>>>
>>>>Thanks,
>>>>Chris
>>>>
>>>>
>>
>>



Reply via email to