Linux下jira使用手册

前言:应同事要求 想搭建一个BUG的提交系统,用来有效的管理项目,所以选用了jira。jira基于J2EE的 ,之前一直接触的都是PHP的平台相关的程序,这次也当是正好练习下JAVA方面的环境安装调试,中间也是出了不少的问题,至少学会了一个最重要的如何调 试tomcat。

一、了解JIRA

不管你知不知道JIRA 还是先大概的了解下。

(大致归纳下)JIRA 是目前比较流行的基于Java架构的管理系统  ,是集项目计划、任务分配、需求管理、错误跟踪于一体的商业软件,功能全面,界面友好,安装简单,配置灵活,权限管理以及可扩展性方面都十分出色。

因为是基于JAVA的所以需要JAVA环境,因为是商业软件所以会要有license key 。

二、具体安装过程(含有解决问题的分析思路)

1、基础环境(以自己实践的环境为例)

操作系统: Linux (具体用过的Centos 5.2 , Slackware 12.1)

2、思考过程

可能拿到一个要安装的软件可能第一反应就是google搜索,但往往网上的文章基本没有绝对完整或者是时效性已经过了的。

正确的思考方式:

A、直接下载JIRA程序,安装方法查看解压包中的README.txt 或者有些软件包还有一个INSTALL

B、以JIRA的官方安装方法为基准 再参考google搜索出来的其他文章。

C、遇到具体再具体分析。

3、下载JIRA

JIRA 官网:http://www.atlassian.com/software/jira/

下载企业版:wget http://www.atlassian.com/software/jira/downloads/binary/atlassian-jira-enterprise-3.13.4-standalone.tar.gz

tar zxvf atlassian-jira-enterprise-3.13.4-standalone.tar.gz

mv atlassian-jira-enterprise-3.13.4-standalone /home/

ln -s atlassian-jira-enterprise-3.13.4-standalone jira

cd /home/jira

4、根据README.txt安装

———————————————————————

JIRA 3.13.4-#354 README

———————————————————————

Thank you for downloading JIRA 3.13.4 – Standalone distribution. This

distribution comes with a built-in Tomcat 5.5.26 web server and hsql

database, so it runs (almost) out the box.

JIRA 3.13.4集成内置了tomcat 5.5.26的 默认是hsql 为database

所以不需要另外安装tomcat

BRIEF INSTALL GUIDE

——————-

1. Install a Java Development Kit (JDK) from

第一步:安装JDK环境

JDK下载路径

http://java.sun.com/javase/downloads/index.jsp

(avoid JREs, Java EEs, Netbeans, etc. on that page – you just want a JDK).

下载最新的JDK

这里的最新版本是JDK 6 Update 14 注意的是选择完平台进行下载的时候 可以直接点击jdk-6u14-linux-i586.bin 进行下载 如果是点击“download selected with sun download manager” 这个是SUN的下载器

2. Set the JAVA_HOME variable to where you installed Java. Windows installers

may do this for you. See also the following for Windows instructions:

http://confluence.atlassian.com/display/DOC/Set+JAVA_HOME+variable+in+Windows

第二步 :安装和配置JAVA环境

JAVA安装很简单主要是配置变量 这里不清楚了可以google下了

参考这篇文章:http://www.tj4c.com/2009/06/25/linux-install-jdk/

我的步骤:

chmod +x jdk-6u14-linux-i586.bin

./jdk-6u14-linux-i586.bin

mv jdk1.6.0_14 /usr/local/jdk

在/etc/profile尾添加

JAVA_HOME=/usr/local/jdk

CLASSPATH=.:$JAVA_HOME/lib/tools.jar:$JAVA_HOME/lib/dt.jar

PATH=$JAVA_HOME/bin:$PATH

export JAVA_HOME

export PATH

export CLASSPATH

还需要在终端中把上面添加的都执行一遍,不然你想重启机器啊,呵呵。

查看是否成功:

用java -version

java version “1.6.0_14″

Java(TM) SE Runtime Environment (build 1.6.0_14-b08)

Java HotSpot(TM) Server VM (build 14.0-b16, mixed mode)

也可以编写个hello.java测试下 (略)

README中对WINDOWS关爱有加 有WINODWS的配置JDK的URL

第三步:配置MYSQL

下面的第3是开始启动JIRA了,但我们的需求是安装JIRA+MYSQL的,所以还需要配置MYSQL

如果不想麻烦建议就用操作系统自带的MYSQL吧 (MYSQL配置自己查)

(以下的JIRA+MYSQL配置参考 官网资料 http://confluence.atlassian.com/display/JIRA/Setting+up+JIRA+Standalone+and+MySQL+on+Linux)

slackware 12.1 和centos 5.2 MYSQL都是5.0的

JIRA的MYSQL配置

mysql
create database jiradb character set utf8;
grant all privileges on jiradb.* to jirauser@localhost identified by 'mypassword' with grant option;
flush privileges;
quit
测试是否成功 用jirauser用户手动登陆试试
第四步:安装MYSQL/J JDBC 驱动
       作用就是让JAVA可以通过JDBC连接MYSQL
下载:http://dev.mysql.com/downloads/connector/j/5.1.html
JDBC下载要跟你的MYSQL基本相同  mysql 5.0选择5.0的驱动 依以类推
wget http://dev.mysql.com/get/Downloads/Connector-J/mysql-connector-java-5.0.8.tar.gz/from/ftp://ftp.jaist.ac.jp/pub/mysql/
tar zxvf mysql-connector-java-5.0.8.tar.gz
cp mysql-connector-java-5.0.8/mysql-connector-java-5.0.8-bin.jar /home/jira/common/lib
第五步:修改JIRA配置
修改一、
vim /home/jira/conf/server.xml
修改成如下几项
username="jirauser"
password="mypassword"
driverClassName="com.mysql.jdbc.Driver"
url="jdbc:mysql://localhost/jiradb? autoReconnect=true&useUnicode=true&characterEncoding=UTF8"
删除以下两行
  minEvictableIdleTimeMillis="4000"
timeBetweenEvictionRunsMillis="5000"
修改二、
vim /home/jira/atlassian-jira/WEB_INF/classes/entityengine.xml
将其中的hsql改成mysql 数据库类型<datasource name="defaultDS" field-type-name="hsql"
<datasource name="defaultDS" field-type-name="mysql"
删除    schema-name="PUBLIC"

3. Run bin/startup.sh (*nix) or bin\startup.bat (Windows). Check that there

are no errors on the console. See below for troubleshooting advice.

第六步:运行JIRA服务

*uix使用JIRA根目录下的bin/starup.sh windows用bin\startup.bat

运行后可以通过logs下的日志进行查看报错

4. Point your browser at http://localhost:8080/

You should see JIRA’s Setup Wizard.

第七步:访问JIRA

通过http://JIRA_server_ip:8080 进行查看 如果出来界面说明配置正确 如果报404等其它问题就是配置中出现问题了

通过仔细检查配置文件都没有改错或者写错的话 那么很有可能就是你的MYSQL连接不正确
三、问题排错

可能大部分的人第一次安装都不会那么顺利,我就是遇到了不少的问题,如何进行排错呢,日志是肯定不能少的。

出现问题后查看 logs下面的catalina.2009-07-14.log 和catalina.out 日志 但只能得到两个错误

SEVERE: Error listenerStart

SEVERE: Context [] startup failed due to previous errors

通过google查看 这类问题不少,也有很多的解决办法 如:http://xuthus.iteye.com/blog/85089

但这都不是解决办法的根源,因为报这个错还是有很多种可能。

解决办法查看最詳細的日志,确定问题的原因:http://618119.com/archives/2007/12/04/37.html

JIRA的tomcat是5.5的 基于上面的方法

参考APACHE的官网资料: http://tomcat.apache.org/tomcat-5.5-doc/logging.html

1、创建log4j.properties

vim /home/jira/common/classes/log4j.properties



            log4j.rootLogger=DEBUG, R
            log4j.appender.R=org.apache.log4j.RollingFileAppender
            log4j.appender.R.File=${catalina.home}/logs/tomcat.log
            log4j.appender.R.MaxFileSize=10MB
            log4j.appender.R.MaxBackupIndex=10
            log4j.appender.R.layout=org.apache.log4j.PatternLayout
            log4j.appender.R.layout.ConversionPattern=%p %t %c - %m%n




2、下载 log4j

wget http://apache.freelamp.com/logging/log4j/1.2.15/apache-log4j-1.2.15.tar.gz

tar zxvf apache-log4j-1.2.15.tar.gz

cp apache-log4j-1.2.15/log4j-1.2.15.jar /home/jira/common/lib/

3、下载commons logging

wget http://apache.freelamp.com/commons/logging/binaries/commons-logging-1.1.1-bin.tar.gz

tar zxvf commons-logging-1.1.1-bin.tar.gz

cp commons-logging-1.1.1/commons-logging-1.1.1.jar /home/jira/common/lib/

这样配置完后 重启JIRA可以在日志中看到更詳細的记录

第一个就是在当前启动JIRA服务的目录下会产生atlassian-jira.log

tail -f atlassian-jira.log

第二个在logs中的catalina.out 跟上面的日志内容是一样的

分析:

以下就我出现的问题具体分析下日志:

日志取最早出现的error

问题A、main ERROR [jira.appconsistency.db.DatabaseConsistencyCheck] There was a SQL exception checking for database driver correctness. Skipping

2009-07-14 17:12:57,743 main ERROR [core.entity.jdbc.DatabaseUtil] Unable to esablish a connection with the database… Error was:org.apache.tomcat.dbcp.dbcp.SQLNestedExceptio

n: Cannot load JDBC driver class ‘org.mysql.jdbc.Driver’

这个是名字打错了,几次折腾重新安装时把驱动的名字打错了 应该把 ‘org.mysql.jdbc.Driver’改成

‘com.mysql.jdbc.Driver’

问题B、 org.apache.tomcat.dbcp.dbcp.SQLNestedException: Cannot create PoolableConnectionFactory (Server connection failure during transaction. Due to underlying exception: ‘java.net.ConnectException: Connection refused’.

连接被拒绝了,其实这个原因是一直没有成功的根源,我当时用的是slackware 12.1的默认mysql的服务启动是skip-network 即是不能通过网络访问的,但手动本地localhost是可以的所以连接的,所以带来了问题的麻烦

解决:去掉启动脚本中的—skip-network

问题C:rg.apache.tomcat.dbcp.dbcp.SQLNestedException: Cannot create PoolableConnectionFactory (Server connection failure during transaction. Due to underlying exception: ‘java.sql.SQLException: Access denied for user ‘jirauser’@'127.0.0.1′ (using password: YES)’.

还是访问被拒绝但已经有明显的访问方式为jirauser’@'127.0.0.1′ ,这个很奇怪,为什么配置中用的是localhost却用127.0.0.1来访问,虽然逻辑上是一样的,但mysql好像不能区分,所以又给127.0.0.1添加了一条权限

解决:grant all privileges on jiradb.* to jirauser@’127.0.0.1′ identified by ‘mypassword’ with grant option;

最后看到日志中出了

Database configuration OK

___ Database Configuration _______

Loading entityengine.xml from : file:/home/atlassian-jira-enterprise-3.13.4-standalone/atlassian-jira/WEB-INF/classes/entityengine.xml

Entity model data source name : defaultDS

Entity model field type name : mysql

Entity model schema name :

Database Version : MySQL – 5.0.51b-log

Database Driver : MySQL-AB JDBC Driver – mysql-connector-java-5.0.5 ( $Date: 2007-03-01 00:01:06 +0100 (Thu, 01 Mar 2007) $, $Revision: 6329 $ )

Database URL : jdbc:mysql://localhost:3306/jiradb?autoReconnect=true&useUnicode=true&characterEncoding=UTF8

Database JNDI address : java:comp/env/jdbc/JiraDS

说明成功了
四、JIRA界面配置

这个就不詳細说了,具体看官网资料 图文并茂http://www.atlassian.com/software/jira/docs/v3.13/setup.html

其它的资料见README中的其它URL

Full documentation is available online at:

http://www.atlassian.com/software/jira/docs/v3.13.4/install.html

PROBLEMS?

———

A common startup problem is when another program has claimed port 8080, which

JIRA is configured to run on by default. To avoid this port conflict, JIRA’s

port can be changed in conf/server.xml.

If you have installation (or other) problems, please see the resources

listed at https://support.atlassian.com

QUESTIONS?

———-

Questions? Try the docs at:

http://www.atlassian.com/software/jira/docs/v3.13.4/

Alternatively ask on the forums at:

http://forums.atlassian.com/index.jspa

or ask Atlassian directly – see the contact info at

https://support.atlassian.com

成功的截图

猜你喜欢

转载自zhb1208.iteye.com/blog/736859