Well, in Resin 3.1 there was folder to place such files, it was
$RESIN_HOME/ext-webapp-lib and it was configured in default resin.conf with
this:

    <!--
       - Defaults applied to each web-app.
      -->
    <web-app-default>
      <prologue>
        <!--
           - Extension library for common jar files.  The ext is safe
           - even for non-classloader aware jars.  The loaded classes
           - will be loaded separately for each web-app, i.e. the class
           - itself will be distinct.
          -->
        <class-loader>
          <tree-loader path="${resin.root}/ext-webapp-lib"/>
        </class-loader>

        <!-- further stuff -->
      </prologue>

      <!-- further stuff -->
    </web-app-default>


Maybe you can try to put spring.jar, spring-webmvc.jar, commons-logging.jar
into a new folder "ext-webapp-lib" into your resin.root folder and add this
snippet into the <prologue> of your resin.xml

        <!--
           - Extension library for common jar files.  The ext is safe
           - even for non-classloader aware jars.  The loaded classes
           - will be loaded separately for each web-app, i.e. the class
           - itself will be distinct.
          -->
        <class-loader>
          <tree-loader path="${resin.root}/ext-webapp-lib"/>
        </class-loader>


Please be aware, that there are maybe even better approaches to fit your
requirements.
e.g.
http://blog.caucho.com/?p=211


-- Steffen



2009/10/25 Horacy Oliwka <d...@lolownia.org>

> Hi all.
> Please help me with a seemingly simple problem, which, however, took me
> hours of googling and trials with no success at all.
>
> I'm using spring 2.5 with Log4j 1.2.15, under Resin 4.0.1 server.
>
> I have a very simple test case: web app with just DispatcherServlet and
> Log4jConfigListener.
>
> My problem is that Log4jConfigListener runs Log4jConfigurer which throws
> ClassNotFoundException: org.apache.log4j.PropertyConfigurator.
>
> My configuration is as follows:
>     1. spring.jar, spring-webmvc.jar and commons-logging.jar are in
>        server's global directory
>     2. log4j.jar is in apps WEB-INF/lib (and is not present in global
>        lib dir)
>
> Resin configuration is not chagned from the default:
> Normal classloader configuration from conf/app-default.xml applies.
> The LibraryLoader for WEB-INF/lib seems to notice the jars places there,
> but it is not forwarded to Spring.
> I have written to spring forums regarding this issue already, but they
> told me to ask here.
>
> The exception:
> Code:
> [09-09-11 14:29:35.284] {main} WebApp[http://default] Initializing log4j
> from
> [/home/me/project/simple/out/exploded/simpleWeb/WEB-INF/log4j.properties]
> [09-09-11 14:29:35.341] {main} WebApp[http://default] error
> [09-09-11 14:29:35.359] {main} java.lang.ClassNotFoundException:
> org.apache.log4j.PropertyConfigurator in EnvironmentClassLoader[]
> [09-09-11 14:29:35.359] {main}  at
> com.caucho.loader.DynamicClassLoader.loadClass(DynamicClassLoader.java:1326)
> [09-09-11 14:29:35.359] {main}  at
> com.caucho.loader.DynamicClassLoader.loadClass(DynamicClassLoader.java:1302)
> [09-09-11 14:29:35.359] {main}  at
> java.lang.ClassLoader.loadClassInternal(ClassLoader.java:320)
> [09-09-11 14:29:35.359] {main}  at
> org.springframework.util.Log4jConfigurer.initLogging(Log4jConfigurer.java:73)
> [09-09-11 14:29:35.359] {main}  at
> org.springframework.web.util.Log4jWebConfigurer.initLogging(Log4jWebConfigurer.java:152)
> [09-09-11 14:29:35.359] {main}  at
> org.springframework.web.util.Log4jConfigListener.contextInitialized(Log4jConfigListener.java:47)
> [09-09-11 14:29:35.359] {main}  at
> com.caucho.server.webapp.WebApp.start(WebApp.java:2388)
> [09-09-11 14:29:35.359] {main}  at
> com.caucho.server.deploy.DeployController.startImpl(DeployController.java:693)
> [09-09-11 14:29:35.359] {main}  at
> com.caucho.server.deploy.StartAutoRedeployAutoStrategy.startOnInit(StartAutoRedeployAutoStrategy.java:72)
> [09-09-11 14:29:35.359] {main}  at
> com.caucho.server.deploy.DeployController.startOnInit(DeployController.java:557)
> [09-09-11 14:29:35.359] {main}  at
> com.caucho.server.deploy.DeployContainer.start(DeployContainer.java:160)
> [09-09-11 14:29:35.359] {main}  at
> com.caucho.server.webapp.WebAppContainer.startImpl(WebAppContainer.java:707)
> [09-09-11 14:29:35.359] {main}  at
> com.caucho.server.host.Host.startImpl(Host.java:496)
> [09-09-11 14:29:35.359] {main}  at
> com.caucho.server.webapp.WebAppContainer.start(WebAppContainer.java:687)
> [09-09-11 14:29:35.359] {main}  at
> com.caucho.server.deploy.DeployController.startImpl(DeployController.java:693)
> [09-09-11 14:29:35.359] {main}  at
> com.caucho.server.deploy.StartAutoRedeployAutoStrategy.startOnInit(StartAutoRedeployAutoStrategy.java:72)
> [09-09-11 14:29:35.359] {main}  at
> com.caucho.server.deploy.DeployController.startOnInit(DeployController.java:557)
> [09-09-11 14:29:35.359] {main}  at
> com.caucho.server.deploy.DeployContainer.start(DeployContainer.java:160)
> [09-09-11 14:29:35.359] {main}  at
> com.caucho.server.host.HostContainer.start(HostContainer.java:484)
> [09-09-11 14:29:35.359] {main}  at
> com.caucho.server.cluster.Server.start(Server.java:1817)
> [09-09-11 14:29:35.359] {main}  at
> com.caucho.server.resin.Resin.createServer(Resin.java:950)
> [09-09-11 14:29:35.359] {main}  at
> com.caucho.server.resin.Resin.start(Resin.java:1021)
> [09-09-11 14:29:35.359] {main}  at
> com.caucho.server.resin.Resin.initMain(Resin.java:1494)
> [09-09-11 14:29:35.359] {main}  at
> com.caucho.server.resin.Resin.main(Resin.java:1683)
> The Resin server uses WEB-INF/lib in its loaders.
>
> Please note, that both following configurations do work:
>      * spring.jar, spring-webmvc.jar, commons-logging.jar and log4j.jar
>        in global server lib directory (but I need to have a separate
>        log4j for each app)
>      * spring.jar, spring-webmvc.jar, commons-logging.jar and log4j.jar
>        in WEB-INF/lib directory (but I want to share the spring's
>        jars).
>
> It seems like spring's classloaders ignore WEB-INF/lib, except when
> spring.jar is also there, but I'd like to have spring.jar in a global
> directory.
> On the other hand it seems from the trace that Spring in fact uses
> com.caucho.loader.DynamicClassLoader.
>
> How can I debug this?
> I'm completely out of ideas.
>
> Suggestions, solutions, pointers greatly appreciated.
>
> m.
>
>
>
> _______________________________________________
> resin-interest mailing list
> resin-interest@caucho.com
> http://maillist.caucho.com/mailman/listinfo/resin-interest
>
_______________________________________________
resin-interest mailing list
resin-interest@caucho.com
http://maillist.caucho.com/mailman/listinfo/resin-interest

Reply via email to