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

Posted on 2006-11-16
Medium Priority
Last Modified: 2009-07-29

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.

Question by:firewired44
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 9
  • 6
LVL 19

Expert Comment

ID: 17960100
I think you should read carefully this documentation
It describes web applications per user configuration

Author Comment

ID: 18017549
Sorry this is not enough to help me out
LVL 19

Expert Comment

ID: 18017710
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

Ransomware: The New Cyber Threat & How to Stop It

This infographic explains ransomware, type of malware that blocks access to your files or your systems and holds them hostage until a ransom is paid. It also examines the different types of ransomware and explains what you can do to thwart this sinister online threat.  


Author Comment

ID: 18018283
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.. ?
LVL 19

Expert Comment

ID: 18018353
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

Author Comment

ID: 18018704
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"/>

LVL 19

Expert Comment

ID: 18018900
And what is inside test.war file ?

Author Comment

ID: 18018941
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..)

LVL 19

Expert Comment

ID: 18018966
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.

Author Comment

ID: 18019035
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)
LVL 19

Accepted Solution

ramazanyich earned 2000 total points
ID: 18019144
have the same issue with deploymeny of your war file on my system. Probably bug in Tomcat :(

Author Comment

ID: 18019291
But isn't there a way to work around this problem... ? :-(


Author Comment

ID: 18043851
Can someone help me out with this problem please.. ?

Author Comment

ID: 18122987
Is there only one tomcat expert here . . .?

Author Comment

ID: 18149940
Sorry but I'm not impressed by the service offered here.. I'm cancelling my subscription.

Featured Post

Get free NFR key for Veeam Availability Suite 9.5

Veeam is happy to provide a free NFR license (1 year, 2 sockets) to all certified IT Pros. The license allows for the non-production use of Veeam Availability Suite v9.5 in your home lab, without any feature limitations. It works for both VMware and Hyper-V environments

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction As you’re probably aware the HTTP protocol offers basic / weak authentication, which in combination with the relevant configuration on your web server, provides the ability to password protect all or part of your host.  If you were not…
If your site has a few sections that need to be secure when data is transmitted between the server and local computer, such as a /order/ section for ordering or /customer/ which contains customer data, etc it would of course be recommended to secure…
Michael from AdRem Software outlines event notifications and Automatic Corrective Actions in network monitoring. Automatic Corrective Actions are scripts, which can automatically run upon discovery of a certain undesirable condition in your network.…
Monitoring a network: how to monitor network services and why? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the philosophy behind service monitoring and why a handshake validation is critical in network monitoring. Software utilized …
Suggested Courses

765 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question