commons-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Akram (JIRA)" <j...@apache.org>
Subject [jira] [Updated] (DBCP-544) Custom Shared ClassLoader not working after migrated from Tomcat 7 to Tomcat 9.0.17
Date Tue, 16 Apr 2019 14:48:00 GMT

     [ https://issues.apache.org/jira/browse/DBCP-544?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]

Akram updated DBCP-544:
-----------------------
    Description: 
 
 Hi,
I have Custom SharedClassLoader in Tomcat 7 to load shared library jars,
 which is used by different applications in that tomcat. We migrated to
 Tomcat 9, now it is not working. How to achieve the same functionality in
 tomcat 9.

In Tomcat 9 it expects resources to be passed. I don't find any sample Code
 on how to populate resources.

I tried like below

public CustomSharedClassLoader(ClassLoader parent) throws Exception {
         super(parent);
 //The below three lines are added by me to work for Tomcat 9.
         StandardRoot standardRoot = new StandardRoot();
         standardRoot.addPreResources(new DirResourceSet());
         setResources(standardRoot);// End for tomcat 9 changes.

        for (URL urlForJars : getClassPath(SHARED_LIB))

{             addURL(urlForJars);         }

        start();
     }

It didn't work.

public class CustomSharedClassLoader extends WebappClassLoader

{//Which takes shared folder libarary, it returns those classes.}

  was:
|
|h3. Akram Hussain <akram.hussain.sk@gmail.com>|
|3:59 PM (4 hours ago)
 | |!https://mail.google.com/mail/u/0/images/cleardot.gif!
!https://mail.google.com/mail/u/0/images/cleardot.gif!|
|
|to users
!https://mail.google.com/mail/u/0/images/cleardot.gif|id=:3m3!|
|
 
 
 
Hi,

I have Custom SharedClassLoader in Tomcat 7 to load shared library jars,
which is used by different applications in that tomcat. We migrated to
Tomcat 9, now it is not working. How to achieve the same functionality in
tomcat 9.

In Tomcat 9 it expects resources to be passed. I don't find any sample Code
on how to populate resources.

I tried like below

public CustomSharedClassLoader(ClassLoader parent) throws Exception {
        super(parent);
//The below three lines are added by me to work for Tomcat 9.
        StandardRoot standardRoot = new StandardRoot();
        standardRoot.addPreResources(new DirResourceSet());
        setResources(standardRoot);// End for tomcat 9 changes.

        for (URL urlForJars : getClassPath(SHARED_LIB)) {
            addURL(urlForJars);
        }
        start();
    }

It didn't work.

public class CustomSharedClassLoader extends WebappClassLoader{//Which
takes shared folder libarary, it returns those classes.}


> Custom Shared ClassLoader not working after migrated from Tomcat 7 to Tomcat 9.0.17
> -----------------------------------------------------------------------------------
>
>                 Key: DBCP-544
>                 URL: https://issues.apache.org/jira/browse/DBCP-544
>             Project: Commons DBCP
>          Issue Type: Bug
>            Reporter: Akram
>            Priority: Critical
>
>  
>  Hi,
> I have Custom SharedClassLoader in Tomcat 7 to load shared library jars,
>  which is used by different applications in that tomcat. We migrated to
>  Tomcat 9, now it is not working. How to achieve the same functionality in
>  tomcat 9.
> In Tomcat 9 it expects resources to be passed. I don't find any sample Code
>  on how to populate resources.
> I tried like below
> public CustomSharedClassLoader(ClassLoader parent) throws Exception {
>          super(parent);
>  //The below three lines are added by me to work for Tomcat 9.
>          StandardRoot standardRoot = new StandardRoot();
>          standardRoot.addPreResources(new DirResourceSet());
>          setResources(standardRoot);// End for tomcat 9 changes.
>         for (URL urlForJars : getClassPath(SHARED_LIB))
> {             addURL(urlForJars);         }
>         start();
>      }
> It didn't work.
> public class CustomSharedClassLoader extends WebappClassLoader
> {//Which takes shared folder libarary, it returns those classes.}



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Mime
View raw message