如何在我的java Web应用程序中调用C#参数化构造函数 [英] How to call C# parameterised constructor in my java web applications
本文介绍了如何在我的java Web应用程序中调用C#参数化构造函数的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有C#代码和一个参数化构造函数,但我想在java Web应用程序中调用参数化的构造函数。我的问题是我正在使用Javonet来传递java到.NET但是我在调用C#类构造函数时它会在tomcat服务器中抛出一些异常
I have C# Code and with in One Parameterised constructor but I want to Call that parameterised Constructor in java Web Applications. My problem is I am using Javonet for Communicating java to .NET but whille I calling that C# Class constructor it throws some exception in tomcat server
Hibernate: select customer0_.id as id1_0_, customer0_.email as email2_0_, customer0_.first_name as first_na3_0_, customer0_.last_name as last_nam4_0_ from customer customer0_ order by customer0_.last_name
Setting temporary directory for Javonet lic file to: C:\Users\MANASK~1\AppData\Local\Temp\
hiii........hiii..
com.javonet.api.NException: Exception while trying to create instance of TcpipIntface.Code.Client.AcsTcpClass using 0 parameters
at SicsClrController.Engine.ClrEngine.CreateInstance(Unknown Source)
at SicsClrController.Engine.ClrEngine.processCommand(Unknown Source)
at com.javonet.internal.BinaryStreamProtocol.executeCommand(BinaryStreamProtocol.java:136)
at com.javonet.internal.GatewayManager.createInstance(GatewayManager.java:257)
at com.javonet.internal.GatewayManager.createInstance(GatewayManager.java:205)
at com.javonet.Javonet.New(Javonet.java:564)
at com.udemy.spring.hibernate.Controller.CustomerController.javaCallCsharp(CustomerController.java:108)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
我尝试过:
What I have tried:
@GetMapping("/cSharpCall")
public String javaCallCsharp()
{
final String TMP_DIR = System.getProperty("java.io.tmpdir");
try
{
/*System.out.println("Setting temporary directory for Javonet lic file to: "+TMP_DIR);
Javonet.setLicenseDirectory(TMP_DIR);*/
if (!Javonet.isActivated())
{
System.out.println("Setting temporary directory for Javonet lic file to: "+TMP_DIR);
Javonet.setLicenseDirectory(TMP_DIR);
Javonet.activate("sahumanas1275@gmail.com","Za2j-Hb58-z8J3-b7MA-x4J7",JavonetFramework.v45);
System.out.println("hiii........hiii..");
}
Javonet.addReference("ClassLibrary.dll");
NObject objRandom = Javonet.New("TcpipIntface.Code.Client.AcsTcpClass");
byte b=(byte)1;
Boolean value = objRandom.invoke("Opendoor",b);
System.out.println(value);
}
catch(JavonetException e)
{
e.printStackTrace();
}
return "redirect:/customer/list";
}
推荐答案
你没有参数调用Javonet.New,所以它试图调用一个没有参数的构造函数,它不存在...
尝试这样的东西:
You call Javonet.New without parameters, so it try to invoke a parameter-less constructor, which does not exists...
Try someting like this:
Javonet.New("DateTime",1980,1,1);
你打电话给Javonet.New没有参数,所以它尝试调用一个不存在的无参数构造函数...
尝试这样的事情:
You call Javonet.New without parameters, so it try to invoke a parameter-less constructor, which does not exists...
Try something like this:
Javonet.New("DateTime",1980,1,1);
这篇关于如何在我的java Web应用程序中调用C#参数化构造函数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文