Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

NHibernate.Exceptions.GenericADOException #33

Open
enkodellc opened this issue Dec 29, 2023 · 0 comments
Open

NHibernate.Exceptions.GenericADOException #33

enkodellc opened this issue Dec 29, 2023 · 0 comments

Comments

@enkodellc
Copy link

I am trying to use this with AWS mariaDB. The tables get created but then it errors the following:

I did try to run select utc_timestamp() as a query and it seems to run fine in mariadb.

NHibernate.Exceptions.GenericADOException
  HResult=0x80131500
  Message=could not execute query
[ select utc_timestamp() ]
[SQL: select utc_timestamp()]
  Source=NHibernate
  StackTrace:
   at NHibernate.Loader.Loader.DoList(ISessionImplementor session, QueryParameters queryParameters, IResultTransformer forcedResultTransformer, QueryCacheResultBuilder queryCacheResultBuilder)
   at NHibernate.Loader.Loader.DoList(ISessionImplementor session, QueryParameters queryParameters)
   at NHibernate.Loader.Loader.ListIgnoreQueryCache(ISessionImplementor session, QueryParameters queryParameters)
   at NHibernate.Loader.Loader.List(ISessionImplementor session, QueryParameters queryParameters, ISet`1 querySpaces)
   at NHibernate.Loader.Custom.CustomLoader.List(ISessionImplementor session, QueryParameters queryParameters)
   at NHibernate.Impl.StatelessSessionImpl.ListCustomQuery(ICustomQuery customQuery, QueryParameters queryParameters, IList results)
   at NHibernate.Impl.AbstractSessionImpl.List(NativeSQLQuerySpecification spec, QueryParameters queryParameters, IList results)
   at NHibernate.Impl.AbstractSessionImpl.List(NativeSQLQuerySpecification spec, QueryParameters queryParameters)
   at NHibernate.Impl.SqlQueryImpl.List()
   at NHibernate.Impl.AbstractQueryImpl.UniqueResult()
   at Snork.FluentNHibernateTools.UtcDateHelper.RefreshUtcOffset(ISessionFactory sessionFactory, ProviderTypeEnum providerType)
   at Snork.FluentNHibernateTools.UtcDateHelper.GetUtcOffset(ISessionFactory sessionFactory, ProviderTypeEnum providerType)
   at Snork.FluentNHibernateTools.UtcDateHelper.GetUtcOffset(ISession session, ProviderTypeEnum providerType)
   at Hangfire.FluentNHibernateStorage.FluentNHibernateJobStorage.RefreshUtcOFfset()
   at Hangfire.FluentNHibernateStorage.FluentNHibernateJobStorage.Initialize(SessionFactoryInfo info)
   at Hangfire.FluentNHibernateStorage.FluentNHibernateJobStorage..ctor(SessionFactoryInfo info)
   at Hangfire.FluentNHibernateStorage.FluentNHibernateJobStorage..ctor(ProviderTypeEnum providerType, String nameOrConnectionString, FluentNHibernateStorageOptions options)
   at Hangfire.FluentNHibernateStorage.FluentNHibernateStorageFactory.For(ProviderTypeEnum providerType, String nameOrConnectionString, FluentNHibernateStorageOptions options)
   at BlazorBoilerplate.Server.Startup.ConfigureServices(IServiceCollection services) in E:\Websites\Framework\src\Server\BlazorBoilerplate.Server\Startup.cs:line 861
   at System.RuntimeMethodHandle.InvokeMethod(Object target, Span`1& arguments, Signature sig, Boolean constructor, Boolean wrapExceptions)
   at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
   at Microsoft.AspNetCore.Hosting.ConfigureServicesBuilder.InvokeCore(Object instance, IServiceCollection services)
   at Microsoft.AspNetCore.Hosting.ConfigureServicesBuilder.<>c__DisplayClass9_0.<Invoke>g__Startup|0(IServiceCollection serviceCollection)
   at Microsoft.AspNetCore.Hosting.ConfigureServicesBuilder.Invoke(Object instance, IServiceCollection services)
   at Microsoft.AspNetCore.Hosting.ConfigureServicesBuilder.<>c__DisplayClass8_0.<Build>b__0(IServiceCollection services)
   at Microsoft.AspNetCore.Hosting.GenericWebHostBuilder.UseStartup(Type startupType, HostBuilderContext context, IServiceCollection services, Object instance)

  This exception was originally thrown at this call stack:
    [External Code]

Inner Exception 1:
NullReferenceException: Object reference not set to an instance of an object.

Here is my code:

                var fluentOptions = new FluentNHibernateStorageOptions
                {
                    TransactionIsolationLevel = IsolationLevel.Serializable,
                    QueuePollInterval = TimeSpan.FromSeconds(15),
                    JobExpirationCheckInterval = TimeSpan.FromHours(1),
                    CountersAggregateInterval = TimeSpan.FromMinutes(5),
                    UpdateSchema = true,
                    DashboardJobListLimit = 50000,
                    InvisibilityTimeout = TimeSpan.FromMinutes(360),
                    TransactionTimeout = TimeSpan.FromMinutes(5),
                    DefaultSchema = null, // use database provider's default schema
                    TablePrefix = "Hangfire_"
                };


                services.AddHangfire((provider, configuration) =>
                {
                    configuration
                    .SetDataCompatibilityLevel(CompatibilityLevel.Version_170)
                    .UseSimpleAssemblyNameTypeSerializer()
                    .UseRecommendedSerializerSettings()
                    .UseFluentNHibernateJobStorage(Configuration.GetConnectionString("AWSMariaSQLDataConnection"), ProviderTypeEnum.MySQL, fluentOptions)
                    .UseFilter(provider.GetRequiredService<AutomaticRetryAttribute>());
                });
               
                //Need to add individual queues to set worker count per queue
                services.AddHangfireServer(options =>
                {
                    options.Queues = new[] { "default" };
                    options.WorkerCount = 2;                  
                });
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant