-
1. Re: JBoss 5.1 class loading question
jaikiran Jul 8, 2009 4:06 AM (in response to scao)How/where were you using that API earlier? And where exactly is the jar file located? Is it inside your app or inside the server directories or outside the server?
-
2. Re: JBoss 5.1 class loading question
scao Jul 9, 2009 11:52 AM (in response to scao)I have '<load-on-startup>1</load-on-startup>' serlvet to get an instance of ServiceLocator. It get the classloader from the instance of ServiceLocator. Then cast it to RepositoryClassLoader. We could load classes in Jar file from a directory which is outside of server directory.
I use this way to load some classes from a jar file which is developed after the product is installed at customer site, for example: customized workflow handlers. They have to be load within the ear classloader, not server classloader.
Here is the sample code:RepositoryClassLoader targetCL = (RepositoryClassLoader) com.xyz.ServiceLocator.getInstance().getClass().getClassLoader(); String[] jarFileNames = getAllAppJarFileNames(); StringBuffer buffer = new StringBuffer(); for(int i = 0; i < jarFileNames.length; i++) { try { targetCL.addURL(new File(jarFileNames).toURL()); } catch (Exception e) { theLogger.warn("Could not add external app jar file to server classloader: " + jarFileNames, e); } }
-
3. Re: JBoss 5.1 class loading question
alesj Jul 10, 2009 7:08 AM (in response to scao)See what we're doing with Seam, WebBeans or JSFUnit,
where we dynamically add certain jars to deployment's classpath,
if we recognize that deployment as Seam/WB/JSFUnit specific.
Adding jboss-seam-int.jar:
http://anonsvn.jboss.org/repos/jbossas/projects/jboss-seam-int/trunk/microcontainer/src/main/java/org/jboss/seam/integration/microcontainer/deployers/SeamUrlIntegrationDeployer.java
Adding webbeans jars
http://anonsvn.jboss.org/repos/jbossas/projects/webbeans-ri-int/trunk/deployer/src/main/java/org/jboss/webbeans/integration/deployer/cl/WebBeansUrlIntegrationDeployer.java
JSFUnit
http://jsfunit.blogspot.com/2008/10/jsfunit-easy-way.html -
4. Re: JBoss 5.1 class loading question
scao Jul 10, 2009 9:06 PM (in response to scao)Thanks. Would you please let me know how to configure the deployer after I have the implementation? Can it load classes for ear class loading?
Where I have to configure SeamUrlIntegrationDeployer WebBeansUrlIntegrationDeployer? Do you have any sample configuration file? -
5. Re: JBoss 5.1 class loading question
alesj Jul 11, 2009 4:25 AM (in response to scao)"slc99" wrote:
Where I have to configure SeamUrlIntegrationDeployer WebBeansUrlIntegrationDeployer? Do you have any sample configuration file?
Text search the deployers/ directory (in JBossAS_5.1) for the two terms.