- - PR -
実行環境で起動エラー (CrystalReport10,C#.NET)
1
投稿者 | 投稿内容 |
---|---|
|
投稿日時: 2004-08-18 16:23
【環境】
・開発:WindowsXP, C#.NET, SQLServer2000, ODBC接続設定, CrystalReport10(作成ファイルのDB接続はODBC経由) ・実行:WindowsXP, SQLServer2000, ODBC接続設定 【内容】 CrystalReport10(製品版)で作成したレポートをC#.NETの プログラムから起動し、プレビューさせようとしています。 【現象】 開発環境では正常に起動しますが、実際の環境で起動する と「レポートのロードに失敗しました。」とエラーメッセ ージが表示されます。<< 詳細は最下部へ >> 【ソース】 crConnectionInfo.ServerName = DSNM; // ODBC経由接続のため crConnectionInfo.DatabaseName = DBNM; crConnectionInfo.UserID = DBID; crConnectionInfo.Password = DBPW; //Get the table information from the report crReportDocument.Load(In_FName); //CrystalReport FilePath crDatabase = crReportDocument.Database; crTables = crDatabase.Tables; for (int i = 0; i < crTables.Count; i++) { crTable = crTables[i]; crTableLogOnInfo = crTable.LogOnInfo; crTableLogOnInfo.ConnectionInfo = crConnectionInfo; crTable.ApplyLogOnInfo(crTableLogOnInfo); } //Set the viewer to the report object to be previewed. crystalReportViewer.ReportSource = crReportDocument; } catch(Exception e) { MessageBox.Show(e.Message,"帳票表示エラー",MessageBoxButtons.OK); } 【SetUpプロジェクトに含めたマージモジュール】 dotnetfxredist_x86.msm Crystal_Managed2003.msm Crystal_Managed2003_ jpn.msm Crystal_Database_Access2003.msm Crystal_Database_Access2003_ jpn.msm Crystal_regwiz2003.msm (license Key入力済) CrystalReports10_maps.msm CrystalReports10_NET_EmbeddedReporting.msm(license Key入力済) C#で作成したプログラム部分は正常に動作しているようです。 ReportViewerへロードするときに失敗している、そこまでは分かったの ですが、何を試してもエラーが解消されず何が原因かさっぱりわかりま せん。 何かヒントでも結構です。 ご存知の方いらっしゃいましたら、教えていただけませんでしょうか? よろしくお願い致します。 << エラー内容(詳細) >> このメッセージの最後を参照してください。 ************** 例外テキスト ************** System.Exception: レポートのロードに失敗しました。 ---> System.Runtime.InteropServices.COMException (0x80004005): 指定されたパスが見つかりません。 at CrystalDecisions.ReportAppServer.ClientDoc.ReportClientDocumentClass.Open(Object& DocumentPath, Int32 Options) at CrystalDecisions.ReportAppServer.ReportClientDocumentWrapper.Open(Object& DocumentPath, Int32 Options) at CrystalDecisions.ReportAppServer.ReportClientDocumentWrapper.EnsureDocumentIsOpened() --- 内部例外スタック トレースの終わり --- at CrystalDecisions.ReportAppServer.ReportClientDocumentWrapper.EnsureDocumentIsOpened() at CrystalDecisions.CrystalReports.Engine.ReportDocument.Load(String filename, OpenReportMethod openMethod, Int16 parentJob) at CrystalDecisions.CrystalReports.Engine.ReportDocument.Load(String filename) at Simple.Form1.Form1_Load(Object sender, EventArgs e) at System.Windows.Forms.Form.OnLoad(EventArgs e) at System.Windows.Forms.Form.OnCreateControl() at System.Windows.Forms.Control.CreateControl(Boolean fIgnoreVisible) at System.Windows.Forms.Control.CreateControl() at System.Windows.Forms.Control.WmShowWindow(Message& m) at System.Windows.Forms.Control.WndProc(Message& m) at System.Windows.Forms.ScrollableControl.WndProc(Message& m) at System.Windows.Forms.ContainerControl.WndProc(Message& m) at System.Windows.Forms.Form.WmShowWindow(Message& m) at System.Windows.Forms.Form.WndProc(Message& m) at System.Windows.Forms.ControlNativeWindow.OnMessage(Message& m) at System.Windows.Forms.ControlNativeWindow.WndProc(Message& m) at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam) ************** 読み込まれたアセンブリ ************** mscorlib アセンブリ バージョン : 1.0.5000.0 Win32 バージョン : 1.1.4322.573 コードベース : file:///c:/windows/microsoft.net/framework/v1.1.4322/mscorlib.dll ---------------------------------------- Simple アセンブリ バージョン : 0.0.0.0 Win32 バージョン : 0.0.0.0 コードベース : file:///C:/Program%20Files/CDHChostemPrintEngine/Simple.exe ---------------------------------------- System.Windows.Forms アセンブリ バージョン : 1.0.5000.0 Win32 バージョン : 1.1.4322.573 コードベース : file:///c:/windows/assembly/gac/system.windows.forms/1.0.5000.0__b77a5c561934e089/system.windows.forms.dll ---------------------------------------- System アセンブリ バージョン : 1.0.5000.0 Win32 バージョン : 1.1.4322.573 コードベース : file:///c:/windows/assembly/gac/system/1.0.5000.0__b77a5c561934e089/system.dll ---------------------------------------- System.Drawing アセンブリ バージョン : 1.0.5000.0 Win32 バージョン : 1.1.4322.573 コードベース : file:///c:/windows/assembly/gac/system.drawing/1.0.5000.0__b03f5f7f11d50a3a/system.drawing.dll ---------------------------------------- mscorlib.resources アセンブリ バージョン : 1.0.5000.0 Win32 バージョン : 1.1.4322.573 コードベース : file:///c:/windows/assembly/gac/mscorlib.resources/1.0.5000.0_ja_b77a5c561934e089/mscorlib.resources.dll ---------------------------------------- CrystalDecisions.CrystalReports.Engine アセンブリ バージョン : 10.0.3300.0 Win32 バージョン : 10.0.9500.0 コードベース : file:///c:/windows/assembly/gac/crystaldecisions.crystalreports.engine/10.0.3300.0__692fbea5521e1304/crystaldecisions.crystalreports.engine.dll ---------------------------------------- CrystalDecisions.Shared アセンブリ バージョン : 10.0.3300.0 Win32 バージョン : 10.0.9500.0 コードベース : file:///c:/windows/assembly/gac/crystaldecisions.shared/10.0.3300.0__692fbea5521e1304/crystaldecisions.shared.dll ---------------------------------------- CrystalDecisions.ReportAppServer.CommLayer アセンブリ バージョン : 10.0.3300.0 Win32 バージョン : 10.0.9500.0 コードベース : file:///c:/windows/assembly/gac/crystaldecisions.reportappserver.commlayer/10.0.3300.0__692fbea5521e1304/crystaldecisions.reportappserver.commlayer.dll ---------------------------------------- CrystalDecisions.ReportAppServer.ClientDoc アセンブリ バージョン : 10.0.3300.0 Win32 バージョン : 10.0.9500.0 コードベース : file:///c:/windows/assembly/gac/crystaldecisions.reportappserver.clientdoc/10.0.3300.0__692fbea5521e1304/crystaldecisions.reportappserver.clientdoc.dll ---------------------------------------- System.Data アセンブリ バージョン : 1.0.5000.0 Win32 バージョン : 1.1.4322.573 コードベース : file:///c:/windows/assembly/gac/system.data/1.0.5000.0__b77a5c561934e089/system.data.dll ---------------------------------------- System.Xml アセンブリ バージョン : 1.0.5000.0 Win32 バージョン : 1.1.4322.573 コードベース : file:///c:/windows/assembly/gac/system.xml/1.0.5000.0__b77a5c561934e089/system.xml.dll ---------------------------------------- CrystalDecisions.ReportAppServer.DataSetConversion アセンブリ バージョン : 10.0.3300.0 Win32 バージョン : 10.0.9500.0 コードベース : file:///c:/windows/assembly/gac/crystaldecisions.reportappserver.datasetconversion/10.0.3300.0__692fbea5521e1304/crystaldecisions.reportappserver.datasetconversion.dll ---------------------------------------- CrystalDecisions.ReportAppServer.CubeDefModel アセンブリ バージョン : 10.0.3300.0 Win32 バージョン : 10.0.9500.0 コードベース : file:///c:/windows/assembly/gac/crystaldecisions.reportappserver.cubedefmodel/10.0.3300.0__692fbea5521e1304/crystaldecisions.reportappserver.cubedefmodel.dll ---------------------------------------- CrystalDecisions.ReportAppServer.Controllers アセンブリ バージョン : 10.0.3300.0 Win32 バージョン : 10.0.9500.0 コードベース : file:///c:/windows/assembly/gac/crystaldecisions.reportappserver.controllers/10.0.3300.0__692fbea5521e1304/crystaldecisions.reportappserver.controllers.dll ---------------------------------------- CrystalDecisions.ReportAppServer.DataDefModel アセンブリ バージョン : 10.0.3300.0 Win32 バージョン : 10.0.9500.0 コードベース : file:///c:/windows/assembly/gac/crystaldecisions.reportappserver.datadefmodel/10.0.3300.0__692fbea5521e1304/crystaldecisions.reportappserver.datadefmodel.dll ---------------------------------------- CrystalDecisions.ReportAppServer.ReportDefModel アセンブリ バージョン : 10.0.3300.0 Win32 バージョン : 10.0.9500.0 コードベース : file:///c:/windows/assembly/gac/crystaldecisions.reportappserver.reportdefmodel/10.0.3300.0__692fbea5521e1304/crystaldecisions.reportappserver.reportdefmodel.dll ---------------------------------------- CrystalDecisions.KeyCode アセンブリ バージョン : 10.0.3300.0 Win32 バージョン : 10.0.9500.0 コードベース : file:///c:/windows/assembly/gac/crystaldecisions.keycode/10.0.3300.0__692fbea5521e1304/crystaldecisions.keycode.dll ---------------------------------------- System.Web アセンブリ バージョン : 1.0.5000.0 Win32 バージョン : 1.1.4322.573 コードベース : file:///c:/windows/assembly/gac/system.web/1.0.5000.0__b03f5f7f11d50a3a/system.web.dll ---------------------------------------- CrystalDecisions.Shared.resources アセンブリ バージョン : 10.0.3300.0 Win32 バージョン : 10.0.9500.0 コードベース : file:///c:/windows/assembly/gac/crystaldecisions.shared.resources/10.0.3300.0_ja_692fbea5521e1304/crystaldecisions.shared.resources.dll ---------------------------------------- CrystalDecisions.Windows.Forms アセンブリ バージョン : 10.0.3300.0 Win32 バージョン : 10.0.9500.0 コードベース : file:///c:/windows/assembly/gac/crystaldecisions.windows.forms/10.0.3300.0__692fbea5521e1304/crystaldecisions.windows.forms.dll ---------------------------------------- CrystalDecisions.ReportSource アセンブリ バージョン : 10.0.3300.0 Win32 バージョン : 10.0.9500.0 コードベース : file:///c:/windows/assembly/gac/crystaldecisions.reportsource/10.0.3300.0__692fbea5521e1304/crystaldecisions.reportsource.dll ---------------------------------------- CrystalDecisions.Windows.Forms.resources アセンブリ バージョン : 10.0.3300.0 Win32 バージョン : 10.0.9500.0 コードベース : file:///c:/windows/assembly/gac/crystaldecisions.windows.forms.resources/10.0.3300.0_ja_692fbea5521e1304/crystaldecisions.windows.forms.resources.dll ---------------------------------------- CrystalDecisions.CrystalReports.Engine.resources アセンブリ バージョン : 10.0.3300.0 Win32 バージョン : 10.0.9500.0 コードベース : file:///c:/windows/assembly/gac/crystaldecisions.crystalreports.engine.resources/10.0.3300.0_ja_692fbea5521e1304/crystaldecisions.crystalreports.engine.resources.dll ---------------------------------------- System.Windows.Forms.resources アセンブリ バージョン : 1.0.5000.0 Win32 バージョン : 1.1.4322.573 コードベース : file:///c:/windows/assembly/gac/system.windows.forms.resources/1.0.5000.0_ja_b77a5c561934e089/system.windows.forms.resources.dll ---------------------------------------- ************** JIT デバッグ ************** Just-In-Time (JIT) デバッグを有効にするには、 このアプリケーション、またはコンピュータ (machine.config) の構成ファイルの jitDebugging 値を system.windows.forms セクションで設定しなければなりません。 アプリケーションはまた、デバッグを 有効にしてコンパイルされなければなりません。 例 : <configuration> <system.windows.forms jitDebugging="true" /> </configuration> JIT デバッグが有効なときは、このダイアログで処理するよりも、ハンドルされていない例外はすべて コンピュータに登録された JIT デバッガに設定されなければなりません。 |
|
投稿日時: 2004-08-18 17:52
単にrptファイルが見つからないだけのような気がしますが。
crReportDocument.Load(In_FName); private 自分のネームスペース.レポートファイル名 crReportDocument; の形式の定義になっていますか? すべてのファイルを表示で Reportxxx.rpt の下に出てくる Reportxxx.cs を使って定義します。 そうするとLoad不要です。 _________________ えムナウ Microsoft MVP for Visual Developer - C#,2005/01-2007/12 えムナウのプログラミングのページ Blog1 Blog2 |
|
投稿日時: 2004-08-18 18:21
えムナウさん、早速のご返答ありがとうございます。りんごっちです。
C#もCrystalReportも初心者なので、とんちんかんかもしれませんが、、、 今回のC#のプログラムは、外部からの引数にて利用するレポートを自由に指定できるようになっています。 バッチで起動するとしたら、以下のような感じです。 c:\exe\PrintEngine.exe "c:\\rpt\\test.rpt" 与えられた引数のパスのレポートがIn_FNameにあたります。 その方法の場合、 「private 自分のネームスペース.レポートファイル名 crReportDocument;」 と書く場合、具体的にどのように書けばよいのでしょうか? また「Reportxxx.cs」というファイルはありませんでした。 よろしくお願い致します。 |
|
投稿日時: 2004-08-18 18:51
こんにちは。
開発環境と実際の環境は同じなのでしょうか? (ドライブ構成やフォルダ構成などなど) エラー内容の先頭部分がヒントになるはずなのですが。。。 >System.Exception: レポートのロードに失敗しました。 > ---> System.Runtime.InteropServices.COMException (0x80004005): > 指定されたパスが見つかりません。 (改行失礼m(..)m) |
|
投稿日時: 2004-08-18 20:45
COMException になっているのは CrystalDecisions.ReportAppServer.ClientDoc.ReportClientDocumentClass.Open から、
外部のCOM(DLL)を呼んでいるからだと思います。 COMException (0x80004005): 指定されたパスが見つかりません。 内容から見ても単にrptファイルが見つからないだけのような気がしますが。 #DLLが足りない可能性もありますが _________________ えムナウ Microsoft MVP for Visual Developer - C#,2005/01-2007/12 えムナウのプログラミングのページ Blog1 Blog2 |
|
投稿日時: 2004-08-31 14:17
問題が解決しましたのでその報告をさせていただきます。
Qooさんのご指摘どおり、開発環境と実行環境のドライブが異なっていたため、 ドライブを合わせてコンパイルしました。 → 結果、残念ながら変化ありませんでした。(TnT) えムナウさんのご指摘を参考に、怪しい箇所のソース1行おきにMessageboxをは さんで実行環境で原因を調べたところ、ソース中の定義 private ReportDocument crReportDocument = new ReportDocument(); で落ちていることが分かりました。 調べた結果、CrystalDecisions.CrystalReports.Engine が、何らかの原因で使 用できない状態であったことがわかりました。 その後、さまざまなマージモジュールを加えたりして試しましたが、変化がなく 増やしてダメなら、減らしたらどうか!?と思い、セットアッププロジェクト作 成時に、自動的に探して取り込まれる「見つかった依存関係」の crystalreports10_net_webservicereporting.msm を[除外]にしてテストしました。(CrystalDecisions.CrystalReports.Engineは 「プログラム(アクティブ)の プライマリ出力」の[Dependencies]の(依存関係) の中に既に含まれていた、かつ、web関連の機能は一切使用していなかった為) → 結果、実行環境での起動成功!! Y(^o^)Y しかし、さらに問題が発生し... 引数により PDF・Excel・Printer・Preview・ユーザ指定画面の5つの動きがで きるようになっているのですが、なぜか 直接Previewを起動したときのみ、エラ ーが発生してしまいました。 メッセージ的には「割り当てられた時間内で無償ライセンスを取得できなかった ため、Crystal Reports ジョブが失敗しました。ライセンスは Business Objects または Business Objects オンライン ストアから購入できます。」のような感じ だったと思います。 ただ、ユーザ指定画面よりPreviewを選択したときは同一ルーチンを通っているの に表示されるため、ソースはおかしくないと思い、試しに直前にメッセージボック スをはさんでテストしてみたところ表示されました。 どうやらライセンス認証の処理が問題ということが分かり、Apprication.DoEvents をはさんでみたら、すんなり実行できるようになりました。 以上、私の長〜い長〜い格闘の結果でした。(^-^!) この会議室と皆さんの応援のおかげで何とか解決することができました。 今後また何かあったら、よろしくお願いします。 特に えムナウさん、Qooさん、 本当に本当にありがとうございました。 m(_ _)m |
1