2016-05-02 44 views
1

即时通讯与一个奇怪的问题结合在一起。 我已经写了一个dll(作为Navision的插件),它通过process.start()调用控制台应用程序。使用IKVM的控制台应用程序使用pdfbox.net(v1.8.4)。IKVM在使用pdfbox.net时没有找到提供程序(如果与process.start一起运行)

如果我直接运行控制台应用程序(在Visual Studio中使用cmd或“start”),一切正常。 如果我启动控制台应用程序THROU的Process.Start()从类libary(与测试单元测试(MSTEST))或任何其他(试验 - )项目我得到一个异常:

javax.xml.parsers.FactoryConfigurationError: Provider com.sun.org.apache.xerces.internal.jaxp.DocumentBuilderFactoryImpl not found

我的Process.Start从IIb类:

string[] args = {pdfFilePath, zugferdFilePath}; 
ProcessStartInfo processStartInfo = new ProcessStartInfo 
{ 
    FileName = exeFile, 
    Arguments = string.Join(" ", args), 
    WorkingDirectory = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), 
    ErrorDialog = true, 
    RedirectStandardError = true, 
    RedirectStandardOutput = true, 
    UseShellExecute = false 
}; 
Process process = Process.Start(processStartInfo); 

详细有关异常: 消息:

Provider com.sun.org.apache.xerces.internal.jaxp.DocumentBuilderFactoryImpl not found

来源:

IKVM.OpenJDK.XML.API

堆栈跟踪:

((java.lang.Throwable)_exception).StackTrace " bei javax.xml.parsers.DocumentBuilderFactory.newInstance() bei Mustang.ZUGFeRDImporter.parse() in C:\GIT\KCorp.NAV.Zugferd\KCorp.Nav.Zugferd.Split\Mustang\ZUGFeRDImport.cs:Zeile 124. bei KCorp.Nav.Zugferd.Split.Zaumzeug.showZUGFeRD(String filepath,String xmlFilePath) in C:\GIT\KCorp.NAV.Zugferd\KCorp.Nav.Zugferd.Split\Zaumzeug.cs:Zeile 30."

有谁有一个想法如何解决这一问题?

如果您需要更多信息,请让我知道。

在此先感谢。

回答

0

这是一个类加载器的问题。尝试调用出厂前行加入以下:

var s = new [email protected](); 

这将强制装配加载和每次我遇到了这个问题的时间已为我工作。

相关问题