JDBC e JNDI

di il
7 risposte

JDBC e JNDI

Ciao a tutti!

Sto creando un programmino in java che si collega tramite jdbc ad un db oracle per prelevare dei dati da inserire in vari un report di crystalreport.

Ho fatto una prova, ma mi vengono fuori queste eccezioni:

- JRCAgent1 detected an exception: Errore di ricerca del nome JNDI (CPR)
	at com.crystaldecisions.reports.reportdefinition.datainterface.a.a(Unknown Source)
	at com.crystaldecisions.reports.reportdefinition.datainterface.a.a(Unknown Source)
	at com.crystaldecisions.reports.reportdefinition.datainterface.a.a(Unknown Source)
	at com.crystaldecisions.reports.reportdefinition.datainterface.a.a(Unknown Source)
	at com.crystaldecisions.reports.reportdefinition.datainterface.g.a(Unknown Source)
	at com.businessobjects.reports.sdk.b.b.byte(Unknown Source)
	at com.businessobjects.reports.sdk.b.b.int(Unknown Source)
	at com.businessobjects.reports.sdk.JRCCommunicationAdapter.request(Unknown Source)
	at com.crystaldecisions.proxy.remoteagent.x.a(Unknown Source)
	at com.crystaldecisions.proxy.remoteagent.q.a(Unknown Source)
	at com.crystaldecisions.sdk.occa.report.application.dd.a(Unknown Source)
	at com.crystaldecisions.sdk.occa.report.application.ReportSource.a(Unknown Source)
	at com.crystaldecisions.sdk.occa.report.application.ReportSource.a(Unknown Source)
	at com.crystaldecisions.sdk.occa.report.application.PrintOutputController.export(Unknown Source)
	at com.crystaldecisions.sdk.occa.report.application.PrintOutputController.export(Unknown Source)
	at com.crystaldecisions.reports.sdk.PrintOutputController.export(Unknown Source)
	at JRCExportReport.main(JRCExportReport.java:84)

com.crystaldecisions.sdk.occa.report.lib.ReportSDKException: Errore di ricerca del nome JNDI (CPR)---- Error code:-2147467259 Error code name:failed
	at com.crystaldecisions.sdk.occa.report.application.PrintOutputController.export(Unknown Source)
	at com.crystaldecisions.sdk.occa.report.application.PrintOutputController.export(Unknown Source)
	at com.crystaldecisions.reports.sdk.PrintOutputController.export(Unknown Source)
	at JRCExportReport.main(JRCExportReport.java:84)
Caused by: com.crystaldecisions.reports.reportdefinition.datainterface.e: Errore di ricerca del nome JNDI (CPR)
	at com.crystaldecisions.reports.reportdefinition.datainterface.a.a(Unknown Source)
	at com.crystaldecisions.reports.reportdefinition.datainterface.a.a(Unknown Source)
	at com.crystaldecisions.reports.reportdefinition.datainterface.a.a(Unknown Source)
	at com.crystaldecisions.reports.reportdefinition.datainterface.a.a(Unknown Source)
	at com.crystaldecisions.reports.reportdefinition.datainterface.g.a(Unknown Source)
	at com.businessobjects.reports.sdk.b.b.byte(Unknown Source)
	at com.businessobjects.reports.sdk.b.b.int(Unknown Source)
	at com.businessobjects.reports.sdk.JRCCommunicationAdapter.request(Unknown Source)
	at com.crystaldecisions.proxy.remoteagent.x.a(Unknown Source)
	at com.crystaldecisions.proxy.remoteagent.q.a(Unknown Source)
	at com.crystaldecisions.sdk.occa.report.application.dd.a(Unknown Source)
	at com.crystaldecisions.sdk.occa.report.application.ReportSource.a(Unknown Source)
	at com.crystaldecisions.sdk.occa.report.application.ReportSource.a(Unknown Source)
	... 4 more
Caused by: com.crystaldecisions.reports.queryengine.am: Errore di ricerca del nome JNDI (CPR)
	at com.crystaldecisions.reports.queryengine.driverImpl.o.if(Unknown Source)
	at com.crystaldecisions.reports.queryengine.ax.new(Unknown Source)
	at com.crystaldecisions.reports.queryengine.ax.byte(Unknown Source)
	... 17 more
Caused by
com.crystaldecisions.reports.reportdefinition.datainterface.e: Errore di ricerca del nome JNDI (CPR)
	at com.crystaldecisions.reports.reportdefinition.datainterface.a.a(Unknown Source)
	at com.crystaldecisions.reports.reportdefinition.datainterface.a.a(Unknown Source)
	at com.crystaldecisions.reports.reportdefinition.datainterface.a.a(Unknown Source)
	at com.crystaldecisions.reports.reportdefinition.datainterface.a.a(Unknown Source)
	at com.crystaldecisions.reports.reportdefinition.datainterface.g.a(Unknown Source)
	at com.businessobjects.reports.sdk.b.b.byte(Unknown Source)
	at com.businessobjects.reports.sdk.b.b.int(Unknown Source)
	at com.businessobjects.reports.sdk.JRCCommunicationAdapter.request(Unknown Source)
	at com.crystaldecisions.proxy.remoteagent.x.a(Unknown Source)
	at com.crystaldecisions.proxy.remoteagent.q.a(Unknown Source)
	at com.crystaldecisions.sdk.occa.report.application.dd.a(Unknown Source)
	at com.crystaldecisions.sdk.occa.report.application.ReportSource.a(Unknown Source)
	at com.crystaldecisions.sdk.occa.report.application.ReportSource.a(Unknown Source)
	at com.crystaldecisions.sdk.occa.report.application.PrintOutputController.export(Unknown Source)
	at com.crystaldecisions.sdk.occa.report.application.PrintOutputController.export(Unknown Source)
	at com.crystaldecisions.reports.sdk.PrintOutputController.export(Unknown Source)
	at JRCExportReport.main(JRCExportReport.java:84)
Caused by: com.crystaldecisions.reports.queryengine.am: Errore di ricerca del nome JNDI (CPR)
	at com.crystaldecisions.reports.queryengine.driverImpl.o.if(Unknown Source)
	at com.crystaldecisions.reports.queryengine.ax.new(Unknown Source)
	at com.crystaldecisions.reports.queryengine.ax.byte(Unknown Source)
	... 17 more
Caused by:
com.crystaldecisions.reports.reportdefinition.datainterface.e: Errore di ricerca del nome JNDI (CPR)
	at com.crystaldecisions.reports.reportdefinition.datainterface.a.a(Unknown Source)
	at com.crystaldecisions.reports.reportdefinition.datainterface.a.a(Unknown Source)
	at com.crystaldecisions.reports.reportdefinition.datainterface.a.a(Unknown Source)
	at com.crystaldecisions.reports.reportdefinition.datainterface.a.a(Unknown Source)
	at com.crystaldecisions.reports.reportdefinition.datainterface.g.a(Unknown Source)
	at com.businessobjects.reports.sdk.b.b.byte(Unknown Source)
	at com.businessobjects.reports.sdk.b.b.int(Unknown Source)
	at com.businessobjects.reports.sdk.JRCCommunicationAdapter.request(Unknown Source)
	at com.crystaldecisions.proxy.remoteagent.x.a(Unknown Source)
	at com.crystaldecisions.proxy.remoteagent.q.a(Unknown Source)
	at com.crystaldecisions.sdk.occa.report.application.dd.a(Unknown Source)
	at com.crystaldecisions.sdk.occa.report.application.ReportSource.a(Unknown Source)
	at com.crystaldecisions.sdk.occa.report.application.ReportSource.a(Unknown Source)
	at com.crystaldecisions.sdk.occa.report.application.PrintOutputController.export(Unknown Source)
	at com.crystaldecisions.sdk.occa.report.application.PrintOutputController.export(Unknown Source)
	at com.crystaldecisions.reports.sdk.PrintOutputController.export(Unknown Source)
	at JRCExportReport.main(JRCExportReport.java:84)
Caused by: com.crystaldecisions.reports.queryengine.am: Errore di ricerca del nome JNDI (CPR)
	at com.crystaldecisions.reports.queryengine.driverImpl.o.if(Unknown Source)
	at com.crystaldecisions.reports.queryengine.ax.new(Unknown Source)
	at com.crystaldecisions.reports.queryengine.ax.byte(Unknown Source)
	... 17 more
Ho provato a girare un pò su internet, ma non ho trovato nulla che mi servisse. Sapreste aiutarmi?

7 Risposte

  • Re: JDBC e JNDI

    Posti un pò di codice del main...visto che dà un errore alla riga 84
  • Re: JDBC e JNDI

    Chiao zaknafein83. Scusa per il ritardo, ma ho avuto un lavoro urgente.
    Il codice dove mi dà errore è questo:

    try {
    checkParameters(args);
    getParameters(args);
    //Open report.
    ReportClientDocument reportClientDoc = new ReportClientDocument();
    reportClientDoc.open(REPORT_NAME, 0);

    logonDatabase(reportClientDoc);

    PrintOutputController outController = reportClientDoc.getPrintOutputController();

    //NOTE: For more complex parameter value types below (range and multi-value range parameters), use the sample utility methods below for creating ParameterFieldValue
    //objects that can be passed into the setCurrentValue(s) method.

    ByteArrayInputStream byteArrayInputStream = (ByteArrayInputStream)outController.export(EXPORT_FORMAT);


    //Release report.
    reportClientDoc.close();

    //Use the Java I/O libraries to write the exported content to the file system.
    byte byteArray[] = new byte[byteArrayInputStream.available()];

    //Create a new file that will contain the exported result.
    File file = new File(EXPORT_FILE);
    FileOutputStream fileOutputStream = new FileOutputStream(file);

    ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream(byteArrayInputStream.available());
    int x = byteArrayInputStream.read(byteArray, 0, byteArrayInputStream.available());

    byteArrayOutputStream.write(byteArray, 0, x);
    byteArrayOutputStream.writeTo(fileOutputStream);

    //Close streams.
    byteArrayInputStream.close();
    byteArrayOutputStream.close();
    fileOutputStream.close();

    System.out.println("Successfully exported report to " + EXPORT_FILE);
    }catch(ReportSDKException ex) {
    ex.printStackTrace();
    }catch(Exception ex) {
    ex.printStackTrace();
    }
    }

    La riga che mi da errore è questa ByteArrayInputStream byteArrayInputStream = (ByteArrayInputStream)outController.export(EXPORT_FORMAT);
  • Re: JDBC e JNDI

    Usa il tag code...non si capisce una cappa
  • Re: JDBC e JNDI

    Sorry
    
    try {
    		checkParameters(args);
    		getParameters(args);
    		//Open report.
    		ReportClientDocument reportClientDoc = new ReportClientDocument();
    		reportClientDoc.open(REPORT_NAME, 0);
    					
    		logonDatabase(reportClientDoc);
    
    		PrintOutputController outController = reportClientDoc.getPrintOutputController();
    		
    		 //NOTE: For more complex parameter value types below (range and multi-value range parameters), use the sample utility methods below for creating ParameterFieldValue
    		 //objects that can be passed into the setCurrentValue(s) method.
    				  
    		 ByteArrayInputStream byteArrayInputStream = (ByteArrayInputStream)outController.export(EXPORT_FORMAT);
    
    		
    		//Release report.
    		reportClientDoc.close();
    					
    		//Use the Java I/O libraries to write the exported content to the file system.
    		byte byteArray[] = new byte[byteArrayInputStream.available()];
    
    		//Create a new file that will contain the exported result.
    		File file = new File(EXPORT_FILE);
    		FileOutputStream fileOutputStream = new FileOutputStream(file);
    
    		ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream(byteArrayInputStream.available());
    		int x = byteArrayInputStream.read(byteArray, 0, byteArrayInputStream.available());
    
    		byteArrayOutputStream.write(byteArray, 0, x);
    		byteArrayOutputStream.writeTo(fileOutputStream);
    
    		//Close streams.
    		byteArrayInputStream.close();
    		byteArrayOutputStream.close();
    		fileOutputStream.close();
    		
    		System.out.println("Successfully exported report to " + EXPORT_FILE);								
    	}catch(ReportSDKException ex) {		
    		ex.printStackTrace();			
    	}catch(Exception ex) {			
    		ex.printStackTrace();						
    	}
    }
    
  • Re: JDBC e JNDI

    Scusami, la riga 84?
  • Re: JDBC e JNDI

    È questa

    ByteArrayInputStream byteArrayInputStream = ByteArrayInputStream)outController.export(EXPORT_FORMAT);
  • Re: JDBC e JNDI

    Guarda sinceramente così non riesco a capire...potrebbe essere un problema di collegamento al database...l'hai provato un collegamento "al volo" per vedere se funziona?
Devi accedere o registrarti per scrivere nel forum
7 risposte