You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@lucenenet.apache.org by Johannes Drachenfels <jo...@drachenfels.de> on 2009/12/09 14:57:20 UTC

System.TypeInitializationException on linux (vbnc)

Hi,

 

sorry for re-posting - I am new to this list...

 

I am switching from lucene.net 2.0.0.4 to lucene.net 2.9.1.1 and I have
problems in a very early state. 

 

With version 2.0.0.4 it works fine!

With version 2.9.1.1 on Microsoft it works fine

With version 2.9.1.1 on linux I always get the following errors:

 

################################

System.TypeInitializationException: An exception was thrown by the type
initializer for Lucene.Net.Store.FSDirectory --->
System.TypeInitializationException: An exception was thrown by the type
initializer for Lucene.Net.Util.Constants --->
System.NullReferenceException: Object reference not set to an instance
of an object

  at Lucene.Net.Util.Constants..cctor () [0x00000]

  --- End of inner exception stack trace ---

  at Lucene.Net.Store.FSDirectory..cctor () [0x00000]

  --- End of inner exception stack trace ---

  at ConsoleApplication1.Module1.Main () [0x00000]

################################

System.TypeInitializationException: An exception was thrown by the type
initializer for Lucene.Net.Index.IndexWriter --->
System.TypeInitializationException: An exception was thrown by the type
initializer for Lucene.Net.Index.DocumentsWriter --->
System.TypeInitializationException: An exception was thrown by the type
initializer for Lucene.Net.Util.Constants --->
System.NullReferenceException: Object reference not set to an instance
of an object

  at Lucene.Net.Util.Constants..cctor () [0x00000]

  --- End of inner exception stack trace ---

  at Lucene.Net.Store.FSDirectory..cctor () [0x00000]

  --- End of inner exception stack trace ---

  at Lucene.Net.Index.IndexWriter..cctor () [0x00000]

  --- End of inner exception stack trace ---

  at ConsoleApplication1.Module1.Main () [0x00000]

 

>From debugging I found the reason for the errors:

 

            dir =
Lucene.Net.Store.FSDirectory.GetDirectory(indexFileLocation, True)

 

and

 

            indexWriter = New Lucene.Net.Index.IndexWriter(dirR,
analyzer, True)

 

but I do not have any idea what's happen here.... I have attached the
source of my test application! 

 

Thanks for help & Regards,

 

Johannes

 


AW: Re: System.TypeInitializationException on linux (vbnc)

Posted by Johannes Drachenfels <jo...@drachenfels.de>.
Thanks a lot! This works perfect! I added a line

System.Environment.SetEnvironmentVariable("OS", "linux")

Do you know how to file a bug to the developers?!

Thanks & Regards,

Johannes



Johannes von Drachenfels
Phone: +49-7231-9223800
Mobile: +49-171-6710815
 
Drachenfels GmbH
Bleichstrasse 56
75173 Pforzheim
Germany
 
Geschäftsführer: Johannes von Drachenfels
Sitz der Gesellschaft: Pforzheim
Handelsregister: Registergericht Mannheim: HRB 504389
 
Notice: This transmittal and/or attachments may be privileged or confidential. If you are not the intended recipient, you are hereby notified that you have received this transmittal in error; any review, dissemination, or copying is strictly prohibited. If you received this transmittal in error, please notify us immediately by reply and immediately delete this message and all its attachments. Thank you. 


-----Ursprüngliche Nachricht-----
Von: news [mailto:news@ger.gmane.org] Im Auftrag von Robert Jordan
Gesendet: Mittwoch, 9. Dezember 2009 15:17
An: lucene-net-user@incubator.apache.org
Betreff: Re: System.TypeInitializationException on linux (vbnc)

On 09.12.2009 14:57, Johannes Drachenfels wrote:
> Hi,
>
>
>
> sorry for re-posting - I am new to this list...
>
>
>
> I am switching from lucene.net 2.0.0.4 to lucene.net 2.9.1.1 and I have
> problems in a very early state.
>
>
>
> With version 2.0.0.4 it works fine!
>
> With version 2.9.1.1 on Microsoft it works fine
>
> With version 2.9.1.1 on linux I always get the following errors:
>
>
>
> ################################
>
> System.TypeInitializationException: An exception was thrown by the type
> initializer for Lucene.Net.Store.FSDirectory --->
> System.TypeInitializationException: An exception was thrown by the type
> initializer for Lucene.Net.Util.Constants --->
> System.NullReferenceException: Object reference not set to an instance
> of an object
>
>    at Lucene.Net.Util.Constants..cctor () [0x00000]
>
>    --- End of inner exception stack trace ---
>
>    at Lucene.Net.Store.FSDirectory..cctor () [0x00000]
>
>    --- End of inner exception stack trace ---
>
>    at ConsoleApplication1.Module1.Main () [0x00000]


This is probably caused by this line in Lucene.Net.Util.Constants.cs:

public static readonly System.String OS_NAME = 
System.Environment.GetEnvironmentVariable("OS");

Try to assign some value to the env var "OS":

	OS=foo mono yourapp.exe

Robert


Re: System.TypeInitializationException on linux (vbnc)

Posted by Robert Jordan <ro...@gmx.net>.
On 09.12.2009 14:57, Johannes Drachenfels wrote:
> Hi,
>
>
>
> sorry for re-posting - I am new to this list...
>
>
>
> I am switching from lucene.net 2.0.0.4 to lucene.net 2.9.1.1 and I have
> problems in a very early state.
>
>
>
> With version 2.0.0.4 it works fine!
>
> With version 2.9.1.1 on Microsoft it works fine
>
> With version 2.9.1.1 on linux I always get the following errors:
>
>
>
> ################################
>
> System.TypeInitializationException: An exception was thrown by the type
> initializer for Lucene.Net.Store.FSDirectory --->
> System.TypeInitializationException: An exception was thrown by the type
> initializer for Lucene.Net.Util.Constants --->
> System.NullReferenceException: Object reference not set to an instance
> of an object
>
>    at Lucene.Net.Util.Constants..cctor () [0x00000]
>
>    --- End of inner exception stack trace ---
>
>    at Lucene.Net.Store.FSDirectory..cctor () [0x00000]
>
>    --- End of inner exception stack trace ---
>
>    at ConsoleApplication1.Module1.Main () [0x00000]


This is probably caused by this line in Lucene.Net.Util.Constants.cs:

public static readonly System.String OS_NAME = 
System.Environment.GetEnvironmentVariable("OS");

Try to assign some value to the env var "OS":

	OS=foo mono yourapp.exe

Robert