Re: Hibernate and iKVM

Kumaravel Sadras <[email protected]>
Newsgroups gmane.comp.java.ikvm.devel
Message-ID <CAFR7Q1takh=QFrwHpisej3KQx9LD=r=UzANVYSyQE86844WsDA@mail.gmail.com>
I worked around the problem with cfg configuration file in java by
modifying my java code to pick a cfg file from a specific location and that
works in java

import java.io.File;

import org.hibernate.Session;
import org.hibernate.SessionFactory;
import org.hibernate.cfg.Configuration;
import org.hibernate.service.ServiceRegistry;
import org.hibernate.service.ServiceRegistryBuilder;

@SuppressWarnings("deprecation")
public class HibernateDriver {

public void writeUser()
 {
  Configuration configuration=new Configuration();
  File f = new File("C:\\hibernateikvm\\hibernate.cfg.xml");
  configuration.configure(f);
  ServiceRegistry sr= new
ServiceRegistryBuilder().applySettings(configuration.getProperties()).build();

  SessionFactory sf=configuration.buildSessionFactory(sr);

...
}

When I convert my jar file to dll I get these warnings

c:\hibernateikvm>ikvmc -debug -target:library hibernateqboconnect.jar
IKVM.NET Compiler version 7.2.4630.5
Copyright (C) 2002-2012 Jeroen Frijters
http://www.ikvm.net/

note IKVMC0002: Output file is "hibernateqboconnect.dll"
warning IKVMC0100: Class "javax.persistence.Id" not found
warning IKVMC0100: Class "javax.persistence.Column" not found
warning IKVMC0100: Class "javax.persistence.Entity" not found
warning IKVMC0100: Class "org.hibernate.cfg.Configuration" not found
warning IKVMC0100: Class "org.hibernate.service.ServiceRegistryBuilder" not
foun
d
warning IKVMC0100: Class
"org.hibernate.boot.registry.StandardServiceRegistry" n
ot found
warning IKVMC0100: Class "org.hibernate.service.ServiceRegistry" not found
warning IKVMC0100: Class "org.hibernate.SessionFactory" not found
warning IKVMC0100: Class "org.hibernate.Session" not found
warning IKVMC0100: Class "org.hibernate.Transaction" not found
*warning IKVMC0111: Emitted java.lang.NoClassDefFoundError in
"com.intuit.qbo.pbl*
*.HibernateDriver.writeUser()V"*
*    ("org.hibernate.cfg.Configuration")*

When I step in writeUser it is giving an exception.

Any suggestions is really appreciated.

-Kumar.



On Thu, Jul 17, 2014 at 3:02 PM, Kumaravel Sadras <[email protected]> wrote:

> Hi
>  I built a sample project in Java using Eclipse that talks to a mysql
> database using Hibernate. That works.
>  I converted all the jar files to .dll using iKVMC
>
> In my Visual Studio project I instantiate my class that writes date to the
> database through hibernate. And I get an exception
>
> An unhandled exception of type java.lang.NoClassDefFoundError occurred in
> hibernateqboconnect.dll
>
> Additional Infomation: org.hibernate.cfg Configuration
>
> In the Eclipse project, we create a hibernate.xml.cfg file that resides at
> the src folder level, which has the configuration properties.
>
> I suspect that in .NET, it is not able to find the .cfg file.
>
> I copied the .cfg file to where the .dll files are. And I still get the
> same error.
>
> How do I make the C# client read this configuration file? Where should I
> copy it to?
>
> Thanks,
> -Kumar.
>

------------------------------------------------------------------------------
Want fast and easy access to all the code in your enterprise? Index and
search up to 200,000 lines of code with a free copy of Black Duck
Code Sight - the same software that powers the world's largest code
search on Ohloh, the Black Duck Open Hub! Try it now.
http://p.sf.net/sfu/bds

_______________________________________________
Ikvm-developers mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ikvm-developers
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.