These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 6 posts ] 
Author Message
 Post subject: NHibernate small app. installation problem
PostPosted: Thu Sep 06, 2007 6:45 pm 
Newbie

Joined: Tue Sep 07, 2004 7:12 pm
Posts: 7
I'm generating my first small app. installation using the provided utility in VS 2005. The generation is ok, the problem comes executing the setup.exe of my app, that seems not to find hibernate.cfg.xml
During development I had no problem at all. I have the cfg file as an “incrusted resource” and “copy always”.

Id appreciate your help.

Thanx,
Guillermo


Hibernate version:
1.2.0.GA

Mapping documents:

Code between sessionFactory.openSession() and session.close():

Full stack trace of any exception that occurs:
************** Texto de la excepción **************
NHibernate.HibernateException: problem parsing configuration : System.IO.FileNotFoundException: No se pudo encontrar el archivo 'C:\Documents and Settings\Guillermo Najar\Configuración local\Apps\2.0\67054VK3.TAG\0ZTAC31E.L37\bloc..tion_9ed459f7d8a28c65_0001.0000_e6b9082f7838f903\hibernate.cfg.xml'.
Nombre de archivo: 'C:\Documents and Settings\Guillermo Najar\Configuración local\Apps\2.0\67054VK3.TAG\0ZTAC31E.L37\bloc..tion_9ed459f7d8a28c65_0001.0000_e6b9082f7838f903\hibernate.cfg.xml'
en System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath)
en System.IO.FileStream.Init(String path, FileMode mode, FileAccess access, Int32 rights, Boolean useRights, FileShare share, Int32 bufferSize, FileOptions options, SECURITY_ATTRIBUTES secAttrs, String msgPath, Boolean bFromProxy)
en System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access, FileShare share, Int32 bufferSize)
en System.Xml.XmlDownloadManager.GetStream(Uri uri, ICredentials credentials)
en System.Xml.XmlUrlResolver.GetEntity(Uri absoluteUri, String role, Type ofObjectToReturn)
en System.Xml.XmlTextReaderImpl.OpenUrlDelegate(Object xmlResolver)
en System.Threading.CompressedStack.runTryCode(Object userData)
en System.Runtime.CompilerServices.RuntimeHelpers.ExecuteCodeWithGuaranteedCleanup(TryCode code, CleanupCode backoutCode, Object userData)
en System.Threading.CompressedStack.Run(CompressedStack compressedStack, ContextCallback callback, Object state)
en System.Xml.XmlTextReaderImpl.OpenUrl()
en System.Xml.XmlTextReaderImpl.Read()
en System.Xml.XmlTextReader.Read()
en System.Xml.XmlValidatingReaderImpl.Read()
en System.Xml.XmlValidatingReader.Read()
en System.Xml.XmlLoader.Load(XmlDocument doc, XmlReader reader, Boolean preserveWhitespace)
en System.Xml.XmlDocument.Load(XmlReader reader)
en NHibernate.Cfg.Configuration.Configure(XmlTextReader reader)
en NHibernate.Cfg.Configuration.Configure(XmlTextReader reader)
en NHibernate.Cfg.Configuration.Configure(String fileName)
en BlockNotas_3.GNsis.Bd.NH_Manejador..ctor()
en BlockNotas_3.Nota_Lista_Form.Nota_Lista_Form_Load(Object sender, EventArgs e)
en System.EventHandler.Invoke(Object sender, EventArgs e)
en System.Windows.Forms.Form.OnLoad(EventArgs e)
en System.Windows.Forms.Form.OnCreateControl()
en System.Windows.Forms.Control.CreateControl(Boolean fIgnoreVisible)
en System.Windows.Forms.Control.CreateControl()
en System.Windows.Forms.Control.WmShowWindow(Message& m)
en System.Windows.Forms.Control.WndProc(Message& m)
en System.Windows.Forms.ScrollableControl.WndProc(Message& m)
en System.Windows.Forms.ContainerControl.WndProc(Message& m)
en System.Windows.Forms.Form.WmShowWindow(Message& m)
en System.Windows.Forms.Form.WndProc(Message& m)
en System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
en System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
en System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)

Name and version of the database you are using:
MySQL 5
The generated SQL (show_sql=true):

Debug level Hibernate log excerpt:





Problems with Session and transaction handling?

Read this: http://hibernate.org/42.html

_________________
Guillermo


Top
 Profile  
 
 Post subject: Re: NHibernate small app. installation problem
PostPosted: Thu Sep 13, 2007 6:45 pm 
Regular
Regular

Joined: Fri Jan 20, 2006 7:45 pm
Posts: 97
Location: San Antonio, TX
gnajar wrote:
I'm generating my first small app. installation using the provided utility in VS 2005. The generation is ok, the problem comes executing the setup.exe of my app, that seems not to find hibernate.cfg.xml
During development I had no problem at all. I have the cfg file as an “incrusted resource” and “copy always”.

Id appreciate your help.

Thanx,
Guillermo


...



Primero, losiento pero muchos de nosotros no hablamos espanol bien. Entonces, tal ves puede usted a copiar el texto de sus excepciones en ingels tambien. I joke.

Anyway, try changing Build Action to Content and then in your setup make sure that you include content files along with your project's primary output.

If that doesn't work we'll have to see the config code in your app.

Config code should look something like this.
Configuration configuration = new Configuration();
configuration.Configure();

The second line will try to read hibernate.cfg.xml locally by default. The path before the looks strange to me. I was wondering if you had a static path that you are passing to the Configure method.

I'll typically put my config information in the app.config, but that's just my preference.

Hope that helps!


Top
 Profile  
 
 Post subject:
PostPosted: Mon Sep 17, 2007 3:19 pm 
Newbie

Joined: Tue Sep 07, 2004 7:12 pm
Posts: 7
Thank you jlockwood for your answer.

You're right; for another post I'll translate Spanish errors. Sorry about that. I changed Build Action to Content for "hibernate.cfg.xml" as recommended but didn't work.

"then in your setup make sure that you include content files along with your project's primary output."

I'd appreciate if you elaborate a bit more on this? How can I make sure to include content files? I'm kind of newbie with VS.2005; what I do is Generate->Publish and I let it do it all. I'm checking the "Release" directory and the "hibernate.cfg.xml" is there.

In the program, I created an NHibernate object handler where I have:

Public Sub New()

f_configuracion = New Configuration
f_configuracion.Configure("hibernate.cfg.xml")
f_sesiones = f_configuracion.BuildSessionFactory

End Sub

As you see I don't have a static path. In a later test I left empty the parameter in the configure method, and didn't work either =(

What can it be?

Thanx,
Guillermo

_________________
Guillermo


Top
 Profile  
 
 Post subject:
PostPosted: Mon Sep 17, 2007 3:30 pm 
Regular
Regular

Joined: Fri Jan 20, 2006 7:45 pm
Posts: 97
Location: San Antonio, TX
As a quick test, run your SetUp.exe and see if you have the config file in the directory that it installs to. If not, manually place the config file in the directory (where executable and dlls are) and try running the app again, it should work.

Next, address the problem directly. I think the problem is that you only have the primary output from your assemblies included in your installer project. You can specify to include Content in the deployment, which should pick up your config file.

Fix your install project, unistall your previous test and ensure that you delete the config file that you manually dropped in the installed directory, then reinstall and your config file should be included.

_________________
Dum spiro, spero
-------------------------------
Rate my post if it helps...


Top
 Profile  
 
 Post subject:
PostPosted: Mon Sep 17, 2007 6:10 pm 
Newbie

Joined: Tue Sep 07, 2004 7:12 pm
Posts: 7
Hi,

In the setup configuration, hibernate.cfg.xml was configured as a "data file"; I changed as "Included" and now works fine.

Thank you for your help
=)

Guillermo

_________________
Guillermo


Top
 Profile  
 
 Post subject:
PostPosted: Mon Sep 17, 2007 8:45 pm 
Regular
Regular

Joined: Fri Jan 20, 2006 7:45 pm
Posts: 97
Location: San Antonio, TX
Mucho gusto amigo! Estoy alegre ayudar.

_________________
Dum spiro, spero
-------------------------------
Rate my post if it helps...


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 6 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.