Showing results for 
Search instead for 
Did you mean: 

Loading classes from different components?

Former Member
0 Kudos


I understand that my portal component can instantiate (API)-classes of all components referenced in the (Private)SharingReference of portalapp.xml. But my problem is I don't know in advance what classes from which .pars my component is going to instantiate via reflection, so I can't put them into the SharingReference.

My question: how can I tell the classloader during runtime, not deploy time, to dynamically load a different portal component?

Any hints are very welcome.



Accepted Solutions (0)

Answers (2)

Answers (2)

Former Member
0 Kudos


it's for sure a hack, but you may try this one:


AutoClassLoader cl = (AutoClassLoader) this.getClass().getClassLoader();

ClassLoader componentClassLoader = iwizardcontext.getRequest().getComponentContext().getComponent().getClass().getClassLoader();


// do your dirty doings here



Former Member
0 Kudos

I wouldn't recommend this in a million years,

but a nice hack is to instansiate a new URLClassloader and initialize it with a set of jar files from the components you wish to use.

A security manager might prevent this though.

Also have a look at the classes

com.sapportals.portal.prt.util.AutoClassLoader and com.sapportals.portal.prt.util.ApplicationClassLoader

I believe these are the classes which do the job for the portal runtime

Let me know how this goes