dcsimg
Getting classcastException in Junit....
2 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   Maniranjan_Kumar
Posted On:   Sunday, July 28, 2002 11:26 PM

hi, I m trying to run JUnit test class on the together Soft's Test Server 1.0 which accesses some startup RMI classes' remote interface from weblogic 6.1 sp2. But getting a class cast exception. I understand that it is due to two different class loaders as highlighted in the log file below. Though fully qualified class names are same in both the cases but as class loaders are differnet so JVM treats them as different classes and is throwing classCastException. But I m not able to rectify it. If nebody who has faced such an issue earlier on, either working with JUnit or working with ne other server, Please get back to me. Major concern is how to tell test server via its JVM properties or some other way not to load the class again using   More>>

hi,



I m trying to run JUnit test class on the together Soft's Test Server 1.0 which accesses some startup RMI classes' remote interface from weblogic 6.1 sp2. But getting a class cast exception. I understand that it is due to two different class loaders as highlighted in the log file below. Though fully qualified class names are same in both the cases but as class loaders are differnet so JVM treats them as different classes and is throwing classCastException. But I m not able to rectify it. If nebody who has faced such an issue earlier on, either working with JUnit or working with ne other server, Please get back to me. Major concern is how to tell test server via its JVM properties or some other way not to load the class again using ParentClassLoader.







regards,

Maniranjan Kumar


P.S. I have already tried rectifying JUnit's excluded.properties file and putting it in the server's classpath.





2001-07-29 10:20:56,594 DEBUG com.togethersoft.testing.internal.testserver.RemoteClassLoader2 - Loading com.cpb.util.CacheManager

2001-07-29 10:20:56,655 DEBUG com.togethersoft.testing.internal.testserver.RemoteClassLoader2 - Request url

2001-07-29 10:20:56,655 DEBUG com.togethersoft.testing.internal.testserver.RemoteClassLoader2 - Loading java.rmi.Remote

2001-07-29 10:20:56,655 DEBUG applicationlogging - CacheManager.class.getClassLoader() :: com.togethersoft.testing.internal.testserver.RemoteClassLoader@2ba11b

2001-07-29 10:20:58,207 DEBUG applicationlogging - ic.lookup(POWS.CacheManager).getClass().getClassLoader() :: com.togethersoft.testing.TestServer$ParentlessClassLoader@2457b6

2001-07-29 10:20:58,207 DEBUG applicationlogging - ----- Direct RMI call -----

2001-07-29 10:20:58,257 DEBUG applicationlogging - Looking up Test-home from JNDI 2weblogic.rmi.internal.LeasedRemoteRef@10f - jvmid: '-2797210065874769615S:192.168.203.154:[7001,7001,7002,7002,7001,7002,-1]:mydomain:myserver', oid: '271'

2001-07-29 10:20:58,277 DEBUG applicationlogging - In TestDetailsDAO.java :: testGetDetailsData() :java.lang.ClassCastException: $Proxy1

   <<Less

Re: Getting classcastException in Junit....

Posted By:   Andariel_Lau  
Posted On:   Tuesday, August 27, 2002 11:23 PM



Get JUnit3.8 at sourceforge.
It resolved my ClassLoader problem.


good luck.

Re: Getting classcastException in Junit....

Posted By:   Andariel_Lau  
Posted On:   Tuesday, August 27, 2002 04:38 PM

hey,


i met same question in Junit too, so if you got some answer, please let me know, thanks in advance.




yours,

Andariel Lau
About | Sitemap | Contact