从BIRT 2.1.2升级; Platform.createFactoryObject()返回null

时间:2016-07-12 21:42:39

标签: java eclipse maven birt

管理层希望我将使用BIRT 2.1.2 / Java 4 / IBM WebSphere 5 / Windows 2003的项目迁移到Linux / Apache / Tomcat。我选择了Tomcat 8,Java 8和BIRT 4.5,以便在我们再次脱离后沿之前最大化时间。

我坚持使用此代码初始化BIRT的失败测试用例:

public static void init( String engineHome, String Birt_Resource_Path) 
throws BirtException 
{
    if (!initialized) {
        initialized = true;
        DesignConfig config = new DesignConfig();
//      config.setBIRTHome( engineHome);
        Platform.startup( config);
        IDesignEngineFactory factory = 
            (IDesignEngineFactory) Platform.createFactoryObject( 
                IDesignEngineFactory.EXTENSION_DESIGN_ENGINE_FACTORY);
        if (factory == null) {
            log.warn("Failed to construct DesignEngineFactory");
            initialized = false;
        } else {
            birtEngine = factory.createDesignEngine(config);
            birtResourcePath = Birt_Resource_Path; 
        }

        log.info("DesignEngineService initialized! " + engineHome);
    }
}

我的测试用例调用此代码,然后测试引擎是否已初始化并失败。

我阅读了有关BIRT 3.7变化的说明,这意味着我不必致电config.setBIRTHome( engineHome),所以我注释掉了这一行。

Platform.createFactoryObject(...)的调用仍然返回null,因此我得到了日志消息"无法构造DesignEngineFactory"我的测试用例失败了。

我正在使用Eclipse Mars和Maven来构建和依赖。我的pom.xml是

<project xmlns="http://maven.apache.org/POM/4.0.0" 
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">

<modelVersion>4.0.0</modelVersion>
<groupId>com.lxnx.sysman.webstar</groupId>
<artifactId>reportService</artifactId>
<packaging>war</packaging>
<version>2.0-DEVELOPMENT</version>
<name>Report Service</name>
<url>http://myproject.mycompany.com/ReportService</url>

<properties>
  <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
  <birt-version>4.5.0a</birt-version>
</properties>

<dependencies>

  <dependency>
    <groupId>org.eclipse.birt.runtime</groupId>
    <artifactId>org.eclipse.birt.runtime</artifactId>
    <version>${birt-version}</version>
  </dependency>

<dependency>
  <groupId>junit</groupId>
  <artifactId>junit</artifactId>
  <version>4.12</version>
  <scope>test</scope>
</dependency>

<dependency>
    <groupId>log4j</groupId>
    <artifactId>log4j</artifactId>
    <version>1.2.17</version>
</dependency>

<dependency>
    <groupId>opennms</groupId>
    <artifactId>opennms-joesnmp</artifactId>
    <version>20031201-173122</version>
</dependency>

<dependency>
    <groupId>com.microsoft.sqlserver</groupId>
    <artifactId>sqljdbc4</artifactId>
    <version>4.2</version>
</dependency>

<dependency>
    <groupId>struts</groupId>
    <artifactId>struts</artifactId>
    <version>1.2.9</version>
</dependency>
<dependency>
    <groupId>com.mycompany.myproject</groupId>
    <artifactId>ReportServiceImpl</artifactId>
    <version>2.0</version>
</dependency>
</dependencies>
<build>
<plugins>
  <plugin>
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-compiler-plugin</artifactId>
    <version>3.5</version>
    <configuration>
      <source>1.8</source>
      <target>1.8</target>
    </configuration>
  </plugin>

  <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-war-plugin</artifactId>
        <version>2.6</version>
        <configuration>
            <failOnMissingWebXml>false</failOnMissingWebXml>
            <warSourceDirectory>WebContent</warSourceDirectory>
        </configuration>
    </plugin>

  <plugin>
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-surefire-plugin</artifactId>
    <version>2.19.1</version>
    <configuration>
      <additionalClasspathElements>
        <additionalClasspathElement>c:\mycompany\app\myproject\bin\jars\sqljdbc42.jar</additionalClasspathElement>
      </additionalClasspathElements>
    </configuration>
  </plugin>
</plugins>
<finalName>ReportService</finalName>
</build>
</project>

看起来所有的BIRT罐子都在Maven Dependencies库中;至少org.eclipse.birt.runtime-4.5.0a.jar还有其他一百个。

我还需要做什么?

0 个答案:

没有答案