문제

나는 새로운 BIRT 와 내가 만들려고 노력하고 보고서 엔진이 실행됩니다.내가 사용하는 코드 조각에서 제공하는 http://www.eclipse.org/birt/phoenix/deploy/reportEngineAPI.php

그러나 나는 이상한 예외:

java.랭.AssertionError 에서 org.eclipse.birt.핵심입니다.framework.플랫폼입니다.시동(플랫폼입니다.java:86)

아무것도에서 로그 파일이 있습니다.

어쩌면 내가 뭔가를 놓친 구성에서?수 있는 누군가가 나에게 힌트에 대해 무엇을 할 수 있게 만들려고 그것을 실행?

여기에는 코드 사용:

public static void executeReport()
    {

        IReportEngine engine=null;
        EngineConfig config = null;

        try{
            config = new EngineConfig( );           
            config.setBIRTHome("D:\\birt-runtime-2_3_0\\ReportEngine");
            config.setLogConfig("d:/temp", Level.FINEST);
            Platform.startup( config );
            IReportEngineFactory factory = (IReportEngineFactory) Platform
            .createFactoryObject( IReportEngineFactory.EXTENSION_REPORT_ENGINE_FACTORY );
            engine = factory.createReportEngine( config );      

            IReportRunnable design = null;
            //Open the report design
            design = engine.openReportDesign("D:\\birt-runtime-2_3_0\\ReportEngine\\samples\\hello_world.rptdesign"); 
            IRunAndRenderTask task = engine.createRunAndRenderTask(design);         

            HTMLRenderOption options = new HTMLRenderOption();      
            options.setOutputFileName("output/resample/Parmdisp.html");
            options.setOutputFormat("html");

            task.setRenderOption(options);
            task.run();
            task.close();
            engine.destroy();
        }catch( Exception ex){
            ex.printStackTrace();
        }       
        finally
        {
            Platform.shutdown( );
        }
    }
도움이 되었습니까?

해결책

다만 생각,하지만 내가 궁금해하는 경우 사용의 슬래시 설정할 때 로의 문제를 일으키는?대

config.setLogConfig("d:/temp", Level.FINEST);

당신이 사용해야 한다

 config.setLogConfig("/temp", Level.FINEST);

  config.setLogConfig("d:\\temp", Level.FINEST);

마지막으로,내가 깨닫게 이것은 단지 몇 가지 예제 코드입니다,하지만 당신은 확실히 분할하려는 귀하의 플랫폼을 시작 코드에서 밖으로 실행하고 렌더링 작업입니다.플랫폼의 시작은 매우 비싸고해야 한다.

나는 몇 가지의 이클립스 프로젝트에서 설치 파괴 서버가 사용하는 방법을 보여주는 보고서를 사용하여 엔진(API REAPI)및 디자인 엔진(API DEAPI)유용할 수 있는대로의 코드가 더 복잡합니다.

을 얻을 예제 중 하나가 필요합 Subclipse 또는 파괴적인 플러그인을 그리고 당신은 연결해야합니다 다음과 같은 저장소:

http://longlake.minnovent.com/repos/birt_example

프로젝트는 필요하다:

birt_api_example
birt_runtime_lib
script.lib

당신이 조절이 필요할 수 있습니다 몇몇 파일의 위치에서 BirtUtil 클래스,그러나 내가 생각하는 가장 파일의 위치는 상대적인 경로입니다.더 많은 정보를 사용하는 방법에 대해 예제 프로젝트에 나 블로그 http:/birtworld.blogspot.com.특히 이 문서에서 도와야 한다: 테스트와 디버그의 보고서

다른 팁

나도 같은 실수를 몇 개월 전에.나는 확실히 실제로 그것을 해결하지만 내 코드는 다음과 같습니다:

        IDesignEngine engine = null;
    DesignConfig dConfig = new DesignConfig();
    EngineConfig config = new EngineConfig();
    IDesignEngineFactory factory = null;
    config.setLogConfig(LOG_DIRECTORY, Level.FINE);
    HttpServletRequest servletRequest = (HttpServletRequest) FacesContext.getCurrentInstance()
     .getExternalContext().getRequest();

    String u = servletRequest.getSession().getServletContext().getRealPath("/");
    File f = new File(u + PATH_TO_ENGINE_HOME);

    log.debug("setting engine home to:"+f.getAbsolutePath());
    config.setEngineHome(f.getAbsolutePath());

    Platform.startup(config);
    factory = (IDesignEngineFactory) Platform.createFactoryObject(IDesignEngineFactory.EXTENSION_DESIGN_ENGINE_FACTORY);
    engine = factory.createDesignEngine(dConfig);
    SessionHandle session = engine.newSessionHandle(null);

    this.design = session.openDesign(u + PATH_TO_MAIN_DESIGN);

아마도 당신은 당신의 문제를 해결할 수 있는 비교하여 이 코드고 자신의 코드입니다.btw 내 PATH_TO_ENGINE_HOME 은"/웹 INF/플랫폼".[편집]내가 사용하는 완벽한'플랫폼'-에서 폴더 WebViewerExample 의 birt-runtime-2_1_1.atm birt-runtime-2_3_0 은 실제.[/편집]

이 방법으로 해결되지 않으면 주시기 바랍게 몇 가지 정보(예를 들어 코드 조각).

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top