Page 1 of 1

Issues Installing OpenKM as Windows Service on Windows Serve

PostPosted:Wed Nov 05, 2014 9:41 pm
by alexwgordon
Hi Guys!

So I'm having some issues installing OpenKM as a windows service. I've followed these instructions here:
http://wiki.openkm.com/index.php/Config ... ce_windows

I followed the instructions exactly as they are, except for when it says to alter the line regarding port "8880" which I assume they meant port "8080". I had some issue in the beginning getting a 500 error, but have worked through that via windows firewall.

I have tested the Openkm-6.3.0-community-windows-installer.exe and it works perfectly. However, as soon as the user who started OpenKM logs out, it is no longer accessible; hence the need for a windows service.

I'm currently running Windows Server Standard 2008 SP2, jdk1.7.0_71, tomcat-7.0.27, and OpenKM 6.3. I have the files installed on a secondary drive (not sure if this should cause issues) under D:\OpenKM and have a Java folder and my tomcat folder.

So as it stands I'm receiving the error, "javax.servlet.ServletException: com.openkm.core.DatabaseException: Cannot open connection"

If anyone has any advice on the matter, I'd greatly appreciate it! I'm a little new to all this so I'm struggling a bit, but would be so happy to get this guy working with a little community help :) Thanks everyone in advance!

Re: Issues Installing OpenKM as Windows Service on Windows S

PostPosted:Wed Nov 05, 2014 9:47 pm
by alexwgordon
Also, here are my OpenKM.cfg, OpenKM.xml, and server.xml


OpenKM.cfg
Code: Select all
# OpenKM Hibernate configuration values
hibernate.dialect=org.hibernate.dialect.HSQLDialect
hibernate.hbm2ddl=none

# Initial configuration - Linux
system.imagemagick.convert=/usr/bin/convert
system.openoffice.path=/usr/lib/libreoffice
system.swftools.pdf2swf=/opt/openkm/bin/pdf2swf -f -T 9 -t -s storeallcharacters ${fileIn} -o ${fileOut}

# Initial configuration - Windows
#system.imagemagick.convert=C:/openkm/bin/convert.exe
#system.openoffice.path=C:/Program Files (x86)/OpenOffice 4
#system.swftools.pdf2swf=C:/openkm/bin/pdf2swf.exe -f -T 9 -t -s storeallcharacters ${fileIn} -o ${fileOut}


OpenKM.xml
Code: Select all
<?xml version="1.0" encoding="UTF-8"?>
<beans:beans xmlns:beans="http://www.springframework.org/schema/beans"
             xmlns:security="http://www.springframework.org/schema/security"
             xmlns:task="http://www.springframework.org/schema/task"
             xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
             xsi:schemaLocation="http://www.springframework.org/schema/beans
                                 http://www.springframework.org/schema/beans/spring-beans-3.1.xsd
                                 http://www.springframework.org/schema/security
                                 http://www.springframework.org/schema/security/spring-security-3.1.xsd
                                 http://www.springframework.org/schema/task
                                 http://www.springframework.org/schema/task/spring-task-3.1.xsd">
  
  <!-- Security configuration -->
  <security:authentication-manager alias="authenticationManager">
    <security:authentication-provider>
      <security:password-encoder hash="md5"/>
      <security:jdbc-user-service 
        data-source-ref="dataSource"
        users-by-username-query="select usr_id, usr_password, 1 from OKM_USER where usr_id=? and usr_active='T'"
        authorities-by-username-query="select ur_user, ur_role from OKM_USER_ROLE where ur_user=?"/>
    </security:authentication-provider>
  </security:authentication-manager>
</beans:beans>

Server.xml
Code: Select all
<?xml version='1.0' encoding='utf-8'?>
<!--
  Licensed to the Apache Software Foundation (ASF) under one or more
  contributor license agreements.  See the NOTICE file distributed with
  this work for additional information regarding copyright ownership.
  The ASF licenses this file to You under the Apache License, Version 2.0
  (the "License"); you may not use this file except in compliance with
  the License.  You may obtain a copy of the License at

      http://www.apache.org/licenses/LICENSE-2.0

  Unless required by applicable law or agreed to in writing, software
  distributed under the License is distributed on an "AS IS" BASIS,
  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  See the License for the specific language governing permissions and
  limitations under the License.
-->
<!-- Note:  A "Server" is not itself a "Container", so you may not
     define subcomponents such as "Valves" at this level.
     Documentation at /docs/config/server.html
 -->
<Server port="8005" shutdown="SHUTDOWN">
  <!-- Security listener. Documentation at /docs/config/listeners.html
  <Listener className="org.apache.catalina.security.SecurityListener" />
  -->
  <!--APR library loader. Documentation at /docs/apr.html -->
  <Listener className="org.apache.catalina.core.AprLifecycleListener" SSLEngine="on" />
  <!--Initialize Jasper prior to webapps are loaded. Documentation at /docs/jasper-howto.html -->
  <Listener className="org.apache.catalina.core.JasperListener" />
  <!-- Prevent memory leaks due to use of particular java/javax APIs-->
  <Listener className="org.apache.catalina.core.JreMemoryLeakPreventionListener" />
  <Listener className="org.apache.catalina.mbeans.GlobalResourcesLifecycleListener" />
  <Listener className="org.apache.catalina.core.ThreadLocalLeakPreventionListener" />
  <!-- Automatically reload log4j configuration -->
  <Listener className="com.openkm.util.Log4JInitializer" configFile="${catalina.base}/conf/log4j.properties"/>

  <!-- Global JNDI resources
       Documentation at /docs/jndi-resources-howto.html
  -->
  <GlobalNamingResources>
    <!-- Editable user database that can also be used by
         UserDatabaseRealm to authenticate users
    -->
    <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" />
    <Resource auth="Container" driverClassName="org.hsqldb.jdbcDriver" maxActive="100" maxIdle="30" 
          maxWait="10000" name="jdbc/OpenKMDS" password="password" type="javax.sql.DataSource" 
          url="jdbc:hsqldb:${catalina.base}/repository/okmdb" username="sa"
          validationQuery="select 1 from INFORMATION_SCHEMA.SYSTEM_USERS"/> 
 
    <Resource name="mail/OpenKM" auth="Container" type="javax.mail.Session"
            mail.smtp.host="localhost" mail.from="testing@openkm.com"/>
  </GlobalNamingResources>

  <!-- A "Service" is a collection of one or more "Connectors" that share
       a single "Container" Note:  A "Service" is not itself a "Container",
       so you may not define subcomponents such as "Valves" at this level.
       Documentation at /docs/config/service.html
   -->
  <Service name="Catalina">

    <!--The connectors can use a shared executor, you can define one or more named thread pools-->
    <!--
    <Executor name="tomcatThreadPool" namePrefix="catalina-exec-"
        maxThreads="150" minSpareThreads="4"/>
    -->


    <!-- A "Connector" represents an endpoint by which requests are received
         and responses are returned. Documentation at :
         Java HTTP Connector: /docs/config/http.html (blocking & non-blocking)
         Java AJP  Connector: /docs/config/ajp.html
         APR (HTTP/AJP) Connector: /docs/apr.html
         Define a non-SSL HTTP/1.1 Connector on port 8080
    -->
    <Connector address="0.0.0.0" port="8080" protocol="HTTP/1.1"
               connectionTimeout="20000"
               redirectPort="8443" />
    <!-- A "Connector" using the shared thread pool-->
    <!--
    <Connector executor="tomcatThreadPool"
               port="8080" protocol="HTTP/1.1"
               connectionTimeout="20000"
               redirectPort="8443" />
    -->
    <!-- Define a SSL HTTP/1.1 Connector on port 8443
         This connector uses the JSSE configuration, when using APR, the
         connector should be using the OpenSSL style configuration
         described in the APR documentation -->
    <!--
    <Connector port="8443" protocol="HTTP/1.1" SSLEnabled="true"
               maxThreads="150" scheme="https" secure="true"
               clientAuth="false" sslProtocol="TLS" />
    -->

    <!-- Define an AJP 1.3 Connector on port 8009 -->
    <Connector port="8009" protocol="AJP/1.3" redirectPort="8443" />


    <!-- An Engine represents the entry point (within Catalina) that processes
         every request.  The Engine implementation for Tomcat stand alone
         analyzes the HTTP headers included with the request, and passes them
         on to the appropriate Host (virtual host).
         Documentation at /docs/config/engine.html -->

    <!-- You should set jvmRoute to support load-balancing via AJP ie :
    <Engine name="Catalina" defaultHost="localhost" jvmRoute="jvm1">
    -->
    <Engine name="Catalina" defaultHost="localhost">

      <!--For clustering, please take a look at documentation at:
          /docs/cluster-howto.html  (simple how to)
          /docs/config/cluster.html (reference documentation) -->
      <!--
      <Cluster className="org.apache.catalina.ha.tcp.SimpleTcpCluster"/>
      -->

      <!-- Use the LockOutRealm to prevent attempts to guess user passwords
           via a brute-force attack -->
      <Realm className="org.apache.catalina.realm.LockOutRealm">
        <!-- This Realm uses the UserDatabase configured in the global JNDI
             resources under the key "UserDatabase".  Any edits
             that are performed against this UserDatabase are immediately
             available for use by the Realm.  -->
        <Realm className="org.apache.catalina.realm.UserDatabaseRealm"
               resourceName="UserDatabase"/>
      </Realm>

      <Host name="localhost"  appBase="webapps"
            unpackWARs="true" autoDeploy="true">

        <!-- SingleSignOn valve, share authentication between web applications
             Documentation at: /docs/config/valve.html -->
        <!--
        <Valve className="org.apache.catalina.authenticator.SingleSignOn" />
        -->

        <!-- Access log processes all example.
             Documentation at: /docs/config/valve.html
             Note: The pattern used is equivalent to using pattern="common" -->
        <Valve className="org.apache.catalina.valves.AccessLogValve" directory="logs"
               prefix="localhost_access_log." suffix=".txt"
               pattern="%h %l %u %t "%r" %s %b" />

      </Host>
    </Engine>
  </Service>
</Server>

Re: Issues Installing OpenKM as Windows Service on Windows S

PostPosted:Thu Nov 06, 2014 1:30 am
by alexwgordon
Okay, so an update:

I noticed that in the $TOMCAT/lib folder there was no hsqldb.jar file. So after copying the that file from the open community windows exe into my tomcat folder, I get the following error:
javax.servlet.ServletException: com.openkm.core.DatabaseException: could not execute query

Also as a precaution, I removed the $TOMCAT/webapps/OpenKM and $TOMCAT/work/Catalina/localhost folders and got this error:
An exception occurred processing JSP page /login_desktop.jsp at line 68 65: Language 66:

Any thoughts?? Thanks again in advance everyone!

Re: Issues Installing OpenKM as Windows Service on Windows S

PostPosted:Sat Nov 08, 2014 11:02 am
by jllort
for what are you explaining, seems the problem is with database. On initial question is a production or testing environment ? because for production you should not use hsql you should use mysql ( I suggest take a look here http://wiki.openkm.com/index.php/MySQL_-_OpenKM_6.2)

If error persists, I suggest stop tomcat. Remove catalina.log file. Start application and upload here the catalina.log file ( I want to see all the log ).

SOLVED Issues Installing OpenKM as Windows Service on Window

PostPosted:Tue Nov 11, 2014 8:36 pm
by alexwgordon
Success!

So I made a bad assumption that our server had MySQL properly installed and setup.

For anyone else having this problem, I thought I would outline the steps I took (some might be unnecessary, but worked in my case):

1. Download and install MySQL Server.
2. Download and installed windows exe 6.3.0 community.
3. Downloaded apache tomcat 7.0.27
4. Copied $TOMCAT\bin and $TOMCAT\lib to corresponding folders in $OPENKM\tomcat\ just to be safe. Not overwriting.
5. Deleted $OPENKM\tomcat\work\Catalina\localhost\ and $OPENKM\tomcat\webapps\OpenKM\ just in case.
6. Setup JAVA_HOME in environment variables - this was probably unnecessary, I just installed Java in a separate folder.
7. Followed your instructions for setting up OpenKM with MySQL: http://wiki.openkm.com/index.php/MySQL_-_OpenKM_6.2 – changing the "Tomcat datasources" line with the correct MySQL password.
8. At this point tested and everything worked!
9. Followed the instructions start at step 4.3 to setup tomcat a service: http://wiki.openkm.com/index.php/Config ... ce_windows
10. Retested and everything worked!


I'm about 90% sure that these were all the steps I took. I think I'm going to retest these steps on another machine to make sure it all works. But I hope that this helps someone else out there! And Thanks so much jllort for your help!

Re: Issues Installing OpenKM as Windows Service on Windows S

PostPosted:Wed Nov 12, 2014 9:21 am
by jllort
I suspect the problem was on our tomcat-7.0.27, there're some dll for 32 bits and others for 64 bits, into default tomcat. Can you take a look if into our original tomcat/bin there're some folders called x64 and x32 ?

Re: Issues Installing OpenKM as Windows Service on Windows S

PostPosted:Wed Nov 12, 2014 6:14 pm
by alexwgordon
In the $OpenKM\tomcat\bin? If that's the folder you are referring to, then yes, there is an x86 and x64 folder.

Re: Issues Installing OpenKM as Windows Service on Windows S

PostPosted:Fri Nov 14, 2014 1:21 am
by alexwgordon
Also, now that I've got everything working with the actual windows service setup, I'm having issues with my custom version adapater not working (see x-post below). It works on a local mac install of OpenKM, but isn't working with the service. Any thoughts you might have on the issue would be great! Thank jllort for all your help and efforts!

http://forum.openkm.com/viewtopic.php?f=31&t=12624