4 Replies Latest reply on Nov 22, 2005 3:45 AM by thomas.diesler

    ParameterMetaData caching & Annotated Classloading

    jason.greene

      During the deploy process of a JSR181 endpoint the UMD uses a different classloader, the annotation classloader, since the web classloader is not yet available. After deployment the classloader is switched, which introduces a classloader problem with caching. Since tools needs to analyze the java type of a parameter, it calls getJavaType() on ParameterMetaData. The class object is then cached. After the first request, the classloader is then switched to the thread context classloader, leaving a cached class object from the old classloader. A type mapping is then built from these cached javatype classes. This cause the type lookups from the binding layer to finally fail because the lookup is using the correct class objects that are in the classloading context of the service endpoint.

      The workaround I am currently using is to verify the classloader of the cached class values matches the UMD classloader. If it doesn't we then reload the class.

      The other possible solution is to throw out caching altogether.

      Any thoughts on this one?

      -Jason