java - Is there any way to load a component from filesystem in Oracle Commerce(ATG)? -
i'm trying find out if can load oracle commerce component file system. assemble code ear file , deploy it, however, got requirement in have store components in file system rather packaging them along ear file.
i know can use urlclassloader load class shown below,
file classdir = new file("a:\\lodeemodule\\classes"); url[] url = { classdir.touri().tourl() }; classloader loader = new urlclassloader(url); (file file : classdir.listfiles()) { string filename = file.getname().replace(".class", ""); loader.loadclass("com.buddha.testers." + filename).getconstructor().newinstance(); }
but how can use same component has resolved nucleus @ later point of time? there way instruct nucleus resolve component file system?
you should able add jar contains components classes classpath system variable used application server instance.
then in component configuration define implementing class would
$class=some.class.path.class
if using jboss eap 6+ on newer version of atg (11.0+) might have more trouble, have jump through more hoops due classloader
https://docs.jboss.org/author/display/as7/class+loading+in+as7
essentially need define jboss module containing jar files, , define dependency between ear's "module" , module containing classes.
alternatively can define classloaderservice manage classes jars
to this, need define new classloaderservice, create new properties file other component.
/my/custom/classloaderservice.properties
$class=atg.nucleus.servicesmanifestclassloaderservice $description=custom class loader service. # files go classpath of classloader classpathfiles=\ /path/to/my/jars/lib/someclasses.jar,\ /path/to/my/jars/lib/someotherclasses.jar loggingdebug=false
then in actual component need these classes add line;
$classloader=/my/custom/classloaderservice
Comments
Post a Comment