You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by Remy Maucherat <re...@exoffice.com> on 2000/04/27 05:23:44 UTC

Re: Build broken + [PATCH] build.xml

> Hi !
>
> I just downloaded the CVS tree, and tried to build tomcat.
> There are apparently 2 errors in the file
> src\share\org\apache\tomcat\core\Container.java
>
> C:\Documents and Settings\Sylvain Laurent\My
> Documents\jakarta\jakarta-tomcat\src\share\org\apache\t
> omcat\core\Container.java:150: Statement not reached.
>             if(context!=null) contextM=context.getContextManager();
>             ^
> C:\Documents and Settings\Sylvain Laurent\My
> Documents\jakarta\jakarta-tomcat\src\share\org\apache\t
> omcat\core\Container.java:263: Statement not reached.
>             handler=context.getDefaultServlet();
>             ^
> 2 errors
> BUILD FATAL ERROR: Compile failed, messages should have been provided.
>
> Hope it'll help...

Comment the two lines and it will compile.

I noticed two things with the newest build :
- There are errors parsing web.xml
- My servlet seems to die every time I call
HttpServletRequest.getPathTranslated() and its result is not null. Removing
the call fixes the problem (which seems to be coming from changes to the
Context class). Ideas ?

Here is a small patch for build.xml to make the life of WinCVS users (like
myself) a bit easier. Basically, it adds an **/CVS/** excludes attribute to
every javac element, so that Ant ignores WinCVS temporary files.

===================================================================
RCS file: /home/cvspublic/jakarta-tomcat/build.xml,v
retrieving revision 1.46
diff -r1.46 build.xml
58c58
< classpath="${tomcat.build}/lib/xml.jar" debug="on"/>
---
> classpath="${tomcat.build}/lib/xml.jar" debug="on" excludes="**/CVS/**"/>
72c72
< classpath="${tomcat.build}/classes"/>
---
> classpath="${tomcat.build}/classes" excludes="**/CVS/**"/>
74c74
< destdir="${tomcat.build}/webapps/examples/jsp/plugin/applet"/>
---
> destdir="${tomcat.build}/webapps/examples/jsp/plugin/applet"
excludes="**/CVS/**"/>
81c81
< classpath="${tomcat.build}/classes"/>
---
> classpath="${tomcat.build}/classes" excludes="**/CVS/**"/>
88c88
< classpath="${tomcat.build}/classes"/>
---
> classpath="${tomcat.build}/classes" excludes="**/CVS/**"/>
95c95
< classpath="${tomcat.build}/classes"/>
---
> classpath="${tomcat.build}/classes" excludes="**/CVS/**"/>

Remy


Re: Build broken + [PATCH] build.xml

Posted by Remy Maucherat <re...@exoffice.com>.
> > I noticed two things with the newest build :
> > - There are errors parsing web.xml
>
> Can you send a sample of what's failing ? Errors, the web.xml that fails,
etc.

No problem. I didn't have enough time to look into that more in depth,

<snip>
Adding context Ctx( /examples )
Adding context Ctx(  )
Adding context Ctx( /test )
Starting tomcat. Check logs/tomcat.log for error messages
Tomcat install = ..
Tomcat home = C:\Work\cvs\build\tomcat
Adding context Ctx( /admin )
ERROR reading C:\Work\cvs\build\tomcat\webapps\examples\WEB-INF\web.xml
At Line 80 /web-app/security-constraint/

ERROR reading C:\Work\cvs\build\tomcat\webapps\examples\WEB-INF\web.xml
java.lang.RuntimeException: Assert: container.getHandler==null
        at org.apache.tomcat.core.Container.getHandler(Container.java:262)
        at
org.apache.tomcat.request.SimpleMapper.addContainer(SimpleMapper.java:294)
        at
org.apache.tomcat.core.ContextManager.addContainer(ContextManager.java,
Compiled Code)
        at
org.apache.tomcat.core.Context.addSecurityConstraint(Context.java, Compiled
Code)
        at org.apache.tomcat.context.SCAction.end(WebXmlReader.java,
Compiled Code)
        at org.apache.tomcat.util.xml.XmlMapper.matchEnd(XmlMapper.java,
Compiled Code)
        at org.apache.tomcat.util.xml.XmlMapper.endElement(XmlMapper.java,
Compiled Code)
        at com.sun.xml.parser.Parser.maybeElement(Parser.java, Compiled
Code)
        at com.sun.xml.parser.Parser.content(Parser.java, Compiled Code)
        at com.sun.xml.parser.Parser.maybeElement(Parser.java, Compiled
Code)
        at com.sun.xml.parser.Parser.parseInternal(Parser.java:491)
        at com.sun.xml.parser.Parser.parse(Parser.java:283)
        at org.apache.tomcat.util.xml.XmlMapper.readXml(XmlMapper.java:198)
        at
org.apache.tomcat.context.WebXmlReader.processFile(WebXmlReader.java:141)
        at
org.apache.tomcat.context.WebXmlReader.contextInit(WebXmlReader.java:55)
        at
org.apache.tomcat.core.ContextManager.initContext(ContextManager.java,
Compiled Code)
        at org.apache.tomcat.core.ContextManager.init(ContextManager.java,
Compiled Code)
        at org.apache.tomcat.startup.Tomcat.execute(Tomcat.java:198)
        at org.apache.tomcat.startup.Tomcat.main(Tomcat.java:205)
ERROR reading C:\Work\cvs\build\tomcat\webapps\test\WEB-INF\web.xml
At Line 130 /web-app/security-constraint/

ERROR reading C:\Work\cvs\build\tomcat\webapps\test\WEB-INF\web.xml
java.lang.RuntimeException: Assert: container.getHandler==null
        at org.apache.tomcat.core.Container.getHandler(Container.java:262)
        at
org.apache.tomcat.request.SimpleMapper.addContainer(SimpleMapper.java:294)
        at
org.apache.tomcat.core.ContextManager.addContainer(ContextManager.java,
Compiled Code)
        at
org.apache.tomcat.core.Context.addSecurityConstraint(Context.java, Compiled
Code)
        at org.apache.tomcat.context.SCAction.end(WebXmlReader.java,
Compiled Code)
        at org.apache.tomcat.util.xml.XmlMapper.matchEnd(XmlMapper.java,
Compiled Code)
        at org.apache.tomcat.util.xml.XmlMapper.endElement(XmlMapper.java,
Compiled Code)
        at com.sun.xml.parser.Parser.maybeElement(Parser.java, Compiled
Code)
        at com.sun.xml.parser.Parser.content(Parser.java, Compiled Code)
        at com.sun.xml.parser.Parser.maybeElement(Parser.java, Compiled
Code)
        at com.sun.xml.parser.Parser.parseInternal(Parser.java:491)
        at com.sun.xml.parser.Parser.parse(Parser.java:283)
        at org.apache.tomcat.util.xml.XmlMapper.readXml(XmlMapper.java:198)
        at
org.apache.tomcat.context.WebXmlReader.processFile(WebXmlReader.java:141)
        at
org.apache.tomcat.context.WebXmlReader.contextInit(WebXmlReader.java:55)
        at
org.apache.tomcat.core.ContextManager.initContext(ContextManager.java,
Compiled Code)
        at org.apache.tomcat.core.ContextManager.init(ContextManager.java,
Compiled Code)
        at org.apache.tomcat.startup.Tomcat.execute(Tomcat.java:198)
        at org.apache.tomcat.startup.Tomcat.main(Tomcat.java:205)

> > - My servlet seems to die every time I call
> > HttpServletRequest.getPathTranslated() and its result is not null.
Removing
> > the call fixes the problem (which seems to be coming from changes to the
> > Context class). Ideas ?
>
> Any stack traces or message ? It's hard to debug with only this.

I have nothing, sorry. The thread which handles the request just seems to
deadlock.
I'll be put some debug statements in the Tomcat code to see exactly where it
dies.

> I'm working on the mapper and try to clean up the whole process, and
> probably it will brake something in the process - but everything should be
> stable soon. ( in fact I haven't turned on the new mapper yet ).

Remy


Re: Build broken + [PATCH] build.xml

Posted by Costin Manolache <co...@costin.dnt.ro>.
Thanks Remy,

It's easy to fix, it seems not all containers have handlers. I'll try to find
out why,
and comment out the exception and replace it with the original "error recovery"
code.

( Many methods in tomcat have "error recovery" code - i.e. even if a field
doesn't exist,  we try to guess a reasonable value. In the case of handler - it
will be the DefaultServlet. )

Costin





Remy Maucherat wrote:

> > > I noticed two things with the newest build :
> > > - There are errors parsing web.xml
> >
> > Can you send a sample of what's failing ? Errors, the web.xml that fails,
> etc.
> >
> > > - My servlet seems to die every time I call
> > > HttpServletRequest.getPathTranslated() and its result is not null.
> Removing
> > > the call fixes the problem (which seems to be coming from changes to the
> > > Context class). Ideas ?
> >
> > Any stack traces or message ? It's hard to debug with only this.
>
> In the getRealPath method :
>
> String getRealPath( String path) {
>  // Real Path is the same as PathTranslated for a new request
>
>  String normP=FileUtil.normPath(path);
>  Request req=contextM.createRequest( this , normP );
>  contextM.processRequest(req);
>
> It dies just at the processRequest call.
>
> More precisely,
>
>  for( int i=0; i< requestInterceptors.size(); i++ ) {
>
>    ((RequestInterceptor)requestInterceptors.elementAt(i)).requestMap( req );
>  }
>
> calls SimpleMapper.requestMap(Request req), and stops while executing that
> block :
>
>  // set default container, return
>  if (container == null) {
>      container=m.defaultContainer;
> >     req.setWrapper( m.defaultContainer.getHandler() );
>      req.setServletPath( "" );
>      req.setPathInfo( path);
>  }  else {
>      req.setWrapper( container.getHandler() );
>  }
>
> Which brings me back to the container ...
>
>     public ServletWrapper getHandler() {
>         if (handler == null) {
>      /* assert */ throw new RuntimeException( "Assert:
> container.getHandler==null");
>      file://handler=context.getDefaultServlet();
>  }
>  return handler;
>     }
>
> Ooops, I just noticed the related broken assertions I sent to the mailing
> list.
> Explanation : the handler ServletWrapper instance is null, assertion fails,
> a RuntimeException is thrown, and silently catched somewhere.
>
> > I'm working on the mapper and try to clean up the whole process, and
> > probably it will brake something in the process - but everything should be
> > stable soon. ( in fact I haven't turned on the new mapper yet ).
>
> Remy
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tomcat-dev-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tomcat-dev-help@jakarta.apache.org


Re: Build broken + [PATCH] build.xml

Posted by Remy Maucherat <re...@exoffice.com>.
> > I noticed two things with the newest build :
> > - There are errors parsing web.xml
>
> Can you send a sample of what's failing ? Errors, the web.xml that fails,
etc.
>
> > - My servlet seems to die every time I call
> > HttpServletRequest.getPathTranslated() and its result is not null.
Removing
> > the call fixes the problem (which seems to be coming from changes to the
> > Context class). Ideas ?
>
> Any stack traces or message ? It's hard to debug with only this.

In the getRealPath method :

String getRealPath( String path) {
 // Real Path is the same as PathTranslated for a new request

 String normP=FileUtil.normPath(path);
 Request req=contextM.createRequest( this , normP );
 contextM.processRequest(req);

It dies just at the processRequest call.

More precisely,

 for( int i=0; i< requestInterceptors.size(); i++ ) {


   ((RequestInterceptor)requestInterceptors.elementAt(i)).requestMap( req );
 }

calls SimpleMapper.requestMap(Request req), and stops while executing that
block :

 // set default container, return
 if (container == null) {
     container=m.defaultContainer;
>     req.setWrapper( m.defaultContainer.getHandler() );
     req.setServletPath( "" );
     req.setPathInfo( path);
 }  else {
     req.setWrapper( container.getHandler() );
 }

Which brings me back to the container ...

    public ServletWrapper getHandler() {
        if (handler == null) {
     /* assert */ throw new RuntimeException( "Assert:
container.getHandler==null");
     file://handler=context.getDefaultServlet();
 }
 return handler;
    }

Ooops, I just noticed the related broken assertions I sent to the mailing
list.
Explanation : the handler ServletWrapper instance is null, assertion fails,
a RuntimeException is thrown, and silently catched somewhere.

> I'm working on the mapper and try to clean up the whole process, and
> probably it will brake something in the process - but everything should be
> stable soon. ( in fact I haven't turned on the new mapper yet ).

Remy


Re: Build broken + [PATCH] build.xml

Posted by Costin Manolache <co...@costin.dnt.ro>.
> I noticed two things with the newest build :
> - There are errors parsing web.xml

Can you send a sample of what's failing ? Errors, the web.xml that fails, etc.

> - My servlet seems to die every time I call
> HttpServletRequest.getPathTranslated() and its result is not null. Removing
> the call fixes the problem (which seems to be coming from changes to the
> Context class). Ideas ?

Any stack traces or message ? It's hard to debug with only this.

I'm working on the mapper and try to clean up the whole process, and
probably it will brake something in the process - but everything should be
stable soon. ( in fact I haven't turned on the new mapper yet ).

Costin