This discussion is archived
1 Reply Latest reply: Jan 4, 2013 6:11 AM by cdelahun RSS

Is there some caching of entity classes?

910274 Newbie
Currently Being Moderated
We are analyzing a bug in our application which seems to be caused by some kind of jpa entity class cache in weblogic (or some other feature causing indirectly the same thing).

The bug can't be reproduced every time, but it is happening very often after following steps:

- Deploy application from Eclipse with OEPE in mode "Virtual application"
- Use Redeploy or Clean feature of OEPE several times

We are doing some jpa queries during initialization of our application and after several redeploys assigning of resulting entities of those queries triggers class cast exception. I have captured some diagnostics that confirmed that class of jpa query result entity has different classloader than current web app classloader. How is it possible and how can we clear that kind of cache that's causing this during redeploy? I'm not writing to OEPE forum because I think it uses standard facilities of Weblogic where this should never ever be possible regardles of what tool is using it. My diagnostic logs are:

Expected class classloader: weblogic.utils.classloaders.ChangeAwareClassLoader@6ef4e946 finder: weblogic.utils.classloaders.CodeGenClassFinder@2e1a3d11 annotation: xxx
Expected class source location (notice that this path is same in both cases): file:/C:/Users/.../FeblApplicationSettingsTuple.class
Expected class protection domain: ProtectionDomain (file:/C:/Users/.../FeblApplicationSettingsTuple.class <no signer certificates>)
weblogic.utils.classloaders.ChangeAwareClassLoader@6ef4e946 finder: weblogic.utils.classloaders.CodeGenClassFinder@2e1a3d11 annotation: xxx
<no principals>
java.security.Permissions@4ce3316a (
("java.net.SocketPermission" "localhost:1024-" "listen,resolve")
("java.lang.RuntimePermission" "stopThread")
("java.util.PropertyPermission" "line.separator" "read")
("java.util.PropertyPermission" "java.vm.version" "read")
("java.util.PropertyPermission" "java.vm.specification.version" "read")
("java.util.PropertyPermission" "java.vm.specification.vendor" "read")
("java.util.PropertyPermission" "java.vendor.url" "read")
("java.util.PropertyPermission" "java.vm.name" "read")
("java.util.PropertyPermission" "os.name" "read")
("java.util.PropertyPermission" "java.vm.vendor" "read")
("java.util.PropertyPermission" "path.separator" "read")
("java.util.PropertyPermission" "java.specification.name" "read")
("java.util.PropertyPermission" "os.version" "read")
("java.util.PropertyPermission" "os.arch" "read")
("java.util.PropertyPermission" "java.class.version" "read")
("java.util.PropertyPermission" "java.version" "read")
("java.util.PropertyPermission" "file.separator" "read")
("java.util.PropertyPermission" "java.vendor" "read")
("java.util.PropertyPermission" "java.vm.specification.name" "read")
("java.util.PropertyPermission" "java.specification.version" "read")
("java.util.PropertyPermission" "java.specification.vendor" "read")
)


Actual class classloader: weblogic.utils.classloaders.ChangeAwareClassLoader@1b5f0c6 finder: weblogic.utils.classloaders.CodeGenClassFinder@20094d55 annotation: xxx
Actual class source location: file:/C:/Users/.../FeblApplicationSettingsTuple.class
Actual class protection domain: ProtectionDomain (file:/C:/Users/...n/FeblApplicationSettingsTuple.class <no signer certificates>)
weblogic.utils.classloaders.ChangeAwareClassLoader@1b5f0c6 finder: weblogic.utils.classloaders.CodeGenClassFinder@20094d55 annotation: xxx
<no principals>
java.security.Permissions@57c14d95 (
("java.net.SocketPermission" "localhost:1024-" "listen,resolve")
("java.lang.RuntimePermission" "stopThread")
("java.util.PropertyPermission" "line.separator" "read")
("java.util.PropertyPermission" "java.vm.version" "read")
("java.util.PropertyPermission" "java.vm.specification.version" "read")
("java.util.PropertyPermission" "java.vm.specification.vendor" "read")
("java.util.PropertyPermission" "java.vendor.url" "read")
("java.util.PropertyPermission" "java.vm.name" "read")
("java.util.PropertyPermission" "os.name" "read")
("java.util.PropertyPermission" "java.vm.vendor" "read")
("java.util.PropertyPermission" "path.separator" "read")
("java.util.PropertyPermission" "java.specification.name" "read")
("java.util.PropertyPermission" "os.version" "read")
("java.util.PropertyPermission" "os.arch" "read")
("java.util.PropertyPermission" "java.class.version" "read")
("java.util.PropertyPermission" "java.version" "read")
("java.util.PropertyPermission" "file.separator" "read")
("java.util.PropertyPermission" "java.vendor" "read")
("java.util.PropertyPermission" "java.vm.specification.name" "read")
("java.util.PropertyPermission" "java.specification.version" "read")
("java.util.PropertyPermission" "java.specification.vendor" "read")
)
  • 1. Re: Is there some caching of entity classes?
    cdelahun Pro
    Currently Being Moderated
    Hello,

    Can you post the code that runs into the exception, the exception itself, as well as how you are obtaining your EntityManager and EntityManagerFactory (if applicable)? If you are managing EntityManagerFactories in the application instead of allowing the container to manage them for you via injection, then you must also ensure that the application will close them when undeployed or some point before redeployment occurs. Otherwise, a similar error might occur dependent if garbage collection does not complete before the application next attempts to retrieve a factory.

    Best Regards,
    Chris

Legend

  • Correct Answers - 10 points
  • Helpful Answers - 5 points