Blog-roller weblogger, built under meeclipse
Blogtailatapachemyeclipsemysql
It is said that roller is the first choice for the secondary development Blog system abroad, but it was found that it was developed based on the netbeans project structure after the source code is downloaded. I usually get used to eclipse, so I want to move to myeclipse, but I didn't think it was so difficult. After a whole day, I finally ran it. There are too few reference information on the Internet, which is probably the reseller of the two or three articles. It can be solved if all of them are combined. To sum up, I hope that the users will have a reference effect!
1. Prepare the environment
My eclipse 6.0
JDK 1.6.0 _ 05
Tomcat 5.5.27 (Version 5.5 or above is recommended)
Roroller 4.0.1
2. Download Roller
The home page http://roller.apache.org/roller from roller.
The reason for downloading the release program is that some content in the source code package is inconsistent with the release package. As a result, an error will be reported during the runtime after the source code is compiled in eclipse, because you are not familiar with the source code, therefore, the cause of the error cannot be located. Some configuration files are only available in its official release package and will be used later.
3. Build a Project Environment
Create a new web project in myeclipse and name it roeller. Select 1.4 in the J2EE environment.
The decompressed directory of the handler is called roroller-bin.
① Copy the source file of the entire org directory under the roller-src/apps/weblogger/src/Java directory to the src directory in the project;
② Add the JAR file to Lib. Two Methods: You can copy all jar files from the tools directory in roeller-Src one by one. For the sake of simplicity, it is more convenient to directly obtain the jar files from its release program, copy all the jar files under WEB-INF/lib from roller-bin and put them in lib of our project;
③ Roroller is the default use of MySQL database, but Lib is missing MySQL JDBC driver, so you also need to download the driver jar from the Internet, add to the WEB-INF/lib, if you are using other databases, you also need to manually download the corresponding driver;
④ Copy all the files except the WEB-INF directory from roller-bin and paste them to the webroot of our project. These are the page files and some resource files;
⑤ Copy all the files except classes under the WEB-INF directory in roroller-bin to the WEB-INF directory in our project to overwrite the default web. XML, you can also find that some of its JSP files are placed under the WEB-INF, play a very good protective role, roroller is developed based on struts2;
6 from the WEB-INF/classes directory in Roller-bin, copy all the files except the org directory to Src in our project, these are system configuration files, including international resources, Struts configurations, log configurations, database scripts, and so on.
7. Roller also uses the mail function and requires activation. jar, mail. jar two J2EE jar files are copied to the common/lib directory of Tomcat. If this step is not performed, initialization may fail! The application cannot run normally.
By now, all the files have been moved to myeclipse. Next we need to modify some content and use our project for normal deployment.
4. modify some content
① Create a new file named roller-custom.properties in SRC of our project, and roroller uses this extension configuration to overwrite the default configuration of the system. Some people on the internet want to put this file in the common/classes of Tomcat. In fact, you don't need to, as long as it can be found in classpath, so we put it under our src directory, to facilitate modification, add the following content to the file:
Installation. type = auto
Database. configurationtype = JDBC
Database. JDBC. driverclass = com. MySQL. JDBC. Driver
Database. JDBC. connectionurl = JDBC: mysql: // localhost: 3306/rollerdb? Autoreconnect = true & useunicode = true & characterencoding = UTF-8 & mysqlencoding = utf8
Database. JDBC. Username = Scott
Database. JDBC. Password = Tiger
Mail. configurationtype = Properties
Mail. hostname = smtp-server.example.com
Mail. Username = Scott
Mail. Password = Tiger
Note that the configuration of database. JDBC. connectionurl must be followed by the above encoding parameters. Otherwise, some garbled characters may occur during installation. Modify the URL, username, and password. If you have a mailbox server that can be used normally, enter the password.
② Create a MySQL database named rollerdb and specify the Encoding As UTF-8. If you are using a root user, no authorization is required. If not, authorization is required for the user. The following is an example:
When you start roller, it will query whether the database has been initially completed. If not, it will automatically enter the installation page and guide the user to install it, which is very user-friendly.
③ Modify some source code. The pojos package in org. Apache. Roller. weblogger is faulty! At the beginning, I was always unable to start the service. The error message is a JPA exception and I don't know how to solve it. Later I found an article on csdn, it is said that there is a problem with the source code of the pojos package, which may be inconsistent with the version in the release package, so a slightly abnormal solution is needed.
In our project WEB-INF/lib, find the roller-business.jar and roller-web.jar (as shown in), the two jar is actually the compilation package of all the java files in our SRC, in order not to repeat, remove the roller-web.jar first, then use WinRAR to open the roller-business.jar, delete four other packages and the webloggerexception. class. In this way, other code can be compiled normally!
The following is the final basic structure (for reference only ):
Weroot directory
Src directory:
5. Other supplementary instructions
According to the above steps, the project structure is basically set up normally, which is really laborious! I have not tried it in netbeans. It may be much easier than this! I am used to eclipse, and I will move it all over. I will spend some time studying its source code later. It is a good learning example on the Internet.
① The global configuration file of roeller is stored in roeller. properties in the org. Apache. roeller. weblogger. org. Apache. roeller. weblogger. config package. Here we can find the configuration of various systems, and the roller-custom.properties we manually create is used to override some common attributes.
② Dbscriptsin srcis the SQL script of all data databases. The scripts provided in apache-roller-src-4.0.1.zip are incomplete! Therefore, you need to use the script for officially releasing the package. It carries the initial script of the database, which is automatically created by the system, and there are many additional scripts for version upgrade.
③ The default log configuration is saved in the logs directory of tomcat in the file format, and the name is roeller. log, if you encounter problems during the startup process, please go here to view the startup log and analyze the cause of the exception.
4 roller-custom.properties configured mailbox host and user name password, if the normal connection, it will report an error during initialization, but will not affect the normal start, the premise is that you must put activation. jar, mail. jar files are placed in Tomcat.
⑤ Org. apache. roller. weblogger. business. the webloggerimpl class's creation method has a load roller-verion.properties, but this file was not found in our SRC, And it was originally included in the roller-business.jar. It seems that another class also contains the initial code for starting this sentence. If this class cannot be found, a null pointer exception will be thrown, which also causes the entire application to fail to start. Therefore, at the beginning, a piece of exception handling code was loaded in line 3 of the webloggerimpl class as follows:
Of course, if you already include a roller-version.properties file, this exception will not exist!
⑥ Roller's documentation is very complete, illustrated and illustrated, read more, you can understand how to use it. The IBM Developer Forum is developed based on it and is indeed very powerful. Examples of mainstream technologies such as struts2, JPA, spring, acegi, and velocity can be found here, however, it takes more time to learn a lot from other aspects, such as structure division, code specification, and theme switching.
7 roroller architecture (from network)
Roroller Web: Web and UI Layer
* Editor UI via struts and JSP, blog and feed rendering via Velocity
* Feed parsing via Rome, blogger API via Apache XML-RPC
Roroller beans: Business and persistence layer
* Hibernate/JPA for DBMS, Lucene for search
Learn more and share it with you! Pai_^
Package a PDF file for download.
Reprinted from http://yangjayup.iteye.com/blog/738500