facebook

[JBoss] Redeployment and getLocalHome problem [Closed]

  1. MyEclipse IDE
  2.  > 
  3. General Development
Viewing 8 posts - 1 through 8 (of 8 total)
  • Author
    Posts
  • #200248 Reply

    I 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

    #200249 Reply

    I forgot:

    MyEclipse 2.6.4
    JBoss 3.2.x

    #200250 Reply

    I 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

    #200252 Reply

    Scott Anderson
    Participant

    Martin,

    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

    #200255 Reply

    I touched it using the Eclipse IDE (XML editior). The archive type was exploded. It still fails. ClassCastException kept on occuring.

    #200260 Reply

    After 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… .

    #200261 Reply

    I 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

    #200263 Reply

    Scott Anderson
    Participant

    Martin,

    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

Viewing 8 posts - 1 through 8 (of 8 total)
Reply To: [JBoss] Redeployment and getLocalHome problem [Closed]

You must be logged in to post in the forum log in