Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/java/315.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
使用Oracle数据库在Java中启动Crystal Report_Java_Crystal Reports - Fatal编程技术网

使用Oracle数据库在Java中启动Crystal Report

使用Oracle数据库在Java中启动Crystal Report,java,crystal-reports,Java,Crystal Reports,我正在开发一个web应用程序,可以打开使用Crystal reports生成的报告。我关注了关于如何配置连接的其他帖子: final Tables tablas = databaseController.getDatabase().getTables(); for (final ITable table : tablas) { ITable t = (ITable)table.clone(true); t.setQualifiedName(conexi

我正在开发一个web应用程序,可以打开使用Crystal reports生成的报告。我关注了关于如何配置连接的其他帖子:

final Tables tablas = databaseController.getDatabase().getTables();

    for (final ITable table : tablas) {
        ITable t = (ITable)table.clone(true);

        t.setQualifiedName(conexionBaseDatos.getIdentificadorNombreTabla() + table.getName());

        final IConnectionInfo connectionInfo = table.getConnectionInfo();

        final PropertyBag propertyBag = new PropertyBag();

        propertyBag.put(TRUSTED_CONNECTION, "false");
        propertyBag.put(SERVER_TYPE, "JDBC (JNDI)");
        propertyBag.put(USE_JDBC, "true");
        propertyBag.put(DATABASE_DLL, "crdb_jdbc.dll");
        propertyBag.put(JNDI_OPTIONAL_NAME, conexionBaseDatos.getName());
        propertyBag.put(CONNECTION_URL, conexionBaseDatos.getUri());
        propertyBag.put(DATABASE_CLASS_NAME, conexionBaseDatos.getDriver());

        connectionInfo.setAttributes(propertyBag);

        connectionInfo.setUserName(conexionBaseDatos.getUser());
        connectionInfo.setPassword(conexionBaseDatos.getPass());
        connectionInfo.setKind(ConnectionInfoKind.SQL);

        t.setConnectionInfo(connectionInfo);
        try {
            databaseController.setTableLocation(table, t);
        } catch (final Exception e) {
            LOGGER.error("Error.", e);
            throw new ErrorGenerarInformeException(e);
        }
    }
我认为一切正常,但console向我显示了下一个错误:

    2017-06-08 19:16:12,863 ERROR com.crystaldecisions.reports.dataengine.DataSourceManager.do(SourceFile:691) - Formula error: recompile formulas failed
    com.crystaldecisions.reports.formulas.FormulaException: Exception in formula '{@PGAEJE}' en '{PGA.PGA_EJE}':
    This field name is unknown.
        at com.crystaldecisions.reports.formulas.o.a(SourceFile:1041)
        at com.crystaldecisions.reports.formulas.o.do(SourceFile:1013)
        at com.crystaldecisions.reports.formulas.o.new(SourceFile:688)
        at com.crystaldecisions.reports.formulas.o.else(SourceFile:459)
        at com.crystaldecisions.reports.formulas.f.void(SourceFile:65)
        at com.crystaldecisions.reports.formulas.FormulaParser.a(SourceFile:345)
        at com.crystaldecisions.reports.formulas.r.a(SourceFile:89)
        at com.crystaldecisions.reports.formulas.FormulaInfo.a(SourceFile:570)
        at com.crystaldecisions.reports.formulas.FormulaService.compile(SourceFile:347)
        at com.crystaldecisions.reports.reportdefinition.FormulaCompiler.a(SourceFile:139)
        at com.crystaldecisions.reports.reportdefinition.FormulaFieldDefinitionBase.compile(SourceFile:928)
        at com.crystaldecisions.reports.reportdefinition.o.a(SourceFile:1360)
        at com.crystaldecisions.reports.reportdefinition.o.a(SourceFile:1348)
        at com.crystaldecisions.reports.reportdefinition.o.a(SourceFile:4253)
        at com.crystaldecisions.reports.dataengine.DataSourceManager.do(SourceFile:687)
        at com.crystaldecisions.reports.dataengine.DataSourceManager.new(SourceFile:607)
        at com.crystaldecisions.reports.dataengine.DataSourceManagerCoordinator.a(SourceFile:505)

2017-06-08 19:16:47,473 INFO  com.businessobjects.reports.sdk.JRCCommunicationAdapter.if(SourceFile:630) -  received request: closeServerAgent
2017-06-08 19:16:47,473 INFO  com.businessobjects.reports.sdk.JRCCommunicationAdapter.do(SourceFile:2619) -  has cleaned up and closed down the report
2017-06-08 19:16:47,474 INFO  com.crystaldecisions.reports.queryengine.Connection.ux(SourceFile:1883) - Connection logoffServer:
2017-06-08 19:16:47,493 INFO  com.crystaldecisions.reports.queryengine.driverImpl.jdbc.JDBCConnection.Close(?:?) - Connection Closed !oracle.jdbc.driver.OracleDriver!jdbc:oracle:thin:{userid}/{password}@xxx
2017-06-08 19:16:47,648 ERROR org.slf4j.impl.Log4jLoggerAdapter.error(Log4jLoggerAdapter.java:571) - Failed to load the resource 'InternalFormatterException' from the bundle java.util.PropertyResourceBundle@1bd9a874.
java.util.MissingResourceException: Can't find resource for bundle java.util.PropertyResourceBundle, key InternalFormatterException
    at java.util.ResourceBundle.getObject(ResourceBundle.java:450)
    at java.util.ResourceBundle.getObject(ResourceBundle.java:444)
    at java.util.ResourceBundle.getString(ResourceBundle.java:407)
    at com.crystaldecisions.reports.common.CrystalResources.loadString(Unknown Source)
    at com.crystaldecisions.reports.common.CrystalResources.loadMessage(Unknown Source)
    at com.crystaldecisions.reports.common.CrystalResourcesFactory.getLocalizedMessage(Unknown Source)
    at com.crystaldecisions.reports.common.CrystalException.getLocalizedMessage(Unknown Source)
    at com.crystaldecisions.reports.common.CrystalException.getMessage(Unknown Source)
    at java.lang.Throwable.getLocalizedMessage(Throwable.java:391)
    at java.lang.Throwable.toString(Throwable.java:480)
    at java.lang.String.valueOf(String.java:2994)
    at java.lang.StringBuilder.append(StringBuilder.java:131)


Caused by: com.crystaldecisions.sdk.occa.report.lib.ReportSDKException: InternalFormatterException---- Error code:-2147467259 Error code name:failed
    at com.crystaldecisions.sdk.occa.report.application.PrintOutputController.if(SourceFile:237)
    at com.crystaldecisions.sdk.occa.report.application.PrintOutputController.export(SourceFile:147)
    at com.crystaldecisions.sdk.occa.report.application.PrintOutputController.export(SourceFile:128)
    at com.crystaldecisions.sdk.occa.report.application.PrintOutputController.export(SourceFile:111)


Caused by: com.crystaldecisions.reports.dataengine.DataEngineException: Exception in formula '{@PGAEJE}' en '{PGA.PGA_EJE}':
This field name is unknown.
    at com.crystaldecisions.reports.dataengine.DataSourceManager.do(SourceFile:692)
    at com.crystaldecisions.reports.dataengine.DataSourceManager.new(SourceFile:607)
    at com.crystaldecisions.reports.dataengine.DataSourceManagerCoordinator.a(SourceFile:505)
    at com.crystaldecisions.reports.dataengine.DataSourceManager.a(SourceFile:1060)
    at com.crystaldecisions.reports.dataengine.DataProcessor2.a(SourceFile:729)
    at com.crystaldecisions.reports.formatter.formatter.objectformatter.ObjectFormatter.<init>(SourceFile:179)
    at com.crystaldecisions.reports.formatter.formatter.objectformatter.ObjectFormatter.if(SourceFile:135)
    at com.crystaldecisions.reports.formatter.formatter.paginator.PageFormatterBase.<init>(SourceFile:75)
    at com.crystaldecisions.reports.formatter.formatter.paginator.PageFormatter.<init>(SourceFile:183)
    at com.crystaldecisions.reports.formatter.formatter.paginator.PageFormatter.a(SourceFile:162)
    at com.crystaldecisions.reports.formatter.export2.a.a(SourceFile:201)
    ... 153 more
我需要帮助

编辑:我认为问题不在于连接

    2017-06-08 20:19:32,630 INFO  com.businessobjects.reports.sdk.JRCCommunicationAdapter.if(SourceFile:630) -  received request: fetchSubreportNames
2017-06-08 20:20:43,604 INFO  com.businessobjects.reports.sdk.JRCCommunicationAdapter.if(SourceFile:630) -  received request: fetchReportExportRequest
2017-06-08 20:20:43,605 INFO  com.businessobjects.reports.sdk.JRCLicenseThrottler.a(SourceFile:137) -  attempting to send engine request
2017-06-08 20:20:43,605 INFO  com.businessobjects.reports.sdk.JRCLicenseThrottler.a(SourceFile:142) -  successfully sent engine request
2017-06-08 20:20:43,607 INFO  com.crystaldecisions.reports.formulas.r.a(SourceFile:104) - Formula {@GRUPO} did not compile: com.crystaldecisions.reports.formulas.FormulaException: Exceptión in fórmula '{@GRUPO}' en '{PGA.PGA_EJE}':
This field name is not known.
2017-06-08 20:20:43,608 INFO  com.crystaldecisions.reports.formulas.r.a(SourceFile:104) - Formula {@GRUPO} did not compile: com.crystaldecisions.reports.formulas.FormulaException: Exceptión in fórmula '{@GRUPO}' en '{PGA.PGA_EJE}':
This field name is not known.
2017-06-08 20:20:43,608 INFO  com.crystaldecisions.reports.formulas.r.a(SourceFile:104) - Formula {@PGAECO} did not compile: com.crystaldecisions.reports.formulas.FormulaException: Exceptión in fórmula '{@PGAECO}' en '{PGA.PGA_ECO}':
This field name is not known.
2017-06-08 20:20:43,609 INFO  com.crystaldecisions.reports.formulas.r.a(SourceFile:104) - Formula {@PGAFUN} did not compile: com.crystaldecisions.reports.formulas.FormulaException: Exceptión in fórmula '{@PGAFUN}' en '{PGA.PGA_FUN}':
This field name is not known.
2017-06-08 20:20:43,609 INFO  com.crystaldecisions.reports.formulas.r.a(SourceFile:104) - Formula {@PGAORG} did not compile: com.crystaldecisions.reports.formulas.FormulaException: Exceptión in fórmula '{@PGAORG}' en '{PGA.PGA_ORG}':
This field name is not known.
2017-06-08 20:20:43,610 INFO  com.crystaldecisions.reports.dataengine.DataSourceManager.z(SourceFile:3042) - Create new report state
2017-06-08 20:20:43,610 INFO  com.crystaldecisions.reports.dataengine.DataSourceManager.do(SourceFile:679) - Need to recompile formulas, the number of formulas needed to recompile is 5
2017-06-08 20:20:43,611 INFO  com.crystaldecisions.reports.formulas.r.a(SourceFile:104) - Formula {@PGAORG} did not compile: com.crystaldecisions.reports.formulas.FormulaException: Exceptión in fórmula '{@PGAORG}' en '{PGA.PGA_ORG}':
This field name is not known.
2017-06-08 20:20:43,611 WARN  com.crystaldecisions.reports.reportdefinition.o.a(SourceFile:1366) - com.crystaldecisions.reports.formulas.FormulaException: Excepción en la fórmula '{@PGAORG}' en '{PGA.PGA_ORG}':
This field name is not known.
2017-06-08 20:20:43,611 ERROR com.crystaldecisions.reports.dataengine.DataSourceManager.do(SourceFile:691) - Formula error: recompile formulas failed
com.crystaldecisions.reports.formulas.FormulaException: Exception in formula '{@PGAEJE}' en '{PGA.PGA_EJE}':
This field name is not known.
    at com.crystaldecisions.reports.formulas.o.a(SourceFile:1041)
    at com.crystaldecisions.reports.formulas.o.do(SourceFile:1013)
    at com.crystaldecisions.reports.formulas.o.new(SourceFile:688)

最后,我在这方面解决了我的问题:

t.setQualifiedName(conexionBaseDatos.getIdentificadorNombreTabla() + table.getName());
函数getIdentififacadornombretable返回null,所以报告设置了与name类似的null name。我设置了这个变量,知道它工作正常

t.setQualifiedName(conexionBaseDatos.getIdentificadorNombreTabla() + table.getName());