疯狂的想法:使用 IKVM.NET 将 .NET 和 SAP 与 SAP JCo 连接起来
由于 SAP 不再维护 SAP Connector for .NET,因此我现在正在寻找一种替代方案来连接 Microsoft 世界与 SAP 世界。我知道有像“ERPConnect”这样的第三方产品,但我想使用 SAP 的工具来执行此操作(顺便说一下,我无法使用企业服务,因为目标 SAP 系统是 SAP 4.6C)。
因此,出现了将SAP Java Connector与工具IKVM.NET(www.ikvm.net/devguide/net2java.html)。 IKVM.NET 提供IKVMC 工具,可将 Java 字节码转换为 .NET dll 和 exe。 “说到做到!”我将 SAP JCo 转换为 .NET dll 并创建了一个新的 Visual Studio 解决方案。
我将所有 JCo 文件放入解决方案的子目录中。 我设置了 2 个对生成的 IKVM.OpenJDK.Core.dll 和 sapjco.dll 的引用。太棒了,所有 JCo 类现在都可以作为 .NET 类使用。我充满乐观地编写了一些小代码来连接到 SAP 系统。
JCO.Client 客户端 = null; client = JCO.createClient(...)
我的测试代码的编译没有错误。 “精彩的 !”我想。 然后我开始我的测试应用程序。不幸的是,我在调用 JCO.createClient 时遇到异常:
无法加载中间件层“com.sap.mw.jco.rfc.MiddlewareRFC”\r\njava.library.path 中没有 sapjcorfc
关于此主题,我有2 个问题 。
您认为我使用 SAP Java Connector (SAP JCo) 将 .NET 与 SAP 连接起来的想法是个好主意还是无稽之谈?也许有人已经有同样的想法;-)
如何解决上述异常?
Because the SAP Connector for .NET is no longer maintained by SAP, I am now looking for an alternative to connect the Microsoft world with the SAP world. I know there are third party products like "ERPConnect", but I want to do this with tools from SAP (by the way I cannot use the Enterprise Services, because the target SAP system is SAP 4.6C).
Therefore there has arisen the crazy idea to use the SAP Java Connector in combination with the tool IKVM.NET (www.ikvm.net/devguide/net2java.html). IKVM.NET provides The IKVMC tool, which converts Java bytecode to .NET dll's and exe's. "No sooner said than done!" I converted the SAP JCo to .NET dlls and created a new Visual Studio solution.
I put all the JCo files into a subdirectory of my solution.
I set 2 references to the generated IKVM.OpenJDK.Core.dll and sapjco.dll. Great, all JCo classes where now available as .NET classes. Full of optimism I wrote some little code to connect to a SAP system.
JCO.Client client = null;
client = JCO.createClient(...)
The compilation of my test code had no errors. "Wonderful !" I thought.
Then I started my test application. Unfortunately I got an exception calling JCO.createClient:
Could not load middleware layer 'com.sap.mw.jco.rfc.MiddlewareRFC'\r\nno sapjcorfc in java.library.path
I have 2 questions on this topic.
Do you think my idea using the SAP Java Connector (SAP JCo) to connect .NET with SAP is a good idea or is it nonsense? Perhaps someone had already the same idea ;-)
How can the above exception be solved ?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(5)
1)我认为这种方法不是一个好主意。到 sap 的实际连接不是通过 java(或旧的 .net 连接器中的 .net)完成的。但来自名为 librfc32.dll 的 ac dll。我认为IKVM对JNI的支持并不完整。
它也许会起作用,但是,即使如此,它也会很脆弱。
1) I don't think this approach is a good idea. The actual connection to sap is done not from java ( or from .net in the old .net connector). But from a c dll named, librfc32.dll. I believe that IKVM support of JNI is not complete.
It will maybe work, But, even than, it will be fragile.
我不会推荐这种方式!你应该使用直接的方式。例如,您可以使用 SAP RFC SDK。
I would not recommend this way ! You should use the direct way. For example you can use the SAP RFC SDK.
SAP .Net Connector 3 已发布。我每天上班都用它...
SAP .Net Connector 3 is released. I use it at work every day...
我认为你应该看看Web Services,它会更容易、更灵活。
问候
I think you shold have a look at Web Services, it will be more easy and more flexible.
Regards
这听起来像是 IKVM 的类加载器问题。查看wiki 中的说明。
This sound like a classloader problem of IKVM. Take a look in the description in the wiki.