cancel
Showing results for 
Search instead for 
Did you mean: 

Alfresco 3 stable with Mysql

peter-adams
Champ in-the-making
Champ in-the-making
Can anyone help?

I have setup a new Ubuntu server and installed Mysql 5  and Alfresco 3 stable.  Before starting Alfresco, I edited the custom-repository.properties to change the database directory to mysql, remove the Derby config and add the mysql.  I also edited the custom-hiberate-dialect.properties file to remove Derby and add Mysql.  Then I edited the Alfresco.sh to configure the JAVA_HOME.

When I start up, tomcat runs (I tested it with an index.html file), but Alfresco fails with a 404 error.  From everything I have read, it appears that the mysql-connector-java-5.0.3-bin.jar was missing.  I downloaded this and placed it in the /tomcat/lib folder, but I am not sure how it gets called?  In anycase, it still does not work.

One last point, Before doing this clean install, I did the standard Derby install and it worked, so it is definitely something to do with the mysql connection.  I can connect manually to the Alfresco database, so I know that the MYsql itself is okay.
23 REPLIES 23

boulderdash
Champ in-the-making
Champ in-the-making
Found the issue:
I did not had the correct directory structure in my tomcat shared folder and so my configuration files were not found.
Sorry for that.

iomari
Champ in-the-making
Champ in-the-making
Ok, here is how I got mine to work on Linux.
First off, make sure you have rebooted and your system has no java stuff running.
Then install Alfresco-Labs-3Stable-Linux-x86-Install
After installing, DO NOT RUN IT.
edit /alfresco-root-folder/tomcat/shared/classes/alfresco/extension/custom-hibernate-dialect.properties and
/alfresco-root-folder/tomcat/shared/classes/alfresco/extension/custom-repository.properties as usual.

if openoffice, Imagemagick and pdf2swf are installed. edit the paths to them in custom-repository.properties or you'll get errors when running. otherwise comment them out. Here is my properties file:
###############################                                                                               
## Common Alfresco Properties #                                                                              
###############################                                                                              

#
# Sample custom content and index data location
#                                             
dir.root=/opt/alfresco/alf_data               

#
# Sample database connection properties
#                                     
db.name=alfresco
db.username=alfresco
db.password=alfresco
#db.pool.initial=10
#db.pool.max=100

#
# Sample external executable locations
#
ooo.exe=/opt/openoffice.org3/program/soffice
#ooo.user=${dir.root}/oouser
img.root=/usr
swf.exe=/usr/bin/pdf2swf

#
# Sample index tracking frequency
#
#index.tracking.cronExpression=0/5 * * * * ?

#
# Property to control whether schema updates are performed automatically.
# Updates must be enabled during upgrades as, apart from the static upgrade scripts,
# there are also auto-generated update scripts that will need to be executed.  After
# upgrading to a new version, this can be disabled.
#
#db.schema.update=true

#
# Derby connection
#
db.driver=org.apache.derby.jdbc.EmbeddedDriver
db.url=jdbc:derby:alf_data/derby_data/alfresco;create=true

#
# HSQL connection
#
#db.driver=org.hsqldb.jdbcDriver
#db.url=jdbc:hsqldb:file:alf_data/hsql_data/alfresco;ifexists=true;shutdown=true;

#
# MySQL connection (This is default and requires mysql-connector-java-5.0.3-bin.jar, which ships with the Alfresco server)
#
db.driver=org.gjt.mm.mysql.Driver
db.url=jdbc:mysql://localhost/alfresco

#
# PostgreSQL connection (requires postgresql-8.2-504.jdbc3.jar or equivalent)
#
#db.driver=org.postgresql.Driver
#db.url=jdbc:postgresql://localhost:5432/alfresco

create the database "alfresco" by running this command:

mysql -u root -p < /alfresco-folder/extras/databases/mysql/db_setup.sql

that's assuming that root has administrative rights for your mysql installation.


start the app but do not run web client.
/alfresco-folder/alfresco.sh start
/alfresco-folder/virtual_alf.sh start

stop the app
/alfresco-folder/alfresco.sh stop
/alfresco-folder/virtual_alf.sh stop

the last 2 steps creates the application folders. (/alfresco-folder/tomcat/webapps/alfresco)
the previous "webapps/alfresco" folder does not exist until you run the app for the first time.

copy /alfresco-folder/tomcat/webapps/alfresco/WEB-INF/classes/alfresco/authority-services-context.xml -> /alfresco-folder/tomcat/shared/classes/alfresco/extension

rename the file to custom-authority-services-context.xml  (this is the missing custom-authority-services-context.xml file)

you can now edit this file if you want to give other users admin rights by adding there names to the following section:


<property name="adminUsers">
            <set>
                      <value>admin</value>
                      <value>administrator</value>
            </set>
</property>

you can duplicate the line above "<value>admin</value>" asmany times as you want and change "admin" to whatever user name(s) you want to have admin right.
Of course those users have to be users that you created in the gui but you can create them later.

now start the app and log in to the web client
/alfresco-folder/alfresco.sh start
/alfresco-folder/virtual_alf.sh start

If you want to use another port other than 8080. edit /alfresco-folder/tomcat/conf/server.xml and change the port where you see 8080


<?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">                                 

  <!–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" />                              
  <!– JMX Support for the Tomcat server. Documentation at /docs/non-existent.html –>          
  <Listener className="org.apache.catalina.mbeans.ServerLifecycleListener" />                   
  <Listener className="org.apache.catalina.mbeans.GlobalResourcesLifecycleListener" />          

  <!– 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" />                         
  </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 port="8080" protocol="HTTP/1.1" URIEncoding="UTF-8"                               
               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"/>
      –>

      <!– The request dumper valve dumps useful debugging information about
           the request and response data received and sent by Tomcat.
           Documentation at: /docs/config/valve.html –>
      <!–
      <Valve className="org.apache.catalina.valves.RequestDumperValve"/>
      –>

      <!– 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"/>

      <!– Define the default virtual host
           Note: XML Schema validation will not work with Xerces 2.2.
       –>
      <Host name="localhost"  appBase="webapps"
            unpackWARs="true" autoDeploy="true"
            xmlValidation="false" xmlNamespaceAware="false">

        <!– 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 –>
        <!–
        <Valve className="org.apache.catalina.valves.AccessLogValve" directory="logs"
               prefix="localhost_access_log." suffix=".txt" pattern="common" resolveHosts="false"/>
        –>

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

Of course after this you must restart your app.

Enjoy  Smiley Very Happy

peter-adams
Champ in-the-making
Champ in-the-making
Hello Iomari,

Thanks for the detailed post, I followed your method and it worked perfectly!  Everything is now working and you are right, it was the missing step with the custom-authority-services-context.xml file that was the problem.  Perhaps this should be added to the Wiki install instructions to save others the same pain.

Thanks again for your help though.

Peter Smiley Very Happy

mrogers
Star Contributor
Star Contributor
Please go ahead and update the wiki if it is not clear.   Its community documentation.