You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by "Timm, Sean" <ST...@mailgo.com> on 2000/04/06 04:31:14 UTC

Having problems trying to setup debugging in IDE...

For those of you who don't want to read the following long-winded
explanation, I'm trying to figure out how to get it so I can debug servlets
using my IDE and using the Tomcat servlet engine.  I tried following some
instructions posted on IBM's site for VisualAge (I'm using VisualCafe), and
I got to a certain point, but I'm getting errors returned from Tomcat code.
If anyone can provide me with some tips on how to make this work, I would
*greatly* appreciate it.  We've been using ServletExec, but we just found
out we need some functionality that only Servlet API 2.2 provides, so we're
trying to switch everything over to Tomcat now.  However, we need the
functionality provided by ServletExecDebugger, and the IBM article seems to
explain exactly how to do that (but it doesn't seem to be working for
me...:( )

I'm using VisualCafe 4.0 Expert Edition.  I've got a project set up with all
of the directories from a fresh CVS build placed in the directory my project
is located.  My main method calls Startup.main(args).  From here, I start
having problems.  For my first problem, it was complaining that the Server
tag was not declared.  I realized it was attempting to validate, but I
noticed a comment in the code mentioned that server.xml shouldn't be
validated yet, so I passed "-validate false" on the command-line.

When I try and run it with those parameters, I get further.  It loads the
configuration info from server.xml, but I get the following debug output:
<l:ctx path="/examples" >Add context</l:ctx>
<l:addContext path="/examples"  docBase="null" />
<l:ctx path="/test" >Add context</l:ctx>
<l:addContext path="/test"  docBase="null" />
<l:ctx path="" >Add context</l:ctx>
<l:addContext path=""  docBase="null" />
<l:startEndpoint port="0"
handler="org.apache.tomcat.service.http.HttpConnectionHandler" />
<l:startEndpoint port="8080"
handler="org.apache.tomcat.service.http.HttpConnectionHandler" />
<l:startEndpoint port="8007"
handler="org.apache.tomcat.service.connector.Ajp12ConnectionHandler" />

Notice that docBase is null for some reason.  If I run Tomcat by itself
using startup.bat, however, docBase shows up correctly.  I attempted various
means of getting around this issue.  I can specify -docbase
C:\MyProjectPath, but then I get a NullPointerException in
Config.processArgs.  The problem code snippet is as follows:
--------------------
  String id =
     (String)configElement.getAttribute(Constants.Attribute.Id);

  .........

  } else if (isArg(key) &&
      (config.getElements().size() == 1 ||
          (id.equals(getArg(Constants.Arg.ServiceId))))) {
      configElement.addAttribute(key, getArg(key));
  }
--------------------

id is assigned as null, so the call to id.equals throws an Exception.

So I did some more digging, and I think that it was printing out using
context.getDocumentBase, but it should be using context.getDocBase.

I'm kind of stumped where to go from here.  I experimented with having
setDocumentBase also update setDocBase, but that didn't seem to help any.
When I try and go to http://localhost:8080/, I receive a hit because I get
an error in the debug output as follows:
--------
<l:tc>Error reading request null</l:tc>
--------

Once again, if anyone can assist me, I'd greatly appreciate it.  I've been
trying to dig through the FAQs, documentation, and mailing archives, but I
have yet to come up with anything substantial that can help.  We've got the
Tomcat server up and running...just need to get it so we can debug now!

Thanks in advance,
Sean T.