• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
  • Campbell Ritchie
  • Paul Clapham
  • Ron McLeod
  • Jeanne Boyarsky
  • Tim Cooke
  • Liutauras Vilda
  • paul wheaton
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Frits Walraven
  • Piet Souris
  • Himai Minh

help: where must I store my custom "WebAppClassLoader"

Posts: 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Is my problem very complex ?
I had no response in the mailing list "tomcat-user".
To store a group of special classes shared by multiple webapps, out of the
standard class directoy of the WebApps ("WEF-INF/classes"), I try to
write a custom WebAppClassLoader, but tomcat cant load it at startup !
note: these classes are dynamicly generated with the design tool of an "ERP".
My classLoader are stored in a jar file in the lib directory of my WebApp :
But Catalina delivers me an error at each startup :
At this time the context does'nt exist ?
Although I read information "Normally, application classes should NOT be
placed here" in the "how-to" of the tomcat's classloader, I tried to place
my classes in a jar file located in the directory "$CATALINA_HOME/common/lib"
so that they are visible for catalina,
but that does not run either!
Where must I store my custom WebAppClassLoader classes ?
See behind the details of what I did and how is configured my platform.
Thanks a lot in advance.
Best regards
Olivier Gattaz
Adonix - 5 avenue Victor Hugo - 38130 Echirolles - France

1) I created the two classes :
- "com.adonix.x3.x3web.tomcat.loader.CAdapiLoader"
public class CAdapiLoader extends WebappLoader
- "com.adonix.x3.x3web.tomcat.loader.CAdapiClassLoader"
public class CAdapiClassLoader extends WebappClassLoader

## 2) I store these classes in a Jar file :

## 3) I defined a "Loader" tag in the "context" of my WebApp :
<Context path="/x3webgarp"
docBase="C:\Program files\Adonix\X3Web\SERVERS_BASE\webapps_x3\WAWEBSERVER"
<Loader className="com.adonix.x3.x3web.tomcat.loader.CX3WebLoader"
AdapiClassPath="D:\Adonix\X3Web\Data\X3Classes" />

## 4) When Tomcat start, I always get the error message in the output :
ERROR reading C:\Program files\Adonix\X3Web\SERVERS_BASE\conf\server.xml
At Line 217 /Server/Service/Engine/Host/Context/Loader/
className=com.adonix.x3.x3web.tomcat.loader.CX3WebLoader delegate=false
reloadable=false checkInterval=15 debug=9

## 5) The configuration of my plaform :
- W2000 SP2
- Apache httpd 2.0.39 + Mod_jk
- Sun JDK 1.3.1_03
- Tomcat 4.0.4 running like a service and configured for
multiple instances by setting $CATALINA_BASE
- set CATALINA_HOME=C:\Program Files\Apache Tomcat 4.0
- set CATALINA_BASE=C:\Program files\Adonix\X3Web\SERVERS_BASE
- set JAVA_HOME=C:\jdk1.3.1_03

NOTE: although I set $CATALINA_BASE different of $CATALINA_HOME, the
directory $CATALINA_BASE/common/lib is ignored !
Ranch Hand
Posts: 95
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
If you want to share classes across webapps, you don't have to write your own classloader.
All you have to do is drop them in tomcat/common/classes or tomcat/common/lib.
Watchya got in that poodle gun? Anything for me? Or this tiny ad?
Free, earth friendly heat - from the CodeRanch trailboss
    Bookmark Topic Watch Topic
  • New Topic