views:

35

answers:

1

I checked the javadocs of the Tomcat library I have included under my Netbeans project, and when I deploy the code works fine, but when I do a clean-build of my web project I get a "cannot find symbol" on the getContextPath() method of the ServletContext interface

It's driving me completely insane because in order to run my tests and so on I have to first deploy, then test, if I clean and build, or clean and run tests I get this error...

Anyone have any clue what could be causing this issue? Is there a library I have to update or something?

+1  A: 

I suspect it's not in the version of ServletContext you're building against, but it is in the version you're deploying against. According to the docs of version 2.5 it was introduced in 2.5. So basically change the servlet.jar you're building against to be the 2.5 one, and it should be fine.

Jon Skeet
For that matter, you need Tomcat 6.x for Servlet 2.5 support.
R. Bemrose
Yes, it was working when deploying but not when building.. which doesn't make sense... how does it deploy if it can't build?! Either way, you're right, I had a different servlet.jar in another project that was included... why someone here needed to include servlet.jar in a plain java non-web project... I have no idea
walnutmon