Today I have configured Alfresco 2.1 (Tomcat Version) using JNDI Datasource. The procedure is simple as follows and uses mysql database
1. Update $TOMAT_HOME$\server.xml with the following within
<GlobalNamingResources>
<Resource name="jdbc/alf_global" auth="Container" scope="Shareable"
type="javax.sql.DataSource"
maxActive="100" maxIdle="30" maxWait="10000"
username="alfresco" password="alfresco"
driverClassName="org.gjt.mm.mysql.Driver"
url="jdbc:mysql:///alfresco"/>
…………………………………………………………
<\GlobalNamingResources>
2. Update $TOMCAT_HOME$\context.xml with the following
<Context path="/alfresco" docBase="alfresco"
debug="5" reloadable="true" crossContext="true">
<!– Default set of monitored resources –>
<WatchedResource>WEB-INF/web.xml</WatchedResource>
<!– Uncomment this to disable session persistence across Tomcat
restarts –>
<!–
<Manager pathname="" />
–>
<!– Uncomment this to enable Comet connection tacking (provides
events on session expiration as well as webapp lifecycle) –>
<!–
<Valve className="org.apache.catalina.valves.CometConnectionManagerValve" />
–>
<ResourceLink name="jdbc/alfresco" global="jdbc/alf_global" type="javax.sql.DataSource"/>
</Context>
3. Update $TOMCAT_HOME$\webapps\alfresco\WEB-INF\web.xml at the end with the following
<resource-ref>
<description>DB Connection</description>
<res-ref-name>jdbc/alfresco</res-ref-name>
<res-type>javax.sql.DataSource</res-type>
<res-auth>Container</res-auth>
</resource-ref>
4. Update $TOMCAT_HOME$\webapps\alfresco\WEB-INF\classes\alfresco\core-services-context.xml
with the following
<!– Datasource bean –>
<!–<bean id="dataSource" class="org.apache.commons.dbcp.BasicDataSource" destroy-method="close">
<property name="driverClassName">
<value>${db.driver}</value>
</property>
<property name="url">
<value>${db.url}</value>
</property>
<property name="username">
<value>${db.username}</value>
</property>
<property name="password">
<value>${db.password}</value>
</property>
<property name="initialSize" >
<value>${db.pool.initial}</value>
</property>
<property name="maxActive" >
<value>${db.pool.max}</value>
</property>
<property name="defaultAutoCommit" >
<value>false</value>
</property>
</bean>–>
<bean id="dataSource" class="org.springframework.jndi.JndiObjectFactoryBean">
<property name="jndiName" value="java:comp/env/jdbc/alfresco"/>
</bean>
Actually you are commenting the BasicDataSource and adding JndiObjectFactoryBean
5. Remove naming-factory.jar and naming-resources.jar from the
lib $TOMCAT_HOME$\webapps\alfresco\WEB-INF\lib
these 2 jar files are causing problems when initiating java:comp initial context. These jars are used to connect to a remote resource like LDAP..
etc. I have seen many posts having problems with java:comp context,
I think these are due these jar files, please clarify me.
6. Now run your alfresco…
Please update me your experiences
Thanks,
Vijay