Solved

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

Posted on 2006-11-16
17
386 Views
Last Modified: 2009-07-29
Hi!

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 :    

/www/website.com/users/john/webapps/
 /www/website.com/tom/webapps/
 /www/website.com/mike/webapps/
...

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

0
Comment
Question by:firewired44
  • 9
  • 6
17 Comments
 
LVL 19

Expert Comment

by:ramazanyich
ID: 17960100
I think you should read carefully this documentation
http://tomcat.apache.org/tomcat-5.5-doc/config/host.html#User%20Web%20Applications
It describes web applications per user configuration
0
 

Author Comment

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

Expert Comment

by:ramazanyich
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"
            directoryName="webapps"
            homeBase="www/website.com"
            userClass="org.apache.catalina.startup.HomesUserDatabase"/>

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
http://website.com/~tom/test

0
Windows Server 2016: All you need to know

Learn about Hyper-V features that increase functionality and usability of Microsoft Windows Server 2016. Also, throughout this eBook, you’ll find some basic PowerShell examples that will help you leverage the scripts in your environments!

 

Author Comment

by:firewired44
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.. ?
0
 
LVL 19

Expert Comment

by:ramazanyich
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
0
 

Author Comment

by:firewired44
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"/>
&#8722;
      <GlobalNamingResources>
<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"/>
</GlobalNamingResources>
&#8722;
      <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"/>
&#8722;
      <Engine name="Catalina" defaultHost="localhost">
<Realm className="org.apache.catalina.realm.UserDatabaseRealm" resourceName="UserDatabase"/>
&#8722;
      <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"/>

</Host>
</Engine>
</Service>
</Server>
0
 
LVL 19

Expert Comment

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

Author Comment

by:firewired44
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..)

0
 
LVL 19

Expert Comment

by:ramazanyich
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.
0
 

Author Comment

by:firewired44
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)
0
 
LVL 19

Accepted Solution

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

Author Comment

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

0
 

Author Comment

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

Author Comment

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

Author Comment

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

Featured Post

VMware Disaster Recovery and Data Protection

In this expert guide, you’ll learn about the components of a Modern Data Center. You will use cases for the value-added capabilities of Veeam®, including combining backup and replication for VMware disaster recovery and using replication for data center migration.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Redirect from old domain to new domain 19 73
setting up tomcat for external access 4 74
Zipping many files freeze my whole server through php 5 62
maybe no no httpd.conf 6 48
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…
Hi, in this article I'm going to teach you how to run your own site, and how to let people in (without IP). I'll talk about and explain each step... :) By the way, everything in this Tutorial is completely free and legal. This article is for …
Microsoft Active Directory, the widely used IT infrastructure, is known for its high risk of credential theft. The best way to test your Active Directory’s vulnerabilities to pass-the-ticket, pass-the-hash, privilege escalation, and malware attacks …
Finds all prime numbers in a range requested and places them in a public primes() array. I've demostrated a template size of 30 (2 * 3 * 5) but larger templates can be built such 210  (2 * 3 * 5 * 7) or 2310  (2 * 3 * 5 * 7 * 11). The larger templa…

825 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