找不到BIRT运行时

时间:2019-01-08 14:55:35

标签: maven spring-boot birt

我有一个应用程序,在这里我将介绍Spring Boot。它具有一些定义为.rptdesign文件的BIRT报告。为了处理它们,在web.xml中定义了以下映射。

import com.amazonaws.services.glue.GlueContext
import org.apache.spark.SparkContext
import org.apache.spark.sql.SparkSession


object TryMe {

  def main(args: Array[String]): Unit = {
    val sc: SparkContext = new SparkContext()
    val glueContext: GlueContext = new GlueContext(sc)
    val spark: SparkSession = glueContext.getSparkSession

    // Read data into a DynamicFrame using the Data Catalog metadata
    val t = glueContext.read.format("jdbc").option("url","jdbc:mysql://serverIP:port/database").option("user","username").option("password","password").option("dbtable","select * from table1 where 1=1").option("driver","com.mysql.jdbc.Driver").load()

  }
}

与Maven的依赖关系:

<servlet>
    <servlet-name>EngineServlet</servlet-name>
    <servlet- class>org.eclipse.birt.report.servlet.BirtEngineServlet</servlet-class>
  </servlet>
  <servlet-mapping>
    <servlet-name>EngineServlet</servlet-name>
    <url-pattern>/output</url-pattern>
  </servlet-mapping>

我正在尝试使用spring-boot进行配置。 Maven依赖项是相同的。

我尝试通过ServletRegistrationBean注册映射:

<dependency>
    <groupId>org.eclipse.birt.runtime</groupId>
    <artifactId>org.eclipse.birt.runtime</artifactId>
    <version>${eclipse.runtime.version}</version>
    <exclusions>
      <exclusion>
        <groupId>org.eclipse.birt.runtime</groupId>
        <artifactId>org.apache.poi</artifactId>
      </exclusion>
    </exclusions>
 </dependency>

此代码无法作为类编译:BirtEngineServlet无法解析为类型。我尝试向Maven中添加更多BIRT组件:

@Bean
public ServletRegistrationBean exampleServletBean() {
    ServletRegistrationBean bean = new ServletRegistrationBean(
      new BirtEngineServlet(), "/output/*");
    bean.setLoadOnStartup(1);
    return bean;
}

我尝试过的其他选项是定义自己的BirtEngineFactory。已编译代码,但是在运行时未找到BIRT运行时类(即BirtException),并抛出了NoClassDefFoundException。

关于使用Maven通过Spring Boot配置BIRT的任何建议?

1 个答案:

答案 0 :(得分:0)

解决方案如下:

pom.xml

<repositories>
    <repository>
      <id>Maven Repository</id>
      <url>https://mvnrepository.com</url>
    </repository>
  </repositories>

...

<dependency>
  <groupId>org.eclipse.birt.runtime</groupId>
  <artifactId>org.eclipse.birt.runtime</artifactId>
  <version>4.4.1</version>
  <exclusions>
      <exclusion>
        <groupId>org.eclipse.birt.runtime</groupId>
        <artifactId>org.apache.poi</artifactId>
      </exclusion>
       <exclusion>
            <groupId>org.eclipse.birt.runtime</groupId>
            <artifactId>org.eclipse.orbit.mongodb</artifactId>
      </exclusion>
    </exclusions>
</dependency>

<dependency>
    <groupId>org.eclipse.birt.runtime</groupId>
    <artifactId>viewservlets</artifactId>
    <version>4.2.0</version>
</dependency>

存储库问题和运行时版本问题-尝试了各种操作都失败了-仅4.4.1对我有用。