- This topic has 7 replies, 2 voices, and was last updated 20 years, 12 months ago by Scott Anderson.
-
AuthorPosts
-
Martin_KerstenMemberI just wonder, if someone else found a solution to a problem using the docletX utility class after a redeployment took place.
Within a cactus servlet test case, I use getLocalHome of MyBeanUtil. Since it uses a cache to avoid additional look ups, it rans into an null pointer error.
Here is how the error works:
First: run
MyBeanUtil.getLocalHome() -> Returns a proper local home.Redeploy MyBeanUtil within a packaged ear.
Callign MyBeanUtil.getLocalHome() again -> Returns the old local home (proxy of it), which isn’t applicable anymore. Therefore internally the old local home fails to connect to the resource, causing a null pointer exception.
The root of the evil?
Well I guess since the cache variable is static, the problem lies within the reloading of the MyBeanUtil class during redeployment. The jboss-deployment method does not recognize that the MyBeanUtil class has to be reloaded and reinitialized. Maybe the class has to be marked in a special way. I can’t think of any other explaination.Thanks,
Martin Kersten
Martin_KerstenMemberI forgot:
MyEclipse 2.6.4
JBoss 3.2.x
Martin_KerstenMemberI done some further inventions. Trying it without the cached version (doing the lookup by testcode) it fails causing a cast exception. I also tried to undeploy and deploy again. Same here. Also deploying an exploded version does not help.
The only solution is to shut down the server and start it again. Since then it works fine. Until a redeployment takes place. I am allready sure it is a class loaded issus.
It’s getting us crazy for some time. Any help would be appricated.
Thanks,
Martin Kersten
Scott AndersonParticipantMartin,
Instead of using the ‘Redeploy’ button, try simply making a small (insignificant) edit to the application.xml file and saving it (ie ‘touch’ it). This will tell JBoss that a full reload is necessary for the application and should cause a complete unload reload. Redeploy while the server is hot may be problematic as the server may have locked resources that prevent it from occuring properly.
–Scott
MyEclipse Support
Martin_KerstenMemberI touched it using the Eclipse IDE (XML editior). The archive type was exploded. It still fails. ClassCastException kept on occuring.
Martin_KerstenMemberAfter realising that it also fails on casting remote interfaces, it seamed that this is a class loader issus. The interface classes are loaded using a static class loader and the lookup operation returns instances of classes loaded using a dynamic class-loader. I will do some additional testing… .
Martin_KerstenMemberI have found the solution:
Reason:
The test cases are loaded using the static class loader of jboss and not the dynamic one. This indicates that the cactus related stuff must also be loaded by the dynamic class loader.Solution:
Remove all cactus related libraries from servername/lib (shared library directory) and add the required libraries to your ear directly (I put ’em all in the web/WEB-INF/lib directory).Now it seams to work,
Martin Kersten
Scott AndersonParticipantMartin,
Interesting. Thanks for posting the detail and resolution as I’m sure we have many other users interested in using Cactus for testing also.
–Scott
MyEclipse Support -
AuthorPosts