WattOne's Blog

  博客园 :: 首页 :: 博问 :: 闪存 :: 新随笔 :: 联系 :: 订阅 订阅 :: 管理 ::

  最近在myeclipse中部署了ROLLER4.0.1

  环境配置:JDK 1.5.0_15,Tomcat 6.0.26,eclipse 3.4.1+Myeclipse 7.0.1

  下载Roller的时候最好下载2个包,apache-roller-src-4.0.1.zip这个是源码包,apache-roller-4.0.1.zip这个是Roller的发布包。用2个包的原因是源码包中有些源码在myeclipse中编译的时候会有问题。

  新建一个Web项目,命名roller

  解压apache-roller-src-4.0.1.zip(src)和apache-roller-4.0.1.zip(bin).

  把解压的源码包(src)apps/weblogger/src/java目录整个复制到src里面;

  添加jar文件到lib,源码包里面tools下面有全部的包,不过很分散,比较省力的方法是从bin下面的WEB-INF/lib下面所有的jar文件复制到项目的lib文件夹下;

  roller默认使用mysql数据库,lib中缺少mysql的jdbc驱动,从网上下载mysql-connector-java-5.1.7-bin.jar(最新版本可以到官方网站下载),放入lib文件夹下。

  从bin中复制除了WEB-INF以外所有文件到项目的WebRoot下

  复制bin中WEB-INF下面的除了classes外的所有文件到我们项目的WEB-INF下

  复制bin中WEB-INF/classes下面复制除了org目录外的所有文件到我们项目的src下面

  从网上下载activation.jarmail.jar放到tomcatcommon/lib目录下

 

  新建一个roller-custom.properties,放到项目的src下面,内容为:

  database.configurationType=jndi
  installation.type=auto

  jdbc.driverClass=com.mysql.jdbc.Driver
  jdbc.connectionURL=jdbc:mysql://localhost:3306/rollerdb?autoReconnect=true&useUnicode=true&characterEncoding=

  utf-8&mysqlEncoding=utf8
  jdbc.username=root
  jdbc.password=root

  注意:jdbc.connectionURL后面带上参数utf8不然乱码可能会。还有installation.type=auto是在刚开始的时候数据库没有表格的情况下设定,如果数据库中已经建立所有表格的话请修改installation.type=manual.

  

  在项目的WebRoot/META-INF下面新建context.xml,内容为:

<Context path="/roller"
    docBase="D:/work/roller/WebRoot" debug="0">

  <Resource name="jdbc/rollerdb" auth="Container" type="javax.sql.DataSource"
    driverClassName="com.mysql.jdbc.Driver"
    url="jdbc:mysql://localhost:3306/rollerdb?autoReconnect=true&amp;useUnicode=true&amp;characterEncoding=utf-8&amp;mysqlEncoding=utf8"
    username="root"
    password="root"
    maxActive="20" maxIdle="3" removeAbandoned="true" maxWait="3000" />

  <Resource name="mail/Session" auth="Container" type="javax.mail.Session"
     mail.smtp.host="smtp-server.example.com" />

</Context>

这个用于程序需要使用的数据源,旧版本的tomcat需要在%tomcat%/conf/server.xml中修改

 

  创建数据库:

  create database rollerdb default charset utf8;

  

  接下来比较变态的修改,删除lib下面的roller-web.jar,删除src/org/apache/roller/weblogger/下面的pojos文件夹。

  roller-business.jarroller-web.jar这二个jar其实就是我们src中的所有java文 件的编译打包,为了不重复,先把roller-web.jar删除掉.

  删除pojos包是因为这个包在eclipse编译的时候有问题,详细请看下面:

  http://old.nabble.com/Class-has-not-been-%28JPA%29-enhanced--%28was-Re%3A-Daily-report-of-Referrers-%29-td17131123s12275r0.html

 

  1. As I remember things, the POJOs in Roller are JPA "enhanced" at build   
  2. time, which means that we run a special OpenJPA Ant task against the   
  3. POJO classes and it make some bytecode changes to the .class files.   
  4.   
  5. If you are running against the jars in Roller's WEB-INF/lib direcory   
  6. then the POJO classes should have the enhanced bits and I'm not sure   
  7. what would cause JPA to think otherwise.   
  8.   
  9. What version of Roller are you using? Are you using a custom build?

  如果不删除这个pojos包,启动报错,The type "class org.apache.roller.weblogger.pojos.TaskLock" has not been enhanced.

  

所有准备工作做好的话启动应该没问题,如果开始的时候没有数据库表格,启动会提示创建表格,一路下去就能进入欢迎界面。

posted on 2010-04-07 12:08  WattOne  阅读(1308)  评论(2编辑  收藏  举报