Click here to Skip to main content
15,883,749 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
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:

Java
@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";

}
Posted
Updated 6-Mar-18 15:32pm
v2

You call Javonet.New without parameters, so it try to invoke a parameter-less constructor, which does not exists...
Try someting like this:
Java
Javonet.New("DateTime",1980,1,1);
 
Share this answer
 
You call Javonet.New without parameters, so it try to invoke a parameter-less constructor, which does not exists...
Try something like this:
Java
Javonet.New("DateTime",1980,1,1);
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900