Discussion:
[jboss-user] [JBoss Microcontainer] - Custom ClassLoader
Irfan Basha
2013-03-26 07:34:37 UTC
Permalink
Irfan Basha [https://community.jboss.org/people/irbash] created the discussion

"Custom ClassLoader"

To view the discussion, visit: https://community.jboss.org/message/804773#804773

--------------------------------------------------------------
Hi All,

I am trying to create a custom classloader which I can use to load few classes in my war (may be complete war in future).

I found this article which explains how a custom classloader can be created:
(Custom ClassLoader (classloader-beans.xml)) http://java.dzone.com/articles/a-look-inside-jboss-microconta-0 http://java.dzone.com/articles/a-look-inside-jboss-microconta-0

I have few clarifications in this:
1) Where should I put the content of classloader-beans.xml ? (I have currently put it in jboss-beans.xml and placed it in WEB-INF)
2) Correct me if am wrong: The bean CB2 will be loaded using the customClassLoader... right ?

This is how my jboss-beans.xml looks like:
+<deployment xmlns="urn:jboss:bean-deployer:2.0">+
+          <classloader>+
+                    <inject bean="custom-classloader:0.0.0" />+
+          </classloader>+

+          <classloader name="custom-classloader" xmlns="urn:jboss:classloader:1.0"+
+                    export-all="NON_EMPTY" import-all="true" />+
+          <bean name="CustomCL" class="com.beans.CustomClassLoader">+
+                    <constructor>+
+                              <parameter>+
+                                        <inject bean="custom-classloader:0.0.0" />+
+                              </parameter>+
+                    </constructor>+

+          </bean>+
+          <bean name="CB1" class="com.Sample">+
+          <classloader>+
+                    <inject bean="CustomCL" />+
+          </classloader>+
+</bean>+
+</deployment>+

And I have the class CustomeClassLoader which just extends ClassLoader:

public class CustomClassLoader extends ClassLoader
{
   private Pattern pattern;
   public CustomClassLoader(ClassLoader parent)
   {
      super(parent);
   }
   public Class<?> loadClass(String name) throws ClassNotFoundException
   {
      if (pattern == null || pattern.matcher(name).matches())
         return super.loadClass(name);
      else
         throw new ClassNotFoundException("Name '" + name + "' doesn't match pattern: " + pattern);
   }
   public void setPattern(String regexp)
   {
      pattern = Pattern.compile(regexp);
   }
}

and when I start JBoss I get this following error:
08:28:51,677 ERROR [AbstractKernelController] Error installing to PreInstall: na
me=CustomCL state=Real
java.lang.ClassNotFoundException: com.beans.CustomClassLoader
        at java.net.URLClassLoader$1.run(Unknown Source)
        at java.net.URLClassLoader$1.run(Unknown Source)
        at java.security.AccessController.doPrivileged(Native Method)
        at java.net.URLClassLoader.findClass(Unknown Source)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:428)
        at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:360)
        at java.lang.Class.forName0(Native Method)
        at java.lang.Class.forName(Unknown Source)
        at org.jboss.classloader.spi.base.BaseClassLoaderDomain.loadClass(BaseCl
assLoaderDomain.java:304)
        at org.jboss.classloader.spi.base.BaseClassLoaderDomain.loadClass(BaseCl
assLoaderDomain.java:1172)
        at org.jboss.classloader.spi.base.BaseClassLoader.loadClassFromDomain(Ba
seClassLoader.java:1264)
        at org.jboss.classloader.spi.base.BaseClassLoader.doLoadClass(BaseClassL
oader.java:549)
        at org.jboss.classloader.spi.base.BaseClassLoader.loadClass(BaseClassLoa
der.java:497)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:360)
        at java.lang.Class.forName0(Native Method)
        at java.lang.Class.forName(Unknown Source)
        at org.jboss.reflect.plugins.introspection.IntrospectionTypeInfoFactoryI
mpl.resolveComplexTypeInfo(IntrospectionTypeInfoFactoryImpl.java:419)
        at org.jboss.reflect.plugins.introspection.IntrospectionTypeInfoFactoryI
mpl.getTypeInfo(IntrospectionTypeInfoFactoryImpl.java:388)
        at org.jboss.reflect.plugins.introspection.IntrospectionTypeInfoFactory.
getTypeInfo(IntrospectionTypeInfoFactory.java:54)
        at org.jboss.classadapter.plugins.BasicClassAdapterFactory.getClassAdapt
er(BasicClassAdapterFactory.java:61)
        at org.jboss.config.plugins.AbstractConfiguration.getBeanInfo(AbstractCo
nfiguration.java:86)
        at org.jboss.kernel.plugins.config.AbstractKernelConfig.getBeanInfo(Abst
ractKernelConfig.java:80)
        at org.jboss.kernel.plugins.config.AbstractKernelConfigurator.getBeanInf
o(AbstractKernelConfigurator.java:77)
        at org.jboss.kernel.plugins.config.AbstractKernelConfigurator.getBeanInf
o(AbstractKernelConfigurator.java:96)
        at org.jboss.kernel.plugins.dependency.PreInstallAction.installActionInt
ernal(PreInstallAction.java:90)
        at org.jboss.kernel.plugins.dependency.InstallsAwareAction.installAction
(InstallsAwareAction.java:54)
        at org.jboss.kernel.plugins.dependency.InstallsAwareAction.installAction
(InstallsAwareAction.java:42)
        at org.jboss.dependency.plugins.action.SimpleControllerContextAction.sim
pleInstallAction(SimpleControllerContextAction.java:62)
        at org.jboss.dependency.plugins.action.AccessControllerContextAction.ins
tall(AccessControllerContextAction.java:71)
        at org.jboss.dependency.plugins.AbstractControllerContextActions.install
(AbstractControllerContextActions.java:51)
        at org.jboss.dependency.plugins.AbstractControllerContext.install(Abstra
ctControllerContext.java:348)
        at org.jboss.dependency.plugins.AbstractController.install(AbstractContr
oller.java:1631)
        at org.jboss.dependency.plugins.AbstractController.incrementState(Abstra
ctController.java:934)
        at org.jboss.dependency.plugins.AbstractController.resolveContexts(Abstr
actController.java:1082)
        at org.jboss.dependency.plugins.AbstractController.resolveContexts(Abstr
actController.java:984)
        at org.jboss.dependency.plugins.AbstractController.install(AbstractContr
oller.java:774)
        at org.jboss.dependency.plugins.AbstractController.install(AbstractContr
oller.java:540)
        at org.jboss.deployers.vfs.deployer.kernel.BeanMetaDataDeployer.deploy(B
eanMetaDataDeployer.java:121)
        at org.jboss.deployers.vfs.deployer.kernel.BeanMetaDataDeployer.deploy(B
eanMetaDataDeployer.java:51)
        at org.jboss.deployers.spi.deployer.helpers.AbstractSimpleRealDeployer.i
nternalDeploy(AbstractSimpleRealDeployer.java:62)
        at org.jboss.deployers.spi.deployer.helpers.AbstractRealDeployer.deploy(
AbstractRealDeployer.java:50)
        at org.jboss.deployers.plugins.deployers.DeployerWrapper.deploy(Deployer
Wrapper.java:171)
        at org.jboss.deployers.plugins.deployers.DeployersImpl.doDeploy(Deployer
sImpl.java:1439)
        at org.jboss.deployers.plugins.deployers.DeployersImpl.doInstallParentFi
rst(DeployersImpl.java:1157)
        at org.jboss.deployers.plugins.deployers.DeployersImpl.doInstallParentFi
rst(DeployersImpl.java:1178)
        at org.jboss.deployers.plugins.deployers.DeployersImpl.install(Deployers
Impl.java:1098)
        at org.jboss.dependency.plugins.AbstractControllerContext.install(Abstra
ctControllerContext.java:348)
        at org.jboss.dependency.plugins.AbstractController.install(AbstractContr
oller.java:1631)
        at org.jboss.dependency.plugins.AbstractController.incrementState(Abstra
ctController.java:934)
        at org.jboss.dependency.plugins.AbstractController.resolveContexts(Abstr
actController.java:1082)
        at org.jboss.dependency.plugins.AbstractController.resolveContexts(Abstr
actController.java:984)
        at org.jboss.dependency.plugins.AbstractController.change(AbstractContro
ller.java:822)
        at org.jboss.dependency.plugins.AbstractController.change(AbstractContro
ller.java:553)
        at org.jboss.deployers.plugins.deployers.DeployersImpl.process(Deployers
Impl.java:781)
        at org.jboss.deployers.plugins.main.MainDeployerImpl.process(MainDeploye
rImpl.java:702)
        at org.jboss.system.server.profileservice.repository.MainDeployerAdapter
.process(MainDeployerAdapter.java:117)
        at org.jboss.system.server.profileservice.repository.ProfileDeployAction
.install(ProfileDeployAction.java:70)
        at org.jboss.system.server.profileservice.repository.AbstractProfileActi
on.install(AbstractProfileAction.java:53)
        at org.jboss.system.server.profileservice.repository.AbstractProfileServ
ice.install(AbstractProfileService.java:361)
        at org.jboss.dependency.plugins.AbstractControllerContext.install(Abstra
ctControllerContext.java:348)
        at org.jboss.dependency.plugins.AbstractController.install(AbstractContr
oller.java:1631)
        at org.jboss.dependency.plugins.AbstractController.incrementState(Abstra
ctController.java:934)
        at org.jboss.dependency.plugins.AbstractController.resolveContexts(Abstr
actController.java:1082)
        at org.jboss.dependency.plugins.AbstractController.resolveContexts(Abstr
actController.java:984)
        at org.jboss.dependency.plugins.AbstractController.change(AbstractContro
ller.java:822)
        at org.jboss.dependency.plugins.AbstractController.change(AbstractContro
ller.java:553)
        at org.jboss.system.server.profileservice.repository.AbstractProfileServ
ice.activateProfile(AbstractProfileService.java:306)
        at org.jboss.system.server.profileservice.ProfileServiceBootstrap.start(
ProfileServiceBootstrap.java:271)
        at org.jboss.bootstrap.AbstractServerImpl.start(AbstractServerImpl.java:
461)
        at org.jboss.Main.boot(Main.java:221)
        at org.jboss.Main$1.run(Main.java:556)


DEPLOYMENTS MISSING DEPENDENCIES:
  Deployment "CB1" is missing the following dependencies:
    Dependency "CustomCL" (should be in state "PreInstall", but is actually in s
tate "**ERROR**")


DEPLOYMENTS IN ERROR:
  Deployment "CustomCL" is in error due to the following reason(s): java.lang.Cl
assNotFoundException: com.beans.CustomClassLoader, **ERROR**




Can anyone help in solving this problem.
Ales Justin
2013-03-26 09:02:09 UTC
Permalink
Ales Justin [https://community.jboss.org/people/alesj] created the discussion

"Re: Custom ClassLoader"

To view the discussion, visit: https://community.jboss.org/message/804782#804782

--------------------------------------------------------------
classloader element takes explicit roots -- paths to jars, etc.
* http://anonsvn.jboss.org/repos/jbossas/projects/jboss-cl/branches/Branch_2_0/classloading-vfs/src/main/java/org/jboss/classloading/spi/vfs/metadata/VFSClassLoaderFactory.java http://anonsvn.jboss.org/repos/jbossas/projects/jboss-cl/branches/Branch_2_0/classloading-vfs/src/main/java/org/jboss/classloading/spi/vfs/metadata/VFSClassLoaderFactory.java

Just create CustomCL bean -- no need for classloader element, and set this as classloader to other beans.

Having classloader per whole deployment (whole -beans.xml) is a bit trickier,
as it's chicken-n-egg problem.
--------------------------------------------------------------

Reply to this message by going to Community
[https://community.jboss.org/message/804782#804782]

Start a new discussion in JBoss Microcontainer at Community
[https://community.jboss.org/choose-container!input.jspa?contentType=1&containerType=14&container=2114]
Irfan Basha
2013-03-26 10:36:09 UTC
Permalink
Irfan Basha [https://community.jboss.org/people/irbash] created the discussion

"Re: Custom ClassLoader"

To view the discussion, visit: https://community.jboss.org/message/804797#804797

--------------------------------------------------------------
Hi Ales,

Thanks for the reply.

Do you mean my jboss-beans.xml should be:

<deployment xmlns="urn:jboss:bean-deployer:2.0">
            <classloader name="custom-classloader" xmlns="urn:jboss:classloader:1.0"
                              export-all="NON_EMPTY" import-all="true" />
          <bean name="CustomCL" class="com.beans.CustomClassLoader">
                         <constructor>
                                        <parameter>
                                                       <inject bean="custom-classloader:0.0.0" />
                                        </parameter>
                         </constructor> 
          </bean>
          <bean name="CB1" class="com.Sample">
                         <classloader>
                                        <inject bean="CustomCL" />
                         </classloader>
    </bean>
</deployment>

I still get ClassNotFound Exception...
--------------------------------------------------------------

Reply to this message by going to Community
[https://community.jboss.org/message/804797#804797]

Start a new discussion in JBoss Microcontainer at Community
[https://community.jboss.org/choose-container!input.jspa?contentType=1&containerType=14&container=2114]
Ales Justin
2013-03-26 11:35:48 UTC
Permalink
Ales Justin [https://community.jboss.org/people/alesj] created the discussion

"Re: Custom ClassLoader"

To view the discussion, visit: https://community.jboss.org/message/804813#804813

--------------------------------------------------------------
Your last post somehow got removed ...

But no, completely remove +<classloader name+ element.
Plain CL bean should do.
--------------------------------------------------------------

Reply to this message by going to Community
[https://community.jboss.org/message/804813#804813]

Start a new discussion in JBoss Microcontainer at Community
[https://community.jboss.org/choose-container!input.jspa?contentType=1&containerType=14&container=2114]
Irfan Basha
2013-03-26 13:10:23 UTC
Permalink
Irfan Basha [https://community.jboss.org/people/irbash] created the discussion

"Re: Custom ClassLoader"

To view the discussion, visit: https://community.jboss.org/message/804838#804838

--------------------------------------------------------------
Thanks Ales...
I deleted the last post because I got it working soon after I posted it.

Thanks once again...

Regards,
Irfan
--------------------------------------------------------------

Reply to this message by going to Community
[https://community.jboss.org/message/804838#804838]

Start a new discussion in JBoss Microcontainer at Community
[https://community.jboss.org/choose-container!input.jspa?contentType=1&containerType=14&container=2114]
Ales Justin
2013-03-26 13:18:15 UTC
Permalink
Ales Justin [https://community.jboss.org/people/alesj] created the discussion

"Re: Custom ClassLoader"

To view the discussion, visit: https://community.jboss.org/message/804843#804843

--------------------------------------------------------------
Post by Irfan Basha
I deleted the last post because I got it working soon after I posted it.
Can you post the solutiuon, so others can learn as well?
--------------------------------------------------------------

Reply to this message by going to Community
[https://community.jboss.org/message/804843#804843]

Start a new discussion in JBoss Microcontainer at Community
[https://community.jboss.org/choose-container!input.jspa?contentType=1&containerType=14&container=2114]
Irfan Basha
2013-03-26 13:28:40 UTC
Permalink
Irfan Basha [https://community.jboss.org/people/irbash] created the discussion

"Re: Custom ClassLoader"

To view the discussion, visit: https://community.jboss.org/message/804847#804847

--------------------------------------------------------------
Solution:

1. Add jboss-beans.xml to WEB-INF:
+<deployment xmlns="urn:jboss:bean-deployer:2.0">+
+        + +<classloader name="custom-classloader" xmlns="urn:jboss:classloader:1.0"+
+                    export-all="NON_EMPTY" import-all="true" />+
+          <bean name="CustomCL" class="com.beans.CustomClassLoader">+
+                    <constructor>+
+                              <parameter>+
+                                        <inject bean="custom-classloader:0.0.0" />+
+                              </parameter>+
+                    </constructor>+
+          </bean>+
+          <bean name="CB1" class="com.Sample">+
+          <classloader>+
+                    <inject bean="CustomCL" />+
+          </classloader>+
+</bean>+
+</deployment>+
+
+

2. Create a CustomClassLoader (com.beans.CustomClassLoader):
public class CustomClassLoader extends ClassLoader
{
   public CustomClassLoader(ClassLoader parent)
   {
      super(parent);
   }
   public Class<?> loadClass(String name) throws ClassNotFoundException
   {    
          //This simply calls super's loadClass (if run from jboss, it calls BaseClassLoader
         return super.loadClass(name);    
   }
  
}

Run JBoss, keep a breakpoint in CustomClassLoader.loadClass method. when class com.Sample has to be loaded the breakpoint will be hit.

Regards,
Irfan
--------------------------------------------------------------

Reply to this message by going to Community
[https://community.jboss.org/message/804847#804847]

Start a new discussion in JBoss Microcontainer at Community
[https://community.jboss.org/choose-container!input.jspa?contentType=1&containerType=14&container=2114]
Ales Justin
2013-03-26 13:44:33 UTC
Permalink
Ales Justin [https://community.jboss.org/people/alesj] created the discussion

"Re: Custom ClassLoader"

To view the discussion, visit: https://community.jboss.org/message/804851#804851

--------------------------------------------------------------
Hmmm, how does CustomCL see com.Sample class?

Afair, <classloader> then has zero roots, meaning it only sees system classpath.
Where your CustomCL is created in deployment's CL, with zero-root CL as parent,
where you then try to load com.Sample ... beats me. :-)

Unless this zero-roots CL shares the same domain as deployment's CL.
--------------------------------------------------------------

Reply to this message by going to Community
[https://community.jboss.org/message/804851#804851]

Start a new discussion in JBoss Microcontainer at Community
[https://community.jboss.org/choose-container!input.jspa?contentType=1&containerType=14&container=2114]
Irfan Basha
2013-03-26 14:00:36 UTC
Permalink
Irfan Basha [https://community.jboss.org/people/irbash] created the discussion

"Re: Custom ClassLoader"

To view the discussion, visit: https://community.jboss.org/message/804853#804853

--------------------------------------------------------------
I guess the zero-roots CL (as you say) shares the domain of deployment's CL.

Is that the reason why super.loadClass goes back to org.jboss.classloader.spi.base.BaseClassLoader ?

Is there any thing wrong in what I did ? (I am able to get the breakpoint in loadClass method, and here the parent classloader is BaseClassLoader of jboss)

What I am trying to do is:
My war has few encrypted classes (which can be decrypted only if a hardware dongle is available using the ClassLoader provided by the hardware dongle). And now since we use JBoss, the encrypted classes are not been loaded.
I first tried to load then using translator (the previous post from me), but if I use translator, the plain bytecode is available in translator (after translator decrypts the encrypted class)
So now I am trying to use this customClassLoader, and here use the ClassLoader provided the third party (the company which provides us the hardware dongle).
--------------------------------------------------------------

Reply to this message by going to Community
[https://community.jboss.org/message/804853#804853]

Start a new discussion in JBoss Microcontainer at Community
[https://community.jboss.org/choose-container!input.jspa?contentType=1&containerType=14&container=2114]
Ales Justin
2013-03-26 20:38:20 UTC
Permalink
Ales Justin [https://community.jboss.org/people/alesj] created the discussion

"Re: Custom ClassLoader"

To view the discussion, visit: https://community.jboss.org/message/804929#804929

--------------------------------------------------------------
Post by Irfan Basha
I guess the zero-roots CL (as you say) shares the domain of deployment's CL.
Can we somehow confirm this?
Post by Irfan Basha
Is that the reason why super.loadClass goes back to org.jboss.classloader.spi.base.BaseClassLoader ?
If 1st paragraph holds, then yes.
Post by Irfan Basha
Is there any thing wrong in what I did ? (I am able to get the breakpoint in loadClass method, and here the parent classloader is BaseClassLoader of jboss)
Irfan Basha
2013-03-27 07:26:13 UTC
Permalink
Irfan Basha [https://community.jboss.org/people/irbash] created the discussion

"Re: Custom ClassLoader"

To view the discussion, visit: https://community.jboss.org/message/804974#804974

--------------------------------------------------------------
The translator is different from classloader: In translator, I send the encrypted bytecode, and the translator decrypts it and returns back the actual bytecode, so anyone who wants to get hold of the code can get it from translator.
Where as if I use the classloader (provided by the third party security company), I just send the className and the classloader loads the class and sends back the "Class". Is it possible to get bytecode from Class? (Btw, this third party security company has secure classloader, which itself if encrypted. and surprisingly they somehow donot call the java's classloader i.e the java.lang.ClassLoader. I tested it by modifying the code of java.lang.ClassLoader in rt.jar)
--------------------------------------------------------------

Reply to this message by going to Community
[https://community.jboss.org/message/804974#804974]

Start a new discussion in JBoss Microcontainer at Community
[https://community.jboss.org/choose-container!input.jspa?contentType=1&containerType=14&container=2114]
Irfan Basha
2013-03-27 07:42:25 UTC
Permalink
Irfan Basha [https://community.jboss.org/people/irbash] created the discussion

"Re: Custom ClassLoader"

To view the discussion, visit: https://community.jboss.org/message/804978#804978

--------------------------------------------------------------
The translator is different from classloader:
If I use translator, I pass the encrypted bytecode to the translator and the translator decrypts it and sends back the actual bytecode. So once the translator decrypts it, the actual bytecode can be obtained easily. If anyone wants to get the actual bytecode, he/she can just get it from translator.
If I use classloader (provided by the third party security company, which decrypts the bytecode only if a hardware dongle is available), I just pass the classname to the ClassLoader and it returns me the Class after loading it. So with the Class, one cannot get the bytecode (at least thats what I believe). This secure ClassLoader somehow loads the class without calling the java.lang.ClassLoader, and the classloader itself is encrypted so it is pretty much safe. (I tested this by changing the code of java.lang.ClassLoader in rt.jar... surprisingly this secure classloader doesn't call the java.lang.ClassLoader... )
--------------------------------------------------------------

Reply to this message by going to Community
[https://community.jboss.org/message/804978#804978]

Start a new discussion in JBoss Microcontainer at Community
[https://community.jboss.org/choose-container!input.jspa?contentType=1&containerType=14&container=2114]
Ales Justin
2013-04-02 12:11:40 UTC
Permalink
Ales Justin [https://community.jboss.org/people/alesj] created the discussion

"Re: Custom ClassLoader"

To view the discussion, visit: https://community.jboss.org/message/805990#805990

--------------------------------------------------------------
Post by Irfan Basha
This secure ClassLoader somehow loads the class without calling the java.lang.ClassLoader
Hmmm, never heard of this, nor have some co-workers ...
Post by Irfan Basha
and the classloader itself is encrypted so it is pretty much safe
How is then classloader decrypted?
Chicken-n-egg ...

Afaik, any JavaAgent should be able to read the bytes.
Unless there is some JVM extension / magic I don't know about.
--------------------------------------------------------------

Reply to this message by going to Community
[https://community.jboss.org/message/805990#805990]

Start a new discussion in JBoss Microcontainer at Community
[https://community.jboss.org/choose-container!input.jspa?contentType=1&containerType=14&container=2114]
Irfan Basha
2013-04-02 12:26:41 UTC
Permalink
Irfan Basha [https://community.jboss.org/people/irbash] created the discussion

"Re: Custom ClassLoader"

To view the discussion, visit: https://community.jboss.org/message/805992#805992

--------------------------------------------------------------
Well, I must agree that I have just about 2 years of experience in java programming... and as far as my knowledge is, for java to execute a class it should first load it in memory (in jvm) and this can be done by ClassLoader. Hence any class which should be loaded should have gone through loadClass method of ClassLoader. (I suppose this also applies for classes loaded through reflection)

And the strange thing is, when I modified the code of java.lang.ClassLoader and dumped the bytecode to my local disk (from method loadClass), I didnot find the classes which are loaded through the secure classloader. Is there a way to load class into jvm from any other way without using java.lang.ClassLoader ?
--------------------------------------------------------------

Reply to this message by going to Community
[https://community.jboss.org/message/805992#805992]

Start a new discussion in JBoss Microcontainer at Community
[https://community.jboss.org/choose-container!input.jspa?contentType=1&containerType=14&container=2114]
Ales Justin
2013-04-02 12:40:15 UTC
Permalink
Ales Justin [https://community.jboss.org/people/alesj] created the discussion

"Re: Custom ClassLoader"

To view the discussion, visit: https://community.jboss.org/message/805994#805994

--------------------------------------------------------------
Post by Irfan Basha
Is there a way to load class into jvm from any other way without using java.lang.ClassLoader ?
Not that I'm aware of.
But I never looked JVM into details.
--------------------------------------------------------------

Reply to this message by going to Community
[https://community.jboss.org/message/805994#805994]

Start a new discussion in JBoss Microcontainer at Community
[https://community.jboss.org/choose-container!input.jspa?contentType=1&containerType=14&container=2114]
Irfan Basha
2013-04-02 12:46:57 UTC
Permalink
Irfan Basha [https://community.jboss.org/people/irbash] created the discussion

"Re: Custom ClassLoader"

To view the discussion, visit: https://community.jboss.org/message/805996#805996

--------------------------------------------------------------
Anyway, Is there a way to extend the org.jboss.classloader.spi.base.BaseClassLoader ?
--------------------------------------------------------------

Reply to this message by going to Community
[https://community.jboss.org/message/805996#805996]

Start a new discussion in JBoss Microcontainer at Community
[https://community.jboss.org/choose-container!input.jspa?contentType=1&containerType=14&container=2114]
Ales Justin
2013-04-02 12:53:18 UTC
Permalink
Ales Justin [https://community.jboss.org/people/alesj] created the discussion

"Re: Custom ClassLoader"

To view the discussion, visit: https://community.jboss.org/message/805998#805998

--------------------------------------------------------------
The idea behind extending MC's CL layer is to provide CL policy.
All ugly details are hidden behind CL policy usage.
--------------------------------------------------------------

Reply to this message by going to Community
[https://community.jboss.org/message/805998#805998]

Start a new discussion in JBoss Microcontainer at Community
[https://community.jboss.org/choose-container!input.jspa?contentType=1&containerType=14&container=2114]
Irfan Basha
2013-04-02 13:07:46 UTC
Permalink
Irfan Basha [https://community.jboss.org/people/irbash] created the discussion

"Re: Custom ClassLoader"

To view the discussion, visit: https://community.jboss.org/message/806009#806009

--------------------------------------------------------------
another question...

in Tomcat you can add –Djava.system.class.loader=com.xxx.xxxClassLoader to catalina.bat to state that the system classloader is xxxClassLoader.
Can this be achieved by adding

set "JAVA_OPTS=%JAVA_OPTS% -Djava.system.class.loader=com.xxx.xxxClassLoader" in run.bat ?
--------------------------------------------------------------

Reply to this message by going to Community
[https://community.jboss.org/message/806009#806009]

Start a new discussion in JBoss Microcontainer at Community
[https://community.jboss.org/choose-container!input.jspa?contentType=1&containerType=14&container=2114]
Ales Justin
2013-04-02 13:19:33 UTC
Permalink
Ales Justin [https://community.jboss.org/people/alesj] created the discussion

"Re: Custom ClassLoader"

To view the discussion, visit: https://community.jboss.org/message/806014#806014

--------------------------------------------------------------
Unless this is Java setting, then no -- MC's CL doesn't handle that.
--------------------------------------------------------------

Reply to this message by going to Community
[https://community.jboss.org/message/806014#806014]

Start a new discussion in JBoss Microcontainer at Community
[https://community.jboss.org/choose-container!input.jspa?contentType=1&containerType=14&container=2114]
Loading...