Re: strutstest in Netbeans 6.9
On Wed, 11 Aug 2010, Tim Slattery wrote:
I'm using JUnit 3.8.2 and Strutstest 2.1.4 to run tests on an
application in Netbeans 6.9.
On test classes that use only JUnit things work just fine. But on the
Struts classes, I get this message:
Absent Code attribute in method that is not native or abstract in
class file javax/servlet//http/HttpServletRequestWrapper
After some googling, I determined that I needed to add a web server,
which I hadn't done. I can't add the Weblogic server that's installed
on my machine, NB just won't do it. So I used the Glassfish server
that comes with NB. Now I still get the message above, and it's also
telling me that it two versions of ant in the page, one in the
NetBeans directory and one in the Glassfish directory.
WTF!?!?!
Have you tried turning it off and on again?
More seriously, have you tried getting a copy of servlet-api.jar (from Sun
or the Glassfish installation you have locally) and adding it to your
classpath?
Are you using maven? From what i've read, the exception you report follows
from the fact that there is an official public maven repository for the
J2EE API which contains invalid classes (seriously, folks - which have
method definitions but no bytecode), and while this is sufficient to
compile against, you can't run with them. I don't know what imbecile came
up with this idea, but they need shooting. I suppose this is a consequence
of the problem that there isn't a standalone binary release of the entire
J2EE API (as opposed to any implementations of it), as there is with the
servlet API. This seems like a shocking omission.
Anyway, getting rid of the maven-derived class files and using the real
things should do the trick. You don't need to include the whole
application (ant and all) in your project, just the individual jars which
the tests need. You'll probably have to find those by trial, error, and
grepping, sadly.
tom
--
NTK now entirely filled with google links -- NTK