Solved

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

Posted on 2006-11-16
17
382 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
Comment Utility
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
Comment Utility
Sorry this is not enough to help me out
0
 
LVL 19

Expert Comment

by:ramazanyich
Comment Utility
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
 

Author Comment

by:firewired44
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
And what is inside test.war file ?
0
Backup Your Microsoft Windows Server®

Backup all your Microsoft Windows Server – on-premises, in remote locations, in private and hybrid clouds. Your entire Windows Server will be backed up in one easy step with patented, block-level disk imaging. We achieve RTOs (recovery time objectives) as low as 15 seconds.

 

Author Comment

by:firewired44
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
have the same issue with deploymeny of your war file on my system. Probably bug in Tomcat :(
0
 

Author Comment

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

0
 

Author Comment

by:firewired44
Comment Utility
Can someone help me out with this problem please.. ?
0
 

Author Comment

by:firewired44
Comment Utility
Is there only one tomcat expert here . . .?
0
 

Author Comment

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

Featured Post

Top 6 Sources for Identifying Threat Actor TTPs

Understanding your enemy is essential. These six sources will help you identify the most popular threat actor tactics, techniques, and procedures (TTPs).

Join & Write a Comment

Suggested Solutions

In my time as an SEO for the last 2 years and in the questions I have assisted with on here I have always seen the need to redirect from non-www urls to their www versions. For instance redirecting http://domain.com (http://domain.com) to http…
As Wikipedia explains 'robots.txt' as -- the robot exclusion standard, also known as the Robots Exclusion Protocol or robots.txt protocol, is a convention to prevent cooperating web spiders and other web robots from accessing all or part of a websit…
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…
This video demonstrates how to create an example email signature rule for a department in a company using CodeTwo Exchange Rules. The signature will be inserted beneath users' latest emails in conversations and will be displayed in users' Sent Items…

771 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

Need Help in Real-Time?

Connect with top rated Experts

16 Experts available now in Live!

Get 1:1 Help Now