Ureport2 安装,配置及问题详解

                                                            Ureport2 安装,配置及问题详解

本文详细介绍了笔者Ureport2的 安装,配置以及在此过程中遇到的问题和解决方法。

本安装 基于 IDEA+SpringBoot, 存储使用mysql数据库

1 pre-condition

1)首先需要安装IDEA, jdk8, maven

2) 安装mysql 用于测试

 

  可以参考cboard安装

 

2 安装ureport

  1. 先学习如何用IDEA创建SpringBoot 项目:

 https://blog.****.net/qq_35206244/article/details/81671387

2)

基于SpringBoot 安装 ureport2: https://www.cnblogs.com/Seven-cjy/p/9542616.html

基于maven安装ureport2:

    http://wiki.bsdn.org/pages/viewpage.action?pageId=76448360

3 maven 配置文件

3.1 pom.xml

<dependencies>
    <dependency>
        <groupId>
org.springframework.boot</groupId>
        <artifactId>
spring-boot-starter-web</artifactId>
    </dependency>
    <dependency>
        <groupId>
org.springframework.boot</groupId>
        <artifactId>
spring-boot-starter-test</artifactId>
        <scope>
test</scope>
    </dependency>
    <dependency>
        <groupId>
com.bstek.ureport</groupId>
        <artifactId>
ureport2-console</artifactId>
        <version>
2.2.9</version>
    </dependency>
    <dependency>
        <groupId>
commons-dbcp</groupId>
        <artifactId>
commons-dbcp</artifactId>
        <version>
20030825.184428</version>
    </dependency>
    <dependency>
        <groupId>
mysql</groupId>
        <artifactId>
mysql-connector-java</artifactId>
        <version>
8.0.17</version>
    </dependency>
</dependencies>

 

3.2 application.properties

src/main/resources/application.properties

 

ureport.fileStoreDir=E:/web/ureportfiles

spring.datasource.url=jdbc:mysql://localhost:3306/bookstore?serverTimezone=UTC

spring.datasource.username=root

spring.datasource.password=123

spring.datasource.driverClassName=com.mysql.jdbc.Driver

 

3.3 content.xml

src/main/resources/content.xml

<?xml version="1.0" encoding="UTF-8"?>



<beans xmlns="http://www.springframework.org/schema/beans"

       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"

       xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd">

    <import resource="classpath:ureport-console-context.xml"/>

    <!-- 引入配置文件 -->

    <bean id="propertyConfigurer" parent="ureport.props">

        <property name="location">

            <!-- 读取配置文件 -->

            <value>classpath:application.properties</value>

        </property>

    </bean>

</beans>

 

4 运行

4.1 IDEA 开发环境运行

右键单击main class 文件 -> Run ‘xxxxx’

Ureport2 安装,配置及问题详解

4.2编译成Jar包运行

4.2.1 打开Project Structure…

Ureport2 安装,配置及问题详解

4.2.2 add Artifacts

Ureport2 安装,配置及问题详解

 

4.2.3 设置jar属性

切记step 3,要删除默认的‘main\java’, 仅保留到src 目录

Ureport2 安装,配置及问题详解

点击‘OK’后,如果报如下错误,只需要删除文件MANIFEST.MF即可。

Ureport2 安装,配置及问题详解

4.2.4 build

Ureport2 安装,配置及问题详解

 Ureport2 安装,配置及问题详解

4.2.5 run jar 包

编译好的jar包在工程目录的 .\out\artifacts 目录下

例如demo\out\artifacts\demo_jar

Run > java -jar demo.jar

 

5 使用配置

 浏览器输入: http://localhost:8080/ureport/designer

 5.1 进入ureport页面

Ureport2 安装,配置及问题详解

5.2 mysql数据源配置

 Ureport2 安装,配置及问题详解

具体使用可以参考教程:

http://wiki.bsdn.org/pages/viewpage.action?pageId=76448360

ureport2 常用的url 说明:

https://blog.****.net/qq_37686250/article/details/90698932

 

6 Trouble shooting

6.1 dependency library没有出现在External Libraries列

如果dependency library没有出现在External Libraries 中时,可以重现import

Ureport2 安装,配置及问题详解

 

6.2 连接mysql数据库出现错误

连接mysql数据库出现如下错误:

使用JDBC连接MySql时出现:The server time zone value 'й���׼ʱ��' is unrecognized or represents more than one time zone. You must configure either the server or JDBC driver (via the serverTimezone configuration

 

可以在连接字符串后面加上?serverTimezone=UTC

完整的连接字符串示例:jdbc:mysql://localhost:3306/test?serverTimezone=UTC

或者还有另一种选择:jdbc:mysql://127.0.0.1:3306/test?useUnicode=true&characterEncoding=UTF-8

当然也可以和上面的一起结合:jdbc:mysql://127.0.0.1:3306/test?useUnicode=true&characterEncoding=UTF-8&serverTimezone=UTC