• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 403
  • Last Modified:

Need multiple /webapps folders for different users on my site's tomcat server


I am desperately trying to have multiple /webapps folders for different users on my site's tomcat server. Is there any way to do this ?

Currently I have this place to store my webapps ->  /www/website.com/webapps/

And I'd like to have something like this :    


I don't want people storing all their webapps in the same directory. But I 'd like the same tomcat server running them all.

  • 9
  • 6
1 Solution
I think you should read carefully this documentation
It describes web applications per user configuration
firewired44Author Commented:
Sorry this is not enough to help me out
If you use tomcat5.5 then In your $tomcat_home/conf/server.xml put following config as child of  <Host ... > element:
      <Listener className="org.apache.catalina.startup.UserConfig"

Under www.website.com directory create directories user_name/webapps for every user who will create his directories (replace user_name by real usernames like tom, mike)

put user's web applications in user_name/webapps and now you should be able to access users web applications in format website.com/~username/webappname

for example you have user tom.
you created /www/website.com/tom/webapps dir.
user tom puts his webaaplication test.war to this directory and it is accessible as

Cloud Class® Course: Microsoft Windows 7 Basic

This introductory course to Windows 7 environment will teach you about working with the Windows operating system. You will learn about basic functions including start menu; the desktop; managing files, folders, and libraries.

firewired44Author Commented:
Thanks, it seems to be partly resolving the problem,

Now when I go in my tomcat 5.5's manager I see    /~tom  listed in the applications path. In fact all the usernames that have a webapps folder containing .war files are listed.

But when even though I can access http://website.com/~tom/test.war
the jsp compiler generates an error. (this does not happen if I put the .war in the root webapps folder.
I tried extracting the war into a folder in webapps but it still can't compile the code.

Any ideas what I'm doing wrong.. ?
you should not requestr test.war as URL because test.war will be unpacked to test directory under tom/webapps/ directory by Tomcat itself then URL: http://website.com/~tom/test will be called.

So remove .war from your URL and it should be ok
firewired44Author Commented:
I tried what you said but it just gives me a jsp error, I tried several different war files and they all have the same result.

Here's my server.xml, I added the line you told me about at the end.

<Server port="8005" shutdown="SHUTDOWN">
<Listener className="org.apache.catalina.core.AprLifecycleListener"/>
<Listener className="org.apache.catalina.mbeans.ServerLifecycleListener"/>
<Listener className="org.apache.catalina.mbeans.GlobalResourcesLifecycleListener"/>
<Listener className="org.apache.catalina.storeconfig.StoreConfigLifecycleListener"/>
<Environment name="simpleValue" type="java.lang.Integer" value="30"/>
<Resource name="UserDatabase" auth="Container" type="org.apache.catalina.UserDatabase" description="User database that can be updated and saved" factory="org.apache.catalina.users.MemoryUserDatabaseFactory" pathname="conf/tomcat-users.xml"/>
      <Service name="Catalina">
<Connector port="8080" maxHttpHeaderSize="8192" maxThreads="150" minSpareThreads="25" maxSpareThreads="75" enableLookups="false" redirectPort="8443" acceptCount="100" connectionTimeout="20000" disableUploadTimeout="true"/>
<Connector port="8009" enableLookups="false" redirectPort="8443" protocol="AJP/1.3"/>
      <Engine name="Catalina" defaultHost="localhost">
<Realm className="org.apache.catalina.realm.UserDatabaseRealm" resourceName="UserDatabase"/>
      <Host name="localhost" appBase="webapps" unpackWARs="true" autoDeploy="true" xmlValidation="false" xmlNamespaceAware="false">

<Listener className="org.apache.catalina.startup.UserConfig" directoryName="webapps" homeBase="/www/mywebsite.ch/users" userClass="org.apache.catalina.startup.HomesUserDatabase"/>

And what is inside test.war file ?
firewired44Author Commented:
I'm using the war that you can find on this page for testing http://homepage.ntlworld.com/richard_c_atkinson/jfreechart/

the charts generated by the war are displayed fine when the war is located in root webapps, but when it's in a user's  webapps folder I just get a
org.apache.jasper.JasperException (couldn't compile, etc..)

Strange, but indeed if you put WAR file into user howe it is not unpacked by tomcat(even if unpackWARs=true in Host element).
But if I unpack on my PC  test.war into /www/website.com/tom/webapps/test directory then it works.
Could you try also unpack it on your system ?
Maybe it is a bug (or feature ?!) in tomcat - that it doesn't unpack war files in users home directories.
firewired44Author Commented:
Thanks a lot for spending all this time trying to solve my problem.

That's true it does seem strange that it never unpacks them when located in the user home directories.

Arg.. will the tomcat errors never end !? I unpacked the WAR into a /www/mywebsite.ch/users/tom/webapps/test/ folder
then typed http://mywebsite.ch/~tom/test/

I've been trying to get this thing to work for days and still no luck,

Here is what I got (java is installed in french on this pc, but most of the error text is in english anyway)

27 nov. 2006 14:31:57 org.apache.catalina.core.StandardWrapperValve invoke
GRAVE: "Servlet.service()" pour la servlet jsp a généré une exception
org.apache.jasper.JasperException: Impossible de compiler la classe pour la JSP

Erreur de servlet générée:
Only a type can be imported. org.jfree.chart.demo.servlet.WebHitChart resolves to a package

Erreur de servlet générée:
Only a type can be imported. org.jfree.chart.demo.servlet.WebHitDataSet resolves to a package

Une erreur s'est produite à la ligne: 10 dans le fichier jsp: /jfreechart/pie_chart.jsp
Erreur de servlet générée:
WebHitChart cannot be resolved

Une erreur s'est produite à la ligne: 10 dans le fichier jsp: /jfreechart/pie_chart.jsp
Erreur de servlet générée:
WebHitDataSet cannot be resolved

      at org.apache.jasper.compiler.DefaultErrorHandler.javacError(DefaultErrorHandler.java:84)
      at org.apache.jasper.compiler.ErrorDispatcher.javacError(ErrorDispatcher.java:328)
      at org.apache.jasper.compiler.JDTCompiler.generateClass(JDTCompiler.java:414)
      at org.apache.jasper.compiler.Compiler.compile(Compiler.java:297)
      at org.apache.jasper.compiler.Compiler.compile(Compiler.java:276)
      at org.apache.jasper.compiler.Compiler.compile(Compiler.java:264)
      at org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:563)
      at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:305)
      at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:314)
      at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:264)
      at javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
      at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
      at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
      at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213)
      at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:178)
      at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126)
      at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105)
      at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:107)
      at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148)
      at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:869)
      at org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:664)
      at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:527)
      at org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(LeaderFollowerWorkerThread.java:80)
      at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:684)
      at java.lang.Thread.run(Thread.java:595)
have the same issue with deploymeny of your war file on my system. Probably bug in Tomcat :(
firewired44Author Commented:
But isn't there a way to work around this problem... ? :-(

firewired44Author Commented:
Can someone help me out with this problem please.. ?
firewired44Author Commented:
Is there only one tomcat expert here . . .?
firewired44Author Commented:
Sorry but I'm not impressed by the service offered here.. I'm cancelling my subscription.
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

  • 9
  • 6
Tackle projects and never again get stuck behind a technical roadblock.
Join Now