Установка и настройка программы

Материал из BiTel WiKi

Перейти к: навигация, поиск

1) Создать из проекта WAR файл через Export

2) развертывание архива в tomcat http://www.jguru.com/faq/view.jsp?EID=123229

3) добавление ресурса базы данных с именем dbc/system/<имя системы> http://www.mbaworld.com/docs/jndi-resources-howto.html

<Context>
    ...
    <Resource name="bean/MyBeanFactory" auth="Container"
            type="com.mycompany.MyBean"
            factory="org.apache.naming.factory.BeanFactory"
            bar="23"/> 
    ...
</Context>
<Context path="" docBase="ROOT">
    <Resource name="jdbc/system/bgbilling" auth="Container" type="javax.sql.DataSource" maxActive="10" maxIdle="1" 
factory="org.apache.commons.dbcp.BasicDataSourceFactory" maxWait="10000" username="root" password="" driverClassName="com.mysql.jdbc.Driver" 
url="jdbc:mysql://sql.office.bitel.ru/bgbilling_test?useUnicode=true&characterEncoding=Cp1251&allowUrlInLocalInfile=true&
zeroDateTimeBehavior=convertToNull&jdbcCompliantTruncation=false" removeAbandoned="true" removeAbandonedTimeout="300" logAbandoned="true" 
testOnBorrow="true" testOnReturn="true"/>
    <Resource name="jdbc/system/bgbilling_4.4" auth="Container" type="javax.sql.DataSource" maxActive="10" maxIdle="1" 
factory="org.apache.commons.dbcp.BasicDataSourceFactory" maxWait="10000" username="bill" password="123" driverClassName="com.mysql.jdbc.Driver" 
url="jdbc:mysql://sql.office.bitel.ru/bgbilling?useUnicode=true&characterEncoding=Cp1251&allowUrlInLocalInfile=true&
zeroDateTimeBehavior=convertToNull&jdbcCompliantTruncation=false"removeAbandoned="true" removeAbandonedTimeout="300" logAbandoned="true" 
testOnBorrow="true" testOnReturn="true"/>
    <Resource name="jdbc/system/bgbilling_4.5" h="Container" type="javax.sql.DataSource" maxActive="10" maxIdle="1" 
factory="org.apache.commons.dbcp.BasicDataSourceFactory" maxWait="10000" username="root" password="" driverClassName="com.mysql.jdbc.Driver" 
url="jdbc:mysql://sql.office.bitel.ru/bgbilling_test?useUnicode=true&characterEncoding=Cp1251&allowUrlInLocalInfile=true&
zeroDateTimeBehavior=convertToNull&jdbcCompliantTruncation=false" removeAbandoned="true" removeAbandonedTimeout="300" logAbandoned="true" 
testOnBorrow="true" testOnReturn="true"/>
    <Resource name="jdbc/system/bgbilling_4.6" auth="Container" type="javax.sql.DataSource" maxActive="10" maxIdle="1" 
factory="org.apache.commons.dbcp.BasicDataSourceFactory" maxWait="10000" username="root" password="" driverClassName="com.mysql.jdbc.Driver" 
url="jdbc:mysql://sql.office.bitel.ru/bgbilling_test?useUnicode=true&characterEncoding=Cp1251&allowUrlInLocalInfile=true&
zeroDateTimeBehavior=convertToNull&jdbcCompliantTruncation=false" removeAbandoned="true" removeAbandonedTimeout="300" logAbandoned="true" 
testOnBorrow="true" testOnReturn="true"/>
</Context>

4)Настройка виртуального хоста

<Host name="dbinfo.office.bitel.ru" appBase="/home/tomcat/dbinfo" unpackWARs="true" autoDeploy="true" xmlValidation="false" xmlNamespaceAware="false">
  <Alias>dbinfo.bitel.ru</Alias>
  <Alias>dbinfo</Alias>
  <Valve className="org.apache.catalina.valves.AccessLogValve" directory="logs"  prefix="dbino_access_log." suffix=".txt" pattern="common"
  resolveHosts="false"/> <Realm className="org.apache.catalina.realm.JAASRealm" appName="dbinfo" userClassNames="ru.bitel.dbinfo.auth.User"
  roleClassNames="ru.bitel.dbinfo.auth.Role" debug="99"/>


5)настроить реалмы для аутентификации, в нашем случае используется LDAP аутентификация

- надо скопировать dbinfojaas.jar в tomcat/server/lib

 <Realm className="org.apache.catalina.realm.JAASRealm" appName="dbinfo" userClassNames="ru.bitel.dbinfo.auth.User" 
    roleClassNames="ru.bitel.dbinfo.auth.Role" debug="99"/>
Личные инструменты