Hi Martin,

As you said, your tests are in the WAR, then it means it will be loaded by the container( WebLogic Server). So as Bibhuti mentioned, if it(test) is loaded by the WebLogic server, it will not be reloaded ( I dont know whether WebLogic reloades it. But tomcat is not doing.) So in that case we have to restart the container. Since Cactus does not use it's own class loader to load the test class.
It is better somebody knows more about how Cactus loads the test cases and whether it will be refreshed when we change the test class dynamically.
But I have tested with Tomcat 4.1.24 and Cactus 1.4.1, I have to restart the tomcat to see the changes in the testcases.


*Cactus Implementation:-*

AbstractWebTestCaller.java loads the test class in the following way

testClass = ClassLoaderUtils.loadClass(theClassName,
               this.getClass());

*ClassLoaderUtils.java*

public static Class loadClass(String theClassName, Class theReferrer)
       throws ClassNotFoundException
   {
       // Get the class to call and build an instance of it.
       Class clazz = null;

try
{
// try loading from webapp classloader first
clazz = loadClassFromWebappClassLoader(theClassName, theReferrer);
}
catch (Throwable internalException)
{
// Then try first from Context class loader so that we can put the
// Cactus jar as an external library.
clazz = loadClassFromContextClassLoader(theClassName);
}


       return clazz;
   }

/**
* Try loading class using the Context class loader.
*
* @param theClassName the class to load
* @return the <code>Class</code> object for the class to load
* @exception ClassNotFoundException if the class cannot be loaded through
* this class loader
*/
public static Class loadClassFromContextClassLoader(String theClassName)
throws ClassNotFoundException
{
return Class.forName(theClassName, true,
Thread.currentThread().getContextClassLoader());
}


/**
* Try loading class using the Webapp class loader.
*
* @param theClassName the class to load
* @param theReferrer the class will be loaded using the classloader which
* has loaded this referrer class
* @return the <code>Class</code> object for the class to load
* @exception ClassNotFoundException if the class cannot be loaded through
* this class loader
*/
public static Class loadClassFromWebappClassLoader(String theClassName,
Class theReferrer) throws ClassNotFoundException
{
return Class.forName(theClassName, true, theReferrer.getClassLoader());
}


With the use of one developer, I changed the line in the AbstractWebTestCaller.java like the following

URLClassLoader loader = URLClassLoader.newInstance(new URL[]{new File("<ClassPath to your test classes").toURL()},this.getClass().getClassLoader());
testClass = loader.loadClass(theClassName);


Here Tests should not be present in the containers classpath.

Now my tests are reloaded when I change it. I dont know whethe this approach is correct. Why cactus developers have not given a thought about this. But anyway I thought of using this updated jar for my test development.

Kindly give your comments and feedback over this approach, even if I am entirely wrong.

Regards,
Ramesh.

Martin Leclerc wrote:

Bibhuti,

I can confirm you do not need to put your jar containing the test
under the weblogic classpath.

I have been running cactus (1.4 and 1.5B) under weblogic 7 with this setup:
- cactus.jar and direct dependencies (such as junit.jar, commons-*, etc) in the weblogic classpath (set in startWLS.cmd in my case)
- My cactus tests in the war


As to what your specific problem is, I don't quite know. But be assured
you do not need to restart weblogic every time...


Hope this helps !

Martin



-----Original Message-----
From: Bibhuti Acharya [mailto:[EMAIL PROTECTED]
Sent: July 17, 2003 1:39 PM
To: [EMAIL PROTECTED]
Subject: cactus with weblogic


Hi,


I m running the test case from the ant.
All test case class files are in a jar file and in ant classpath.


Do I need to put the testcase jar file in weblogic
classpath also?

Because if i m putting the jar in classpath it's
working fine, and if not have this test case classpath
throwing below exception

2003-07-17 22:16:03,226 ERROR (BaseLog.java.error:126)
- Error finding class [
com.persistence.test.TestQAUserDO] in classpath
java.lang.ClassNotFoundException:
com.persistence.test.TestQAUserDO

If i do like this every time i change code.. i need to
restart the weblogic.
any suggestions how to do that?

Thanks & Regards
Bibhuti



=====
Bibhuti Bhusan Acharya. HCL Infosystems Ltd. 2nd floor,Thaper House, 43/44,Mountith road. EGMORE,Chennai-600008 ph no-(044)8511293/8511954 ext 218 (O) (044)24348393(R) 9840297429(M) email:[EMAIL PROTECTED] [EMAIL PROTECTED]


__________________________________
Do you Yahoo!?
SBC Yahoo! DSL - Now only $29.95 per month!
http://sbc.yahoo.com

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]





---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Reply via email to