Hi David and Aklil, I was having a similar problem and finally remembered what I did to correct it. I don't currently have VisualAge installed and I'm going from memory on this one. You might also look in the archived postings because I believe that there was another thread on this topic.
The problem may be that the Servlet API project can't be found by the client-side of the cactus test. The Servlet project is automatically included in the classpath for WTE, but you need to explicitly add it to the classpath of the project that contains the test class. You can either add the Servlet project globally for use in all projects or you can add it specifically to the classpath for the project that you are testing. As an explanation for those who don't use VisualAge, you can add VisualAge projects to the classpath in addition to directories. I think that the offending class was ServletException. One of my test methods was declared as throwing this exception. Since the exception class couldn't be found, the suite wasn't successfully created. Even though testXxxx() is executed on the server side, the exceptions it throws must be locatable on the client side. Todd -----Original Message----- From: Vincent Massol [mailto:[EMAIL PROTECTED]] Sent: Saturday, October 13, 2001 5:11 AM To: [EMAIL PROTECTED] Subject: Re: VAJ 3.5.3 Class loader problem Aklil, ----- Original Message ----- From: <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Friday, October 12, 2001 1:43 AM Subject: Re: VAJ 3.5.3 Class loader problem > > David, > > I'm having the same problem you were having, about getting the > > "Failed to invoke suite(): java.lang.NoClassDefFoundError". > > It's definitely a problem with reflection when using the ServletTestCase > class with Cactus version 1.2, because I stepped through the code and the > initial error is "InvocationTargetException". Also when I change the test > class' super class to TestCase instead of ServletTestCase (as you did), it > works fine. I think the problem is very simple and it is what it says it is !, that is simply that there is a class that is not found. It probably means that JUnit is not finding the cactus classes (or any other class that cactus uses). You need to add the cactus classes either from your junit test runner (right click, properties, and add the cactus project) or add the cactus jar in the global workspace properties. > > I have tried to investigate this myself, making sure class paths etc .. are > correct and I am quite sure they are. It has been a while .... are you > still having this problem? Were you able to find a solution? > > Does anybody else have any ideas? > > Thanks > Aklil > > ps I'm not having this problem with version 1.1 for exactly the same test > class. > In that case, it seems to me you may simply be missing the httpclient.jar jar in your classpath as this the only difference from 1.1 to 1.2 in term of classpaths. It is needed on the client side of Cactus. -Vincent > > > > > > > [EMAIL PROTECTED] > om To: [EMAIL PROTECTED] > cc: > 11/09/2001 04:03 AM Subject: Re: VAJ 3.5.3 Class loader problem > Please respond to > cactus-user > > > > > > > > Yes, I set up my environment according to the tutorial on the web site. > It's strange becuase I can run the tests and they work great, but only if I > add the methods individually in the suite() method. I think I will try in > Websphere and see what happens. If anyone else has experienced this, let > me know. > > Thanks, > > David J Mehi > [EMAIL PROTECTED] > (248) 355-6621 > > > > > > > "Vincent > Massol" To: > <[EMAIL PROTECTED]> > <vmassol@octo. cc: > com> Subject: Re: VAJ 3.5. Class > loader problem > > 09/10/2001 > 01:34 PM > Please respond > to cactus-user > > > > > > > Hi David, > > Several on this list had succeeded in using Cacus with VAJava 3.5.3 (using > the "return new TestSuite(TestSampleServlet.class);" construction). I guess > your problem is more a classpath issue somewhere. Have you had a look at > the > VAJava tutorial on the Cactus web site ? > Thanks > -Vincent > > ----- Original Message ----- > From: <[EMAIL PROTECTED]> > To: <[EMAIL PROTECTED]> > Sent: Monday, September 10, 2001 2:47 PM > Subject: VAJ 3.5. Class loader problem > > > > Hello, > > > > I've been having a similar problem with the class loader as well in VAJ > > 3.5.3. I traced through the code and found that the test class cannot > find > > itself! > > > > If my test class extends the class "TestCase" instead of > "ServletTestCase", > > then it works. In my suite() method, if I add each method individually, > > then it works fine. However, for some reason, JUnit cannot find all my > > "test" methods via reflection when extending the "ServletTestCase" class. > > > > TestSuite suite = new TestSuite(); > > suite.addTest( new TestSampleServlet("testGetMethod") ); > > suite.addTest( new TestSampleServlet("testPostMethod") ); > > ....... > > return suite; > > > > instead of > > > > return new TestSuite(TestSampleServlet.class); // JUnit can't find all > > methods via relfection when extending "ServletTestCase" > > > > JUnit provides the error: > > Failed to invoke suite():java.lang.NoClassDefFoundError > > > > But it seems like it can't find the "ServletTestCase", which is the > actual > > test class. It might be something with the VAJ JVM. Does anyone know > what > > could be causing this? It works fine by added the individual methods, > but > > if I have a lot of methods, I would rather just be able to add via > > reflection. > > > > Thanks for your reply, > > > > David J Mehi > > [EMAIL PROTECTED] > > (248) 355-6621 > > > > > > > > > > > > > > > > > **************************************************************************** > > > > > > The information contained in this transmission, which may be > > confidential and proprietary, is only for the intended recipients. > > Unauthorized use is strictly prohibited. If you receive this > > transmission in error, please notify me immediately by telephone > > or electronic mail and confirm that you deleted this transmission > > and the reply from your electronic mail system. > > > **************************************************************************** > > > > > > > > > > > > > > > > > > **************************************************************************** > > > The information contained in this transmission, which may be > confidential and proprietary, is only for the intended recipients. > Unauthorized use is strictly prohibited. If you receive this > transmission in error, please notify me immediately by telephone > or electronic mail and confirm that you deleted this transmission > and the reply from your electronic mail system. > **************************************************************************** > > > > > > > > > This message is for the designated recipient only and may contain > privileged or confidential information. If you have received it in error, > please notify the sender immediately and delete the original. Any other > use of the email by you is prohibited. > >
