Harry,

Thank you for your suggestion.  I wasn't aware there was a property by that
name.  The documentation does mention a jspwiki_custom.properties file for a
single wiki instance.  I tried using that property instead and it worked for
one of my test contexts.  I found that it only worked if I unzipped the
JSPWiki.war file into a directory and then pointed docBase at that
directory.  If I point it straight at the war file, the
jspwiki.custom.config appears to be ignored.  I appear to be able to create
multiple wikis now.  I still need to do testing for things like cookies,
authentication/authorization, but that is my next step.  Thank you for
responding to my post as I was completely stuck and you definitely got me
unstuck.  I wanted to reply with complete details just in case anyone has a
similar issue.

Below is my working Context:

<Context path="/Test" docBase="/wikis/wikis/Test/JSPWiki">
        <Parameter name="jspwiki.custom.config"
value="/wikis/wikis/Test/Test.properties"/>
</Context>


I create a context file under %CATALINA_BASE%/conf/Catalina/localhost for
each wiki.  Each wiki has its own properties file, pages/attachments
directory, work directory, and log file.

Steps to allow the creation of multiple wikis:

1.  Use the "jspwiki.custom.config" parameter instead of the
jspwiki.propertyfile.
2.  Unzip the JSPWiki.war file into a directory and point docBase at this
directory (you will need to do this for each wiki that you want to setup)

BONUS:  Do you know why it works for a directory but not the war file?  I
found other articles with people saying it doesn't work for the war file but
I never found an explanation.  I know that war files are unpacked under
webapps but I am not sure why that would prevent the custom parameter from
being applied.

Thank you for all of your help.

Shawn Campbell '99
Systems Analyst
Information Technology Offices
Phone:  330.471.8501
Fax:  330.471.8302
E-mail:  scampb...@malone.edu



Please click here to take a virtual campus tour

Malone University
2600 Cleveland Avenue NW
Canton, Ohio 44709



-----Original Message-----
From: Harry Metske [mailto:harry.met...@gmail.com]
Sent: Friday, January 6, 2017 2:24 PM
To: user@jspwiki.apache.org
Subject: Re: Tomcat 8.5 + JSPWiki 2.10.2 - multiple wikis

Shawn,

shouldn't you use parameter name  "jspwiki.custom.config"  instead of
"jspwiki.propertyfile"
 in your context xml file ?

See:
https://github.com/apache/jspwiki/blob/jspwiki_2_10_2/jspwiki-war/src/main/java/org/apache/wiki/util/PropertyReader.java#L66


kind regards,
Harry



On 5 January 2017 at 23:10, Shawn Campbell <scampb...@malone.edu> wrote:

> I have setup Tomcat 8.5 on Server JDK 8u74 on Debian Linux 8.  I
> downloaded everything from tar.gz/zip files and did not use Debian
> packages (for all of it:  JDK, Tomcat, JSVC, and JSPWiki).  I am using
> JSVC to run Tomcat as a daemon using a customized version of the daemon.sh
> script.
>
>
>
> I set the following variables in the daemon.sh script at the top:
>
> JAVA_HOME=/wikis/jdk
>
> CATALINA_HOME=/wikis/apache-tomcat
>
> The tomcat user and tomcat group own all of the files under the /wikis
> directory and the permissions are set to 770 on all files/directories
> under /wikis (including /wikis).  The root user is a member of the tomcat
> group.
>
>
>
> My intention is to create multiple wikis.  I found instructions that
> said to create a Context XML file under Catalina/localhost rather than
> changing the Tomcat server.xml file, so that is what I have done.
> Below is the contents of
> /wikis/apache-tomcat/conf/Catalina/localhost/Test.xml:
>
>
>
> <Context path="/Test" docBase="/wikis/JSPWiki/JSPWiki.war">
>
>         <Parameter name="jspwiki.propertyfile"
> value="/wikis/Test/Test.properties"
> override="false"/>
>
> </Context>
>
>
>
> The output in catalina-daemon.out indicates that it is reading this file.
> However, I do not receive an error message whether
> /wikis/Test/Test.properties is present or not.  I get the following
> error message from log4j whether the Test.properties file is present or
> not:
>
>
>
> log4j:WARN No appenders could be found for logger (org.apache.wiki.util.
> PropertyReader).
>
> log4j:WARN Please initialize the log4j system properly.
>
> log4j:WARN See http://logging.apache.org/log4j/1.2/faq.html#noconfig
> for more info.
>
> log4j:ERROR setFile(null,true) call failed.
>
> java.io.FileNotFoundException: jspwiki.log (Permission denied)
>
>         at java.io.FileOutputStream.open0(Native Method)
>
>         at java.io.FileOutputStream.open(FileOutputStream.java:270)
>
>         at java.io.FileOutputStream.<init>(FileOutputStream.java:213)
>
>         at java.io.FileOutputStream.<init>(FileOutputStream.java:133)
>
>         at
> org.apache.log4j.FileAppender.setFile(FileAppender.java:294)
>
>         at org.apache.log4j.RollingFileAppender.setFile(
> RollingFileAppender.java:207)
>
>         at org.apache.log4j.FileAppender.activateOptions(FileAppender.
> java:165)
>
>         at org.apache.log4j.config.PropertySetter.activate(
> PropertySetter.java:307)
>
>         at org.apache.log4j.config.PropertySetter.setProperties(
> PropertySetter.java:172)
>
>         at org.apache.log4j.config.PropertySetter.setProperties(
> PropertySetter.java:104)
>
>         at org.apache.log4j.PropertyConfigurator.parseAppender(
> PropertyConfigurator.java:842)
>
>         at org.apache.log4j.PropertyConfigurator.parseCategory(
> PropertyConfigurator.java:768)
>
>         at
> org.apache.log4j.PropertyConfigurator.configureRootCategory(
> PropertyConfigurator.java:648)
>
>         at org.apache.log4j.PropertyConfigurator.doConfigure(
> PropertyConfigurator.java:514)
>
>         at org.apache.log4j.PropertyConfigurator.configure(
> PropertyConfigurator.java:440)
>
>         at org.apache.wiki.WikiEngine.initialize(WikiEngine.java:464)
>
>         at org.apache.wiki.WikiEngine.<init>(WikiEngine.java:430)
>
>         at org.apache.wiki.WikiEngine.getInstance(WikiEngine.java:370)
>
>         at org.apache.wiki.ui.WikiServletFilter.init(
> WikiServletFilter.java:82)
>
>         at
> org.apache.catalina.core.ApplicationFilterConfig.initFilter(
> ApplicationFilterConfig.java:279)
>
>         at org.apache.catalina.core.ApplicationFilterConfig.getFilter(
> ApplicationFilterConfig.java:260)
>
>         at org.apache.catalina.core.ApplicationFilterConfig.<init>
> (ApplicationFilterConfig.java:105)
>
>         at org.apache.catalina.core.StandardContext.filterStart(
> StandardContext.java:4572)
>
>         at org.apache.catalina.core.StandardContext.startInternal(
> StandardContext.java:5215)
>
>         at org.apache.catalina.util.LifecycleBase.start(
> LifecycleBase.java:150)
>
>         at org.apache.catalina.core.ContainerBase.addChildInternal(
> ContainerBase.java:752)
>
>         at org.apache.catalina.core.ContainerBase.addChild(
> ContainerBase.java:728)
>
>         at org.apache.catalina.core.StandardHost.addChild(
> StandardHost.java:734)
>
>         at org.apache.catalina.startup.HostConfig.deployDescriptor(
> HostConfig.java:596)
>
>         at org.apache.catalina.startup.HostConfig$DeployDescriptor.
> run(HostConfig.java:1805)
>
>         at java.util.concurrent.Executors$RunnableAdapter.
> call(Executors.java:511)
>
>         at java.util.concurrent.FutureTask.run(FutureTask.java:266)
>
>         at java.util.concurrent.ThreadPoolExecutor.runWorker(
> ThreadPoolExecutor.java:1142)
>
>         at java.util.concurrent.ThreadPoolExecutor$Worker.run(
> ThreadPoolExecutor.java:617)
>
>         at java.lang.Thread.run(Thread.java:745)
>
> 05-Jan-2017 16:21:33.690 INFO [localhost-startStop-1]
> org.apache.catalina.startup.HostConfig.deployDescriptor Deployment of
> configuration descriptor /wikis/apache-tomcat-8.5.9/
> conf/Catalina/localhost/Test.xml has finished in 2,236 ms
>
>
>
>
>
>
>
> The above error suggests that my Test.properties file is being ignored
> entirely.  The JSPWiki.war file is being decompressed into the Tomcat
> webapps directory as /Test as I would expect.  When I view it from a
> browser, if I go to https://mydomain.com/Test, an incorrectly rendered
> JSPWiki page appears.  If I put my cursor over the links in the page,
> it show https://mydomain.com/JSPWiki in the URLs instead of
> https://mydomain.com/Test.  I have placed the JSPWiki wikipages in the
> Pages directory as instructed.  No log file is being written to the
> location indicates in my Test.properties file.  Below are the contents
> of my Test.properties file:
>
>
>
> jspwiki.applicationName = Test
>
> jspwiki.baseURL=https://mydomain.com/Test/
>
> jspwiki.pageProvider = FileSystemProvider
>
> jspwiki.fileSystemProvider.pageDir = /wikis/Test/Pages
>
> jspwiki.workDir = /wikis/Test/Work
>
> jspwiki.attachmentProvider = BasicAttachmentProvider
>
> jspwiki.basicAttachmentProvider.storageDir = /wikis/Test/Pages
>
> jspwiki.usePageCache = true
>
> jspwiki.encoding = UTF-8
>
> jspwiki.use.external.logconfig = false
>
> jspwiki.usePageCache = true
>
> log4j.appender.FileLog = org.apache.log4j.RollingFileAppender
>
> log4j.appender.FileLog.MaxFileSize    = 10MB
>
> log4j.appender.FileLog.MaxBackupIndex = 14
>
> log4j.appender.FileLog.File = /wikis/Test/Logs/Test-jspwiki.log
>
> log4j.appender.FileLog.layout = org.apache.log4j.PatternLayout
>
> log4j.appender.FileLog.layout.ConversionPattern=%d [%t] %p %c %x -
> %m%n
>
>
>
> I have not tried placing a jspwiki_custom.properties file in the
> WEB-INF of each wiki or modifying the default jspwiki.properties file
> in the embedded jar in the JSPWiki.war file.  I would prefer to avoid
> changing the war file to make upgrading easier.  I have not been able
> to find an explanation for why this approach isn’t working.  I am
> assuming that the Parameter I am setting the context is either not
> formatted correctly or perhaps is no longer supported by the version of
> JSPWiki that I am using.
> I would appreciate any assistance with setting up JSPWiki in a clean
> and maintainable manner for a multiple wikis use case.  I have been
> using JSPWiki for more than 10 years and I am trying to move it from
> an old server to a new server as it is running a very old version of
> JSPWiki.  I also intend to setup Tomcat LDAPS authentication and
> configure JSPWiki to use Tomcat for authentication/authorization, but that
> is a next step.
>
>
>
> My first obstacle is how to get multiple JSPWiki instances to
> recognize a custom configuration file for each wiki instance.  Any
> thoughts?
>
>
>
> *Shawn Campbell '99*
>
> Systems Analyst
>
> Information Technology Offices
>
> Phone:  330.471.8501
>
> Fax:  330.471.8302
>
> E-mail:  scampb...@malone.edu
>
>
>
> [image: cid:43D3B185-AF75-4CFC-A291-D4EE889CFB31@malone.int]
>
>
>
> Please click here to take a virtual campus tour
> <http://www.malone.edu/#virtualtour>
>
>
>
> Malone University
>
> 2600 Cleveland Avenue NW
>
> Canton, Ohio 44709
>
>
>
>
>

Reply via email to