Question

Is it possible to install a static object at the ManagedServer level that is visible to multiple applications? I'm aware of shared libraries, but it isn't clear to me whether that is simply a deployment convenience where each app gets its own copy in memory. An example might be a global cache.

Was it helpful?

Solution

With shared libraries you can share static resources among applications. For instance if you want to share an image among multiple apps you could add the following to your weblogic.xml:

<wls:library-ref>
    <wls:library-name>my_shared_library</wls:library-name>

And if that shared library contained an image, you could reference it directly like:

<img src="my_shared_library.gif"/>

See more here:

https://blogs.oracle.com/jamesbayer/entry/weblogic_server_shared_librari

You can also share a class in a similar manner if you are looking to shared a singleton across multiple apps. Simply create your shared class, jar it up, and drop it into the DOMAIN_HOME/lib directory. This will force weblogic to use the same class loader for all apps, meaning your shared class is only instantiated once. See more here:

https://blogs.oracle.com/jamesbayer/entry/sharing_a_class_with_a

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top