java - 由于此错误,无法打开 rpt 文件:登录错误:ORA-01017:用户名/密码无效;登录被拒绝
问题描述
每当我运行 java 应用程序时,错误总是显示由于此错误而无法打开 rpt 文件:
java.lang.IllegalStateException: Failed to execute CommandLineRunner
at org.springframework.boot.SpringApplication.callRunner(SpringApplication.java:735) [spring-boot-1.5.19.RELEASE.jar:1.5.19.RELEASE]
at org.springframework.boot.SpringApplication.callRunners(SpringApplication.java:716) [spring-boot-1.5.19.RELEASE.jar:1.5.19.RELEASE]
at org.springframework.boot.SpringApplication.afterRefresh(SpringApplication.java:703) [spring-boot-1.5.19.RELEASE.jar:1.5.19.RELEASE]
at org.springframework.boot.SpringApplication.run(SpringApplication.java:304) [spring-boot-1.5.19.RELEASE.jar:1.5.19.RELEASE]
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1118) [spring-boot-1.5.19.RELEASE.jar:1.5.19.RELEASE]
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1107) [spring-boot-1.5.19.RELEASE.jar:1.5.19.RELEASE]
at com.pnb.allianz.Application.main(Application.java:12) [classes/:na]
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:1.8.0_181]
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) ~[na:1.8.0_181]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ~[na:1.8.0_181]
at java.lang.reflect.Method.invoke(Unknown Source) ~[na:1.8.0_181]
at org.springframework.boot.devtools.restart.RestartLauncher.run(RestartLauncher.java:49) [spring-boot-devtools-1.5.19.RELEASE.jar:1.5.19.RELEASE]
Caused by: com.crystaldecisions.sdk.occa.report.lib.ReportSDKLogonException: Logon Error: ORA-01017: invalid username/password; logon denied
at com.businessobjects.reports.sdk.JRCCommunicationAdapter.a(SourceFile:2267) ~[CrystalReportsRuntime.jar:12.2.217.2158]
at com.businessobjects.reports.sdk.JRCCommunicationAdapter.a(SourceFile:2304) ~[CrystalReportsRuntime.jar:12.2.217.2158]
at com.businessobjects.reports.sdk.JRCCommunicationAdapter.if(SourceFile:736) ~[CrystalReportsRuntime.jar:12.2.217.2158]
at com.businessobjects.reports.sdk.JRCCommunicationAdapter.a(SourceFile:166) ~[CrystalReportsRuntime.jar:12.2.217.2158]
at com.businessobjects.reports.sdk.JRCCommunicationAdapter$2.a(SourceFile:528) ~[CrystalReportsRuntime.jar:12.2.217.2158]
at com.businessobjects.reports.sdk.JRCCommunicationAdapter$2.call(SourceFile:526) ~[CrystalReportsRuntime.jar:12.2.217.2158]
at com.crystaldecisions.reports.common.ThreadGuard.syncExecute(SourceFile:102) ~[CrystalReportsRuntime.jar:12.2.217.2158]
at com.businessobjects.reports.sdk.JRCCommunicationAdapter.for(SourceFile:524) ~[CrystalReportsRuntime.jar:12.2.217.2158]
at com.businessobjects.reports.sdk.JRCCommunicationAdapter.int(SourceFile:423) ~[CrystalReportsRuntime.jar:12.2.217.2158]
at com.businessobjects.reports.sdk.JRCCommunicationAdapter.request(SourceFile:351) ~[CrystalReportsRuntime.jar:12.2.217.2158]
at com.businessobjects.sdk.erom.jrc.a.a(SourceFile:54) ~[CrystalReportsRuntime.jar:12.2.217.2158]
at com.businessobjects.sdk.erom.jrc.a.execute(SourceFile:67) ~[CrystalReportsRuntime.jar:12.2.217.2158]
at com.crystaldecisions.proxy.remoteagent.RemoteAgent$a.execute(SourceFile:716) ~[CrystalReportsRuntime.jar:12.2.217.2158]
at com.crystaldecisions.proxy.remoteagent.CommunicationChannel.a(SourceFile:125) ~[CrystalReportsRuntime.jar:12.2.217.2158]
at com.crystaldecisions.proxy.remoteagent.RemoteAgent.a(SourceFile:537) ~[CrystalReportsRuntime.jar:12.2.217.2158]
at com.crystaldecisions.sdk.occa.report.application.ds.a(SourceFile:186) ~[CrystalReportsRuntime.jar:12.2.217.2158]
at com.crystaldecisions.sdk.occa.report.application.an.a(SourceFile:108) ~[CrystalReportsRuntime.jar:12.2.217.2158]
at com.crystaldecisions.sdk.occa.report.application.b0.if(SourceFile:148) ~[CrystalReportsRuntime.jar:12.2.217.2158]
at com.crystaldecisions.sdk.occa.report.application.b0.b(SourceFile:95) ~[CrystalReportsRuntime.jar:12.2.217.2158]
at com.crystaldecisions.sdk.occa.report.application.bb.int(SourceFile:96) ~[CrystalReportsRuntime.jar:12.2.217.2158]
at com.crystaldecisions.proxy.remoteagent.UndoUnitBase.performDo(SourceFile:151) ~[CrystalReportsRuntime.jar:12.2.217.2158]
at com.crystaldecisions.proxy.remoteagent.UndoUnitBase.a(SourceFile:106) ~[CrystalReportsRuntime.jar:12.2.217.2158]
at com.crystaldecisions.sdk.occa.report.application.DatabaseController.a(SourceFile:2159) ~[CrystalReportsRuntime.jar:12.2.217.2158]
at com.crystaldecisions.sdk.occa.report.application.DatabaseController.a(SourceFile:543) ~[CrystalReportsRuntime.jar:12.2.217.2158]
at com.crystaldecisions.sdk.occa.report.application.DatabaseController.a(SourceFile:3898) ~[CrystalReportsRuntime.jar:12.2.217.2158]
at com.crystaldecisions.sdk.occa.report.application.DatabaseController.setTableLocation(SourceFile:2906) ~[CrystalReportsRuntime.jar:12.2.217.2158]
at com.pnb.allianz.util.CRJavaHelper.changeDataSource(CRJavaHelper.java:169) ~[classes/:na]
at com.pnb.allianz.util.CRJavaHelper.changeDataSource(CRJavaHelper.java:67) ~[classes/:na]
at com.pnb.allianz.ProjectInitializer.run(ProjectInitializer.java:77) ~[classes/:na]
at org.springframework.boot.SpringApplication.callRunner(SpringApplication.java:732) [spring-boot-1.5.19.RELEASE.jar:1.5.19.RELEASE]
... 11 common frames omitted
Caused by: com.crystaldecisions.reports.common.LogonFailureException: Logon Error: ORA-01017: invalid username/password; logon denied
at com.crystaldecisions.reports.queryengine.Connection.br(SourceFile:1799) ~[CrystalReportsRuntime.jar:12.2.217.2158]
at com.crystaldecisions.reports.queryengine.Connection.bs(SourceFile:505) ~[CrystalReportsRuntime.jar:12.2.217.2158]
at com.crystaldecisions.reports.queryengine.Connection.t4(SourceFile:3020) ~[CrystalReportsRuntime.jar:12.2.217.2158]
at com.crystaldecisions.reports.queryengine.Table.vc(SourceFile:2417) ~[CrystalReportsRuntime.jar:12.2.217.2158]
at com.crystaldecisions.reports.dataengine.datafoundation.AddDatabaseTableCommand.new(SourceFile:529) ~[CrystalReportsRuntime.jar:12.2.217.2158]
at com.crystaldecisions.reports.common.CommandManager.a(SourceFile:71) ~[CrystalReportsRuntime.jar:12.2.217.2158]
at com.crystaldecisions.reports.common.Document.a(SourceFile:203) ~[CrystalReportsRuntime.jar:12.2.217.2158]
at com.businessobjects.reports.sdk.requesthandler.f.a(SourceFile:175) ~[CrystalReportsRuntime.jar:12.2.217.2158]
at com.businessobjects.reports.sdk.requesthandler.DatabaseRequestHandler.byte(SourceFile:1079) ~[CrystalReportsRuntime.jar:12.2.217.2158]
at com.businessobjects.reports.sdk.JRCCommunicationAdapter.do(SourceFile:1166) ~[CrystalReportsRuntime.jar:12.2.217.2158]
at com.businessobjects.reports.sdk.JRCCommunicationAdapter.if(SourceFile:660) ~[CrystalReportsRuntime.jar:12.2.217.2158]
... 38 common frames omitted
Caused by: java.sql.SQLException: ORA-01017: invalid username/password; logon denied
at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:112) ~[ojdbc14-10.2.0.2.0.jar:Oracle JDBC Driver version - "10.2.0.3.0"]
at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:331) ~[ojdbc14-10.2.0.2.0.jar:Oracle JDBC Driver version - "10.2.0.3.0"]
at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:283) ~[ojdbc14-10.2.0.2.0.jar:Oracle JDBC Driver version - "10.2.0.3.0"]
at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:278) ~[ojdbc14-10.2.0.2.0.jar:Oracle JDBC Driver version - "10.2.0.3.0"]
at oracle.jdbc.driver.T4CTTIoauthenticate.receiveOauth(T4CTTIoauthenticate.java:791) ~[ojdbc14-10.2.0.2.0.jar:Oracle JDBC Driver version - "10.2.0.3.0"]
at oracle.jdbc.driver.T4CConnection.logon(T4CConnection.java:362) ~[ojdbc14-10.2.0.2.0.jar:Oracle JDBC Driver version - "10.2.0.3.0"]
at oracle.jdbc.driver.PhysicalConnection.<init>(PhysicalConnection.java:439) ~[ojdbc14-10.2.0.2.0.jar:Oracle JDBC Driver version - "10.2.0.3.0"]
at oracle.jdbc.driver.T4CConnection.<init>(T4CConnection.java:165) ~[ojdbc14-10.2.0.2.0.jar:Oracle JDBC Driver version - "10.2.0.3.0"]
at oracle.jdbc.driver.T4CDriverExtension.getConnection(T4CDriverExtension.java:35) ~[ojdbc14-10.2.0.2.0.jar:Oracle JDBC Driver version - "10.2.0.3.0"]
at oracle.jdbc.driver.OracleDriver.connect(OracleDriver.java:801) ~[ojdbc14-10.2.0.2.0.jar:Oracle JDBC Driver version - "10.2.0.3.0"]
at com.crystaldecisions.reports.queryengine.driverImpl.jdbc.JDBCConnection.Open(Unknown Source) ~[DatabaseConnectors.jar:12.2.217.2158]
at com.crystaldecisions.reports.queryengine.JDBConnectionWrapper.Open(SourceFile:123) ~[CrystalReportsRuntime.jar:12.2.217.2158]
at com.crystaldecisions.reports.queryengine.Connection.br(SourceFile:1786) ~[CrystalReportsRuntime.jar:12.2.217.2158]
... 48 common frames omitted
我已经检查了数据库凭据,例如 url、用户名、密码和驱动程序类名。都是正确的。
我阅读报告的代码是这样的
for(File f : files) {
reportName = f.getAbsolutePath();
String connectString = dataSource.getUrl();
String driverName = dataSource.getDriverClassName();
String JNDIName = dataSource.getDataSourceJNDI();
String userName = dataSource.getUsername(); // TODO: Fill in database user
String password = dataSource.getPassword(); // TODO: Fill in password
String EXPORT_LOC = "C:\\CRPT_V1\\" + formattedDate + "\\";
subject = f.getName().substring(0, f.getName().indexOf("_"));
File file = new File(EXPORT_LOC);
if (!file.exists()) {
file.mkdirs();
}
String EXPORT_FILE = subject + "_" + formattedDate + ".pdf";
System.out.println("Files:" + f.getName());
ReportClientDocument reportClientDoc = new ReportClientDocument();
reportClientDoc.open(reportName, OpenReportOptions._openAsReadOnly);
CRJavaHelper.changeDataSource(reportClientDoc,userName, password, connectString, driverName, JNDIName);
CRJavaHelper.logonDataSource(reportClientDoc, userName, password);
Integer numberValue = new Integer(7); // TODO: Fill in value
numberValue = Integer.parseInt(YEAR);
if (!subject.equals("001") && !subject.equals("002")) {
CRJavaHelper.addDiscreteParameterValue(reportClientDoc, "", "PROD_MONTH", MONTH);
}
CRJavaHelper.addDiscreteParameterValue(reportClientDoc, "", "CURR_YEAR", numberValue);
ByteArrayInputStream byteArrayInputStream = (ByteArrayInputStream) reportClientDoc
.getPrintOutputController().export(ReportExportFormat.PDF);
reportClientDoc.close();
EXPORT_OUTPUT = EXPORT_LOC + EXPORT_FILE;
//util.writeToFileSystem(byteArrayInputStream,
// EXPORT_OUTPUT);
IOUtils.copy(byteArrayInputStream, new FileOutputStream(EXPORT_FILE));
}
我已经尝试过其他有相关错误的开发人员提供的一些解决方案,但没有运气。
我真的很感激一些帮助。多谢你们!
解决方案
推荐阅读
- google-compute-engine - TPU 错误:ray.exceptions.RayActorError:演员在完成此任务之前意外死亡
- python - 打开可执行文件的前置路径
- css - 收到错误“lessphp 致命错误:无法解析传入的变量@heading_font_weight:”
- git - 将 git 历史记录折叠到标签(在标签之间合并提交)
- ansible - Ansible 重试循环,直到文件内容更新
- three.js - 计算围绕球体运行的物体的角度
- griddb - 如何在 Python3 中集成 Griddb?
- javascript - 事件监听器只工作一次
- python - (Python)对两个链表求和,其中每个节点都是一个整数。属性错误
- vert.x - Vert.x 3.9 WebClient 中的超时未按预期工作