Hi Vincent, Thanks a lot for taking time out of your holidays, it is all working now. I simply had to update the excluded.properties file in the junit.jar file.
Evan ----- Original Message ----- From: "Vincent Massol" <[EMAIL PROTECTED]> To: "'Cactus Users List'" <[EMAIL PROTECTED]> Sent: Tuesday, July 23, 2002 6:37 AM Subject: RE: Strange error when using helper methods > Hi Evan, > > I think I have some idea ... If probably has to do with classloader. If > you look at the stack trace, you'll see the JUnit calls the JDK > getDeclaredMethods(). It means that the SalutationsHome class is now > loaded when the getDeclaredMethods() is called whereas in the first test > it was only loaded during execution of the test. > > Now as to why ... I know JUnit is using some special classloader to loaf > each test case independently. You may want to try to disable this (see > the junit FAQ or web site). > > I cannot help you more at the moment (as I'm on holiday working offline) > but I hope it may give you some idea. > > Cheers, > -Vincent > > > -----Original Message----- > > From: Evan Jehu [mailto:[EMAIL PROTECTED]] > > Sent: 22 July 2002 22:53 > > To: [EMAIL PROTECTED] > > Subject: Strange error when using helper methods > > > > Hi All, > > > > I am trying to execute some tests against EJB's deployed using > > jboss3.0.1RC1, the deployment executes as expected. I am using > netbeans > > as > > my IDE and running the unit tests from within it. I have mounted the > .jar > > files as described in the documentation etc. My problem is that the > > following test executes as expected and passes: > > > > public void testCreateSalutation() throws Exception { > > InitialContext ctx = new InitialContext() ; > > Object home = ctx.lookup("salutation") ; > > SalutationHome sHome = > (SalutationHome)PortableRemoteObject.narrow(home, > > SalutationHome.class) ; > > assertNotNull( sHome ) ; > > } > > > > > > however if I change the code to read: > > > > public void testCreateSalutation() throws Exception { > > SalutationHome sHome = getSalutationHome() ; > > assertNotNull( sHome ) ; > > } > > > > public SalutationHome getSalutationHome() throws Exception { > > InitialContext ctx = new InitialContext() ; > > Object home = ctx.lookup("salutation") ; > > return (SalutationHome)PortableRemoteObject.narrow(home, > > SalutationHome.class) ; > > } > > > > I get the following stack trace: > > > > Exception in thread "main" java.lang.NoClassDefFoundError: > > com/chryxus/cms/ejb/salutation/SalutationHome > > at java.lang.Class.getDeclaredMethods0(Native Method) > > at java.lang.Class.privateGetDeclaredMethods(Class.java:1627) > > at java.lang.Class.privateGetPublicMethods(Class.java:1655) > > at java.lang.Class.getMethod0(Class.java:1744) > > at java.lang.Class.getMethod(Class.java:963) > > at junit.runner.BaseTestRunner.getTest(BaseTestRunner.java:72) > > at junit.awtui.TestRunner.runSuite(TestRunner.java:404) > > at junit.awtui.TestRunner.start(TestRunner.java:485) > > at junit.ui.TestRunner.main(TestRunner.java:11) > > at com.chryxus.cms.test.SalutationTest.main(SalutationTest.java:41) > > > > > > I have checked the classpath and my EJB's are on it (as they would > have to > > be for it to compile and execute the first test code). This error > occures > > before the test calls the server. > > > > I have been stuck on this all day and would love some suggestions :-) > > > > Evan > > > > > > ------ > > > > Evan Jehu > > Software Developer > > > > Tel./Fax: (416) 222-6931 > > > > "After three days without programming, life becomes meaningless." > > The Tao of Programming - Book 2 > > http://misspiggy.gsfc.nasa.gov/tao.html > > > > > > > > > > > > -- > > To unsubscribe, e-mail: <mailto:cactus-user- > > [EMAIL PROTECTED]> > > For additional commands, e-mail: <mailto:cactus-user- > > [EMAIL PROTECTED]> > > > > -- > To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]> > For additional commands, e-mail: <mailto:[EMAIL PROTECTED]> > > -- To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>
